Batch Actions and Defer Registration of Slots (#72)

This commit is contained in:
Julia authored and GitHub committed 2025-09-24 23:25:39 +02:00
1 parent 2e36fbcfcc
commit a2a57d1656
22 files changed
+286 -119

No files matched your search

@@ -2,12 +2,14 @@ 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.CraftGUIUtil;
import binnie.core.craftgui.geometry.Position;
import binnie.core.craftgui.geometry.TextJustification;
import binnie.core.craftgui.minecraft.GUIIcon;
import binnie.core.craftgui.minecraft.InventoryType;
import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.minecraft.control.ControlEnergyBar;
import binnie.core.craftgui.minecraft.control.ControlErrorState;
@@ -19,6 +21,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;
@@ -41,6 +44,9 @@ public class WindowInoculator extends WindowMachine {
@Override
public void initialiseClient() {
super.initialiseClient();
final NBTTagList actions = new NBTTagList();
int x = 16;
int y = 32;
new ControlLiquidTank(this, x, y + 18 + 16).setTankID(0);
@@ -49,7 +55,7 @@ public class WindowInoculator extends WindowMachine {
y,
new ControlSlotArray(this, 0, 0, 2, 1).create(Inoculator.SLOT_SERUM_RESERVE),
new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowRight.getIcon()),
new ControlSlot(this, 0.0f, 0.0f).assign(0),
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));
x += 18;
@@ -69,11 +75,13 @@ public class WindowInoculator extends WindowMachine {
TextJustification.MIDDLE_LEFT,
8.0f,
new ControlSlotArray(this, x, y, 4, 1).create(Inoculator.SLOT_RESERVE),
new ControlSlot(this, x, y + 18 + 8).assign(9),
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 ControlIconDisplay(this, x + 18, y + 18 + 2, GUIIcon.ArrowUpLeft.getIcon());
new ControlIconDisplay(this, x + 18, y + 18 + 18, GUIIcon.ArrowLeftDown.getIcon());
new ControlPlayerInventory(this);
MessageCraftGUI.sendToServer(actions);
}
@Override