use of de.keyle.knbt.TagCompound in project MyPet by xXKeyleXx.
the class MyCreeper method writeExtendedInfo.
@Override
public TagCompound writeExtendedInfo() {
TagCompound info = super.writeExtendedInfo();
info.getCompoundData().put("Powered", new TagByte(isPowered()));
return info;
}
use of de.keyle.knbt.TagCompound in project MyPet by xXKeyleXx.
the class MyDonkey method readExtendedInfo.
@Override
public void readExtendedInfo(TagCompound info) {
if (info.getCompoundData().containsKey("Baby")) {
setBaby(info.getAs("Baby", TagByte.class).getBooleanData());
}
if (info.containsKeyAs("Chest", TagByte.class)) {
boolean chest = info.getAs("Chest", TagByte.class).getBooleanData();
if (chest) {
ItemStack item = new ItemStack(Material.CHEST);
setChest(item);
}
} else if (info.containsKeyAs("Chest", TagCompound.class)) {
TagCompound itemTag = info.get("Chest");
ItemStack item = MyPetApi.getPlatformHelper().compundToItemStack(itemTag);
setChest(item);
}
if (info.containsKeyAs("Saddle", TagByte.class)) {
boolean saddle = info.getAs("Saddle", TagByte.class).getBooleanData();
if (saddle) {
ItemStack item = new ItemStack(Material.SADDLE);
setSaddle(item);
}
} else if (info.containsKeyAs("Saddle", TagCompound.class)) {
TagCompound itemTag = info.get("Saddle");
ItemStack item = MyPetApi.getPlatformHelper().compundToItemStack(itemTag);
setSaddle(item);
}
}
use of de.keyle.knbt.TagCompound in project MyPet by xXKeyleXx.
the class MyEnderman method readExtendedInfo.
@Override
public void readExtendedInfo(TagCompound info) {
if (info.getCompoundData().containsKey("BlockID")) {
int id;
int data = 0;
if (info.containsKeyAs("BlockID", TagShort.class)) {
id = info.getAs("BlockID", TagShort.class).getShortData();
} else {
id = info.getAs("BlockID", TagInt.class).getIntData();
}
if (info.containsKeyAs("BlockData", TagShort.class)) {
data = info.getAs("BlockData", TagShort.class).getShortData();
} else if (info.containsKeyAs("BlockData", TagInt.class)) {
data = info.getAs("BlockData", TagInt.class).getIntData();
}
setBlock(new ItemStack(Material.getMaterial(id), 1, (short) data));
} else if (info.getCompoundData().containsKey("Block")) {
TagCompound itemStackCompund = info.getAs("Block", TagCompound.class);
ItemStack block = MyPetApi.getPlatformHelper().compundToItemStack(itemStackCompund);
setBlock(block);
}
// setScreaming((()info.getValue().get("Screaming")).getBooleanValue());
}
use of de.keyle.knbt.TagCompound in project MyPet by xXKeyleXx.
the class MyGiant method writeExtendedInfo.
@Override
public TagCompound writeExtendedInfo() {
TagCompound info = super.writeExtendedInfo();
List<TagCompound> itemList = new ArrayList<>();
for (EquipmentSlot slot : EquipmentSlot.values()) {
if (getEquipment(slot) != null) {
TagCompound item = MyPetApi.getPlatformHelper().itemStackToCompund(getEquipment(slot));
item.getCompoundData().put("Slot", new TagInt(slot.getSlotId()));
itemList.add(item);
}
}
info.getCompoundData().put("Equipment", new TagList(itemList));
return info;
}
use of de.keyle.knbt.TagCompound in project MyPet by xXKeyleXx.
the class MyHorse method writeExtendedInfo.
@Override
public TagCompound writeExtendedInfo() {
TagCompound info = super.writeExtendedInfo();
info.getCompoundData().put("Type", new TagByte(getHorseType()));
info.getCompoundData().put("Variant", new TagInt(getVariant()));
if (hasArmor()) {
info.getCompoundData().put("Armor", MyPetApi.getPlatformHelper().itemStackToCompund(getArmor()));
}
info.getCompoundData().put("Age", new TagInt(getAge()));
if (hasChest()) {
info.getCompoundData().put("Chest", MyPetApi.getPlatformHelper().itemStackToCompund(getChest()));
}
if (hasSaddle()) {
info.getCompoundData().put("Saddle", MyPetApi.getPlatformHelper().itemStackToCompund(getSaddle()));
}
return info;
}
Aggregations