예제 #1
0
  public static void insulation() {
    int ticks = ElectricExpansion.debugRecipes ? 1 : 8;

    for (int i = 0; i < 16; i++) {
      InsulationRecipes.INSTANCE.addProcessing(new ItemStack(Block.cloth, 32, i), 32, ticks * 80);
    }
    InsulationRecipes.INSTANCE.addProcessing(new ItemStack(Item.leather, 8), 24, ticks * 25);
    InsulationRecipes.INSTANCE.addProcessing(new ItemStack(Item.rottenFlesh, 8), 16, ticks * 25);
    FurnaceRecipes.smelting().addSmelting(Item.leather.itemID, insulationIS, 0);

    for (ItemStack is : OreDictionary.getOres("itemRubber")) {
      if (!is.isItemEqual(insulationIS)) {
        ItemStack is2 = is.copy();
        is2.stackSize = 8;
        InsulationRecipes.INSTANCE.addProcessing(
            is2, is2.stackSize, ((int) Math.floor((is2.stackSize * ticks * 10.0 / 8.0) + 0.5)));
      }
    }
  }
  /** Called to transfer a stack from one inventory to the other eg. when shift clicking. */
  @Override
  public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par1) {
    ItemStack var2 = null;
    Slot var3 = (Slot) this.inventorySlots.get(par1);

    if (var3 != null && var3.getHasStack()) {
      ItemStack var4 = var3.getStack();
      var2 = var4.copy();

      if (par1 == 2) {
        if (!this.mergeItemStack(var4, 3, 39, true)) return null;

        var3.onSlotChange(var4, var2);
      } else if (par1 != 1 && par1 != 0) {
        if (var4.getItem() instanceof IItemElectric) {
          if (!this.mergeItemStack(var4, 0, 1, false)) return null;
        } else if (InsulationRecipes.INSTANCE.getProcessResult(var4) > 0) {
          if (!this.mergeItemStack(var4, 1, 2, false)) return null;
        } else if (par1 >= 3 && par1 < 30) {
          if (!this.mergeItemStack(var4, 30, 39, false)) return null;
        } else if (par1 >= 30 && par1 < 39 && !this.mergeItemStack(var4, 3, 30, false)) return null;
      } else if (!this.mergeItemStack(var4, 3, 39, false)) return null;

      if (var4.stackSize == 0) {
        var3.putStack((ItemStack) null);
      } else {
        var3.onSlotChanged();
      }

      if (var4.stackSize == var2.stackSize) return null;

      var3.onPickupFromSlot(par1EntityPlayer, var4);
    }

    return var2;
  }