Пример #1
0
  @Override
  public boolean isItemValidForSlot(int i, ItemStack itemstack) {

    return itemstack == null
        || itemstack.stackSize == 64
            && (itemstack.getItem() instanceof ItemElement)
            && PolytoolHelper.getTypeFromElement(ItemElement.getElement(itemstack), 1) != null;
  }
Пример #2
0
  @Override
  public void setInventorySlotContents(int i, ItemStack itemstack) {
    item = itemstack;

    if (itemstack != null
        && itemstack.stackSize == 64
        && (itemstack.getItem() instanceof ItemElement)
        && PolytoolHelper.getTypeFromElement(ItemElement.getElement(itemstack), 1) != null
        && ItemPolytool.validAlloyInfusion(player.getCurrentEquippedItem(), itemstack)) {
      item = null;
      ItemPolytool.addTypeToNBT(
          player.inventory.getCurrentItem(),
          PolytoolHelper.getTypeFromElement(ItemElement.getElement(itemstack), 1));

      if (!player.worldObj.isRemote) {
        PacketHandler.sendPolytoolUpdatePacket(
            PolytoolHelper.getTypeFromElement(ItemElement.getElement(itemstack), 1), player);
      }
    }
  }