From 55f64675b42ac8d3c557cc850f78664bee006f6f Mon Sep 17 00:00:00 2001 From: Jason Mitchell Date: Sat, 28 Jan 2023 19:32:44 -0800 Subject: [ci skip] spotlessApply with the new settings --- .../core/container/Container_BackpackBase.java | 80 +++++------- .../container/Container_CircuitProgrammer.java | 48 +++---- .../core/container/Container_DecayablesChest.java | 29 ++--- .../core/container/Container_EggBox.java | 29 ++--- .../core/container/Container_FishTrap.java | 31 ++--- .../core/container/Container_Grindle.java | 96 +++++--------- .../core/container/Container_HeliumGenerator.java | 52 +++----- .../core/container/Container_ModularityTable.java | 138 +++++++-------------- .../core/container/Container_PestKiller.java | 35 +++--- .../core/container/Container_ProjectTable.java | 86 ++++--------- .../core/container/Container_RoundRobinator.java | 22 ++-- .../core/container/Container_SuperJukebox.java | 46 +++---- .../core/container/Container_TradeTable.java | 83 ++++--------- .../container/Container_VolumetricFlaskSetter.java | 49 ++++---- .../core/container/box/LunchBoxContainer.java | 10 +- .../core/container/box/MagicBagContainer.java | 10 +- .../core/container/box/ToolBoxContainer.java | 10 +- 17 files changed, 312 insertions(+), 542 deletions(-) (limited to 'src/main/java/gtPlusPlus/core/container') diff --git a/src/main/java/gtPlusPlus/core/container/Container_BackpackBase.java b/src/main/java/gtPlusPlus/core/container/Container_BackpackBase.java index e3ed090b0c..5016a93280 100644 --- a/src/main/java/gtPlusPlus/core/container/Container_BackpackBase.java +++ b/src/main/java/gtPlusPlus/core/container/Container_BackpackBase.java @@ -1,34 +1,33 @@ package gtPlusPlus.core.container; -import gtPlusPlus.core.inventories.BaseInventoryBackpack; -import gtPlusPlus.core.slots.SlotItemBackpackInv; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import gtPlusPlus.core.inventories.BaseInventoryBackpack; +import gtPlusPlus.core.slots.SlotItemBackpackInv; + public class Container_BackpackBase extends Container { + /** The Item Inventory for this Container, only needed if you want to reference isUseableByPlayer */ public final BaseInventoryBackpack inventory; - /** Using these will make transferStackInSlot easier to understand and implement - * INV_START is the index of the first slot in the Player's Inventory, so our - * BaseInventoryBackpack's number of slots (e.g. 5 slots is array indices 0-4, so start at 5) - * Notice how we don't have to remember how many slots we made? We can just use - * BaseInventoryBackpack.INV_SIZE and if we ever change it, the Container updates automatically. */ - private static final int INV_START = BaseInventoryBackpack.INV_SIZE, - INV_END = INV_START + 26, - HOTBAR_START = INV_END + 1, - HOTBAR_END = HOTBAR_START + 8; + /** + * Using these will make transferStackInSlot easier to understand and implement INV_START is the index of the first + * slot in the Player's Inventory, so our BaseInventoryBackpack's number of slots (e.g. 5 slots is array indices + * 0-4, so start at 5) Notice how we don't have to remember how many slots we made? We can just use + * BaseInventoryBackpack.INV_SIZE and if we ever change it, the Container updates automatically. + */ + private static final int INV_START = BaseInventoryBackpack.INV_SIZE, INV_END = INV_START + 26, + HOTBAR_START = INV_END + 1, HOTBAR_END = HOTBAR_START + 8; // If you're planning to add armor slots, put those first like this: // ARMOR_START = BaseInventoryBackpack.INV_SIZE, ARMOR_END = ARMOR_START+3, // INV_START = ARMOR_END+1, and then carry on like above. - public Container_BackpackBase( - final EntityPlayer par1Player, - final InventoryPlayer inventoryPlayer, + public Container_BackpackBase(final EntityPlayer par1Player, final InventoryPlayer inventoryPlayer, final BaseInventoryBackpack inventoryItem) { this.inventory = inventoryItem; @@ -50,11 +49,9 @@ public class Container_BackpackBase extends Container { // If you want, you can add ARMOR SLOTS here as well, but you need to // make a public version of SlotArmor. I won't be doing that in this tutorial. /* - for (i = 0; i < 4; ++i) - { - // These are the standard positions for survival inventory layout - this.addSlotToContainer(new SlotArmor(this.player, inventoryPlayer, inventoryPlayer.getSizeInventory() - 1 - i, 8, 8 + i * 18, i)); - } + * for (i = 0; i < 4; ++i) { // These are the standard positions for survival inventory layout + * this.addSlotToContainer(new SlotArmor(this.player, inventoryPlayer, inventoryPlayer.getSizeInventory() - 1 - + * i, 8, 8 + i * 18, i)); } */ // PLAYER INVENTORY - uses default locations for standard inventory texture file @@ -101,35 +98,17 @@ public class Container_BackpackBase extends Container { // Item is in inventory / hotbar, try to place in custom inventory or armor slots else { /* - If your inventory only stores certain instances of Items, - you can implement shift-clicking to your inventory like this: - - // Check that the item is the right type - if (itemstack1.getItem() instanceof ItemCustom) - { - // Try to merge into your custom inventory slots - // We use 'BaseInventoryBackpack.INV_SIZE' instead of INV_START just in case - // you also add armor or other custom slots - if (!this.mergeItemStack(itemstack1, 0, BaseInventoryBackpack.INV_SIZE, false)) - { - return null; - } - } - // If you added armor slots, check them here as well: - // Item being shift-clicked is armor - try to put in armor slot - if (itemstack1.getItem() instanceof ItemArmor) - { - int type = ((ItemArmor) itemstack1.getItem()).armorType; - if (!this.mergeItemStack(itemstack1, ARMOR_START + type, ARMOR_START + type + 1, false)) - { - return null; - } - } - Otherwise, you have basically 2 choices: - 1. shift-clicking between player inventory and custom inventory - 2. shift-clicking between action bar and inventory - - Be sure to choose only ONE of the following implementations!!! + * If your inventory only stores certain instances of Items, you can implement shift-clicking to your + * inventory like this: // Check that the item is the right type if (itemstack1.getItem() instanceof + * ItemCustom) { // Try to merge into your custom inventory slots // We use + * 'BaseInventoryBackpack.INV_SIZE' instead of INV_START just in case // you also add armor or other + * custom slots if (!this.mergeItemStack(itemstack1, 0, BaseInventoryBackpack.INV_SIZE, false)) { return + * null; } } // If you added armor slots, check them here as well: // Item being shift-clicked is armor + * - try to put in armor slot if (itemstack1.getItem() instanceof ItemArmor) { int type = ((ItemArmor) + * itemstack1.getItem()).armorType; if (!this.mergeItemStack(itemstack1, ARMOR_START + type, ARMOR_START + * + type + 1, false)) { return null; } } Otherwise, you have basically 2 choices: 1. shift-clicking + * between player inventory and custom inventory 2. shift-clicking between action bar and inventory Be + * sure to choose only ONE of the following implementations!!! */ /** * Implementation number 1: Shift-click into your custom inventory @@ -176,9 +155,8 @@ public class Container_BackpackBase extends Container { } /** - * You should override this method to prevent the player from moving the stack that - * opened the inventory, otherwise if the player moves it, the inventory will not - * be able to save properly + * You should override this method to prevent the player from moving the stack that opened the inventory, otherwise + * if the player moves it, the inventory will not be able to save properly */ @Override public ItemStack slotClick(final int slot, final int button, final int flag, final EntityPlayer player) { diff --git a/src/main/java/gtPlusPlus/core/container/Container_CircuitProgrammer.java b/src/main/java/gtPlusPlus/core/container/Container_CircuitProgrammer.java index 73f7eefe8d..5eebcf5654 100644 --- a/src/main/java/gtPlusPlus/core/container/Container_CircuitProgrammer.java +++ b/src/main/java/gtPlusPlus/core/container/Container_CircuitProgrammer.java @@ -1,11 +1,5 @@ package gtPlusPlus.core.container; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.inventories.InventoryCircuitProgrammer; -import gtPlusPlus.core.slots.SlotIntegratedCircuit; -import gtPlusPlus.core.slots.SlotNoInput; -import gtPlusPlus.core.tileentities.general.TileEntityCircuitProgrammer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; @@ -13,6 +7,13 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.inventories.InventoryCircuitProgrammer; +import gtPlusPlus.core.slots.SlotIntegratedCircuit; +import gtPlusPlus.core.slots.SlotNoInput; +import gtPlusPlus.core.tileentities.general.TileEntityCircuitProgrammer; + public class Container_CircuitProgrammer extends Container { protected TileEntityCircuitProgrammer tile_entity; @@ -46,12 +47,10 @@ public class Container_CircuitProgrammer extends Container { int o = 0; // Storage Side - /*for (var6 = 0; var6 < 3; var6++) { - for (var7 = 0; var7 < 5; var7++) { - this.addSlotToContainer(new SlotIntegratedCircuit(o, this.inventoryChest, o, 44 + (var7 * 18), 15 + (var6 * 18))); - o++; - } - }*/ + /* + * for (var6 = 0; var6 < 3; var6++) { for (var7 = 0; var7 < 5; var7++) { this.addSlotToContainer(new + * SlotIntegratedCircuit(o, this.inventoryChest, o, 44 + (var7 * 18), 15 + (var6 * 18))); o++; } } + */ int xStart = 8; int yStart = 5; @@ -106,13 +105,12 @@ public class Container_CircuitProgrammer extends Container { } Logger.INFO("4"); - } catch (Throwable t) { - } + } catch (Throwable t) {} } @Override - public ItemStack slotClick( - final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer) { + public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, + final EntityPlayer aPlayer) { if (!aPlayer.worldObj.isRemote) { if ((aSlotIndex == 999) || (aSlotIndex == -999)) { @@ -146,18 +144,12 @@ public class Container_CircuitProgrammer extends Container { var3 = var5.copy(); /* - * if (par2 == 0) { if (!this.mergeItemStack(var5, - * InOutputSlotNumber, FullSlotNumber, true)) { return null; } - * - * var4.onSlotChange(var5, var3); } else if (par2 >= - * InOutputSlotNumber && par2 < InventoryOutSlotNumber) { if - * (!this.mergeItemStack(var5, InventoryOutSlotNumber, - * FullSlotNumber, false)) { return null; } } else if (par2 >= - * InventoryOutSlotNumber && par2 < FullSlotNumber) { if - * (!this.mergeItemStack(var5, InOutputSlotNumber, - * InventoryOutSlotNumber, false)) { return null; } } else if - * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, - * false)) { return null; } + * if (par2 == 0) { if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, true)) { return null; + * } var4.onSlotChange(var5, var3); } else if (par2 >= InOutputSlotNumber && par2 < InventoryOutSlotNumber) + * { if (!this.mergeItemStack(var5, InventoryOutSlotNumber, FullSlotNumber, false)) { return null; } } else + * if (par2 >= InventoryOutSlotNumber && par2 < FullSlotNumber) { if (!this.mergeItemStack(var5, + * InOutputSlotNumber, InventoryOutSlotNumber, false)) { return null; } } else if + * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, false)) { return null; } */ if (var5.stackSize == 0) { diff --git a/src/main/java/gtPlusPlus/core/container/Container_DecayablesChest.java b/src/main/java/gtPlusPlus/core/container/Container_DecayablesChest.java index ac755d71aa..55227e6ab0 100644 --- a/src/main/java/gtPlusPlus/core/container/Container_DecayablesChest.java +++ b/src/main/java/gtPlusPlus/core/container/Container_DecayablesChest.java @@ -1,8 +1,5 @@ package gtPlusPlus.core.container; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.inventories.Inventory_DecayablesChest; -import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; @@ -10,6 +7,10 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.inventories.Inventory_DecayablesChest; +import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest; + public class Container_DecayablesChest extends Container { protected TileEntityDecayablesChest tile_entity; @@ -64,8 +65,8 @@ public class Container_DecayablesChest extends Container { } @Override - public ItemStack slotClick( - final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer) { + public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, + final EntityPlayer aPlayer) { if (!aPlayer.worldObj.isRemote) { if ((aSlotIndex == 999) || (aSlotIndex == -999)) { @@ -100,18 +101,12 @@ public class Container_DecayablesChest extends Container { var3 = var5.copy(); /* - * if (par2 == 0) { if (!this.mergeItemStack(var5, - * InOutputSlotNumber, FullSlotNumber, true)) { return null; } - * - * var4.onSlotChange(var5, var3); } else if (par2 >= - * InOutputSlotNumber && par2 < InventoryOutSlotNumber) { if - * (!this.mergeItemStack(var5, InventoryOutSlotNumber, - * FullSlotNumber, false)) { return null; } } else if (par2 >= - * InventoryOutSlotNumber && par2 < FullSlotNumber) { if - * (!this.mergeItemStack(var5, InOutputSlotNumber, - * InventoryOutSlotNumber, false)) { return null; } } else if - * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, - * false)) { return null; } + * if (par2 == 0) { if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, true)) { return null; + * } var4.onSlotChange(var5, var3); } else if (par2 >= InOutputSlotNumber && par2 < InventoryOutSlotNumber) + * { if (!this.mergeItemStack(var5, InventoryOutSlotNumber, FullSlotNumber, false)) { return null; } } else + * if (par2 >= InventoryOutSlotNumber && par2 < FullSlotNumber) { if (!this.mergeItemStack(var5, + * InOutputSlotNumber, InventoryOutSlotNumber, false)) { return null; } } else if + * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, false)) { return null; } */ if (var5.stackSize == 0) { diff --git a/src/main/java/gtPlusPlus/core/container/Container_EggBox.java b/src/main/java/gtPlusPlus/core/container/Container_EggBox.java index 26815d2b7b..17a72135ec 100644 --- a/src/main/java/gtPlusPlus/core/container/Container_EggBox.java +++ b/src/main/java/gtPlusPlus/core/container/Container_EggBox.java @@ -1,8 +1,5 @@ package gtPlusPlus.core.container; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.inventories.Inventory_EggBox; -import gtPlusPlus.core.tileentities.general.TileEntityEggBox; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; @@ -10,6 +7,10 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.inventories.Inventory_EggBox; +import gtPlusPlus.core.tileentities.general.TileEntityEggBox; + public class Container_EggBox extends Container { protected TileEntityEggBox tile_entity; @@ -64,8 +65,8 @@ public class Container_EggBox extends Container { } @Override - public ItemStack slotClick( - final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer) { + public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, + final EntityPlayer aPlayer) { if (!aPlayer.worldObj.isRemote) { if ((aSlotIndex == 999) || (aSlotIndex == -999)) { @@ -100,18 +101,12 @@ public class Container_EggBox extends Container { var3 = var5.copy(); /* - * if (par2 == 0) { if (!this.mergeItemStack(var5, - * InOutputSlotNumber, FullSlotNumber, true)) { return null; } - * - * var4.onSlotChange(var5, var3); } else if (par2 >= - * InOutputSlotNumber && par2 < InventoryOutSlotNumber) { if - * (!this.mergeItemStack(var5, InventoryOutSlotNumber, - * FullSlotNumber, false)) { return null; } } else if (par2 >= - * InventoryOutSlotNumber && par2 < FullSlotNumber) { if - * (!this.mergeItemStack(var5, InOutputSlotNumber, - * InventoryOutSlotNumber, false)) { return null; } } else if - * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, - * false)) { return null; } + * if (par2 == 0) { if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, true)) { return null; + * } var4.onSlotChange(var5, var3); } else if (par2 >= InOutputSlotNumber && par2 < InventoryOutSlotNumber) + * { if (!this.mergeItemStack(var5, InventoryOutSlotNumber, FullSlotNumber, false)) { return null; } } else + * if (par2 >= InventoryOutSlotNumber && par2 < FullSlotNumber) { if (!this.mergeItemStack(var5, + * InOutputSlotNumber, InventoryOutSlotNumber, false)) { return null; } } else if + * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, false)) { return null; } */ if (var5.stackSize == 0) { diff --git a/src/main/java/gtPlusPlus/core/container/Container_FishTrap.java b/src/main/java/gtPlusPlus/core/container/Container_FishTrap.java index 44079d21e5..3dd73a1aaf 100644 --- a/src/main/java/gtPlusPlus/core/container/Container_FishTrap.java +++ b/src/main/java/gtPlusPlus/core/container/Container_FishTrap.java @@ -1,9 +1,5 @@ package gtPlusPlus.core.container; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.inventories.InventoryFishTrap; -import gtPlusPlus.core.slots.SlotNoInput; -import gtPlusPlus.core.tileentities.general.TileEntityFishTrap; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; @@ -11,6 +7,11 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.inventories.InventoryFishTrap; +import gtPlusPlus.core.slots.SlotNoInput; +import gtPlusPlus.core.tileentities.general.TileEntityFishTrap; + public class Container_FishTrap extends Container { protected TileEntityFishTrap tile_entity; @@ -65,8 +66,8 @@ public class Container_FishTrap extends Container { } @Override - public ItemStack slotClick( - final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer) { + public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, + final EntityPlayer aPlayer) { if (!aPlayer.worldObj.isRemote) { if ((aSlotIndex == 999) || (aSlotIndex == -999)) { @@ -101,18 +102,12 @@ public class Container_FishTrap extends Container { var3 = var5.copy(); /* - * if (par2 == 0) { if (!this.mergeItemStack(var5, - * InOutputSlotNumber, FullSlotNumber, true)) { return null; } - * - * var4.onSlotChange(var5, var3); } else if (par2 >= - * InOutputSlotNumber && par2 < InventoryOutSlotNumber) { if - * (!this.mergeItemStack(var5, InventoryOutSlotNumber, - * FullSlotNumber, false)) { return null; } } else if (par2 >= - * InventoryOutSlotNumber && par2 < FullSlotNumber) { if - * (!this.mergeItemStack(var5, InOutputSlotNumber, - * InventoryOutSlotNumber, false)) { return null; } } else if - * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, - * false)) { return null; } + * if (par2 == 0) { if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, true)) { return null; + * } var4.onSlotChange(var5, var3); } else if (par2 >= InOutputSlotNumber && par2 < InventoryOutSlotNumber) + * { if (!this.mergeItemStack(var5, InventoryOutSlotNumber, FullSlotNumber, false)) { return null; } } else + * if (par2 >= InventoryOutSlotNumber && par2 < FullSlotNumber) { if (!this.mergeItemStack(var5, + * InOutputSlotNumber, InventoryOutSlotNumber, false)) { return null; } } else if + * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, false)) { return null; } */ if (var5.stackSize == 0) { diff --git a/src/main/java/gtPlusPlus/core/container/Container_Grindle.java b/src/main/java/gtPlusPlus/core/container/Container_Grindle.java index f0580abb24..f49d840819 100644 --- a/src/main/java/gtPlusPlus/core/container/Container_Grindle.java +++ b/src/main/java/gtPlusPlus/core/container/Container_Grindle.java @@ -1,36 +1,31 @@ package gtPlusPlus.core.container; -import gtPlusPlus.core.inventories.BaseInventoryGrindle; -import gtPlusPlus.core.slots.SlotDataStick; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import gtPlusPlus.core.inventories.BaseInventoryGrindle; +import gtPlusPlus.core.slots.SlotDataStick; + public class Container_Grindle extends Container { + /** - * The Item Inventory for this Container, only needed if you want to reference - * isUseableByPlayer + * The Item Inventory for this Container, only needed if you want to reference isUseableByPlayer */ public final BaseInventoryGrindle inventory; /** - * Using these will make transferStackInSlot easier to understand and implement - * INV_START is the index of the first slot in the Player's Inventory, so our - * BaseInventoryBackpack's number of slots (e.g. 5 slots is array indices 0-4, - * so start at 5) Notice how we don't have to remember how many slots we made? - * We can just use BaseInventoryBackpack.INV_SIZE and if we ever change it, the - * Container updates automatically. + * Using these will make transferStackInSlot easier to understand and implement INV_START is the index of the first + * slot in the Player's Inventory, so our BaseInventoryBackpack's number of slots (e.g. 5 slots is array indices + * 0-4, so start at 5) Notice how we don't have to remember how many slots we made? We can just use + * BaseInventoryBackpack.INV_SIZE and if we ever change it, the Container updates automatically. */ - private static final int INV_START = BaseInventoryGrindle.INV_SIZE, - INV_END = INV_START + 0, - HOTBAR_START = INV_END, + private static final int INV_START = BaseInventoryGrindle.INV_SIZE, INV_END = INV_START + 0, HOTBAR_START = INV_END, HOTBAR_END = HOTBAR_START + 8; - public Container_Grindle( - final EntityPlayer par1Player, - final InventoryPlayer inventoryPlayer, + public Container_Grindle(final EntityPlayer par1Player, final InventoryPlayer inventoryPlayer, final BaseInventoryGrindle inventoryItem) { this.inventory = inventoryItem; @@ -56,8 +51,7 @@ public class Container_Grindle extends Container { } /** - * Called when a player shift-clicks on a slot. You must override this or you - * will crash when someone does that. + * 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(final EntityPlayer par1EntityPlayer, final int index) { @@ -81,56 +75,35 @@ public class Container_Grindle extends Container { // slots else { /* - - * If your inventory only stores certain instances of Items, you can implement - * shift-clicking to your inventory like this: - * - * // Check that the item is the right type if (itemstack1.getItem() instanceof + * If your inventory only stores certain instances of Items, you can implement shift-clicking to your + * inventory like this: // Check that the item is the right type if (itemstack1.getItem() instanceof * ItemCustom) { // Try to merge into your custom inventory slots // We use - * 'BaseInventoryBackpack.INV_SIZE' instead of INV_START just in case // you - * also add armor or other custom slots if (!this.mergeItemStack(itemstack1, 0, - * BaseInventoryBackpack.INV_SIZE, false)) { return null; } } // If you added - * armor slots, check them here as well: // Item being shift-clicked is armor - - * try to put in armor slot if (itemstack1.getItem() instanceof ItemArmor) { int - * type = ((ItemArmor) itemstack1.getItem()).armorType; if - * (!this.mergeItemStack(itemstack1, ARMOR_START + type, ARMOR_START + type + 1, - * false)) { return null; } } Otherwise, you have basically 2 choices: 1. - * shift-clicking between player inventory and custom inventory 2. - * shift-clicking between action bar and inventory - * - * Be sure to choose only ONE of the following implementations!!! - - */ + * 'BaseInventoryBackpack.INV_SIZE' instead of INV_START just in case // you also add armor or other + * custom slots if (!this.mergeItemStack(itemstack1, 0, BaseInventoryBackpack.INV_SIZE, false)) { return + * null; } } // If you added armor slots, check them here as well: // Item being shift-clicked is armor + * - try to put in armor slot if (itemstack1.getItem() instanceof ItemArmor) { int type = ((ItemArmor) + * itemstack1.getItem()).armorType; if (!this.mergeItemStack(itemstack1, ARMOR_START + type, ARMOR_START + * + type + 1, false)) { return null; } } Otherwise, you have basically 2 choices: 1. shift-clicking + * between player inventory and custom inventory 2. shift-clicking between action bar and inventory Be + * sure to choose only ONE of the following implementations!!! + */ /** * Implementation number 1: Shift-click into your custom inventory */ /* - if (index >= INV_START) { - // place in custom inventory - if (!this.mergeItemStack(itemstack1, 0, INV_START, false)) { - return null; - } - } - - */ + * if (index >= INV_START) { // place in custom inventory if (!this.mergeItemStack(itemstack1, 0, + * INV_START, false)) { return null; } } + */ /** * Implementation number 2: Shift-click items between action bar and inventory */ /* - // item is in player's inventory, but not in action bar - if ((index >= INV_START) && (index < HOTBAR_START)) { - // place in action bar - if (!this.mergeItemStack(itemstack1, HOTBAR_START, HOTBAR_END + 1, false)) { - return null; - } - } - // item in action bar - place in player inventory - else if ((index >= HOTBAR_START) && (index < (HOTBAR_END + 1))) { - if (!this.mergeItemStack(itemstack1, INV_START, INV_END + 1, false)) { - return null; - } - } - */ } + * // item is in player's inventory, but not in action bar if ((index >= INV_START) && (index < + * HOTBAR_START)) { // place in action bar if (!this.mergeItemStack(itemstack1, HOTBAR_START, HOTBAR_END + * + 1, false)) { return null; } } // item in action bar - place in player inventory else if ((index >= + * HOTBAR_START) && (index < (HOTBAR_END + 1))) { if (!this.mergeItemStack(itemstack1, INV_START, + * INV_END + 1, false)) { return null; } } + */ } if (itemstack1.stackSize == 0) { slot.putStack((ItemStack) null); @@ -149,9 +122,8 @@ public class Container_Grindle extends Container { } /** - * You should override this method to prevent the player from moving the stack - * that opened the inventory, otherwise if the player moves it, the inventory - * will not be able to save properly + * You should override this method to prevent the player from moving the stack that opened the inventory, otherwise + * if the player moves it, the inventory will not be able to save properly */ @Override public ItemStack slotClick(final int slot, final int button, final int flag, final EntityPlayer player) { diff --git a/src/main/java/gtPlusPlus/core/container/Container_HeliumGenerator.java b/src/main/java/gtPlusPlus/core/container/Container_HeliumGenerator.java index 3bda62a403..1ab23ed315 100644 --- a/src/main/java/gtPlusPlus/core/container/Container_HeliumGenerator.java +++ b/src/main/java/gtPlusPlus/core/container/Container_HeliumGenerator.java @@ -1,11 +1,5 @@ package gtPlusPlus.core.container; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.inventories.InventoryHeliumGenerator; -import gtPlusPlus.core.slots.SlotFuelRod; -import gtPlusPlus.core.slots.SlotNoInput; -import gtPlusPlus.core.tileentities.general.TileEntityHeliumGenerator; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; @@ -13,6 +7,13 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.inventories.InventoryHeliumGenerator; +import gtPlusPlus.core.slots.SlotFuelRod; +import gtPlusPlus.core.slots.SlotNoInput; +import gtPlusPlus.core.tileentities.general.TileEntityHeliumGenerator; + public class Container_HeliumGenerator extends Container { protected TileEntityHeliumGenerator tile_entity; @@ -84,8 +85,8 @@ public class Container_HeliumGenerator extends Container { } @Override - public ItemStack slotClick( - final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer) { + public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, + final EntityPlayer aPlayer) { if (!aPlayer.worldObj.isRemote) { if ((aSlotIndex == 999) || (aSlotIndex == -999)) { @@ -118,33 +119,14 @@ public class Container_HeliumGenerator extends Container { final ItemStack var5 = var4.getStack(); var3 = var5.copy(); - /*if (par2 == 0) - { - if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, true)) - { - return null; - } - - var4.onSlotChange(var5, var3); - } - else if (par2 >= InOutputSlotNumber && par2 < InventoryOutSlotNumber) - { - if (!this.mergeItemStack(var5, InventoryOutSlotNumber, FullSlotNumber, false)) - { - return null; - } - } - else if (par2 >= InventoryOutSlotNumber && par2 < FullSlotNumber) - { - if (!this.mergeItemStack(var5, InOutputSlotNumber, InventoryOutSlotNumber, false)) - { - return null; - } - } - else if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, false)) - { - return null; - }*/ + /* + * if (par2 == 0) { if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, true)) { return null; + * } var4.onSlotChange(var5, var3); } else if (par2 >= InOutputSlotNumber && par2 < InventoryOutSlotNumber) + * { if (!this.mergeItemStack(var5, InventoryOutSlotNumber, FullSlotNumber, false)) { return null; } } else + * if (par2 >= InventoryOutSlotNumber && par2 < FullSlotNumber) { if (!this.mergeItemStack(var5, + * InOutputSlotNumber, InventoryOutSlotNumber, false)) { return null; } } else if + * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, false)) { return null; } + */ if (var5.stackSize == 0) { var4.putStack((ItemStack) null); diff --git a/src/main/java/gtPlusPlus/core/container/Container_ModularityTable.java b/src/main/java/gtPlusPlus/core/container/Container_ModularityTable.java index 602de2447b..3a615675b5 100644 --- a/src/main/java/gtPlusPlus/core/container/Container_ModularityTable.java +++ b/src/main/java/gtPlusPlus/core/container/Container_ModularityTable.java @@ -1,5 +1,12 @@ package gtPlusPlus.core.container; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.inventories.modulartable.InventoryModularMain; @@ -8,12 +15,6 @@ import gtPlusPlus.core.slots.SlotModularBauble; import gtPlusPlus.core.slots.SlotModularBaubleUpgrades; import gtPlusPlus.core.slots.SlotNoInput; import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; public class Container_ModularityTable extends Container { @@ -61,8 +62,12 @@ public class Container_ModularityTable extends Container { for (var7 = 0; var7 < 3; ++var7) { // Utils.LOG_WARNING("Adding slots at var:"+(var7 + var6 * 4)+" x:"+(8 + var7 * 18)+" y:"+(7 + var6 * // 18)); - this.addSlotToContainer(new SlotModularBaubleUpgrades( - this.inventoryGrid, nextFreeSlot, 8 + 18 + (var7 * 18), 17 + (var6 * 18))); + this.addSlotToContainer( + new SlotModularBaubleUpgrades( + this.inventoryGrid, + nextFreeSlot, + 8 + 18 + (var7 * 18), + 17 + (var6 * 18))); this.slotGrid[o] = nextFreeSlot; nextFreeSlot++; o++; @@ -88,10 +93,10 @@ public class Container_ModularityTable extends Container { /** * Callback for when the crafting matrix is changed. */ - /* public void onCraftMatrixChanged(IInventory p_75130_1_) - { - this.craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj)); - }*/ + /* + * public void onCraftMatrixChanged(IInventory p_75130_1_) { this.craftResult.setInventorySlotContents(0, + * CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj)); } + */ /** * Called when the container is closed. @@ -100,12 +105,10 @@ public class Container_ModularityTable extends Container { public void onContainerClosed(EntityPlayer p_75134_1_) { super.onContainerClosed(p_75134_1_); if (!this.worldObj.isRemote) { - /* for (int i = 0; i < 9; ++i){ - ItemStack itemstack = this.craftMatrix.getStackInSlotOnClosing(i); - if (itemstack != null){ - p_75134_1_.dropPlayerItemWithRandomChoice(itemstack, false); - } - }*/ + /* + * for (int i = 0; i < 9; ++i){ ItemStack itemstack = this.craftMatrix.getStackInSlotOnClosing(i); if + * (itemstack != null){ p_75134_1_.dropPlayerItemWithRandomChoice(itemstack, false); } } + */ } } @@ -117,8 +120,8 @@ public class Container_ModularityTable extends Container { } @Override - public ItemStack slotClick( - final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer) { + public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, + final EntityPlayer aPlayer) { if (!aPlayer.worldObj.isRemote) { if ((aSlotIndex == 999) || (aSlotIndex == -999)) { @@ -160,82 +163,31 @@ public class Container_ModularityTable extends Container { return null; - /*ItemStack var3 = null; - final Slot var4 = (Slot)this.inventorySlots.get(par2); - - if ((var4 != null) && var4.getHasStack()) - { - final ItemStack var5 = var4.getStack(); - var3 = var5.copy(); - - if (par2 == 0) - { - if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, true)) - { - return null; - } - - var4.onSlotChange(var5, var3); - } - else if ((par2 >= InOutputSlotNumber) && (par2 < InventoryOutSlotNumber)) - { - if (!this.mergeItemStack(var5, InventoryOutSlotNumber, FullSlotNumber, false)) - { - return null; - } - } - else if ((par2 >= InventoryOutSlotNumber) && (par2 < FullSlotNumber)) - { - if (!this.mergeItemStack(var5, InOutputSlotNumber, InventoryOutSlotNumber, false)) - { - return null; - } - } - else if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, 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;*/ + /* + * ItemStack var3 = null; final Slot var4 = (Slot)this.inventorySlots.get(par2); if ((var4 != null) && + * var4.getHasStack()) { final ItemStack var5 = var4.getStack(); var3 = var5.copy(); if (par2 == 0) { if + * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, true)) { return null; } + * var4.onSlotChange(var5, var3); } else if ((par2 >= InOutputSlotNumber) && (par2 < InventoryOutSlotNumber)) { + * if (!this.mergeItemStack(var5, InventoryOutSlotNumber, FullSlotNumber, false)) { return null; } } else if + * ((par2 >= InventoryOutSlotNumber) && (par2 < FullSlotNumber)) { if (!this.mergeItemStack(var5, + * InOutputSlotNumber, InventoryOutSlotNumber, false)) { return null; } } else if (!this.mergeItemStack(var5, + * InOutputSlotNumber, FullSlotNumber, 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; + */ } // Can merge Slot - /*public boolean func_94530_a(ItemStack p_94530_1_, Slot p_94530_2_){ - return p_94530_2_.inventory != this.craftResult && super.func_94530_a(p_94530_1_, p_94530_2_); - }*/ - - /*public ItemStack getOutputContent(){ - ItemStack output = this.craftResult.getStackInSlot(0); - if (output != null){ - return output; - } - return null; - } + /* + * public boolean func_94530_a(ItemStack p_94530_1_, Slot p_94530_2_){ return p_94530_2_.inventory != + * this.craftResult && super.func_94530_a(p_94530_1_, p_94530_2_); } + */ - public ItemStack[] getInputComponents(){ - ItemStack inputs[] = new ItemStack[9]; - for (int r=0;r= - * InOutputSlotNumber && par2 < InventoryOutSlotNumber) { if - * (!this.mergeItemStack(var5, InventoryOutSlotNumber, - * FullSlotNumber, false)) { return null; } } else if (par2 >= - * InventoryOutSlotNumber && par2 < FullSlotNumber) { if - * (!this.mergeItemStack(var5, InOutputSlotNumber, - * InventoryOutSlotNumber, false)) { return null; } } else if - * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, - * false)) { return null; } + * if (par2 == 0) { if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, true)) { return null; + * } var4.onSlotChange(var5, var3); } else if (par2 >= InOutputSlotNumber && par2 < InventoryOutSlotNumber) + * { if (!this.mergeItemStack(var5, InventoryOutSlotNumber, FullSlotNumber, false)) { return null; } } else + * if (par2 >= InventoryOutSlotNumber && par2 < FullSlotNumber) { if (!this.mergeItemStack(var5, + * InOutputSlotNumber, InventoryOutSlotNumber, false)) { return null; } } else if + * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, false)) { return null; } */ if (var5.stackSize == 0) { diff --git a/src/main/java/gtPlusPlus/core/container/Container_ProjectTable.java b/src/main/java/gtPlusPlus/core/container/Container_ProjectTable.java index 63eeb3fcae..0401908ccf 100644 --- a/src/main/java/gtPlusPlus/core/container/Container_ProjectTable.java +++ b/src/main/java/gtPlusPlus/core/container/Container_ProjectTable.java @@ -1,5 +1,12 @@ package gtPlusPlus.core.container; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.*; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.world.World; + import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.inventories.projecttable.InventoryProjectMain; @@ -8,12 +15,6 @@ import gtPlusPlus.core.slots.SlotCraftingNoCollect; import gtPlusPlus.core.slots.SlotDataStick; import gtPlusPlus.core.slots.SlotNoInput; import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.*; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.world.World; public class Container_ProjectTable extends Container { @@ -91,7 +92,8 @@ public class Container_ProjectTable extends Container { @Override public void onCraftMatrixChanged(IInventory p_75130_1_) { this.craftResult.setInventorySlotContents( - 0, CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj)); + 0, + CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj)); } /** @@ -111,8 +113,8 @@ public class Container_ProjectTable extends Container { } @Override - public ItemStack slotClick( - final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer) { + public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, + final EntityPlayer aPlayer) { if (!aPlayer.worldObj.isRemote) { if ((aSlotIndex == 999) || (aSlotIndex == -999)) { @@ -152,60 +154,18 @@ public class Container_ProjectTable extends Container { return null; - /*ItemStack var3 = null; - final Slot var4 = (Slot)this.inventorySlots.get(par2); - - if ((var4 != null) && var4.getHasStack()) - { - final ItemStack var5 = var4.getStack(); - var3 = var5.copy(); - - if (par2 == 0) - { - if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, true)) - { - return null; - } - - var4.onSlotChange(var5, var3); - } - else if ((par2 >= InOutputSlotNumber) && (par2 < InventoryOutSlotNumber)) - { - if (!this.mergeItemStack(var5, InventoryOutSlotNumber, FullSlotNumber, false)) - { - return null; - } - } - else if ((par2 >= InventoryOutSlotNumber) && (par2 < FullSlotNumber)) - { - if (!this.mergeItemStack(var5, InOutputSlotNumber, InventoryOutSlotNumber, false)) - { - return null; - } - } - else if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, 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;*/ + /* + * ItemStack var3 = null; final Slot var4 = (Slot)this.inventorySlots.get(par2); if ((var4 != null) && + * var4.getHasStack()) { final ItemStack var5 = var4.getStack(); var3 = var5.copy(); if (par2 == 0) { if + * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, true)) { return null; } + * var4.onSlotChange(var5, var3); } else if ((par2 >= InOutputSlotNumber) && (par2 < InventoryOutSlotNumber)) { + * if (!this.mergeItemStack(var5, InventoryOutSlotNumber, FullSlotNumber, false)) { return null; } } else if + * ((par2 >= InventoryOutSlotNumber) && (par2 < FullSlotNumber)) { if (!this.mergeItemStack(var5, + * InOutputSlotNumber, InventoryOutSlotNumber, false)) { return null; } } else if (!this.mergeItemStack(var5, + * InOutputSlotNumber, FullSlotNumber, 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; + */ } // Can merge Slot diff --git a/src/main/java/gtPlusPlus/core/container/Container_RoundRobinator.java b/src/main/java/gtPlusPlus/core/container/Container_RoundRobinator.java index 3baaeac983..7befab8aeb 100644 --- a/src/main/java/gtPlusPlus/core/container/Container_RoundRobinator.java +++ b/src/main/java/gtPlusPlus/core/container/Container_RoundRobinator.java @@ -1,13 +1,7 @@ package gtPlusPlus.core.container; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.GT_Values; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.inventories.Inventory_RoundRobinator; -import gtPlusPlus.core.slots.SlotNoInput; -import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator; import java.util.Iterator; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; @@ -16,6 +10,14 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.GT_Values; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.inventories.Inventory_RoundRobinator; +import gtPlusPlus.core.slots.SlotNoInput; +import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator; + public class Container_RoundRobinator extends Container { public TileEntityRoundRobinator tile_entity; @@ -26,7 +28,7 @@ public class Container_RoundRobinator extends Container { private final int posY; private final int posZ; - private final boolean[] mActiveData = new boolean[] {false, false, false, false}; + private final boolean[] mActiveData = new boolean[] { false, false, false, false }; public static int mStorageSlotNumber = 4; // Number of slots in storage area public static int mInventorySlotNumber = 36; // Inventory Slots (Inventory @@ -80,8 +82,8 @@ public class Container_RoundRobinator extends Container { } @Override - public ItemStack slotClick( - final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer) { + public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, + final EntityPlayer aPlayer) { if (!aPlayer.worldObj.isRemote) { if (aSlotIndex < 4) { diff --git a/src/main/java/gtPlusPlus/core/container/Container_SuperJukebox.java b/src/main/java/gtPlusPlus/core/container/Container_SuperJukebox.java index d1b8d1ee6d..f9b4a43641 100644 --- a/src/main/java/gtPlusPlus/core/container/Container_SuperJukebox.java +++ b/src/main/java/gtPlusPlus/core/container/Container_SuperJukebox.java @@ -1,14 +1,7 @@ package gtPlusPlus.core.container; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.block.machine.Machine_SuperJukebox.TileEntitySuperJukebox; -import gtPlusPlus.core.inventories.Inventory_SuperJukebox; -import gtPlusPlus.core.slots.SlotJukebox; -import gtPlusPlus.core.slots.SlotNoInput; import java.util.Iterator; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; @@ -17,6 +10,15 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.block.machine.Machine_SuperJukebox.TileEntitySuperJukebox; +import gtPlusPlus.core.inventories.Inventory_SuperJukebox; +import gtPlusPlus.core.slots.SlotJukebox; +import gtPlusPlus.core.slots.SlotNoInput; + public class Container_SuperJukebox extends Container { protected TileEntitySuperJukebox tile_entity; @@ -52,12 +54,10 @@ public class Container_SuperJukebox extends Container { int o = 0; // Storage Side - /*for (var6 = 0; var6 < 3; var6++) { - for (var7 = 0; var7 < 5; var7++) { - this.addSlotToContainer(new SlotIntegratedCircuit(o, this.inventoryChest, o, 44 + (var7 * 18), 15 + (var6 * 18))); - o++; - } - }*/ + /* + * for (var6 = 0; var6 < 3; var6++) { for (var7 = 0; var7 < 5; var7++) { this.addSlotToContainer(new + * SlotIntegratedCircuit(o, this.inventoryChest, o, 44 + (var7 * 18), 15 + (var6 * 18))); o++; } } + */ int xStart = 9; int yStart = 20; @@ -143,18 +143,12 @@ public class Container_SuperJukebox extends Container { var3 = var5.copy(); /* - * if (par2 == 0) { if (!this.mergeItemStack(var5, - * InOutputSlotNumber, FullSlotNumber, true)) { return null; } - * - * var4.onSlotChange(var5, var3); } else if (par2 >= - * InOutputSlotNumber && par2 < InventoryOutSlotNumber) { if - * (!this.mergeItemStack(var5, InventoryOutSlotNumber, - * FullSlotNumber, false)) { return null; } } else if (par2 >= - * InventoryOutSlotNumber && par2 < FullSlotNumber) { if - * (!this.mergeItemStack(var5, InOutputSlotNumber, - * InventoryOutSlotNumber, false)) { return null; } } else if - * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, - * false)) { return null; } + * if (par2 == 0) { if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, true)) { return null; + * } var4.onSlotChange(var5, var3); } else if (par2 >= InOutputSlotNumber && par2 < InventoryOutSlotNumber) + * { if (!this.mergeItemStack(var5, InventoryOutSlotNumber, FullSlotNumber, false)) { return null; } } else + * if (par2 >= InventoryOutSlotNumber && par2 < FullSlotNumber) { if (!this.mergeItemStack(var5, + * InOutputSlotNumber, InventoryOutSlotNumber, false)) { return null; } } else if + * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, false)) { return null; } */ if (var5.stackSize == 0) { diff --git a/src/main/java/gtPlusPlus/core/container/Container_TradeTable.java b/src/main/java/gtPlusPlus/core/container/Container_TradeTable.java index 14515c25f3..ff19730c20 100644 --- a/src/main/java/gtPlusPlus/core/container/Container_TradeTable.java +++ b/src/main/java/gtPlusPlus/core/container/Container_TradeTable.java @@ -1,5 +1,12 @@ package gtPlusPlus.core.container; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.inventories.tradetable.InventoryTradeMain; @@ -7,12 +14,6 @@ import gtPlusPlus.core.inventories.tradetable.InventoryTradeOutput; import gtPlusPlus.core.slots.SlotGeneric; import gtPlusPlus.core.slots.SlotNoInput; import gtPlusPlus.core.tileentities.machines.TileEntityTradeTable; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; public class Container_TradeTable extends Container { @@ -99,8 +100,8 @@ public class Container_TradeTable extends Container { } @Override - public ItemStack slotClick( - final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer) { + public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, + final EntityPlayer aPlayer) { if (!aPlayer.worldObj.isRemote) { if ((aSlotIndex == 999) || (aSlotIndex == -999)) { @@ -140,60 +141,18 @@ public class Container_TradeTable extends Container { return null; - /*ItemStack var3 = null; - final Slot var4 = (Slot)this.inventorySlots.get(par2); - - if ((var4 != null) && var4.getHasStack()) - { - final ItemStack var5 = var4.getStack(); - var3 = var5.copy(); - - if (par2 == 0) - { - if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, true)) - { - return null; - } - - var4.onSlotChange(var5, var3); - } - else if ((par2 >= InOutputSlotNumber) && (par2 < InventoryOutSlotNumber)) - { - if (!this.mergeItemStack(var5, InventoryOutSlotNumber, FullSlotNumber, false)) - { - return null; - } - } - else if ((par2 >= InventoryOutSlotNumber) && (par2 < FullSlotNumber)) - { - if (!this.mergeItemStack(var5, InOutputSlotNumber, InventoryOutSlotNumber, false)) - { - return null; - } - } - else if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, 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;*/ + /* + * ItemStack var3 = null; final Slot var4 = (Slot)this.inventorySlots.get(par2); if ((var4 != null) && + * var4.getHasStack()) { final ItemStack var5 = var4.getStack(); var3 = var5.copy(); if (par2 == 0) { if + * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, true)) { return null; } + * var4.onSlotChange(var5, var3); } else if ((par2 >= InOutputSlotNumber) && (par2 < InventoryOutSlotNumber)) { + * if (!this.mergeItemStack(var5, InventoryOutSlotNumber, FullSlotNumber, false)) { return null; } } else if + * ((par2 >= InventoryOutSlotNumber) && (par2 < FullSlotNumber)) { if (!this.mergeItemStack(var5, + * InOutputSlotNumber, InventoryOutSlotNumber, false)) { return null; } } else if (!this.mergeItemStack(var5, + * InOutputSlotNumber, FullSlotNumber, 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; + */ } public ItemStack getOutputContent() { diff --git a/src/main/java/gtPlusPlus/core/container/Container_VolumetricFlaskSetter.java b/src/main/java/gtPlusPlus/core/container/Container_VolumetricFlaskSetter.java index 740048f88d..5af33d3684 100644 --- a/src/main/java/gtPlusPlus/core/container/Container_VolumetricFlaskSetter.java +++ b/src/main/java/gtPlusPlus/core/container/Container_VolumetricFlaskSetter.java @@ -1,5 +1,15 @@ package gtPlusPlus.core.container; +import java.util.Iterator; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.api.objects.Logger; @@ -9,14 +19,6 @@ import gtPlusPlus.core.slots.SlotNoInput; import gtPlusPlus.core.slots.SlotVolumetricFlask; import gtPlusPlus.core.tileentities.general.TileEntityVolumetricFlaskSetter; import gtPlusPlus.core.util.Utils; -import java.util.Iterator; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; public class Container_VolumetricFlaskSetter extends Container { @@ -55,12 +57,10 @@ public class Container_VolumetricFlaskSetter extends Container { int o = 0; // Storage Side - /*for (var6 = 0; var6 < 3; var6++) { - for (var7 = 0; var7 < 5; var7++) { - this.addSlotToContainer(new SlotIntegratedCircuit(o, this.inventoryChest, o, 44 + (var7 * 18), 15 + (var6 * 18))); - o++; - } - }*/ + /* + * for (var6 = 0; var6 < 3; var6++) { for (var7 = 0; var7 < 5; var7++) { this.addSlotToContainer(new + * SlotIntegratedCircuit(o, this.inve