Esempio n. 1
0
 @Override
 public TagCompound writeExtendedInfo() {
   TagCompound info = super.writeExtendedInfo();
   if (hasSaddle()) {
     info.getCompoundData()
         .put("Saddle", MyPetApi.getPlatformHelper().itemStackToCompund(getSaddle()));
   }
   info.getCompoundData().put("Baby", new TagByte(isBaby()));
   return info;
 }
Esempio n. 2
0
 @Override
 public void readExtendedInfo(TagCompound info) {
   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);
   }
   if (info.getCompoundData().containsKey("Baby")) {
     setBaby(info.getAs("Baby", TagByte.class).getBooleanData());
   }
 }