mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-22 14:19:49 +00:00
Wrapper Naming Improvement Scheme
This commit is contained in:
1 parent
3a8b75f152
commit
11a4d0b61d
94 files changed
+558
-370
No files matched your search
@@ -0,0 +1,43 @@
|
||||
package noppes.npcs.wrapper.nbt;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.platform.nbt.INBTCompound;
|
||||
import noppes.npcs.platform.nbt.INBTList;
|
||||
import noppes.npcs.platform.nbt.NBTFactory;
|
||||
|
||||
/**
|
||||
* 1.7.10 implementation of NBTFactory.
|
||||
*/
|
||||
public class NBTWrapperFactory implements NBTFactory {
|
||||
|
||||
@Override
|
||||
public INBTCompound createCompound() {
|
||||
return new NBTWrapper(new NBTTagCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public INBTList createList() {
|
||||
return new NBTListWrapper(new NBTTagList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public INBTCompound wrap(Object mcNBTTagCompound) {
|
||||
if (!(mcNBTTagCompound instanceof NBTTagCompound)) {
|
||||
throw new IllegalArgumentException(
|
||||
"Expected NBTTagCompound, got " + mcNBTTagCompound.getClass().getName()
|
||||
);
|
||||
}
|
||||
return new NBTWrapper((NBTTagCompound) mcNBTTagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public INBTList wrapList(Object mcNBTTagList) {
|
||||
if (!(mcNBTTagList instanceof NBTTagList)) {
|
||||
throw new IllegalArgumentException(
|
||||
"Expected NBTTagList, got " + mcNBTTagList.getClass().getName()
|
||||
);
|
||||
}
|
||||
return new NBTListWrapper((NBTTagList) mcNBTTagList);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user