use of net.minecraft.nbt.IntArrayTag 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 net.minecraft.nbt.IntArrayTag in project SpongeCommon by SpongePowered.
the class PrimaryLevelDataMixin method bridge$writeSpongeLevelData.
@Override
public CompoundTag bridge$writeSpongeLevelData() {
final CompoundTag data = new CompoundTag();
data.putUUID(Constants.Sponge.World.UNIQUE_ID, this.bridge$uniqueId());
// Map Storage
final CompoundTag mapUUIDIndexTag = new CompoundTag();
MapUtil.saveMapUUIDIndex(mapUUIDIndexTag, this.bridge$getMapUUIDIndex());
data.put(Constants.Map.MAP_UUID_INDEX, mapUUIDIndexTag);
final ListTag playerIdList = new ListTag();
data.put(Constants.Sponge.SPONGE_PLAYER_UUID_TABLE, playerIdList);
this.impl$pendingUniqueIds.forEach(uuid -> playerIdList.add(new IntArrayTag(SerializableUUID.uuidToIntArray(uuid))));
this.impl$pendingUniqueIds.clear();
return data;
}
Aggregations