diff options
| author | YannickMG <yannickmg@gmail.com> | 2022-07-01 19:13:43 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-02 00:13:43 +0100 |
| commit | e7eaa051f2725501436ac31f880746a9dc2f1465 (patch) | |
| tree | 7fc74410cc795d855913cf590c75574b2834b222 /src/main | |
| parent | f7bdbd14a6f5e8fb4e5af0010b4cfcae3282feee (diff) | |
| download | GT5-Unofficial-e7eaa051f2725501436ac31f880746a9dc2f1465.tar.gz GT5-Unofficial-e7eaa051f2725501436ac31f880746a9dc2f1465.tar.bz2 GT5-Unofficial-e7eaa051f2725501436ac31f880746a9dc2f1465.zip | |
Par, var, begone! (#1104)
* Renamed parameters of ItemBlock subclasses
* Renamed damageDropped and getDamageValue method parameters of Block subclasses
* Removed trivially superfluous overrides of Block::quantityDropped, Block::isOpaqueCube and Block::renderAsNormalBlock
* Removed trivially superfluous overrides of Block::getItemDropped
* Cleaned up a few more block subclass method parameters
* Cleaned up obsolete Javadoc
* par1 -> block in ItemBlock Constructors
* Renamed arguments to drawGuiContainerForegroundLayer
* Cleaned up redundant casts
* Renamed arguments to drawGuiContainerBackgroundLayer
* Renamed arguments to Slot subclass constructors
* Renamed arguments to World subclass GT_DummyWorld
* Renamed parameters of updateProgressBar
* Renamed the rest of the par* parameters outside of GT_MinableOreGenerator which should be deleted
* Renamed most var1-var10 and a few more in generally non-dead code
* Renamed last varSomething variables
* Removed 3 fully dead classes used nowhere in the codebase, with obsolete unused code
Diffstat (limited to 'src/main')
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(); - var9 = tTempStackSize > -1; + canSwap = tTempStackSize > -1; } - if (var9 && aSlot.getHasStack()) { + if (canSwap && aSlot.getHasStack()) { aHoldStack = aSlot.getStack(); aPlayerInventory.setInventorySlotContents(aMouseclick, aHoldStack); @@ -300,92 +307,92 @@ public class GT_Container extends Container { * merges provided ItemStack with the first avaliable one in the container/player inventory */ @Override - protected boolean mergeItemStack(ItemStack aStack, int aStartIndex, int aSlotCount, boolean par4) { - boolean var5 = false; - int var6 = aStartIndex; + protected boolean mergeItemStack(ItemStack aStack, int aStartIndex, int aSlotCount, boolean reverseOrder) { + boolean transferredStack = false; + int slotIndex = aStartIndex; mTileEntity.markDirty(); - if (par4) { - var6 = aSlotCount - 1; + if (reverseOrder) { + slotIndex = aSlotCount - 1; } - Slot var7; - ItemStack var8; + Slot slot; + ItemStack itemStack; if (aStack.isStackable()) { - while (aStack.stackSize > 0 && (!par4 && var6 < aSlotCount || par4 && var6 >= aStartIndex)) { - var7 = (Slot) this.inventorySlots.get(var6); - var8 = var7.getStack(); - |
