diff options
| author | Jason Mitchell <mitchej@gmail.com> | 2023-01-28 19:32:44 -0800 |
|---|---|---|
| committer | Jason Mitchell <mitchej@gmail.com> | 2023-01-28 19:32:44 -0800 |
| commit | 55f64675b42ac8d3c557cc850f78664bee006f6f (patch) | |
| tree | 2afd26dd3d5e6f763119bc192b57c66a1a075922 /src/main/java/gtPlusPlus/core/container | |
| parent | 0f5dfd01b877b6a1019e0671b88d07974aae68c0 (diff) | |
| download | GT5-Unofficial-55f64675b42ac8d3c557cc850f78664bee006f6f.tar.gz GT5-Unofficial-55f64675b42ac8d3c557cc850f78664bee006f6f.tar.bz2 GT5-Unofficial-55f64675b42ac8d3c557cc850f78664bee006f6f.zip | |
[ci skip] spotlessApply with the new settings
Diffstat (limited to 'src/main/java/gtPlusPlus/core/container')
17 files changed, 312 insertions, 542 deletions
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; |
