コード例 #1
0
 @Override
 public void onPickupFromSlot(
     int slotNumber, IInventory inventory, EntityPlayer player, ItemStack stack) {
   if (slotNumber == 0 && tile.getStackInSlot(0) != null && tile.getStackInSlot(0).stackSize > 0) {
     tile.decrementCraftingField();
   }
 }
コード例 #2
0
 @Override
 public void render(TileEntity tile, double x, double y, double z, float f) {
   super.render(tile, x, y, z, f);
   if (tile instanceof TileStructureCrafter) {
     TileStructureCrafter structureCrafter = (TileStructureCrafter) tile;
     ItemStack stack = structureCrafter.getStackInSlot(0);
     if (stack != null && stack.stackSize > 0) {
       // TODO render result on top
     }
   }
 }
コード例 #3
0
 @Override
 public ItemStack transferStackInSlot(EntityPlayer player, int slotNumber) {
   ItemStack stack = null;
   Slot slot = (Slot) inventorySlots.get(slotNumber);
   if (slot != null && slot.getHasStack()) {
     ItemStack slotClicked = slot.getStack();
     stack = slotClicked.copy();
     if (slotNumber <= 36) {
       if (slotNumber == 0 && stack != null && stack.stackSize > 0) {
         tile.decrementCraftingField();
       }
       if (!mergeItemStack(slotClicked, 37, inventorySlots.size(), true)) {
         return null;
       }
     } else {
       stack = null;
     }
     if (slotClicked.stackSize == 0) {
       slot.putStack(null);
     } else {
       slot.onSlotChanged();
     }
   }
   return stack;
 }
コード例 #4
0
 @Override
 public boolean canTakeStack(int slotNumber, IInventory inventory, EntityPlayer player) {
   return tile.canTakeSlot(slotNumber, player);
 }