diff --git a/src/main/java/binnie/core/craftgui/WindowFieldKit.java b/src/main/java/binnie/core/craftgui/WindowFieldKit.java index 878232cd..3fae1970 100644 --- a/src/main/java/binnie/core/craftgui/WindowFieldKit.java +++ b/src/main/java/binnie/core/craftgui/WindowFieldKit.java @@ -115,12 +115,14 @@ public class WindowFieldKit extends Window { @Override public void initialiseClient() { + final NBTTagList actions = new NBTTagList(); + setTitle(getName()); CraftGUI.render.stylesheet(new StyleSheetPunnett()); getWindowInventory().createSlot(0); getWindowInventory().createSlot(1); setupValidators(); - new ControlPlayerInventory(this); + new ControlPlayerInventory(this).create(actions); IPoint handGlass = new IPoint(16.0f, 32.0f); GlassControl = new ControlImage( this, @@ -128,8 +130,6 @@ public class WindowFieldKit extends Window { handGlass.y(), new StandardTexture(0, 160, 96, 96, ExtraBeeTexture.GUIPunnett)); - final NBTTagList actions = new NBTTagList(); - new ControlSlot(this, handGlass.x() + 54.0f, handGlass.y() + 26.0f).assign(actions, InventoryType.Window, 0); new ControlSlot(this, 208.0f, 8.0f).assign(actions, InventoryType.Window, 1); diff --git a/src/main/java/binnie/core/craftgui/WindowGenesis.java b/src/main/java/binnie/core/craftgui/WindowGenesis.java index d5880dd2..bafee9d6 100644 --- a/src/main/java/binnie/core/craftgui/WindowGenesis.java +++ b/src/main/java/binnie/core/craftgui/WindowGenesis.java @@ -63,7 +63,7 @@ public class WindowGenesis extends Window { @Override public void initialiseClient() { - new ControlPlayerInventory(this); + new ControlPlayerInventory(this).createAndRegister(); setTitle(getName()); ControlTabBar tabSystems = new BreedingSystemControlTabBar(); diff --git a/src/main/java/binnie/core/craftgui/minecraft/control/ControlPlayerInventory.java b/src/main/java/binnie/core/craftgui/minecraft/control/ControlPlayerInventory.java index 574b6ac5..71199a80 100644 --- a/src/main/java/binnie/core/craftgui/minecraft/control/ControlPlayerInventory.java +++ b/src/main/java/binnie/core/craftgui/minecraft/control/ControlPlayerInventory.java @@ -40,7 +40,6 @@ public class ControlPlayerInventory extends Control { slots.add(slot2); } } - create(); } public ControlPlayerInventory(IWidget parent) { @@ -56,12 +55,9 @@ public class ControlPlayerInventory extends Control { slots.add(slot); } } - create(); } - public void create() { - final NBTTagList actions = new NBTTagList(); - + public ControlPlayerInventory create(NBTTagList actions) { for (int row = 0; row < 3; ++row) { for (int column = 0; column < 9; ++column) { ControlSlot slot = slots.get(column + row * 9); @@ -74,14 +70,13 @@ public class ControlPlayerInventory extends Control { slot2.assign(actions, InventoryType.Player, i1); } + return this; + } + + public ControlPlayerInventory createAndRegister() { + final NBTTagList actions = new NBTTagList(); + create(actions); MessageCraftGUI.sendToServer(actions); + return this; } - - public ControlSlot getSlot(int i) { - if (i < 0 || i >= slots.size()) { - return null; - } - return slots.get(i); - } - } diff --git a/src/main/java/binnie/core/craftgui/minecraft/control/ControlSlotArray.java b/src/main/java/binnie/core/craftgui/minecraft/control/ControlSlotArray.java index e2ab5bc6..2a5d1c25 100644 --- a/src/main/java/binnie/core/craftgui/minecraft/control/ControlSlotArray.java +++ b/src/main/java/binnie/core/craftgui/minecraft/control/ControlSlotArray.java @@ -9,7 +9,6 @@ import net.minecraft.nbt.NBTTagList; import binnie.core.craftgui.IWidget; import binnie.core.craftgui.controls.core.Control; import binnie.core.craftgui.minecraft.InventoryType; -import binnie.core.network.packet.MessageCraftGUI; public class ControlSlotArray extends Control implements Iterable { @@ -29,13 +28,7 @@ public class ControlSlotArray extends Control implements Iterable { return new ControlSlot(this, x, y); } - public ControlSlotArray create(int[] index) { - return create(InventoryType.Machine, index); - } - - public ControlSlotArray create(InventoryType inventoryType, int[] index) { - final NBTTagList actions = new NBTTagList(); - + public ControlSlotArray create(NBTTagList actions, InventoryType inventoryType, int[] index) { int i = 0; for (ControlSlot controlSlot : slots) { final int slotIndex = index[i]; @@ -43,7 +36,6 @@ public class ControlSlotArray extends Control implements Iterable { i++; } - MessageCraftGUI.sendToServer(actions); return this; } diff --git a/src/main/java/binnie/core/machines/storage/WindowCompartment.java b/src/main/java/binnie/core/machines/storage/WindowCompartment.java index 37ad0a99..7be8f55b 100644 --- a/src/main/java/binnie/core/machines/storage/WindowCompartment.java +++ b/src/main/java/binnie/core/machines/storage/WindowCompartment.java @@ -190,7 +190,11 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh for (int k = 0; k < inv.getPageSize(); ++k) { slotsIDs[k] = i++; } - new ControlSlotArray(thisPage, 8, 8, inv.getPageSize() / 5, 5).create(slotsIDs); + + final NBTTagList actions = new NBTTagList(); + new ControlSlotArray(thisPage, 8, 8, inv.getPageSize() / 5, 5) + .create(actions, InventoryType.Machine, slotsIDs); + MessageCraftGUI.sendToServer(actions); } x += compartmentPageWidth; if (tabs2.length > 0) { @@ -248,7 +252,7 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh setSize(new IPoint(Math.max(32 + compartmentWidth, 252), h())); controlCompartment.setPosition(new IPoint((w() - controlCompartment.w()) / 2.0f, controlCompartment.y())); - new ControlPlayerInventory(this, true); + new ControlPlayerInventory(this, true).createAndRegister(); ControlSlide slide = new ControlSlide(this, 0.0f, 134.0f, 136.0f, 92.0f, Position.LEFT); slide.setLabel(I18N.localise("binniecore.machine.storage.tab.properties")); slide.setSlide(false); @@ -370,7 +374,7 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh }; slotGrid = new Control(scroll, 1.0f, 1.0f, 108.0f, 18.0f); scroll.setScrollableContent(slotGrid); - new ControlPlayerInventory(this, true); + new ControlPlayerInventory(this, true).createAndRegister(); new ControlTextEdit(this, 16.0f, 16.0f, 100.0f, 14.0f).addEventHandler(new EventTextEdit.Handler() { @Override diff --git a/src/main/java/binnie/extrabees/gui/WindowAlvearyFrame.java b/src/main/java/binnie/extrabees/gui/WindowAlvearyFrame.java index 77184cc6..76f03f8c 100644 --- a/src/main/java/binnie/extrabees/gui/WindowAlvearyFrame.java +++ b/src/main/java/binnie/extrabees/gui/WindowAlvearyFrame.java @@ -2,6 +2,7 @@ package binnie.extrabees.gui; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; +import net.minecraft.nbt.NBTTagList; import binnie.core.AbstractMod; import binnie.core.craftgui.minecraft.InventoryType; @@ -10,6 +11,7 @@ import binnie.core.craftgui.minecraft.control.ControlPlayerInventory; import binnie.core.craftgui.minecraft.control.ControlSlot; import binnie.core.machines.Machine; import binnie.core.machines.TileEntityMachine; +import binnie.core.network.packet.MessageCraftGUI; import binnie.core.util.I18N; import binnie.extrabees.ExtraBees; import cpw.mods.fml.relauncher.Side; @@ -34,9 +36,10 @@ public class WindowAlvearyFrame extends Window { @Override public void initialiseClient() { setTitle(I18N.localise("extrabees.machine.alveay.frame")); - playerInventory = new ControlPlayerInventory(this); - ControlSlot slot = new ControlSlot(this, 79.0f, 30.0f); - slot.assignAndRegister(InventoryType.Machine, 0); + final NBTTagList actions = new NBTTagList(); + playerInventory = new ControlPlayerInventory(this).create(actions); + new ControlSlot(this, 79.0f, 30.0f).assign(actions, InventoryType.Machine, 0); + MessageCraftGUI.sendToServer(actions); } @Override diff --git a/src/main/java/binnie/extrabees/gui/WindowAlvearyHatchery.java b/src/main/java/binnie/extrabees/gui/WindowAlvearyHatchery.java index e7b9f35c..bf6efa23 100644 --- a/src/main/java/binnie/extrabees/gui/WindowAlvearyHatchery.java +++ b/src/main/java/binnie/extrabees/gui/WindowAlvearyHatchery.java @@ -2,13 +2,16 @@ package binnie.extrabees.gui; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; +import net.minecraft.nbt.NBTTagList; import binnie.core.AbstractMod; +import binnie.core.craftgui.minecraft.InventoryType; import binnie.core.craftgui.minecraft.Window; import binnie.core.craftgui.minecraft.control.ControlPlayerInventory; import binnie.core.craftgui.minecraft.control.ControlSlotArray; import binnie.core.machines.Machine; import binnie.core.machines.TileEntityMachine; +import binnie.core.network.packet.MessageCraftGUI; import binnie.core.util.I18N; import binnie.extrabees.ExtraBees; import binnie.extrabees.apiary.machine.hatchery.AlvearyHatchery; @@ -33,10 +36,11 @@ public class WindowAlvearyHatchery extends Window { @Override public void initialiseClient() { + final NBTTagList actions = new NBTTagList(); setTitle(I18N.localise("extrabees.machine.alveay.hatchery")); - playerInventory = new ControlPlayerInventory(this); - ControlSlotArray slot = new ControlSlotArray(this, 43, 30, 5, 1); - slot.create(AlvearyHatchery.SLOT_LARVAE); + playerInventory = new ControlPlayerInventory(this).create(actions); + new ControlSlotArray(this, 43, 30, 5, 1).create(actions, InventoryType.Machine, AlvearyHatchery.SLOT_LARVAE); + MessageCraftGUI.sendToServer(actions); } @Override diff --git a/src/main/java/binnie/extrabees/gui/WindowAlvearyMutator.java b/src/main/java/binnie/extrabees/gui/WindowAlvearyMutator.java index b621af03..d5e3960f 100644 --- a/src/main/java/binnie/extrabees/gui/WindowAlvearyMutator.java +++ b/src/main/java/binnie/extrabees/gui/WindowAlvearyMutator.java @@ -3,6 +3,7 @@ package binnie.extrabees.gui; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagList; import binnie.core.AbstractMod; import binnie.core.craftgui.controls.ControlText; @@ -16,6 +17,7 @@ import binnie.core.craftgui.minecraft.control.ControlPlayerInventory; import binnie.core.craftgui.minecraft.control.ControlSlot; import binnie.core.machines.Machine; import binnie.core.machines.TileEntityMachine; +import binnie.core.network.packet.MessageCraftGUI; import binnie.core.util.I18N; import binnie.extrabees.ExtraBees; import binnie.extrabees.apiary.machine.mutator.AlvearyMutator; @@ -40,10 +42,11 @@ public class WindowAlvearyMutator extends Window { @Override public void initialiseClient() { + final NBTTagList actions = new NBTTagList(); + setTitle(I18N.localise("extrabees.machine.alveay.mutator")); - playerInventory = new ControlPlayerInventory(this); - ControlSlot slot = new ControlSlot(this, 79.0f, 30.0f); - slot.assignAndRegister(InventoryType.Machine, AlvearyMutator.SLOT_MUTATOR); + playerInventory = new ControlPlayerInventory(this).create(actions); + new ControlSlot(this, 79.0f, 30.0f).assign(actions, InventoryType.Machine, AlvearyMutator.SLOT_MUTATOR); new ControlText( this, new IArea(0.0f, 52.0f, w(), 16.0f), @@ -64,6 +67,8 @@ public class WindowAlvearyMutator extends Window { display.hastooltip = true; x += 17.0f; } + + MessageCraftGUI.sendToServer(actions); } @Override diff --git a/src/main/java/binnie/extrabees/gui/WindowAlvearyStimulator.java b/src/main/java/binnie/extrabees/gui/WindowAlvearyStimulator.java index d263d3d0..36082066 100644 --- a/src/main/java/binnie/extrabees/gui/WindowAlvearyStimulator.java +++ b/src/main/java/binnie/extrabees/gui/WindowAlvearyStimulator.java @@ -2,6 +2,7 @@ package binnie.extrabees.gui; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; +import net.minecraft.nbt.NBTTagList; import binnie.core.AbstractMod; import binnie.core.craftgui.geometry.Position; @@ -12,6 +13,7 @@ import binnie.core.craftgui.minecraft.control.ControlPlayerInventory; import binnie.core.craftgui.minecraft.control.ControlSlot; import binnie.core.machines.Machine; import binnie.core.machines.TileEntityMachine; +import binnie.core.network.packet.MessageCraftGUI; import binnie.core.util.I18N; import binnie.extrabees.ExtraBees; import binnie.extrabees.apiary.machine.stimulator.AlvearyStimulator; @@ -36,11 +38,12 @@ public class WindowAlvearyStimulator extends Window { @Override public void initialiseClient() { + final NBTTagList actions = new NBTTagList(); setTitle(I18N.localise("extrabees.machine.alveay.stimulator")); + playerInventory = new ControlPlayerInventory(this).create(actions); + new ControlSlot(this, 41.0f, 28.0f).assign(actions, InventoryType.Machine, AlvearyStimulator.SLOT_CIRCUIT); new ControlEnergyBar(this, 75, 29, 60, 16, Position.LEFT); - ControlSlot slot = new ControlSlot(this, 41.0f, 28.0f); - slot.assignAndRegister(InventoryType.Machine, AlvearyStimulator.SLOT_CIRCUIT); - playerInventory = new ControlPlayerInventory(this); + MessageCraftGUI.sendToServer(actions); } @Override diff --git a/src/main/java/binnie/extratrees/craftgui/WindowLumbermill.java b/src/main/java/binnie/extratrees/craftgui/WindowLumbermill.java index 19132494..79e8ae84 100644 --- a/src/main/java/binnie/extratrees/craftgui/WindowLumbermill.java +++ b/src/main/java/binnie/extratrees/craftgui/WindowLumbermill.java @@ -48,10 +48,11 @@ public class WindowLumbermill extends Window { new ControlSlot(this, 148.0f, 43.0f).assign(actions, InventoryType.Machine, Lumbermill.SLOT_PLANKS); new ControlSlot(this, 172.0f, 28.0f).assign(actions, InventoryType.Machine, Lumbermill.SLOT_BARK); new ControlSlot(this, 172.0f, 58.0f).assign(actions, InventoryType.Machine, Lumbermill.SLOT_SAWDUST); + new ControlLumbermillProgress(this, 70.0f, 43.0f); new ControlLiquidTank(this, 16, 32); new ControlEnergyBar(this, 8, 112, 16, 60, Position.BOTTOM); - new ControlPlayerInventory(this); + new ControlPlayerInventory(this).create(actions); new ControlErrorState(this, 95.0f, 73.0f); MessageCraftGUI.sendToServer(actions); diff --git a/src/main/java/binnie/extratrees/craftgui/WindowWoodworker.java b/src/main/java/binnie/extratrees/craftgui/WindowWoodworker.java index 3db20d71..e02cfd24 100644 --- a/src/main/java/binnie/extratrees/craftgui/WindowWoodworker.java +++ b/src/main/java/binnie/extratrees/craftgui/WindowWoodworker.java @@ -51,6 +51,8 @@ public class WindowWoodworker extends Window { @Override public void initialiseClient() { + final NBTTagList actions = new NBTTagList(); + setTitle(Machine.getMachine(getInventory()).getPackage().getDisplayName()); new ControlText( this, @@ -61,11 +63,14 @@ public class WindowWoodworker extends Window { textEdit = new ControlTextEdit(this, 188.0f, 178.0f, 118.0f, 12.0f); ControlScrollableContent scroll = new ControlScrollableContent(this, 190.0f, 50.0f, 114.0f, 122.0f, 12.0f); scroll.setScrollableContent(tileSelect = new ControlTileSelect(scroll, 0.0f, 0.0f)); - new ControlPlayerInventory(this).setPosition(new IPoint(14.0f, 96.0f)); + + ControlPlayerInventory controlPlayerInventory = new ControlPlayerInventory(this); + controlPlayerInventory.setPosition(new IPoint(14.0f, 96.0f)); + controlPlayerInventory.create(actions); + new ControlErrorState(this, 76.0f, 65.0f); if (getInventory() != null) { - final NBTTagList actions = new NBTTagList(); ControlSlot slotWood1 = new ControlSlot(this, 22.0f, 34.0f); slotWood1.assign(actions, InventoryType.Machine, Designer.DESIGN_1_SLOT); @@ -74,9 +79,9 @@ public class WindowWoodworker extends Window { ControlSlot slotBeeswax = new ControlSlot(this, 42.0f, 64.0f); slotBeeswax.assign(actions, InventoryType.Machine, Designer.GLUE_SLOT); new ControlRecipeSlot(this, 112, 34); - - MessageCraftGUI.sendToServer(actions); } + + MessageCraftGUI.sendToServer(actions); } @Override diff --git a/src/main/java/binnie/genetics/craftgui/WindowAcclimatiser.java b/src/main/java/binnie/genetics/craftgui/WindowAcclimatiser.java index 53809c70..6b782965 100644 --- a/src/main/java/binnie/genetics/craftgui/WindowAcclimatiser.java +++ b/src/main/java/binnie/genetics/craftgui/WindowAcclimatiser.java @@ -2,6 +2,7 @@ package binnie.genetics.craftgui; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; +import net.minecraft.nbt.NBTTagList; import binnie.core.AbstractMod; import binnie.core.craftgui.geometry.Position; @@ -14,6 +15,7 @@ import binnie.core.craftgui.minecraft.control.ControlSlot; import binnie.core.craftgui.minecraft.control.ControlSlotArray; import binnie.core.craftgui.resource.Texture; import binnie.core.craftgui.resource.minecraft.StandardTexture; +import binnie.core.network.packet.MessageCraftGUI; import binnie.core.util.I18N; import binnie.extrabees.core.ExtraBeeTexture; import binnie.genetics.Genetics; @@ -41,17 +43,23 @@ public class WindowAcclimatiser extends WindowMachine { @Override public void initialiseClient() { super.initialiseClient(); + + final NBTTagList actions = new NBTTagList(); + int x = 59; int y = 32; - new ControlSlotArray(this, x, y, 2, 2).create(Acclimatiser.SLOT_RESERVE); + new ControlSlotArray(this, x, y, 2, 2).create(actions, InventoryType.Machine, Acclimatiser.SLOT_RESERVE); x += 54; - new ControlSlot(this, x + 18, y).assignAndRegister(InventoryType.Machine, Acclimatiser.SLOT_TARGET); - new ControlSlotArray(this, x, y + 18 + 18, 3, 1).create(Acclimatiser.SLOT_ACCLIMATISER); + new ControlSlot(this, x + 18, y).assign(actions, InventoryType.Machine, Acclimatiser.SLOT_TARGET); + new ControlSlotArray(this, x, y + 18 + 18, 3, 1) + .create(actions, InventoryType.Machine, Acclimatiser.SLOT_ACCLIMATISER); x += 72; - new ControlSlotArray(this, x, y, 2, 2).create(Acclimatiser.SLOT_DONE); + new ControlSlotArray(this, x, y, 2, 2).create(actions, InventoryType.Machine, Acclimatiser.SLOT_DONE); new ControlEnergyBar(this, 21, 115, 16, 60, Position.BOTTOM); new ControlErrorState(this, 181.0f, 83.0f); - new ControlPlayerInventory(this); + new ControlPlayerInventory(this).create(actions); + + MessageCraftGUI.sendToServer(actions); } @Override diff --git a/src/main/java/binnie/genetics/craftgui/WindowAnalyser.java b/src/main/java/binnie/genetics/craftgui/WindowAnalyser.java index f2738e6b..e47ff420 100644 --- a/src/main/java/binnie/genetics/craftgui/WindowAnalyser.java +++ b/src/main/java/binnie/genetics/craftgui/WindowAnalyser.java @@ -57,7 +57,7 @@ public class WindowAnalyser extends WindowMachine { WindowAnalyser.progress = new StandardTexture(66, 51, 66, 40, GeneticsTexture.GUIProcess.getTexture()); int x = 16; int y = 32; - new ControlSlotArray(this, x, y, 2, 3).create(Analyser.SLOT_RESERVE); + new ControlSlotArray(this, x, y, 2, 3).create(actions, InventoryType.Machine, Analyser.SLOT_RESERVE); x += 28; new ControlSlot(this, x, y + 54 + 8).assign(actions, InventoryType.Machine, 13); new ControlSlotCharge(this, x + 20, y + 54 + 8, 13).setColor(10040319); @@ -71,8 +71,8 @@ public class WindowAnalyser extends WindowMachine { new ControlSlot(this, x + 38 - 9, y + 25 - 9).assign(actions, InventoryType.Machine, Analyser.SLOT_TARGET); new ControlIconDisplay(this, x + 76 + 2, y + 18, GUIIcon.ArrowRight.getIcon()); x += 96; - new ControlSlotArray(this, x, y, 2, 3).create(Analyser.SLOT_FINISHED); - new ControlPlayerInventory(this); + new ControlSlotArray(this, x, y, 2, 3).create(actions, InventoryType.Machine, Analyser.SLOT_FINISHED); + new ControlPlayerInventory(this).create(actions); MessageCraftGUI.sendToServer(actions); } diff --git a/src/main/java/binnie/genetics/craftgui/WindowGeneBank.java b/src/main/java/binnie/genetics/craftgui/WindowGeneBank.java index 69a9c2a1..bcb41443 100644 --- a/src/main/java/binnie/genetics/craftgui/WindowGeneBank.java +++ b/src/main/java/binnie/genetics/craftgui/WindowGeneBank.java @@ -97,7 +97,7 @@ public class WindowGeneBank extends WindowMachine { int boxX; int x = 16; int y = 32; - new ControlPlayerInventory(this, x, y); + new ControlPlayerInventory(this, x, y).createAndRegister(); x += 124; boxX = x; int geneBoxWidth = 200; diff --git a/src/main/java/binnie/genetics/craftgui/WindowGenepool.java b/src/main/java/binnie/genetics/craftgui/WindowGenepool.java index 74e97615..7dd10a66 100644 --- a/src/main/java/binnie/genetics/craftgui/WindowGenepool.java +++ b/src/main/java/binnie/genetics/craftgui/WindowGenepool.java @@ -51,7 +51,7 @@ public class WindowGenepool extends WindowMachine { new ControlLiquidTank(this, x, y).setTankID(Genepool.TANK_ETHANOL); x += 26; - new ControlSlotArray(this, x, y + 3, 2, 3).create(Genepool.SLOT_RESERVE); + new ControlSlotArray(this, x, y + 3, 2, 3).create(actions, InventoryType.Machine, Genepool.SLOT_RESERVE); x += 38; new ControlIconDisplay(this, x, y + 22, GUIIcon.ArrowRight.getIcon()); @@ -68,7 +68,7 @@ public class WindowGenepool extends WindowMachine { new ControlSlot(this, 121.0f, 82.0f).assign(actions, InventoryType.Machine, Genepool.SLOT_ENZYME); new ControlSlotCharge(this, 143, 82, 7).setColor(0xefe8af); new ControlErrorState(this, 181.0f, 83.0f); - new ControlPlayerInventory(this); + new ControlPlayerInventory(this).create(actions); MessageCraftGUI.sendToServer(actions); } diff --git a/src/main/java/binnie/genetics/craftgui/WindowIncubator.java b/src/main/java/binnie/genetics/craftgui/WindowIncubator.java index df775886..40dea50c 100644 --- a/src/main/java/binnie/genetics/craftgui/WindowIncubator.java +++ b/src/main/java/binnie/genetics/craftgui/WindowIncubator.java @@ -2,6 +2,7 @@ package binnie.genetics.craftgui; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; +import net.minecraft.nbt.NBTTagList; import binnie.core.AbstractMod; import binnie.core.craftgui.geometry.Position; @@ -18,6 +19,7 @@ import binnie.core.craftgui.minecraft.control.ControlSlot; import binnie.core.craftgui.minecraft.control.ControlSlotArray; import binnie.core.craftgui.resource.Texture; import binnie.core.craftgui.resource.minecraft.StandardTexture; +import binnie.core.network.packet.MessageCraftGUI; import binnie.core.util.I18N; import binnie.genetics.Genetics; import binnie.genetics.core.GeneticsTexture; @@ -40,11 +42,14 @@ public class WindowIncubator extends WindowMachine { @Override public void initialiseClient() { super.initialiseClient(); + + final NBTTagList actions = new NBTTagList(); + int x = 16; int y = 32; new ControlLiquidTank(this, x, y).setTankID(Incubator.TANK_INPUT); x += 26; - new ControlSlotArray(this, x, y + 3, 1, 3).create(Incubator.SLOT_QUEUE); + new ControlSlotArray(this, x, y + 3, 1, 3).create(actions, InventoryType.Machine, Incubator.SLOT_QUEUE); x += 20; new ControlIconDisplay(this, x, y + 3 + 10, GUIIcon.ArrowRight.getIcon()); x += 18; @@ -55,17 +60,19 @@ public class WindowIncubator extends WindowMachine { WindowIncubator.progressBase, WindowIncubator.progress, Position.LEFT); - new ControlSlot(this, x + 10, y + 3 + 10).assignAndRegister(InventoryType.Machine, Incubator.SLOT_INCUBATOR); + new ControlSlot(this, x + 10, y + 3 + 10).assign(actions, InventoryType.Machine, Incubator.SLOT_INCUBATOR); x += 40; new ControlIconDisplay(this, x, y + 3 + 10, GUIIcon.ArrowRight.getIcon()); x += 18; - new ControlSlotArray(this, x, y + 3, 1, 3).create(Incubator.SLOT_OUTPUT); + new ControlSlotArray(this, x, y + 3, 1, 3).create(actions, InventoryType.Machine, Incubator.SLOT_OUTPUT); x += 26; new ControlLiquidTank(this, x, y).setTankID(Incubator.TANK_OUTPUT); x += 34; new ControlEnergyBar(this, x, y + 3, 16, 54, Position.BOTTOM); new ControlErrorState(this, 91.0f, 82.0f); - new ControlPlayerInventory(this); + new ControlPlayerInventory(this).create(actions); + + MessageCraftGUI.sendToServer(actions); } @Override diff --git a/src/main/java/binnie/genetics/craftgui/WindowInoculator.java b/src/main/java/binnie/genetics/craftgui/WindowInoculator.java index 316e2fc3..3e2bb66b 100644 --- a/src/main/java/binnie/genetics/craftgui/WindowInoculator.java +++ b/src/main/java/binnie/genetics/craftgui/WindowInoculator.java @@ -53,11 +53,13 @@ public class WindowInoculator extends WindowMachine { CraftGUIUtil.horizontalGrid( x, y, - new ControlSlotArray(this, 0, 0, 2, 1).create(Inoculator.SLOT_SERUM_RESERVE), + new ControlSlotArray(this, 0, 0, 2, 1) + .create(actions, InventoryType.Machine, Inoculator.SLOT_SERUM_RESERVE), new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowRight.getIcon()), new ControlSlot(this, 0.0f, 0.0f).assign(actions, InventoryType.Machine, 0), new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowRight.getIcon()), - new ControlSlotArray(this, 0, 0, 2, 1).create(Inoculator.SLOT_SERUM_EXPENDED)); + new ControlSlotArray(this, 0, 0, 2, 1) + .create(actions, InventoryType.Machine, Inoculator.SLOT_SERUM_EXPENDED)); x += 18; new ControlMachineProgress( this, @@ -74,12 +76,13 @@ public class WindowInoculator extends WindowMachine { y, TextJustification.MIDDLE_LEFT, 8.0f, - new ControlSlotArray(this, x, y, 4, 1).create(Inoculator.SLOT_RESERVE), + new ControlSlotArray(this, x, y, 4, 1).create(actions, InventoryType.Machine, Inoculator.SLOT_RESERVE), new ControlSlot(this, x, y + 18 + 8).assign(actions, InventoryType.Machine, 9), - new ControlSlotArray(this, x, y + 18 + 8 + 18 + 8, 4, 1).create(Inoculator.SLOT_FINISHED)); + new ControlSlotArray(this, x, y + 18 + 8 + 18 + 8, 4, 1) + .create(actions, InventoryType.Machine, Inoculator.SLOT_FINISHED)); new ControlIconDisplay(this, x + 18, y + 18 + 2, GUIIcon.ArrowUpLeft.getIcon()); new ControlIconDisplay(this, x + 18, y + 18 + 18, GUIIcon.ArrowLeftDown.getIcon()); - new ControlPlayerInventory(this); + new ControlPlayerInventory(this).create(actions); MessageCraftGUI.sendToServer(actions); } diff --git a/src/main/java/binnie/genetics/craftgui/WindowIsolator.java b/src/main/java/binnie/genetics/craftgui/WindowIsolator.java index 33ba7f21..067a73c6 100644 --- a/src/main/java/binnie/genetics/craftgui/WindowIsolator.java +++ b/src/main/java/binnie/genetics/craftgui/WindowIsolator.java @@ -50,7 +50,7 @@ public class WindowIsolator extends WindowMachine { int y = 32; new ControlLiquidTank(this, x, y).setTankID(Isolator.TANK_ETHANOL); x += 26; - new ControlSlotArray(this, x, y + 3, 1, 3).create(Isolator.SLOT_RESERVE); + new ControlSlotArray(this, x, y + 3, 1, 3).create(actions, InventoryType.Machine, Isolator.SLOT_RESERVE); x += 20; new ControlIconDisplay(this, x, y + 3 + 1, GUIIcon.ArrowRight.getIcon()); x += 18; @@ -66,10 +66,10 @@ public class WindowIsolator extends WindowMachine { x += 20; new ControlIconDisplay(this, x, y + 3 + 1, GUIIcon.ArrowRight.getIcon()); x += 18; - new ControlSlotArray(this, x, y + 3, 2, 3).create(Isolator.SLOT_FINISHED); + new ControlSlotArray(this, x, y + 3, 2, 3).create(actions, InventoryType.Machine, Isolator.SLOT_FINISHED); new ControlEnergyBar(this, 260, 130, 16, 60, Position.BOTTOM); new ControlErrorState(this, 153.0f, 81.0f); - new ControlPlayerInventory(this); + new ControlPlayerInventory(this).create(actions); MessageCraftGUI.sendToServer(actions); } diff --git a/src/main/java/binnie/genetics/craftgui/WindowPolymeriser.java b/src/main/java/binnie/genetics/craftgui/WindowPolymeriser.java index 1e6626c2..50466fff 100644 --- a/src/main/java/binnie/genetics/craftgui/WindowPolymeriser.java +++ b/src/main/java/binnie/genetics/craftgui/WindowPolymeriser.java @@ -53,7 +53,7 @@ public class WindowPolymeriser extends WindowMachine { int x = 16; int y = 38; - new ControlSlotArray(this, x, y, 1, 4).create(Polymeriser.SLOT_SERUM_RESERVE); + new ControlSlotArray(this, x, y, 1, 4).create(actions, InventoryType.Machine, Polymeriser.SLOT_SERUM_RESERVE); new ControlIconDisplay(this, x + 18, y + 1, GUIIcon.ArrowRight.getIcon()); x += 34; new ControlMachineProgress(this, x + 18, y - 6, progressBase, progress, Position.LEFT); @@ -65,9 +65,10 @@ public class WindowPolymeriser extends WindowMachine { new ControlSlot(this, x + 30, y + 18 + 8).assign(actions, InventoryType.Machine, Polymeriser.SLOT_GOLD); new ControlSlotCharge(this, x + 30 + 20, y + 18 + 8, 1).setColor(0xffd800); x += 138; - new ControlSlotArray(this, x, y + 9, 2, 2).create(Polymeriser.SLOT_SERUM_FINISHED); + new ControlSlotArray(this, x, y + 9, 2, 2) + .create(actions, InventoryType.Machine, Polymeriser.SLOT_SERUM_FINISHED); new ControlErrorState(this, 244.0f, 97.0f); - new ControlPlayerInventory(this); + new ControlPlayerInventory(this).create(actions); MessageCraftGUI.sendToServer(actions); } diff --git a/src/main/java/binnie/genetics/craftgui/WindowSequencer.java b/src/main/java/binnie/genetics/craftgui/WindowSequencer.java index ebbb1e13..4d79d4ba 100644 --- a/src/main/java/binnie/genetics/craftgui/WindowSequencer.java +++ b/src/main/java/binnie/genetics/craftgui/WindowSequencer.java @@ -74,7 +74,7 @@ public class WindowSequencer extends WindowMachine { y, TextJustification.MIDDLE_CENTER, 2.0f, - new ControlSlotArray(this, 0, 0, 2, 2).create(Sequencer.SLOT_RESERVE), + new ControlSlotArray(this, 0, 0, 2, 2).create(actions, InventoryType.Machine, Sequencer.SLOT_RESERVE), new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowRight.getIcon()), new ControlSequencerProgress(this, 0, 0), new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowRight.getIcon()), @@ -97,7 +97,7 @@ public class WindowSequencer extends WindowMachine { new ControlEnergyBar(this, x, y, 60, 16, Position.LEFT); x += 92; new ControlErrorState(this, x, y + 1); - new ControlPlayerInventory(this); + new ControlPlayerInventory(this).create(actions); MessageCraftGUI.sendToServer(actions); } diff --git a/src/main/java/binnie/genetics/craftgui/WindowSplicer.java b/src/main/java/binnie/genetics/craftgui/WindowSplicer.java index c209bd7f..41c1897d 100644 --- a/src/main/java/binnie/genetics/craftgui/WindowSplicer.java +++ b/src/main/java/binnie/genetics/craftgui/WindowSplicer.java @@ -56,10 +56,12 @@ public class WindowSplicer extends WindowMachine { CraftGUIUtil.horizontalGrid( x, 62.0f, - new ControlSlotArray(this, 0, 0, 2, 1).create(Splicer.SLOT_SERUM_RESERVE), + new ControlSlotArray(this, 0, 0, 2, 1) + .create(actions, InventoryType.Machine, Splicer.SLOT_SERUM_RESERVE), new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowRight.getIcon()), new ControlSlot(this, 0.0f, 0.0f).assign(actions, InventoryType.Machine, Splicer.SLOT_SERUM_VIAL)); - new ControlSlotArray(this, x + 12, 84, 2, 1).create(Splicer.SLOT_SERUM_EXPENDED); + new ControlSlotArray(this, x + 12, 84, 2, 1) + .create(actions, InventoryType.Machine, Splicer.SLOT_SERUM_EXPENDED); new ControlIconDisplay(this, x + 12 + 36 + 4, 86.0f, GUIIcon.ArrowUpLeft.getIcon()); new ControlEnergyBar(this, 196, 64, 60, 16, Position.LEFT); new ControlErrorState(this, 218.0f, 86.0f); @@ -68,12 +70,13 @@ public class WindowSplicer extends WindowMachine { 32.0f, TextJustification.MIDDLE_CENTER, 4.0f, - new ControlSlotArray(this, 0, 0, 4, 1).create(Inoculator.SLOT_RESERVE), + new ControlSlotArray(this, 0, 0, 4, 1).create(actions, InventoryType.Machine, Inoculator.SLOT_RESERVE), new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowDown.getIcon()), new ControlSlot(this, 0.0f, 0.0f).assign(actions, InventoryType.Machine, Splicer.SLOT_TARGET), new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowDown.getIcon()), - new ControlSlotArray(this, 0, 0, 4, 1).create(Inoculator.SLOT_FINISHED)); - new ControlPlayerInventory(this); + new ControlSlotArray(this, 0, 0, 4, 1) + .create(actions, InventoryType.Machine, Inoculator.SLOT_FINISHED)); + new ControlPlayerInventory(this).create(actions); MessageCraftGUI.sendToServer(actions); } diff --git a/src/main/java/binnie/genetics/gui/WindowAnalyst.java b/src/main/java/binnie/genetics/gui/WindowAnalyst.java index 613298cb..31ea6138 100644 --- a/src/main/java/binnie/genetics/gui/WindowAnalyst.java +++ b/src/main/java/binnie/genetics/gui/WindowAnalyst.java @@ -279,7 +279,7 @@ public class WindowAnalyst extends Window { 244.0f, 80.0f, Position.BOTTOM); - new ControlPlayerInventory(slideUpInv, true); + new ControlPlayerInventory(slideUpInv, true).createAndRegister(); slideUpInv.setSlide(false); } addEventHandler(new EventKey.Down.Handler() { @@ -301,7 +301,7 @@ public class WindowAnalyst extends Window { @Override public void initialise() { new ControlTextCentered(this, 20.0f, I18N.localise("genetics.gui.analyst.info")).setColor(0x444444); - new ControlPlayerInventory(this); + new ControlPlayerInventory(this).createAndRegister(); } }; }