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;
@@ -17,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;
@@ -45,6 +48,9 @@ public class WindowSplicer extends WindowMachine {
@Override
public void initialiseClient() {
super.initialiseClient();
final NBTTagList actions = new NBTTagList();
int x = 16;
new ControlSplicerProgress(this, 84.0f, 32.0f, w() - 172.0f, 102.0f);
CraftGUIUtil.horizontalGrid(
@@ -52,7 +58,7 @@ public class WindowSplicer extends WindowMachine {
62.0f,
new ControlSlotArray(this, 0, 0, 2, 1).create(Splicer.SLOT_SERUM_RESERVE),
new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowRight.getIcon()),
new ControlSlot(this, 0.0f, 0.0f).assign(Splicer.SLOT_SERUM_VIAL));
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 ControlIconDisplay(this, x + 12 + 36 + 4, 86.0f, GUIIcon.ArrowUpLeft.getIcon());
new ControlEnergyBar(this, 196, 64, 60, 16, Position.LEFT);
@@ -64,10 +70,12 @@ public class WindowSplicer extends WindowMachine {
4.0f,
new ControlSlotArray(this, 0, 0, 4, 1).create(Inoculator.SLOT_RESERVE),
new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowDown.getIcon()),
new ControlSlot(this, 0.0f, 0.0f).assign(Splicer.SLOT_TARGET),
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);
MessageCraftGUI.sendToServer(actions);
}
@Override