use of de.keyle.knbt.TagByteArray in project MyPet by xXKeyleXx.
the class ItemStackNBTConverter method vanillaCompoundToCompound.
public static TagBase vanillaCompoundToCompound(Tag vanillaTag) {
switch(vanillaTag.getId()) {
case 1:
return new TagByte(((ByteTag) vanillaTag).getAsByte());
case 2:
return new TagShort(((ShortTag) vanillaTag).getAsShort());
case 3:
return new TagInt(((IntTag) vanillaTag).getAsInt());
case 4:
return new TagLong(((LongTag) vanillaTag).getAsLong());
case 5:
return new TagFloat(((FloatTag) vanillaTag).getAsFloat());
case 6:
return new TagDouble(((DoubleTag) vanillaTag).getAsDouble());
case 7:
return new TagByteArray(((ByteArrayTag) vanillaTag).getAsByteArray());
case 8:
return new TagString(vanillaTag.getAsString());
case 9:
ListTag tagList = (ListTag) vanillaTag;
List compoundList = new ArrayList();
try {
ArrayList list = (ArrayList) TAG_LIST_LIST.get(tagList);
for (Object aList : list) {
compoundList.add(vanillaCompoundToCompound((Tag) aList));
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return new TagList(compoundList);
case 10:
TagCompound compound = new TagCompound();
CompoundTag tagCompound = ((CompoundTag) vanillaTag);
Set<String> keys = tagCompound.getAllKeys();
for (String tagName : keys) {
compound.getCompoundData().put(tagName, vanillaCompoundToCompound(tagCompound.get(tagName)));
}
return compound;
case 11:
return new TagIntArray(((IntArrayTag) vanillaTag).getAsIntArray());
}
return null;
}
use of de.keyle.knbt.TagByteArray in project MyPet by xXKeyleXx.
the class ItemStackNBTConverter method vanillaCompoundToCompound.
public static TagBase vanillaCompoundToCompound(Tag vanillaTag) {
switch(vanillaTag.getId()) {
case 1:
return new TagByte(((ByteTag) vanillaTag).getAsByte());
case 2:
return new TagShort(((ShortTag) vanillaTag).getAsShort());
case 3:
return new TagInt(((IntTag) vanillaTag).getAsInt());
case 4:
return new TagLong(((LongTag) vanillaTag).getAsLong());
case 5:
return new TagFloat(((FloatTag) vanillaTag).getAsFloat());
case 6:
return new TagDouble(((DoubleTag) vanillaTag).getAsDouble());
case 7:
return new TagByteArray(((ByteArrayTag) vanillaTag).getAsByteArray());
case 8:
return new TagString(vanillaTag.getAsString());
case 9:
ListTag tagList = (ListTag) vanillaTag;
List compoundList = new ArrayList();
try {
ArrayList list = (ArrayList) TAG_LIST_LIST.get(tagList);
for (Object aList : list) {
compoundList.add(vanillaCompoundToCompound((Tag) aList));
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return new TagList(compoundList);
case 10:
TagCompound compound = new TagCompound();
CompoundTag tagCompound = ((CompoundTag) vanillaTag);
Set<String> keys = tagCompound.getAllKeys();
for (String tagName : keys) {
compound.getCompoundData().put(tagName, vanillaCompoundToCompound(tagCompound.get(tagName)));
}
return compound;
case 11:
return new TagIntArray(((IntArrayTag) vanillaTag).getAsIntArray());
}
return null;
}
Aggregations