예제 #1
0
  @Override
  public ItemStack transferStackInSlot(EntityPlayer player, int slotID) {
    ItemStack itemstack = null;
    Slot slot = this.inventorySlots.get(slotID);

    if (slot != null && slot.getHasStack()) {
      ItemStack itemstack1 = slot.getStack();
      itemstack = itemstack1.copy();

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

        slot.onSlotChange(itemstack1, itemstack);
      } else if (slotID != 1 && slotID != 0) {
        if (TileScribe.isValidForScribe(itemstack1)) {
          if (!this.mergeItemStack(itemstack1, 0, 1, false)) return null;
        } else if (TileScribe.isBook(itemstack1)) {
          if (!this.mergeItemStack(itemstack1, 1, 2, false)) return null;
        } else if (slotID >= 3 && slotID < 30) {
          if (!this.mergeItemStack(itemstack1, 30, 39, false)) return null;
        } else if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false))
          return null;
      } else if (!this.mergeItemStack(itemstack1, 3, 39, false)) return null;

      if (itemstack1.stackSize == 0) slot.putStack((ItemStack) null);
      else slot.onSlotChanged();

      if (itemstack1.stackSize == itemstack.stackSize) return null;

      slot.onPickupFromSlot(player, itemstack1);
    }

    return itemstack;
  }
  @Override
  public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
    ItemStack itemstack = null;
    Slot slot = (Slot) inventorySlots.get(slotIndex);

    if (slot != null && slot.getHasStack()) {
      ItemStack itemstack1 = slot.getStack();
      itemstack = itemstack1.copy();

      if ((slotIndex < 0 || slotIndex > 2) && slotIndex != 3) {
        if (!ingredientSlot.getHasStack() && ingredientSlot.isItemValid(itemstack1)) {
          if (!mergeItemStack(itemstack1, 3, 4, false)) return null;
        } else if (PotionSlot.canHoldPotion(itemstack)) {
          if (!mergeItemStack(itemstack1, 0, 3, false)) return null;
        } else if (slotIndex >= 4 && slotIndex < 31) {
          if (!mergeItemStack(itemstack1, 31, 40, false)) return null;
        } else if (slotIndex >= 31 && slotIndex < 40) {
          if (!mergeItemStack(itemstack1, 4, 31, false)) return null;
        } else if (!mergeItemStack(itemstack1, 4, 40, false)) return null;
      } else {
        if (!mergeItemStack(itemstack1, 4, 40, true)) return null;

        slot.onSlotChange(itemstack1, itemstack);
      }

      if (itemstack1.stackSize == 0) slot.putStack((ItemStack) null);
      else slot.onSlotChanged();

      if (itemstack1.stackSize == itemstack.stackSize) return null;

      slot.onPickupFromSlot(player, itemstack1);
    }

    return itemstack;
  }
예제 #3
0
 @Override
 public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
   ItemStack result = null;
   Slot slot = getSlot(slotIndex);
   if (slot != null && slot.getHasStack()) {
     ItemStack stack = slot.getStack();
     result = stack.copy();
     if (slotIndex == 1) {
       if (!mergeItemStack(stack, 2, 38, true)) return null;
       slot.onSlotChange(stack, result);
     } else if (slotIndex != 0) {
       if (FurnaceRecipes.smelting().getSmeltingResult(stack) != null) {
         if (!this.mergeItemStack(stack, 0, 1, false)) return null;
       } else if (slotIndex >= 2 && slotIndex < 29) {
         if (!this.mergeItemStack(stack, 29, 38, false)) return null;
       } else if (slotIndex >= 29 && slotIndex < 38) {
         if (!this.mergeItemStack(stack, 2, 29, false)) return null;
       }
     } else if (!this.mergeItemStack(stack, 2, 38, false)) return null;
     if (stack.stackSize <= 0) slot.putStack(null);
     else slot.onSlotChanged();
     if (stack.stackSize == result.stackSize) return null;
     slot.onPickupFromSlot(player, stack);
   }
   return result;
 }
예제 #4
0
  @Override
  public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
    ItemStack var3 = null;
    Slot var4 = (Slot) this.inventorySlots.get(par2);

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

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

        var4.onSlotChange(var5, var3);
      } else if (par2 != 0 && par2 != 1) {
        if (par2 >= 3 && par2 < 30) {
          if (!this.mergeItemStack(var5, 30, 39, false)) return null;
        } else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(var5, 3, 30, false)) return null;
      } else if (!this.mergeItemStack(var5, 3, 39, false)) return null;

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

      if (var5.stackSize == var3.stackSize) return null;

      var4.onPickupFromSlot(par1EntityPlayer, var5);
    }

    return var3;
  }
  @Override
  public ItemStack transferStackInSlot(EntityPlayer player, int slotID) {
    int size = ((IInventory) tile).getSizeInventory();
    int low = size + 27;
    int high = low + 9;
    ItemStack itemstack = null;
    Slot slot = (Slot) this.inventorySlots.get(slotID);

    if (slot != null && slot.getHasStack()) {
      ItemStack stack = slot.getStack();
      itemstack = stack.copy();

      if (slotID < size) {
        if (!this.mergeItemStack(stack, size, high, true)) {
          return null;
        }

        slot.onSlotChange(stack, itemstack);
      } else if (slotID >= size) {
        if (itemstack.getItem() == Factory.fludd) {
          if (!this.mergeItemStack(stack, 5, 6, false)) { // Slot 0-0
            return null;
          }
        } else if (stack.getItem() instanceof IItemUpgrade) {
          if (!this.mergeItemStack(stack, 0, 3, false)) { // Slot 1-3
            return null;
          }
        } else if (FluidHelper.isFluidOrEmpty(stack)) {
          if (!this.mergeItemStack(stack, 3, 4, false)) { // Slot 3-3
            return null;
          }
        } else if (slotID >= size && slotID < low) {
          if (!this.mergeItemStack(stack, low, high, false)) {
            return null;
          }
        } else if (slotID >= low
            && slotID < high
            && !this.mergeItemStack(stack, high, low, false)) {
          return null;
        }
      } else if (!this.mergeItemStack(stack, size, high, false)) {
        return null;
      }

      if (stack.stackSize == 0) {
        slot.putStack((ItemStack) null);
      } else {
        slot.onSlotChanged();
      }

      if (stack.stackSize == itemstack.stackSize) {
        return null;
      }

      slot.onPickupFromSlot(player, stack);
    }

    return itemstack;
  }
  // Shfit-click handling
  @Override
  public ItemStack transferStackInSlot(EntityPlayer player, int sourceSlotId) {
    ItemStack transferedItemStack = null;
    Slot slot = this.getSlot(sourceSlotId);

    if (slot == null || !slot.getHasStack()) {
      return transferedItemStack;
    }

    ItemStack slotStack = slot.getStack();
    transferedItemStack = slotStack.copy();

    if (sourceSlotId == 2) {
      // source is output slot
      if (!mergeItemStack(slotStack, 3, 39, true)) {
        return null;
      }

      slot.onSlotChange(slotStack, transferedItemStack);
    } else if (sourceSlotId != 0 && sourceSlotId != 1) {
      // source is player inventory
      if (RecipesAbstractor.getBaseEssence(slotStack) > 0) {
        if (!mergeItemStack(slotStack, 1, 2, false)) {
          return null;
        }
      } else if (RecipesAbstractor.getCatalystBurning(slotStack) > 0) {
        if (!mergeItemStack(slotStack, 0, 1, false)) {
          return null;
        }
      } else if (sourceSlotId >= 3 && sourceSlotId < 30) {
        // source is from player non-hotbar slots
        if (!mergeItemStack(slotStack, 30, 39, false)) {
          return null;
        }
      } else if (sourceSlotId >= 30 && sourceSlotId < 39) {
        // source is from player hotbar slots
        if (!mergeItemStack(slotStack, 3, 30, false)) {
          return null;
        }
      }

    } else if (!mergeItemStack(slotStack, 3, 39, false)) {
      return null;
    }

    if (slotStack.stackSize <= 0) {
      slot.putStack(null);
    } else {
      slot.onSlotChanged();
    }

    if (transferedItemStack.stackSize == slotStack.stackSize) {
      return null;
    }

    slot.onPickupFromSlot(player, slotStack);

    return transferedItemStack;
  }
  @Override
  public ItemStack transferStackInSlot(EntityPlayer player, int slotNumber) {
    ItemStack stack = null;
    Slot slot = (Slot) inventorySlots.get(slotNumber);

    if ((slot != null) && (slot.getHasStack())) {
      ItemStack stack1 = slot.getStack();
      stack = stack1.copy();
      EntityEquipmentSlot desiredSlot = EntityLiving.getSlotForItemStack(stack);

      if (slotNumber == 0) // CraftingResult
      {
        if (!mergeItemStack(stack1, 13, 49, true)) return ItemStack.field_190927_a;

        slot.onSlotChange(stack1, stack);
      } else if ((slotNumber >= 1) && (slotNumber < 5)) // CraftingGrid
      {
        if (!mergeItemStack(stack1, 13, 49, false)) return ItemStack.field_190927_a;
      } else if ((slotNumber >= 5) && (slotNumber < 13)) // NormalArmor & CosmeticArmor
      {
        if (!mergeItemStack(stack1, 13, 49, false)) return ItemStack.field_190927_a;
      } else if (desiredSlot.getSlotType() == EntityEquipmentSlot.Type.ARMOR
          && !inventorySlots
              .get(8 - desiredSlot.getIndex())
              .getHasStack()) // ItemArmor - check NormalArmor slots
      {
        int j = 8 - desiredSlot.getIndex();

        if (!mergeItemStack(stack1, j, j + 1, false)) return ItemStack.field_190927_a;
      } else if (desiredSlot.getSlotType() == EntityEquipmentSlot.Type.ARMOR
          && !inventorySlots
              .get(12 - desiredSlot.getIndex())
              .getHasStack()) // ItemArmor - check CosmeticArmor slots
      {
        int j = 12 - desiredSlot.getIndex();

        if (!mergeItemStack(stack1, j, j + 1, false)) return ItemStack.field_190927_a;
      } else if ((slotNumber >= 13) && (slotNumber < 40)) // PlayerInventory
      {
        if (!mergeItemStack(stack1, 40, 49, false)) return ItemStack.field_190927_a;
      } else if ((slotNumber >= 40) && (slotNumber < 49)) // PlayerHotBar
      {
        if (!mergeItemStack(stack1, 13, 40, false)) return ItemStack.field_190927_a;
      } else if (!mergeItemStack(stack1, 13, 49, false)) {
        return ItemStack.field_190927_a;
      }

      if (stack1.func_190916_E() == 0) slot.putStack(ItemStack.field_190927_a);
      else slot.onSlotChanged();

      if (stack1.func_190916_E() == stack.func_190916_E()) return ItemStack.field_190927_a;

      slot.func_190901_a(player, stack1);

      if (slotNumber == 0) player.dropItem(stack1, false);
    }

    return stack;
  }
  @Override
  public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
    ItemStack originalStack = null;
    Slot slot = (Slot) this.inventorySlots.get(slotIndex);

    if (slot != null && slot.getHasStack()) {
      ItemStack stack = slot.getStack();
      originalStack = stack.copy();

      if (slotIndex == 2) {
        if (!mergeItemStack(stack, 3, 39, true)) {
          return null;
        }

        slot.onSlotChange(stack, originalStack);
      } else if (slotIndex > 1) {
        boolean inserted = false;

        for (int i = 1; i >= 0; i--) {
          if (campfireEnt.canInsertItem(i, stack, 0)) {
            inserted = true;

            if (!mergeItemStack(stack, i, i + 1, false)) {
              return null;
            }

            break;
          }
        }

        if (!inserted) {
          if (slotIndex >= 3 && slotIndex < 30) // Player inventory
          {
            if (!mergeItemStack(stack, 30, 39, false)) {
              return null;
            }
          } else if (slotIndex >= 30 && slotIndex < 39 && !mergeItemStack(stack, 3, 30, false)) {
            return null;
          }
        }
      } else if (!mergeItemStack(stack, 3, 39, false)) {
        return null;
      }

      if (stack.stackSize == 0) {
        slot.putStack(null);
      } else {
        slot.onSlotChanged();
      }

      if (stack.stackSize == originalStack.stackSize) {
        return null;
      }

      slot.onPickupFromSlot(player, stack);
    }

    return originalStack;
  }
  /**
   * Called when a player shift-clicks on a slot. You must override this or you will crash when
   * someone does that.
   */
  public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
    ItemStack itemstack = null;
    Slot slot = (Slot) this.inventorySlots.get(par2);

    if (slot != null && slot.getHasStack()) {
      ItemStack itemstack1 = slot.getStack();
      itemstack = itemstack1.copy();

      if (par2 == 0) {
        if (!this.mergeItemStack(itemstack1, 9, 45, true)) {
          return null;
        }

        slot.onSlotChange(itemstack1, itemstack);
      } else if (par2 >= 1 && par2 < 5) {
        if (!this.mergeItemStack(itemstack1, 9, 45, false)) {
          return null;
        }
      } else if (par2 >= 5 && par2 < 9) {
        if (!this.mergeItemStack(itemstack1, 9, 45, false)) {
          return null;
        }
      } else if (itemstack.getItem() instanceof ItemArmor
          && !((Slot) this.inventorySlots.get(5 + ((ItemArmor) itemstack.getItem()).armorType))
              .getHasStack()) {
        int j = 5 + ((ItemArmor) itemstack.getItem()).armorType;

        if (!this.mergeItemStack(itemstack1, j, j + 1, false)) {
          return null;
        }
      } else if (par2 >= 9 && par2 < 36) {
        if (!this.mergeItemStack(itemstack1, 36, 45, false)) {
          return null;
        }
      } else if (par2 >= 36 && par2 < 45) {
        if (!this.mergeItemStack(itemstack1, 9, 36, false)) {
          return null;
        }
      } else if (!this.mergeItemStack(itemstack1, 9, 45, false)) {
        return null;
      }

      if (itemstack1.stackSize == 0) {
        slot.putStack((ItemStack) null);
      } else {
        slot.onSlotChanged();
      }

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

      slot.onPickupFromSlot(par1EntityPlayer, itemstack1);
    }

    return itemstack;
  }
예제 #10
0
  /** Take a stack from the specified inventory slot. */
  public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
    ItemStack var3 = null;
    Slot var4 = (Slot) this.inventorySlots.get(par2);

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

      if (par2 == 0) {
        if (!this.mergeItemStack(var5, 9, 45, true)) {
          return null;
        }

        var4.onSlotChange(var5, var3);
      } else if (par2 >= 1 && par2 < 5) {
        if (!this.mergeItemStack(var5, 9, 45, false)) {
          return null;
        }
      } else if (par2 >= 5 && par2 < 9) {
        if (!this.mergeItemStack(var5, 9, 45, false)) {
          return null;
        }
      } else if (var3.getItem() instanceof ItemArmor
          && !((Slot) this.inventorySlots.get(5 + ((ItemArmor) var3.getItem()).armorType))
              .getHasStack()) {
        int var6 = 5 + ((ItemArmor) var3.getItem()).armorType;

        if (!this.mergeItemStack(var5, var6, var6 + 1, false)) {
          return null;
        }
      } else if (par2 >= 9 && par2 < 36) {
        if (!this.mergeItemStack(var5, 36, 45, false)) {
          return null;
        }
      } else if (par2 >= 36 && par2 < 45) {
        if (!this.mergeItemStack(var5, 9, 36, false)) {
          return null;
        }
      } else if (!this.mergeItemStack(var5, 9, 45, false)) {
        return null;
      }

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

      if (var5.stackSize == var3.stackSize) {
        return null;
      }

      var4.onPickupFromSlot(par1EntityPlayer, var5);
    }

    return var3;
  }
예제 #11
0
  @Override
  public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int slotIndex) {
    ItemStack itemstack = null;
    Slot slot = (Slot) this.inventorySlots.get(slotIndex);

    if (slot != null && slot.getHasStack()) {
      ItemStack temp = slot.getStack();
      itemstack = temp.copy();

      if (slotIndex == 3) {
        if (!this.mergeItemStack(temp, 3, 39, true)) {
          return null;
        }

        slot.onSlotChange(temp, itemstack);
      } else if (slotIndex != 0 && slotIndex != 1 && slotIndex != 2) {
        if (temp.getItem().getItemEnchantability() > 0) {
          if (!this.mergeItemStack(temp, 0, 1, false)) {
            return null;
          }
        } else if (temp.itemID == MabiCraftItem.itemEnchantScroll.itemID) {
          if (!this.mergeItemStack(temp, 1, 2, false)) {
            return null;
          }
        } else if (temp.itemID == MabiCraftItem.itemMagicPowder.itemID) {
          if (!this.mergeItemStack(temp, 2, 3, false)) {
            return null;
          }
        } else if (slotIndex >= 4 && slotIndex < 31) {
          if (!this.mergeItemStack(temp, 31, 40, false)) {
            return null;
          }
        } else if (slotIndex >= 31 && slotIndex < 40 && !this.mergeItemStack(temp, 4, 31, false)) {
          return null;
        }
      } else if (!this.mergeItemStack(temp, 4, 40, false)) {
        return null;
      }

      if (temp.stackSize == 0) {
        slot.putStack((ItemStack) null);
      } else {
        slot.onSlotChanged();
      }

      if (temp.stackSize == itemstack.stackSize) {
        return null;
      }

      slot.onPickupFromSlot(par1EntityPlayer, temp);
    }

    return itemstack;
  }
  public ItemStack transferStackInSlot(EntityPlayer player, int par2) {
    ItemStack itemstack = null;
    Slot slot = (Slot) this.inventorySlots.get(par2);

    if (slot != null && slot.getHasStack()) {
      ItemStack itemstack1 = slot.getStack();
      itemstack = itemstack1.copy();

      if (par2 < INV_START) {
        if (!this.mergeItemStack(itemstack1, INV_START, HOTBAR_END, true)) {
          return null;
        }

        slot.onSlotChange(itemstack1, itemstack);
      } else {
        int current = this.getCurrentUsage();
        if (par2 >= INV_START && (current == 0 || current == 1)) {
          if (!this.mergeItemStack(itemstack1, 0, 2, false)) {
            return null;
          }
        } else if (par2 >= INV_START && current == 2) {
          if (!this.mergeItemStack(itemstack1, 3, 5, false)) {
            return null;
          }
        } else if (par2 >= INV_START && current == 3) {
          if (!this.mergeItemStack(itemstack1, 6, 9, false)) {
            return null;
          }
        } else if (par2 >= INV_START && par2 < HOTBAR_START) {
          if (!this.mergeItemStack(itemstack1, HOTBAR_START, HOTBAR_END, false)) {
            return null;
          }
        } else if (par2 >= HOTBAR_START && par2 < HOTBAR_END) {
          if (!this.mergeItemStack(itemstack1, INV_START, INV_END, false)) {
            return null;
          }
        }
      }

      if (itemstack1.stackSize == 0) {
        slot.putStack((ItemStack) null);
      } else {
        slot.onSlotChanged();
      }

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

      slot.onPickupFromSlot(player, itemstack1);
    }

    return itemstack;
  }
  @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 == 0) {
        if (!this.mergeItemStack(var4, 1, 37, true)) {
          return null;
        }

        var3.onSlotChange(var4, var2);
      } else if (par1 != 1 && par1 != 0) {
        if (var4.getItem() instanceof IItemElectric) {
          Slot temp = (Slot) this.inventorySlots.get(0);
          if (!temp.getHasStack()) {
            temp.putStack(var4);
            var3.decrStackSize(1);
          }
          if (!this.mergeItemStack(var4, 0, 0, false)) {
            return null;
          }
        } else if (par1 >= 1 && par1 < 28) {
          if (!this.mergeItemStack(var4, 32, 40, false)) {
            return null;
          }
        } else if (par1 >= 32 && par1 < 40 && !this.mergeItemStack(var4, 3, 30, false)) {
          return null;
        }
      } else if (!this.mergeItemStack(var4, 4, 31, 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;
  }
  /** 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;
    final Slot var3 = (Slot) inventorySlots.get(par1);

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

      if (par1 == 1) {
        if (!mergeItemStack(var4, 2, 38, true)) {
          return null;
        }

        var3.onSlotChange(var4, var2);
      } else if (par1 != 1 && par1 != 0) {
        if (FurnaceRecipes.smelting().getSmeltingResult(var4) != null) {
          if (!mergeItemStack(var4, 0, 1, false)) {
            return null;
          }
        } else if (TileEntityFurnace.isItemFuel(var4)) {
          if (!mergeItemStack(var4, 0, 1, false)) {
            return null;
          }
        } else if (par1 >= 2 && par1 < 29) {
          if (!mergeItemStack(var4, 29, 38, false)) {
            return null;
          }
        } else if (par1 >= 29 && par1 < 38 && !mergeItemStack(var4, 2, 29, false)) {
          return null;
        }
      } else if (!mergeItemStack(var4, 2, 38, 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;
  }
  public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
    ItemStack var3 = null;
    Slot var4 = (Slot) this.inventorySlots.get(par2);

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

      if (par2 == 2) {
        if (!this.mergeItemStack(var5, 3, 39, true)) {
          return null;
        }

        var4.onSlotChange(var5, var3);
      } else if (par2 != 1 && par2 != 0) {
        if (RecipesDwarfFurnace.smelting().getSmeltingResult(var5) != null) {
          if (!this.mergeItemStack(var5, 0, 1, false)) {
            return null;
          }
        } else if (TileEntityDwarfFurnace.isItemFuel(var5)) {
          if (!this.mergeItemStack(var5, 1, 2, false)) {
            return null;
          }
        } else if (par2 >= 3 && par2 < 30) {
          if (!this.mergeItemStack(var5, 30, 39, false)) {
            return null;
          }
        } else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(var5, 3, 30, false)) {
          return null;
        }
      } else if (!this.mergeItemStack(var5, 3, 39, false)) {
        return null;
      }

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

      if (var5.stackSize == var3.stackSize) {
        return null;
      }

      var4.onPickupFromSlot(par1EntityPlayer, var5);
    }

    return var3;
  }
  /**
   * Called when a player shift-clicks on a slot. You must override this or you will crash when
   * someone does that.
   */
  public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
    ItemStack itemstack = null;
    Slot slot = (Slot) this.inventorySlots.get(par2);

    if (slot != null && slot.getHasStack()) {
      ItemStack itemstack1 = slot.getStack();
      itemstack = itemstack1.copy();

      if (par2 == 2) {
        if (!this.mergeItemStack(itemstack1, 3, 39, true)) {
          return null;
        }

        slot.onSlotChange(itemstack1, itemstack);
      } else if (par2 != 1 && par2 != 0) {
        if (ConcreteMixerRecipes.smelting().getSmeltingResult(itemstack1) != null) {
          if (!this.mergeItemStack(itemstack1, 0, 1, false)) {
            return null;
          }
        } else if (TileEntityConcreteMixer.isItemFuel(itemstack1)) {
          if (!this.mergeItemStack(itemstack1, 1, 2, false)) {
            return null;
          }
        } else if (par2 >= 3 && par2 < 30) {
          if (!this.mergeItemStack(itemstack1, 30, 39, false)) {
            return null;
          }
        } else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) {
          return null;
        }
      } else if (!this.mergeItemStack(itemstack1, 3, 39, false)) {
        return null;
      }

      if (itemstack1.stackSize == 0) {
        slot.putStack((ItemStack) null);
      } else {
        slot.onSlotChanged();
      }

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

      slot.onPickupFromSlot(par1EntityPlayer, itemstack1);
    }

    return itemstack;
  }
예제 #17
0
 @Override
 public ItemStack transferStackInSlot(EntityPlayer player, int slotID) {
   ItemStack itemStack = null;
   Slot slot = (Slot) inventorySlots.get(slotID);
   if (slot != null && slot.getHasStack()) {
     ItemStack resultStack = slot.getStack();
     itemStack = resultStack.copy();
     if (slotID >= 0 && slotID <= 9) {
       if (!this.mergeItemStack(resultStack, 10, 46, false)) return null;
       slot.onSlotChange(resultStack, itemStack);
     } else if (slotID >= 10 && slotID <= 46) {
       if ((planter.getItemBurnTime(resultStack) > 0
               && !this.mergeItemStack(resultStack, 0, 1, false))
           || planter.getItemBurnTime(itemStack) <= 0
               && !this.mergeItemStack(resultStack, 1, 10, false)) return null;
       slot.onSlotChange(resultStack, itemStack);
     } else if (!this.mergeItemStack(resultStack, 10, 46, false)) return null;
     if (resultStack.stackSize == 0) slot.putStack((ItemStack) null);
     else slot.onSlotChanged();
     if (resultStack.stackSize == itemStack.stackSize) return null;
     slot.onPickupFromSlot(player, resultStack);
   }
   return null;
 }
예제 #18
0
  /**
   * Called when a player shift-clicks on a slot. You must override this or you will crash when
   * someone does that.
   */
  public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) {
    ItemStack var3 = null;
    Slot var4 = (Slot) this.inventorySlots.get(p_82846_2_);

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

      if (p_82846_2_ == 0) {
        if (!this.mergeItemStack(var5, 1, 37, true)) {
          return null;
        }

        var4.onSlotChange(var5, var3);
      } else if (!this.beaconSlot.getHasStack()
          && this.beaconSlot.isItemValid(var5)
          && var5.stackSize == 1) {
        if (!this.mergeItemStack(var5, 0, 1, false)) {
          return null;
        }
      } else if (p_82846_2_ >= 1 && p_82846_2_ < 28) {
        if (!this.mergeItemStack(var5, 28, 37, false)) {
          return null;
        }
      } else if (p_82846_2_ >= 28 && p_82846_2_ < 37) {
        if (!this.mergeItemStack(var5, 1, 28, false)) {
          return null;
        }
      } else if (!this.mergeItemStack(var5, 1, 37, false)) {
        return null;
      }

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

      if (var5.stackSize == var3.stackSize) {
        return null;
      }

      var4.onPickupFromSlot(p_82846_1_, var5);
    }

    return var3;
  }
  @Override
  public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
    ItemStack itemstack = null;
    Slot slot = (Slot) this.inventorySlots.get(par2);

    if (slot != null && slot.getHasStack()) {
      ItemStack itemstack1 = slot.getStack();
      itemstack = itemstack1.copy();

      if (par2 == 1) {
        if (!this.mergeItemStack(itemstack1, 2, 38, true)) {
          return null;
        }

        slot.onSlotChange(itemstack1, itemstack);
      } else if (par2 != 0) {
        if (FurnaceRecipes.smelting().getSmeltingResult(itemstack1) != null) {
          if (!this.mergeItemStack(itemstack1, 0, 1, false)) {
            return null;
          }
        } else if (par2 >= 2 && par2 < 29) {
          if (!this.mergeItemStack(itemstack1, 29, 38, false)) {
            return null;
          }
        } else if (par2 >= 29 && par2 < 38 && !this.mergeItemStack(itemstack1, 2, 29, false)) {
          return null;
        }
      } else if (!this.mergeItemStack(itemstack1, 2, 38, false)) {
        return null;
      }

      if (itemstack1.stackSize == 0) {
        slot.putStack((ItemStack) null);
      } else {
        slot.onSlotChanged();
      }

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

      slot.onPickupFromSlot(par1EntityPlayer, itemstack1);
    }

    return itemstack;
  }
예제 #20
0
  /**
   * Called when a player shift-clicks on a slot. You must override this or you will crash when
   * someone does that.
   */
  @Override
  public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
    ItemStack var3 = null;
    Slot var4 = (Slot) inventorySlots.get(par2);

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

      if (par2 == 0) {
        if (!this.mergeItemStack(var5, 10, 46, true)) {
          return null;
        }

        var4.onSlotChange(var5, var3);
      } else if (par2 >= 10 && par2 < 37) {
        if (!this.mergeItemStack(var5, 37, 46, false)) {
          return null;
        }
      } else if (par2 >= 37 && par2 < 46) {
        if (!this.mergeItemStack(var5, 10, 37, false)) {
          return null;
        }
      } else if (!this.mergeItemStack(var5, 10, 46, false)) {
        return null;
      }

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

      if (var5.stackSize == var3.stackSize) {
        return null;
      }

      var4.onPickupFromSlot(par1EntityPlayer, var5);
    }

    return var3;
  }
  @Override
  public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) {
    ItemStack itemstack = null;
    Slot slot = this.inventorySlots.get(index);

    if (slot != null) {
      if (slot.getHasStack()) {
        ItemStack itemstack1 = slot.getStack();
        itemstack = itemstack1.copy();

        if (index == 0) {
          if (!this.mergeItemStack(itemstack1, 1, 37, true)) {
            return null;
          }

          slot.onSlotChange(itemstack1, itemstack);
        } else if (index >= 1 && index < 28 && !this.mergeItemStack(itemstack1, 0, 1, false)) {
          return null;
        } else if (index >= 28 && index < 37 && !this.mergeItemStack(itemstack1, 1, 28, false)) {
          return null;
        }

        if (itemstack1.stackSize == 0) {
          slot.putStack((ItemStack) null);
        } else {
          slot.onSlotChanged();
        }

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

        slot.onPickupFromSlot(playerIn, itemstack1);
      } else {
        slot.onSlotChanged();
      }
    }

    return itemstack;
  }
  /** 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;
  }
  @Override
  public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par1) {
    ItemStack var2 = null;
    final Slot var3 = (Slot) this.inventorySlots.get(par1);

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

      if (par1 <= 17) {
        if (!this.mergeItemStack(var4, 18, 46, false)) {
          return null;
        }

        var3.onSlotChange(var4, var2);
      } else if (var2.getItem().itemID == GCCoreItems.partNoseCone.itemID
          && !((Slot) this.inventorySlots.get(1)).getHasStack()) {
        if (!this.mergeItemStack(var4, 1, 2, false)) {
          return null;
        }
      } else if (var2.getItem().itemID == GCCoreItems.heavyPlatingTier1.itemID
          && !((Slot) this.inventorySlots.get(2)).getHasStack()) {
        if (!this.mergeItemStack(var4, 2, 3, false)) {
          return null;
        }
      } else if (var2.getItem().itemID == GCCoreItems.heavyPlatingTier1.itemID
          && !((Slot) this.inventorySlots.get(3)).getHasStack()) {
        if (!this.mergeItemStack(var4, 3, 4, false)) {
          return null;
        }
      } else if (var2.getItem().itemID == GCCoreItems.heavyPlatingTier1.itemID
          && !((Slot) this.inventorySlots.get(4)).getHasStack()) {
        if (!this.mergeItemStack(var4, 4, 5, false)) {
          return null;
        }
      } else if (var2.getItem().itemID == GCCoreItems.heavyPlatingTier1.itemID
          && !((Slot) this.inventorySlots.get(5)).getHasStack()) {
        if (!this.mergeItemStack(var4, 5, 6, false)) {
          return null;
        }
      } else if (var2.getItem().itemID == GCCoreItems.heavyPlatingTier1.itemID
          && !((Slot) this.inventorySlots.get(6)).getHasStack()) {
        if (!this.mergeItemStack(var4, 6, 7, false)) {
          return null;
        }
      } else if (var2.getItem().itemID == GCCoreItems.heavyPlatingTier1.itemID
          && !((Slot) this.inventorySlots.get(7)).getHasStack()) {
        if (!this.mergeItemStack(var4, 7, 8, false)) {
          return null;
        }
      } else if (var2.getItem().itemID == GCCoreItems.heavyPlatingTier1.itemID
          && !((Slot) this.inventorySlots.get(8)).getHasStack()) {
        if (!this.mergeItemStack(var4, 8, 9, false)) {
          return null;
        }
      } else if (var2.getItem().itemID == GCCoreItems.heavyPlatingTier1.itemID
          && !((Slot) this.inventorySlots.get(9)).getHasStack()) {
        if (!this.mergeItemStack(var4, 9, 10, false)) {
          return null;
        }
      } else if (var2.getItem().itemID == GCCoreItems.partFins.itemID
          && !((Slot) this.inventorySlots.get(10)).getHasStack()) {
        if (!this.mergeItemStack(var4, 10, 11, false)) {
          return null;
        }
      } else if (var2.getItem().itemID == GCCoreItems.partFins.itemID
          && !((Slot) this.inventorySlots.get(11)).getHasStack()) {
        if (!this.mergeItemStack(var4, 11, 12, false)) {
          return null;
        }
      } else if (var2.getItem().itemID == GCCoreItems.rocketEngine.itemID
          && !((Slot) this.inventorySlots.get(12)).getHasStack()) {
        if (!this.mergeItemStack(var4, 12, 13, false)) {
          return null;
        }
      } else if (var2.getItem().itemID == GCCoreItems.partFins.itemID
          && !((Slot) this.inventorySlots.get(13)).getHasStack()) {
        if (!this.mergeItemStack(var4, 13, 14, false)) {
          return null;
        }
      } else if (var2.getItem().itemID == GCCoreItems.partFins.itemID
          && !((Slot) this.inventorySlots.get(14)).getHasStack()) {
        if (!this.mergeItemStack(var4, 14, 15, false)) {
          return null;
        }
      } else if (var2.getItem().itemID == Block.chest.blockID
          && !((Slot) this.inventorySlots.get(15)).getHasStack()) {
        if (!this.mergeItemStack(var4, 15, 16, false)) {
          return null;
        }
      } else if (var2.getItem().itemID == Block.chest.blockID
          && !((Slot) this.inventorySlots.get(16)).getHasStack()) {
        if (!this.mergeItemStack(var4, 16, 17, false)) {
          return null;
        }
      } else if (var2.getItem().itemID == Block.chest.blockID
          && !((Slot) this.inventorySlots.get(17)).getHasStack()) {
        if (!this.mergeItemStack(var4, 17, 18, false)) {
          return null;
        }
      } else if (par1 >= 18 && par1 < 37) {
        if (!this.mergeItemStack(var4, 37, 46, false)) {
          return null;
        }
      } else if (par1 >= 37 && par1 < 46) {
        if (!this.mergeItemStack(var4, 18, 37, false)) {
          return null;
        }
      } else if (!this.mergeItemStack(var4, 18, 46, 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;
  }
  /**
   * Called when a player shift-clicks on a slot. You must override this or you will crash when
   * someone does that.
   */
  @Override
  public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
    ItemStack itemstack = null;
    Slot slot = (Slot) this.inventorySlots.get(par2);

    if (slot != null && slot.getHasStack()) {
      ItemStack itemstack1 = slot.getStack();
      itemstack = itemstack1.copy();

      if (par2 == 1) {
        if (!this.mergeItemStack(itemstack1, 29, 65, true)) {
          return null;
        }

        slot.onSlotChange(itemstack1, itemstack);
      } else if (par2 >= 11 && par2 <= 64) {
        if (TileEntityFurnace.isItemFuel(itemstack1)) {

          if (!this.mergeItemStack(itemstack1, 0, 1, false)) {
            return null;
          }
          // else if (!this.mergeItemStack(itemstack1, 11, 20, false)) {

          //	return null;

          // }

          //					if (par2 <= 19) {
          //						if (!this.mergeItemStack(itemstack1, 0, 1, false))
          //						{
          //							return null;
          //						}
          //					}
          //					else if (!this.mergeItemStack(itemstack1, 11, 65, false)) {
          //						return null;
          //					}
          //					else if (!this.mergeItemStack(itemstack1, 11, 20, false))
          //					{
          //						if (!this.mergeItemStack(itemstack1, 20, 65, false))
          //						{
          //							return null;
          //						}
          //					}

        } else if (par2 >= 11 && par2 <= 28) {
          if (!this.mergeItemStack(itemstack1, 29, 65, false)) {
            return null;
          }
        } else if (par2 >= 29 && par2 <= 55) {
          if (!this.mergeItemStack(itemstack1, 11, 20, false)) {

            if (!this.mergeItemStack(itemstack1, 56, 65, false)) {
              return null;
            }
          }
        } else if (par2 >= 56 && par2 <= 64) {
          if (!this.mergeItemStack(itemstack1, 11, 20, false)) {

            if (!this.mergeItemStack(itemstack1, 29, 56, false)) {
              return null;
            }
          }
        }
      } else if (!this.mergeItemStack(itemstack1, 29, 65, false)) {
        return null;
      }

      if (itemstack1.stackSize == 0) {
        slot.putStack((ItemStack) null);
      } else {
        slot.onSlotChanged();
      }

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

      slot.onPickupFromSlot(par1EntityPlayer, itemstack1);
    }

    return itemstack;
  }
 public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
   ItemStack itemstack = null;
   Slot slot = (Slot) this.inventorySlots.get(par2);
   if ((slot != null) && (slot.getHasStack())) {
     ItemStack itemstack1 = slot.getStack();
     itemstack = itemstack1.copy();
     if (par2 < nonInventorySlots) {
       if (!mergeItemStack(
           itemstack1,
           nonInventorySlots,
           nonInventorySlots + playerInventorySlots + playerHotbarSlots,
           false)) return null;
       slot.onSlotChange(itemstack1, itemstack);
     } else if (ModCompatability.getTravellersGearSlot(itemstack) >= 0) {
       int targetSlot = ModCompatability.getTravellersGearSlot(itemstack);
       if (travGear[targetSlot] != -1 && targetSlot >= 0 && targetSlot <= 3) {
         if (!mergeItemStack(
             itemstack1, travGear[0] + targetSlot, travGear[0] + targetSlot + 1, false))
           return null;
       }
     } else if (TravellersGear.BAUBLES
         && itemstack.getItem() instanceof IBauble
         && ((IBauble) itemstack.getItem()).getBaubleType(itemstack) != null) {
       IBauble baubleItem = (IBauble) itemstack.getItem();
       if (baubleItem.getBaubleType(itemstack) == BaubleType.AMULET
           && baubleItem.canEquip(itemstack, this.player)
           && !((Slot) this.inventorySlots.get(baubles[0])).getHasStack()) {
         if (!mergeItemStack(itemstack1, baubles[0], baubles[0] + 1, false)) return null;
       } else if (baubleItem.getBaubleType(itemstack) == BaubleType.RING
           && baubleItem.canEquip(itemstack, this.player)
           && !((Slot) this.inventorySlots.get(baubles[1])).getHasStack()) {
         if (!mergeItemStack(itemstack1, baubles[1], baubles[1] + 1, false)) return null;
       } else if (baubleItem.getBaubleType(itemstack) == BaubleType.RING
           && baubleItem.canEquip(itemstack, this.player)
           && !((Slot) this.inventorySlots.get(baubles[2])).getHasStack()) {
         if (!mergeItemStack(itemstack1, baubles[2], baubles[2] + 1, false)) return null;
       } else if (baubleItem.getBaubleType(itemstack) == BaubleType.BELT
           && baubleItem.canEquip(itemstack, this.player)
           && !((Slot) this.inventorySlots.get(baubles[3])).getHasStack()) {
         if (!mergeItemStack(itemstack1, baubles[3], baubles[3] + 1, false)) return null;
       }
     } else if (((itemstack.getItem() instanceof ItemArmor))
         && (!((Slot) this.inventorySlots.get(((ItemArmor) itemstack.getItem()).armorType))
             .getHasStack())) {
       int j = ((ItemArmor) itemstack.getItem()).armorType;
       if (!mergeItemStack(itemstack1, j + 5, j + 6, false)) return null;
     } else if (TravellersGear.MARI && ModCompatability.isMariJewelry(itemstack)) {
       int valSlot =
           ModCompatability.getMariJeweleryType(itemstack).contains("BRACELET")
               ? 1
               : ModCompatability.getMariJeweleryType(itemstack).contains("NECKLACE") ? 2 : 0;
       if (!mergeItemStack(itemstack1, mari[0] + valSlot, mari[0] + valSlot + 1, false))
         return null;
     } else if (TravellersGear.TCON && ModCompatability.canEquipTConAccessory(itemstack1, 1)) {
       if (!mergeItemStack(itemstack1, tcon[0], tcon[0] + 1, false)) return null;
     } else if (TravellersGear.TCON && ModCompatability.canEquipTConAccessory(itemstack1, 2)) {
       if (!mergeItemStack(itemstack1, tcon[1], tcon[1] + 1, false)) return null;
     } else if (TravellersGear.TCON && ModCompatability.canEquipTConAccessory(itemstack1, 6)) {
       if (!mergeItemStack(itemstack1, tcon[2], tcon[2] + 1, false)) return null;
     } else if (TravellersGear.TCON && ModCompatability.canEquipTConAccessory(itemstack1, 5)) {
       if (!mergeItemStack(itemstack1, tcon[3], tcon[3] + 1, false)) return null;
     } else if (TravellersGear.TCON && ModCompatability.canEquipTConAccessory(itemstack1, 4)) {
       if (!mergeItemStack(itemstack1, tcon[4], tcon[4] + 1, false)) return null;
     }
     /*			else if(TravellersGear.TCON && ModCompatability.canEquipTConAccessory(itemstack1, 3))
     			{
     				if (!mergeItemStack(itemstack1, tcon[5], tcon[5]+1, false))
     					return null;
     			}
     */ else if (TravellersGear.TCON
         && ModCompatability.canEquipTConAccessory(itemstack1, 0)) {
       if (!mergeItemStack(itemstack1, tcon[5], tcon[5] + 1, false)) return null;
     } else if ((par2 >= nonInventorySlots) && (par2 < nonInventorySlots + playerInventorySlots)) {
       if (!mergeItemStack(
           itemstack1,
           nonInventorySlots + playerInventorySlots,
           nonInventorySlots + playerInventorySlots + playerHotbarSlots,
           false)) return null;
     } else if ((par2 >= nonInventorySlots + playerInventorySlots)
         && (par2 < nonInventorySlots + playerInventorySlots + playerHotbarSlots)) {
       if (!mergeItemStack(
           itemstack1, nonInventorySlots, nonInventorySlots + playerInventorySlots, false))
         return null;
     }
     if (itemstack1.stackSize == 0) {
       slot.putStack((ItemStack) null);
     } else {
       slot.onSlotChanged();
     }
     if (itemstack1.stackSize == itemstack.stackSize) {
       return null;
     }
     slot.onPickupFromSlot(par1EntityPlayer, itemstack1);
   }
   return itemstack;
 }
 @Override
 public void onSlotChange(ItemStack itemstack, ItemStack itemstack1) {
   super.onSlotChange(itemstack, itemstack1);
 }
  public ItemStack transferStackInSlot(EntityPlayer player, int parSlot) {
    ItemStack itemstack = null;
    Slot slot = (Slot) this.inventorySlots.get(parSlot);

    if (slot != null && slot.getHasStack()) {
      ItemStack itemstack1 = slot.getStack();
      itemstack = itemstack1.copy();

      if (ArrayUtils.contains(this.tileEntity.resultSlots, parSlot)) {
        if (!this.mergeItemStack(
            itemstack1,
            this.tileEntity.getSizeInventory(),
            this.tileEntity.getSizeInventory() + 36,
            true)) {
          return null;
        }
        slot.onSlotChange(itemstack1, itemstack);
      } else if (!ArrayUtils.contains(this.tileEntity.inputSlots, parSlot)) {
        if (!EnchantmentHelper.getEnchantments(itemstack1).isEmpty()) {
          if (!this.mergeItemStack(itemstack1, 0, this.tileEntity.getSizeInventory() - 1, false)) {
            return null;
          }
          slot.onSlotChanged();
        } else if (parSlot >= this.tileEntity.getSizeInventory()
            && parSlot < this.tileEntity.getSizeInventory() + 27) {
          if (!this.mergeItemStack(
              itemstack1,
              this.tileEntity.getSizeInventory() + 27,
              this.tileEntity.getSizeInventory() + 36,
              false)) {
            return null;
          }
          slot.onSlotChanged();
        } else if (parSlot >= this.tileEntity.getSizeInventory() + 27
            && parSlot < this.tileEntity.getSizeInventory() + 36
            && !this.mergeItemStack(
                itemstack1,
                this.tileEntity.getSizeInventory(),
                this.tileEntity.getSizeInventory() + 27,
                false)) {
          return null;
        }
        slot.onSlotChanged();
      } else if (!this.mergeItemStack(
          itemstack1,
          this.tileEntity.getSizeInventory(),
          this.tileEntity.getSizeInventory() + 36,
          false)) {
        return null;
      }

      if (itemstack1.stackSize == 0) {
        slot.putStack((ItemStack) null);
      } else {
        slot.onSlotChanged();
      }

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

      slot.onPickupFromSlot(player, itemstack1);
    }
    return itemstack;
  }