mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-22 14:19:49 +00:00
44 lines
1.3 KiB
Java
44 lines
1.3 KiB
Java
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);
|
|
}
|
|
}
|