コード例 #1
0
 public ItemStack getPlantedSapling() {
   if (!this.shouldPlantSapling()) return null;
   if (treeCopy.isDyeTree())
     return new ItemStack(TreeGetter.getSaplingID(), 1, treeCopy.getDyeTreeMeta());
   else if (treeCopy.getTreeType() != null) return treeCopy.getSapling();
   else return null;
 }
コード例 #2
0
 private void checkAndMatchInventory() {
   ItemStack sapling = null;
   if (tree.isDyeTree()) {
     sapling = new ItemStack(TreeGetter.getSaplingID(), 1, tree.getDyeTreeMeta());
   } else if (tree.getTreeType() != null) {
     sapling = tree.getSapling();
   }
   if (!ReikaItemHelper.matchStacks(inv[0], sapling)) {
     this.dumpInventory();
   }
 }
コード例 #3
0
 private boolean shouldPlantSapling() {
   if (this.hasEnchantment(Enchantment.infinity)) return true;
   if (treeCopy.isDyeTree()) {
     return inv[0] != null
         && inv[0].stackSize > 0
         && Block.getBlockFromItem(inv[0].getItem()) == TreeGetter.getSaplingID();
   } else if (treeCopy.getTreeType() != null) {
     return inv[0] != null
         && inv[0].stackSize > 0
         && ReikaItemHelper.matchStacks(inv[0], treeCopy.getSapling());
   } else return false;
 }