Example #1
0
  public ItemStack b(int i) {
    ItemStack itemstack = null;
    Slot slot = (Slot) this.b.get(i);

    if (slot != null && slot.d()) {
      ItemStack itemstack1 = slot.getItem();

      itemstack = itemstack1.cloneItemStack();
      if (i == 2) {
        if (!this.a(itemstack1, 3, 39, true)) {
          return null;
        }

        slot.a(itemstack1, itemstack);
      } else if (i != 1 && i != 0) {
        if (RecipesFurnace.getInstance().getResult(itemstack1.getItem().id) != null) {
          if (!this.a(itemstack1, 0, 1, false)) {
            return null;
          }
        } else if (TileEntityFurnace.isFuel(itemstack1)) {
          if (!this.a(itemstack1, 1, 2, false)) {
            return null;
          }
        } else if (i >= 3 && i < 30) {
          if (!this.a(itemstack1, 30, 39, false)) {
            return null;
          }
        } else if (i >= 30 && i < 39 && !this.a(itemstack1, 3, 30, false)) {
          return null;
        }
      } else if (!this.a(itemstack1, 3, 39, false)) {
        return null;
      }

      if (itemstack1.count == 0) {
        slot.set((ItemStack) null);
      } else {
        slot.e();
      }

      if (itemstack1.count == itemstack.count) {
        return null;
      }

      slot.b(itemstack1);
    }

    return itemstack;
  }
  public void burn() {
    if (this.canBurn()) {
      ItemStack itemstack = RecipesFurnace.getInstance().getResult(this.items[0]);

      if (this.items[2] == null) {
        this.items[2] = itemstack.cloneItemStack();
      } else if (this.items[2].getItem() == itemstack.getItem()) {
        ++this.items[2].count;
      }

      --this.items[0].count;
      if (this.items[0].count <= 0) {
        this.items[0] = null;
      }
    }
  }
  private boolean canBurn() {
    if (this.items[0] == null) {
      return false;
    } else {
      ItemStack itemstack = RecipesFurnace.getInstance().getResult(this.items[0]);

      return itemstack == null
          ? false
          : (this.items[2] == null
              ? true
              : (!this.items[2].doMaterialsMatch(itemstack)
                  ? false
                  : (this.items[2].count < this.getMaxStackSize()
                          && this.items[2].count < this.items[2].getMaxStackSize()
                      ? true
                      : this.items[2].count < itemstack.getMaxStackSize())));
    }
  }
Example #4
0
 private ItemStack getBurnResult(ItemStack item) {
   if (item == null) {
     return null;
   }
   return RecipesFurnace.getInstance().getResult(item); // Derpnote
 }