diff options
Diffstat (limited to 'src/main/java/gregtech')
89 files changed, 580 insertions, 921 deletions
diff --git a/src/main/java/gregtech/api/enchants/Enchantment_Radioactivity.java b/src/main/java/gregtech/api/enchants/Enchantment_Radioactivity.java index cc09b5768e..f6088caab3 100644 --- a/src/main/java/gregtech/api/enchants/Enchantment_Radioactivity.java +++ b/src/main/java/gregtech/api/enchants/Enchantment_Radioactivity.java @@ -40,7 +40,7 @@ public class Enchantment_Radioactivity extends EnchantmentDamage { } @Override - public boolean canApply(ItemStack par1ItemStack) { + public boolean canApply(ItemStack itemStack) { return false; } diff --git a/src/main/java/gregtech/api/gui/GT_Container.java b/src/main/java/gregtech/api/gui/GT_Container.java index 0f788d543b..2b7959d6cb 100644 --- a/src/main/java/gregtech/api/gui/GT_Container.java +++ b/src/main/java/gregtech/api/gui/GT_Container.java @@ -119,6 +119,9 @@ public class GT_Container extends Container { e.printStackTrace(GT_Log.err); } + // It looks like the rest of this code should ideally never be + // called, and might in fact never be called. + ItemStack rStack = null; InventoryPlayer aPlayerInventory = aPlayer.inventory; Slot aSlot; @@ -158,24 +161,24 @@ public class GT_Container extends Container { aSlot = (Slot) this.inventorySlots.get(aSlotIndex); if (aSlot != null) { tTempStack = aSlot.getStack(); - ItemStack var13 = aPlayerInventory.getItemStack(); + ItemStack mouseStack = aPlayerInventory.getItemStack(); if (tTempStack != null) { rStack = GT_Utility.copyOrNull(tTempStack); } if (tTempStack == null) { - if (var13 != null && aSlot.isItemValid(var13)) { - tTempStackSize = aMouseclick == 0 ? var13.stackSize : 1; + if (mouseStack != null && aSlot.isItemValid(mouseStack)) { + tTempStackSize = aMouseclick == 0 ? mouseStack.stackSize : 1; if (tTempStackSize > aSlot.getSlotStackLimit()) { tTempStackSize = aSlot.getSlotStackLimit(); } - aSlot.putStack(var13.splitStack(tTempStackSize)); + aSlot.putStack(mouseStack.splitStack(tTempStackSize)); - if (var13.stackSize == 0) { + if (mouseStack.stackSize == 0) { aPlayerInventory.setItemStack(null); } } } else if (aSlot.canTakeStack(aPlayer)) { - if (var13 == null) { + if (mouseStack == null) { tTempStackSize = aMouseclick == 0 ? tTempStack.stackSize : (tTempStack.stackSize + 1) / 2; aHoldStack = aSlot.decrStackSize(tTempStackSize); aPlayerInventory.setItemStack(aHoldStack); @@ -183,29 +186,29 @@ public class GT_Container extends Container { aSlot.putStack(null); } aSlot.onPickupFromSlot(aPlayer, aPlayerInventory.getItemStack()); - } else if (aSlot.isItemValid(var13)) { - if (tTempStack.getItem() == var13.getItem() && tTempStack.getItemDamage() == var13.getItemDamage() && ItemStack.areItemStackTagsEqual(tTempStack, var13)) { - tTempStackSize = aMouseclick == 0 ? var13.stackSize : 1; + } else if (aSlot.isItemValid(mouseStack)) { + if (tTempStack.getItem() == mouseStack.getItem() && tTempStack.getItemDamage() == mouseStack.getItemDamage() && ItemStack.areItemStackTagsEqual(tTempStack, mouseStack)) { + tTempStackSize = aMouseclick == 0 ? mouseStack.stackSize : 1; if (tTempStackSize > aSlot.getSlotStackLimit() - tTempStack.stackSize) { tTempStackSize = aSlot.getSlotStackLimit() - tTempStack.stackSize; } - if (tTempStackSize > var13.getMaxStackSize() - tTempStack.stackSize) { - tTempStackSize = var13.getMaxStackSize() - tTempStack.stackSize; + if (tTempStackSize > mouseStack.getMaxStackSize() - tTempStack.stackSize) { + tTempStackSize = mouseStack.getMaxStackSize() - tTempStack.stackSize; } - var13.splitStack(tTempStackSize); - if (var13.stackSize == 0) { + mouseStack.splitStack(tTempStackSize); + if (mouseStack.stackSize == 0) { aPlayerInventory.setItemStack(null); } tTempStack.stackSize += tTempStackSize; - } else if (var13.stackSize <= aSlot.getSlotStackLimit()) { - aSlot.putStack(var13); + } else if (mouseStack.stackSize <= aSlot.getSlotStackLimit()) { + aSlot.putStack(mouseStack); aPlayerInventory.setItemStack(tTempStack); } - } else if (tTempStack.getItem() == var13.getItem() && var13.getMaxStackSize() > 1 && (!tTempStack.getHasSubtypes() || tTempStack.getItemDamage() == var13.getItemDamage()) && ItemStack.areItemStackTagsEqual(tTempStack, var13)) { + } else if (tTempStack.getItem() == mouseStack.getItem() && mouseStack.getMaxStackSize() > 1 && (!tTempStack.getHasSubtypes() || tTempStack.getItemDamage() == mouseStack.getItemDamage()) && ItemStack.areItemStackTagsEqual(tTempStack, mouseStack)) { tTempStackSize = tTempStack.stackSize; - if (tTempStackSize > 0 && tTempStackSize + var13.stackSize <= var13.getMaxStackSize()) { - var13.stackSize += tTempStackSize; + if (tTempStackSize > 0 && tTempStackSize + mouseStack.stackSize <= mouseStack.getMaxStackSize()) { + mouseStack.stackSize += tTempStackSize; tTempStack = aSlot.decrStackSize(tTempStackSize); if (tTempStack.stackSize == 0) { @@ -219,20 +222,24 @@ public class GT_Container extends Container { aSlot.onSlotChanged(); } } + // Did the player try to swap a slot with his hotbar using a + // number key from 1 to 9 + // aMouseclick == 0 means number 1, aMouseclick == 8 means number 9 } else if (aShifthold == 2 && aMouseclick >= 0 && aMouseclick < 9) { aSlot = (Slot) this.inventorySlots.get(aSlotIndex); if (aSlot.canTakeStack(aPlayer)) { + // get the stack at the specified hotbar slot. tTempStack = aPlayerInventory.getStackInSlot(aMouseclick); - boolean var9 = tTempStack == null || aSlot.inventory == aPlayerInventory && aSlot.isItemValid(tTempStack); + boolean canSwap = tTempStack == null || aSlot.inventory == aPlayerInventory && aSlot.isItemValid(tTempStack); tTempStackSize = -1; - if (!var9) { + if (!canSwap) { tTempStackSize = aPlayerInventory.getFirstEmptyStack(); - |
