public TagCompound save() { TagCompound nbtTagCompound = new TagCompound(); nbtTagCompound.getCompoundData().put("Active", new TagByte(pickup)); return nbtTagCompound; }
public void convertCreeper(Creeper creeper, TagCompound properties) { properties.getCompoundData().put("Powered", new TagByte(creeper.isPowered())); }
public TagCompound save(TagCompound compound) { List<TagCompound> itemList = new ArrayList<>(); for (int i = 0; i < this.items.size(); i++) { ItemStack itemStack = this.items.get(i); if (itemStack != null) { TagCompound item = ItemStackNBTConverter.itemStackToCompund(itemStack); item.getCompoundData().put("Slot", new TagByte((byte) i)); itemList.add(item); } } compound.getCompoundData().put("Items", new TagList(itemList)); return compound; }
public void convertAgable(Ageable ageable, TagCompound properties) { properties.getCompoundData().put("Baby", new TagByte(!ageable.isAdult())); }
public void convertWolf(Wolf wolf, TagCompound properties) { properties.getCompoundData().put("Sitting", new TagByte(wolf.isSitting())); properties.getCompoundData().put("Tamed", new TagByte(wolf.isTamed())); properties.getCompoundData().put("CollarColor", new TagByte(wolf.getCollarColor().getWoolData())); } }
public void convertPig(Pig pig, TagCompound properties) { properties.getCompoundData().put("Saddle", new TagByte(pig.hasSaddle())); }
@Override public TagCompound save() { TagCompound nbtTagCompound = new TagCompound(); nbtTagCompound.getCompoundData().put("Buffs", new TagIntArray(selectedBuffs.stream().mapToInt(Buff::getId).toArray())); nbtTagCompound.getCompoundData().put("Active", new TagByte(this.active)); nbtTagCompound.getCompoundData().put("Reciever", new TagString(this.receiver.name())); return nbtTagCompound; }
public void convertZombie(Zombie zombie, TagCompound properties) { properties.getCompoundData().put("Baby", new TagByte(zombie.isBaby())); if (zombie.isVillager()) { properties.getCompoundData().put("Type", new TagInt(1)); } }
public void convertSheep(Sheep sheep, TagCompound properties) { properties.getCompoundData().put("Color", new TagInt(sheep.getColor().getDyeData())); properties.getCompoundData().put("Sheared", new TagByte(sheep.isSheared())); }
public void convertOcelot(Ocelot ocelot, TagCompound properties) { properties.getCompoundData().put("CatType", new TagInt(ocelot.getCatType().getId())); properties.getCompoundData().put("Sitting", new TagByte(ocelot.isSitting())); }
public static TagCompound itemStackToCompund(ItemStack itemStack) { TagCompound compound = new TagCompound(); compound.getCompoundData().put("id", new TagShort((short) Item.getId(itemStack.getItem()))); compound.getCompoundData().put("Count", new TagByte((byte) itemStack.count)); compound.getCompoundData().put("Damage", new TagShort((short) itemStack.getData())); if (itemStack.getTag() != null) { compound.getCompoundData().put("tag", vanillaCompoundToCompound(itemStack.getTag())); } return compound; }
public void convertHorse(Horse horse, TagCompound properties) { byte type = (byte) horse.getVariant().ordinal(); int style = horse.getStyle().ordinal(); int color = horse.getColor().ordinal(); int variant = color & 255 | style << 8; if (horse.getInventory().getArmor() != null) { TagCompound armor = MyPetApi.getPlatformHelper().itemStackToCompund(horse.getInventory().getArmor()); properties.getCompoundData().put("Armor", armor); } if (horse.getInventory().getSaddle() != null) { TagCompound saddle = MyPetApi.getPlatformHelper().itemStackToCompund(horse.getInventory().getSaddle()); properties.getCompoundData().put("Saddle", saddle); } properties.getCompoundData().put("Type", new TagByte(type)); properties.getCompoundData().put("Variant", new TagInt(variant)); properties.getCompoundData().put("Chest", new TagByte(horse.isCarryingChest())); properties.getCompoundData().put("Age", new TagInt(horse.getAge())); if (horse.isCarryingChest()) { ItemStack[] contents = horse.getInventory().getContents(); for (int i = 2; i < contents.length; i++) { ItemStack item = contents[i]; if (item != null) { horse.getWorld().dropItem(horse.getLocation(), item); } } } }
switch (vanillaTag.getTypeId()) { case 1: return new TagByte(((NBTTagByte) vanillaTag).f()); case 2: return new TagShort(((NBTTagShort) vanillaTag).e());