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,9 +2,11 @@ package binnie.extratrees.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;
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;
@@ -12,6 +14,7 @@ import binnie.core.craftgui.minecraft.control.ControlLiquidTank;
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
import binnie.core.craftgui.minecraft.control.ControlSlot;
import binnie.core.machines.Machine;
import binnie.core.network.packet.MessageCraftGUI;
import binnie.extratrees.ExtraTrees;
import binnie.extratrees.machines.lumbermill.Lumbermill;
import cpw.mods.fml.relauncher.Side;
@@ -38,15 +41,19 @@ public class WindowLumbermill extends Window {
@Override
public void initialiseClient() {
final NBTTagList actions = new NBTTagList();
setTitle(Machine.getMachine(getInventory()).getPackage().getDisplayName());
new ControlSlot(this, 42.0f, 43.0f).assign(Lumbermill.SLOT_WOOD);
new ControlSlot(this, 148.0f, 43.0f).assign(Lumbermill.SLOT_PLANKS);
new ControlSlot(this, 172.0f, 28.0f).assign(Lumbermill.SLOT_BARK);
new ControlSlot(this, 172.0f, 58.0f).assign(Lumbermill.SLOT_SAWDUST);
new ControlSlot(this, 42.0f, 43.0f).assign(actions, InventoryType.Machine, Lumbermill.SLOT_WOOD);
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 ControlErrorState(this, 95.0f, 73.0f);
MessageCraftGUI.sendToServer(actions);
}
}
@@ -2,6 +2,7 @@ package binnie.extratrees.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.controls.ControlText;
@@ -12,6 +13,7 @@ import binnie.core.craftgui.events.EventTextEdit;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.geometry.TextJustification;
import binnie.core.craftgui.minecraft.InventoryType;
import binnie.core.craftgui.minecraft.MinecraftGUI;
import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.minecraft.control.ControlErrorState;
@@ -19,6 +21,7 @@ import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
import binnie.core.craftgui.minecraft.control.ControlSlot;
import binnie.core.craftgui.window.Panel;
import binnie.core.machines.Machine;
import binnie.core.network.packet.MessageCraftGUI;
import binnie.core.util.I18N;
import binnie.extratrees.ExtraTrees;
import binnie.extratrees.machines.designer.Designer;
@@ -62,13 +65,17 @@ public class WindowWoodworker extends Window {
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(Designer.DESIGN_1_SLOT);
slotWood1.assign(actions, InventoryType.Machine, Designer.DESIGN_1_SLOT);
ControlSlot slotWood2 = new ControlSlot(this, 62.0f, 34.0f);
slotWood2.assign(Designer.DESIGN_2_SLOT);
slotWood2.assign(actions, InventoryType.Machine, Designer.DESIGN_2_SLOT);
ControlSlot slotBeeswax = new ControlSlot(this, 42.0f, 64.0f);
slotBeeswax.assign(Designer.GLUE_SLOT);
slotBeeswax.assign(actions, InventoryType.Machine, Designer.GLUE_SLOT);
new ControlRecipeSlot(this, 112, 34);
MessageCraftGUI.sendToServer(actions);
}
}