Compare commits

...
7 Commits
28 changed files with 427 additions and 192 deletions

No files matched your search

+2 -2
View File
@@ -2,9 +2,9 @@
dependencies { dependencies {
api('com.github.GTNewHorizons:ForestryMC:4.10.17:dev') api('com.github.GTNewHorizons:ForestryMC:4.10.17:dev')
implementation('com.github.GTNewHorizons:GTNHLib:0.6.39:dev') implementation('com.github.GTNewHorizons:GTNHLib:0.7.0:dev')
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.7.90-GTNH:dev') devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.0-GTNH:dev')
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.44:api') compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.44:api')
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev') compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
@@ -76,12 +76,14 @@ public class TileEntityMetadata extends TileEntity {
} }
public static ItemStack getItemStack(Block block, int damage) { public static ItemStack getItemStack(Block block, int damage) {
NBTTagCompound tag = new NBTTagCompound();
tag.setInteger("meta", damage);
ItemStack item = new ItemStack(block, 1, 0); ItemStack item = new ItemStack(block, 1, 0);
item.setItemDamage(Math.min(damage, 16387)); if (0 <= damage && damage < Short.MAX_VALUE) {
item.setTagCompound(tag); item.setItemDamage(damage);
} else {
NBTTagCompound tag = new NBTTagCompound();
tag.setInteger("meta", damage);
item.setTagCompound(tag);
}
return item; return item;
} }
@@ -12,6 +12,7 @@ import net.minecraft.init.Items;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import binnie.Binnie; import binnie.Binnie;
import binnie.core.AbstractMod; import binnie.core.AbstractMod;
@@ -33,6 +34,7 @@ import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
import binnie.core.craftgui.resource.minecraft.PaddedTexture; import binnie.core.craftgui.resource.minecraft.PaddedTexture;
import binnie.core.craftgui.resource.minecraft.StandardTexture; import binnie.core.craftgui.resource.minecraft.StandardTexture;
import binnie.core.machines.inventory.SlotValidator; import binnie.core.machines.inventory.SlotValidator;
import binnie.core.network.packet.MessageCraftGUI;
import binnie.core.util.I18N; import binnie.core.util.I18N;
import binnie.extrabees.core.ExtraBeeTexture; import binnie.extrabees.core.ExtraBeeTexture;
import binnie.extrabees.gui.ExtraBeeGUITexture; import binnie.extrabees.gui.ExtraBeeGUITexture;
@@ -113,20 +115,26 @@ public class WindowFieldKit extends Window {
@Override @Override
public void initialiseClient() { public void initialiseClient() {
final NBTTagList actions = new NBTTagList();
setTitle(getName()); setTitle(getName());
CraftGUI.render.stylesheet(new StyleSheetPunnett()); CraftGUI.render.stylesheet(new StyleSheetPunnett());
getWindowInventory().createSlot(0); getWindowInventory().createSlot(0);
getWindowInventory().createSlot(1); getWindowInventory().createSlot(1);
setupValidators(); setupValidators();
new ControlPlayerInventory(this); new ControlPlayerInventory(this).create(actions);
IPoint handGlass = new IPoint(16.0f, 32.0f); IPoint handGlass = new IPoint(16.0f, 32.0f);
GlassControl = new ControlImage( GlassControl = new ControlImage(
this, this,
handGlass.x(), handGlass.x(),
handGlass.y(), handGlass.y(),
new StandardTexture(0, 160, 96, 96, ExtraBeeTexture.GUIPunnett)); new StandardTexture(0, 160, 96, 96, ExtraBeeTexture.GUIPunnett));
new ControlSlot(this, handGlass.x() + 54.0f, handGlass.y() + 26.0f).assign(InventoryType.Window, 0);
new ControlSlot(this, 208.0f, 8.0f).assign(InventoryType.Window, 1); 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);
MessageCraftGUI.sendToServer(actions);
(text = new ControlText(this, new IPoint(232.0f, 13.0f), I18N.localise("binniecore.gui.tooltip.paper"))) (text = new ControlText(this, new IPoint(232.0f, 13.0f), I18N.localise("binniecore.gui.tooltip.paper")))
.setColor(0x222222); .setColor(0x222222);
(text = new ControlText(this, new IArea(0.0f, 120.0f, w(), 24.0f), "", TextJustification.MIDDLE_CENTER)) (text = new ControlText(this, new IArea(0.0f, 120.0f, w(), 24.0f), "", TextJustification.MIDDLE_CENTER))
@@ -63,7 +63,7 @@ public class WindowGenesis extends Window {
@Override @Override
public void initialiseClient() { public void initialiseClient() {
new ControlPlayerInventory(this); new ControlPlayerInventory(this).createAndRegister();
setTitle(getName()); setTitle(getName());
ControlTabBar<BreedingSystem> tabSystems = new BreedingSystemControlTabBar(); ControlTabBar<BreedingSystem> tabSystems = new BreedingSystemControlTabBar();
@@ -1,5 +1,7 @@
package binnie.core.craftgui.minecraft; package binnie.core.craftgui.minecraft;
import static net.minecraftforge.common.util.Constants.NBT.TAG_COMPOUND;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -14,6 +16,7 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
@@ -37,6 +40,42 @@ import cpw.mods.fml.relauncher.Side;
public class ContainerCraftGUI extends Container { public class ContainerCraftGUI extends Container {
// Action type is one of the action constants below
public final static String ACTION_TYPE = "type";
// Action constants
public final static String ACTION_BATCH = "batch";
public final static String SLOT_REG = "slot-reg";
public final static String TANK_CLICK = "tank-click";
public final static String TANK_UPDATE = "tank-update-";
public final static String POWER_UPDATE = "power-update";
public final static String PROCESS_UPDATE = "process-update";
public final static String ERROR_UPDATE = "error-update";
public final static String MOUSE_OVER_SLOT = "mouse-over-slot";
public final static String SHIFT_CLICK_INFO = "shift-click-info";
// Error type is one of the error constants below
public final static String ERROR_TYPE = "type";
// Error constants
public static final byte CANNOT_WORK = (byte) 0;
public static final byte CANNOT_PROGRESS = (byte) 1;
// Slot constants
public static final String SLOT_TYPE = "t";
public static final String SLOT_INDEX = "i";
public static final String SLOT_NUMBER = "n";
// Uncategorized constants
public static final String ACTIONS = "actions";
private static final String USERNAME = "username";
private static final String SLOT_ID = "id";
private static final String SLOT = "slot";
private static final String SLOTS = "slots";
private static final String TANK = "tank";
private static final String ORIGIN = "origin";
private static final String NAME = "name";
private final Window window; private final Window window;
private final Map<String, NBTTagCompound> syncedNBT = new HashMap<>(); private final Map<String, NBTTagCompound> syncedNBT = new HashMap<>();
private final Map<String, NBTTagCompound> sentNBT = new HashMap<>(); private final Map<String, NBTTagCompound> sentNBT = new HashMap<>();
@@ -64,8 +103,8 @@ public class ContainerCraftGUI extends Container {
if (user == null) return; if (user == null) return;
NBTTagCompound nbt = new NBTTagCompound(); NBTTagCompound nbt = new NBTTagCompound();
nbt.setString("username", user.getName()); nbt.setString(USERNAME, user.getName());
sendNBTToClient("username", nbt); sendNBTToClient(USERNAME, nbt);
} }
@Override @Override
@@ -84,17 +123,15 @@ public class ContainerCraftGUI extends Container {
@Override @Override
public void putStackInSlot(int index, ItemStack stack) { public void putStackInSlot(int index, ItemStack stack) {
if (getSlot(index) != null) { final Slot slot = getSlot(index);
getSlot(index).putStack(stack); if (slot != null) slot.putStack(stack);
}
} }
@Override @Override
public void putStacksInSlots(ItemStack[] par1ArrayOfItemStack) { public void putStacksInSlots(ItemStack[] par1ArrayOfItemStack) {
for (int i = 0; i < par1ArrayOfItemStack.length; ++i) { for (int i = 0; i < par1ArrayOfItemStack.length; ++i) {
if (getSlot(i) != null) { final Slot slot = getSlot(i);
getSlot(i).putStack(par1ArrayOfItemStack[i]); if (slot != null) slot.putStack(par1ArrayOfItemStack[i]);
}
} }
} }
@@ -145,20 +182,17 @@ public class ContainerCraftGUI extends Container {
@Override @Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { public ItemStack transferStackInSlot(EntityPlayer player, int slotID) {
return shiftClick(player, slotID); shiftClick(player, slotID);
return null;
} }
private ItemStack shiftClick(EntityPlayer player, int index) { private void shiftClick(EntityPlayer player, int index) {
TransferRequest request = getShiftClickRequest(player, index); TransferRequest request = getShiftClickRequest(player, index);
if (request == null) { if (request == null) return;
return null;
}
ItemStack stack = request.transfer(true); ItemStack stack = request.transfer(true);
Slot shiftClickedSlot = inventorySlots.get(index); Slot shiftClickedSlot = inventorySlots.get(index);
shiftClickedSlot.putStack(stack); shiftClickedSlot.putStack(stack);
shiftClickedSlot.onSlotChanged(); shiftClickedSlot.onSlotChanged();
return null;
} }
private TransferRequest getShiftClickRequest(EntityPlayer player, int index) { private TransferRequest getShiftClickRequest(EntityPlayer player, int index) {
@@ -211,15 +245,18 @@ public class ContainerCraftGUI extends Container {
return heldItem; return heldItem;
} }
public void handleNBT(Side side, EntityPlayer player, String name, NBTTagCompound action) { public void handleNBT(Side side, EntityPlayer player, NBTTagCompound action) {
final String actionType = action.getString(ACTION_TYPE);
if (side == Side.SERVER) { if (side == Side.SERVER) {
switch (name) { switch (actionType) {
case "tank-click" -> tankClick(player, action.getByte("id")); case TANK_CLICK -> tankClick(player, action.getByte(SLOT_ID));
case "slot-reg" -> { case SLOT_REG -> {
int type = action.getByte("t"); final int slotType = action.getByte(SLOT_TYPE);
int index = action.getShort("i"); final int slotIndex = action.getShort(SLOT_INDEX);
int slotNumber = action.getShort("n"); final int slotNumber = action.getShort(SLOT_NUMBER);
createSlot(InventoryType.values()[type % 4], index, slotNumber);
createSlot(InventoryType.values()[slotType % 4], slotIndex, slotNumber);
for (ICrafting crafterObject : crafters) { for (ICrafting crafterObject : crafters) {
crafterObject.sendContainerAndContentsToPlayer(this, getInventory()); crafterObject.sendContainerAndContentsToPlayer(this, getInventory());
@@ -228,14 +265,14 @@ public class ContainerCraftGUI extends Container {
} }
} }
switch (name) { switch (actionType) {
case "power-update" -> onPowerUpdate(action); case POWER_UPDATE -> onPowerUpdate(action);
case "process-update" -> onProcessUpdate(action); case PROCESS_UPDATE -> onProcessUpdate(action);
case "error-update" -> onErrorUpdate(action); case ERROR_UPDATE -> onErrorUpdate(action);
case "mouse-over-slot" -> onMouseOverSlot(player, action); case MOUSE_OVER_SLOT -> onMouseOverSlot(player, action);
case "shift-click-info" -> onReceiveShiftClickHighlights(player, action); case SHIFT_CLICK_INFO -> onReceiveShiftClickHighlights(action);
default -> { default -> {
if (name.contains("tank-update")) onTankUpdate(action); if (actionType.contains(TANK_UPDATE)) onTankUpdate(action);
} }
} }
} }
@@ -255,15 +292,15 @@ public class ContainerCraftGUI extends Container {
for (int i = 0; i < tankInfos.length; ++i) { for (int i = 0; i < tankInfos.length; ++i) {
final TankInfo tank = tankInfos[i]; final TankInfo tank = tankInfos[i];
if (this.getTankInfo(i).equals(tank)) continue; if (this.getTankInfo(i).equals(tank)) continue;
syncedNBT.put("tank-update-" + i, createTankNBT(i, tank)); syncedNBT.put(TANK_UPDATE + i, createTankNBT(i, tank));
syncedTanks.put(i, tank); syncedTanks.put(i, tank);
} }
} }
if (window.isServer()) { if (window.isServer()) {
if (powered != null) syncedNBT.put("power-update", createPowerNBT(powered.getPowerInfo())); if (powered != null) syncedNBT.put(POWER_UPDATE, createPowerNBT(powered.getPowerInfo()));
if (process != null) syncedNBT.put("process-update", createProcessNBT(process.getInfo())); if (process != null) syncedNBT.put(PROCESS_UPDATE, createProcessNBT(process.getInfo()));
if (error != null) syncedNBT.put("error-update", createErrorNBT(error)); if (error != null) syncedNBT.put(ERROR_UPDATE, createErrorNBT(error));
} }
INetwork.SendGuiNBT machineSync = Machine.getInterface(INetwork.SendGuiNBT.class, entityInventory); INetwork.SendGuiNBT machineSync = Machine.getInterface(INetwork.SendGuiNBT.class, entityInventory);
@@ -271,23 +308,30 @@ public class ContainerCraftGUI extends Container {
if (machineSync != null) machineSync.sendGuiNBT(syncedNBT); if (machineSync != null) machineSync.sendGuiNBT(syncedNBT);
Map<String, NBTTagCompound> sentThisTime = new HashMap<>(); Map<String, NBTTagCompound> sentThisTime = new HashMap<>();
for (Map.Entry<String, NBTTagCompound> nbt : syncedNBT.entrySet()) { NBTTagList actions = new NBTTagList();
final NBTTagCompound nbtValue = nbt.getValue();
final String nbtKey = nbt.getKey();
final NBTTagCompound nbtValuePrev = sentNBT.get(nbtKey);
nbtValue.setString("type", nbtKey); for (Map.Entry<String, NBTTagCompound> entry : syncedNBT.entrySet()) {
final String actionType = entry.getKey();
final NBTTagCompound action = entry.getValue();
final NBTTagCompound actionPrev = sentNBT.get(actionType);
if (nbtValue.equals(nbtValuePrev)) continue; action.setString(ACTION_TYPE, actionType);
for (ICrafting crafter : crafters) { if (action.equals(actionPrev)) continue;
if (crafter instanceof EntityPlayerMP playerMP) {
final MessageContainerUpdate packet = new MessageContainerUpdate(nbtValue); actions.appendTag(action);
BinnieCore.proxy.sendToPlayer(packet, playerMP); sentThisTime.put(actionType, action);
} }
NBTTagCompound actionsBatch = new NBTTagCompound();
actionsBatch.setString(ACTION_TYPE, ACTION_BATCH);
actionsBatch.setTag(ACTIONS, actions);
for (ICrafting crafter : crafters) {
if (crafter instanceof EntityPlayerMP playerMP) {
final MessageContainerUpdate packet = new MessageContainerUpdate(actionsBatch);
BinnieCore.proxy.sendToPlayer(packet, playerMP);
} }
sentThisTime.put(nbtKey, nbtValue);
} }
sentNBT.putAll(sentThisTime); sentNBT.putAll(sentThisTime);
@@ -298,10 +342,10 @@ public class ContainerCraftGUI extends Container {
NBTTagCompound nbt = new NBTTagCompound(); NBTTagCompound nbt = new NBTTagCompound();
ErrorState state = null; ErrorState state = null;
if (error.canWork() != null) { if (error.canWork() != null) {
nbt.setByte("type", (byte) 0); nbt.setByte(ERROR_TYPE, CANNOT_WORK);
state = error.canWork(); state = error.canWork();
} else if (error.canProgress() != null) { } else if (error.canProgress() != null) {
nbt.setByte("type", (byte) 1); nbt.setByte(ERROR_TYPE, CANNOT_PROGRESS);
state = error.canProgress(); state = error.canProgress();
} }
@@ -326,12 +370,12 @@ public class ContainerCraftGUI extends Container {
public NBTTagCompound createTankNBT(int tank, TankInfo tankInfo) { public NBTTagCompound createTankNBT(int tank, TankInfo tankInfo) {
NBTTagCompound nbt = new NBTTagCompound(); NBTTagCompound nbt = new NBTTagCompound();
tankInfo.writeToNBT(nbt); tankInfo.writeToNBT(nbt);
nbt.setByte("tank", (byte) tank); nbt.setByte(TANK, (byte) tank);
return nbt; return nbt;
} }
public void onTankUpdate(NBTTagCompound nbt) { public void onTankUpdate(NBTTagCompound nbt) {
int tankID = nbt.getByte("tank"); int tankID = nbt.getByte(TANK);
TankInfo tank = new TankInfo(); TankInfo tank = new TankInfo();
tank.readFromNBT(nbt); tank.readFromNBT(nbt);
syncedTanks.put(tankID, tank); syncedTanks.put(tankID, tank);
@@ -360,8 +404,8 @@ public class ContainerCraftGUI extends Container {
} }
public void onErrorUpdate(NBTTagCompound nbt) { public void onErrorUpdate(NBTTagCompound nbt) {
errorType = nbt.getByte("type"); errorType = nbt.getByte(ERROR_TYPE);
if (nbt.hasKey("name")) { if (nbt.hasKey(NAME)) {
error = new ErrorState("", ""); error = new ErrorState("", "");
error.readFromNBT(nbt); error.readFromNBT(nbt);
} else { } else {
@@ -393,13 +437,13 @@ public class ContainerCraftGUI extends Container {
mousedOverSlotNumber = slot.slotNumber; mousedOverSlotNumber = slot.slotNumber;
ControlSlot.highlighting.get(EnumHighlighting.SHIFT_CLICK).clear(); ControlSlot.highlighting.get(EnumHighlighting.SHIFT_CLICK).clear();
NBTTagCompound nbt = new NBTTagCompound(); NBTTagCompound nbt = new NBTTagCompound();
nbt.setShort("slot", (short) slot.slotNumber); nbt.setShort(SLOT, (short) slot.slotNumber);
window.sendClientAction("mouse-over-slot", nbt); window.sendClientAction(MOUSE_OVER_SLOT, nbt);
} }
private void onMouseOverSlot(EntityPlayer player, NBTTagCompound data) { private void onMouseOverSlot(EntityPlayer player, NBTTagCompound data) {
int slotnumber = data.getShort("slot"); int slotNumber = data.getShort(SLOT);
TransferRequest request = getShiftClickRequest(player, slotnumber); TransferRequest request = getShiftClickRequest(player, slotNumber);
if (request == null) { if (request == null) {
return; return;
} }
@@ -407,8 +451,8 @@ public class ContainerCraftGUI extends Container {
request.transfer(false); request.transfer(false);
NBTTagCompound nbt = new NBTTagCompound(); NBTTagCompound nbt = new NBTTagCompound();
List<Integer> slots = new ArrayList<>(); List<Integer> slots = new ArrayList<>();
for (TransferRequest.TransferSlot tslot : request.getInsertedSlots()) { for (TransferRequest.TransferSlot transferSlot : request.getInsertedSlots()) {
Slot slot = getSlot(tslot.inventory, tslot.id); Slot slot = getSlot(transferSlot.inventory, transferSlot.id);
if (slot != null) { if (slot != null) {
slots.add(slot.slotNumber); slots.add(slot.slotNumber);
} }
@@ -419,14 +463,14 @@ public class ContainerCraftGUI extends Container {
array[i] = slots.get(i); array[i] = slots.get(i);
} }
nbt.setIntArray("slots", array); nbt.setIntArray(SLOTS, array);
nbt.setShort("origin", (short) slotnumber); nbt.setShort(ORIGIN, (short) slotNumber);
syncedNBT.put("shift-click-info", nbt); syncedNBT.put(SHIFT_CLICK_INFO, nbt);
} }
private void onReceiveShiftClickHighlights(EntityPlayer player, NBTTagCompound data) { private void onReceiveShiftClickHighlights(NBTTagCompound data) {
ControlSlot.highlighting.get(EnumHighlighting.SHIFT_CLICK).clear(); ControlSlot.highlighting.get(EnumHighlighting.SHIFT_CLICK).clear();
for (int slotIndex : data.getIntArray("slots")) { for (int slotIndex : data.getIntArray(SLOTS)) {
ControlSlot.highlighting.get(EnumHighlighting.SHIFT_CLICK).add(slotIndex); ControlSlot.highlighting.get(EnumHighlighting.SHIFT_CLICK).add(slotIndex);
} }
} }
@@ -442,27 +486,30 @@ public class ContainerCraftGUI extends Container {
} }
public void receiveNBT(Side side, EntityPlayer player, NBTTagCompound action) { public void receiveNBT(Side side, EntityPlayer player, NBTTagCompound action) {
String name = action.getString("type"); String actionType = action.getString(ACTION_TYPE);
handleNBT(side, player, name, action); if (actionType.equals(ACTION_BATCH)) {
window.receiveGuiNBT(getSide(), player, name, action); NBTTagList actionsBatch = action.getTagList(ACTIONS, TAG_COMPOUND);
for (int i = 0; i < actionsBatch.tagCount(); i++) {
receiveNBT(side, player, actionsBatch.getCompoundTagAt(i));
}
return;
}
handleNBT(side, player, action);
window.receiveGuiNBT(getSide(), player, actionType, action);
INetwork.ReceiveGuiNBT machine = Machine.getInterface(INetwork.ReceiveGuiNBT.class, window.getInventory()); INetwork.ReceiveGuiNBT machine = Machine.getInterface(INetwork.ReceiveGuiNBT.class, window.getInventory());
if (machine == null) return; if (machine == null) return;
machine.receiveGuiNBT(getSide(), player, name, action); machine.receiveGuiNBT(getSide(), player, actionType, action);
} }
public Slot getOrCreateSlot(InventoryType type, int index) { public Slot getOrCreateSlot(InventoryType inventoryType, int slotIndex) {
IInventory inventory = getInventory(type); final IInventory inventory = getInventory(inventoryType);
Slot slot = getSlot(inventory, index); Slot slot = getSlot(inventory, slotIndex);
if (slot == null) { if (slot == null) {
slot = new CustomSlot(inventory, index); slot = new CustomSlot(inventory, slotIndex);
addSlotToContainer(slot); addSlotToContainer(slot);
} }
NBTTagCompound nbt = new NBTTagCompound();
nbt.setByte("t", (byte) type.ordinal());
nbt.setShort("i", (short) index);
nbt.setShort("n", (short) slot.slotNumber);
window.sendClientAction("slot-reg", nbt);
return slot; return slot;
} }
@@ -3,9 +3,12 @@ package binnie.core.craftgui.minecraft.control;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.minecraft.nbt.NBTTagList;
import binnie.core.craftgui.IWidget; import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.controls.core.Control; import binnie.core.craftgui.controls.core.Control;
import binnie.core.craftgui.minecraft.InventoryType; import binnie.core.craftgui.minecraft.InventoryType;
import binnie.core.network.packet.MessageCraftGUI;
public class ControlPlayerInventory extends Control { public class ControlPlayerInventory extends Control {
@@ -37,7 +40,6 @@ public class ControlPlayerInventory extends Control {
slots.add(slot2); slots.add(slot2);
} }
} }
create();
} }
public ControlPlayerInventory(IWidget parent) { public ControlPlayerInventory(IWidget parent) {
@@ -53,28 +55,28 @@ public class ControlPlayerInventory extends Control {
slots.add(slot); slots.add(slot);
} }
} }
create();
} }
public void create() { public ControlPlayerInventory create(NBTTagList actions) {
for (int row = 0; row < 3; ++row) { for (int row = 0; row < 3; ++row) {
for (int column = 0; column < 9; ++column) { for (int column = 0; column < 9; ++column) {
ControlSlot slot = slots.get(column + row * 9); ControlSlot slot = slots.get(column + row * 9);
slot.assign(InventoryType.Player, 9 + column + row * 9); slot.assign(actions, InventoryType.Player, 9 + column + row * 9);
} }
} }
for (int i1 = 0; i1 < 9; ++i1) { for (int i1 = 0; i1 < 9; ++i1) {
ControlSlot slot2 = slots.get(27 + i1); ControlSlot slot2 = slots.get(27 + i1);
slot2.assign(InventoryType.Player, i1); slot2.assign(actions, InventoryType.Player, i1);
} }
return this;
} }
public ControlSlot getSlot(int i) { public ControlPlayerInventory createAndRegister() {
if (i < 0 || i >= slots.size()) { final NBTTagList actions = new NBTTagList();
return null; create(actions);
} MessageCraftGUI.sendToServer(actions);
return slots.get(i); return this;
} }
} }
@@ -1,5 +1,11 @@
package binnie.core.craftgui.minecraft.control; package binnie.core.craftgui.minecraft.control;
import static binnie.core.craftgui.minecraft.ContainerCraftGUI.ACTION_TYPE;
import static binnie.core.craftgui.minecraft.ContainerCraftGUI.SLOT_INDEX;
import static binnie.core.craftgui.minecraft.ContainerCraftGUI.SLOT_NUMBER;
import static binnie.core.craftgui.minecraft.ContainerCraftGUI.SLOT_REG;
import static binnie.core.craftgui.minecraft.ContainerCraftGUI.SLOT_TYPE;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -10,6 +16,8 @@ import net.minecraft.client.multiplayer.PlayerControllerMP;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import binnie.core.craftgui.CraftGUI; import binnie.core.craftgui.CraftGUI;
@@ -26,6 +34,7 @@ import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
import binnie.core.machines.inventory.InventorySlot; import binnie.core.machines.inventory.InventorySlot;
import binnie.core.machines.inventory.MachineSide; import binnie.core.machines.inventory.MachineSide;
import binnie.core.machines.inventory.SlotValidator; import binnie.core.machines.inventory.SlotValidator;
import binnie.core.network.packet.MessageCraftGUI;
import binnie.core.util.I18N; import binnie.core.util.I18N;
public class ControlSlot extends ControlSlotBase { public class ControlSlot extends ControlSlotBase {
@@ -179,14 +188,28 @@ public class ControlSlot extends ControlSlotBase {
return null; return null;
} }
public ControlSlot assign(int index) { /// Assign a slot and register it immediately. Should be used when no other actions need to be sent.
return assign(InventoryType.Machine, index); @SuppressWarnings("UnusedReturnValue")
public ControlSlot assignAndRegister(InventoryType inventoryType, int slotIndex) {
final NBTTagList actions = new NBTTagList();
assign(actions, inventoryType, slotIndex);
MessageCraftGUI.sendToServer(actions);
return this;
} }
public ControlSlot assign(InventoryType inventory, int index) { /// Assign a slot and defer registration using an `NBTTagList`.
if (slot == null) { /// Use in combination with {@link MessageCraftGUI#sendToServer(NBTTagList)}.
slot = ((Window) getSuperParent()).getContainer().getOrCreateSlot(inventory, index); public ControlSlot assign(NBTTagList actions, InventoryType inventoryType, int slotIndex) {
} if (slot == null) slot = ((Window) getSuperParent()).getContainer().getOrCreateSlot(inventoryType, slotIndex);
NBTTagCompound slotReg = new NBTTagCompound();
slotReg.setString(ACTION_TYPE, SLOT_REG);
slotReg.setByte(SLOT_TYPE, (byte) inventoryType.ordinal());
slotReg.setShort(SLOT_INDEX, (short) slotIndex);
slotReg.setShort(SLOT_NUMBER, (short) slot.slotNumber);
actions.appendTag(slotReg);
return this; return this;
} }
@@ -4,6 +4,8 @@ import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import net.minecraft.nbt.NBTTagList;
import binnie.core.craftgui.IWidget; import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.controls.core.Control; import binnie.core.craftgui.controls.core.Control;
import binnie.core.craftgui.minecraft.InventoryType; import binnie.core.craftgui.minecraft.InventoryType;
@@ -26,15 +28,14 @@ public class ControlSlotArray extends Control implements Iterable<ControlSlot> {
return new ControlSlot(this, x, y); return new ControlSlot(this, x, y);
} }
public ControlSlotArray create(int[] index) { public ControlSlotArray create(NBTTagList actions, InventoryType inventoryType, int[] index) {
return create(InventoryType.Machine, index);
}
public ControlSlotArray create(InventoryType type, int[] index) {
int i = 0; int i = 0;
for (ControlSlot slot : slots) { for (ControlSlot controlSlot : slots) {
slot.assign(type, index[i++]); final int slotIndex = index[i];
controlSlot.assign(actions, inventoryType, slotIndex);
i++;
} }
return this; return this;
} }
@@ -15,6 +15,7 @@ import net.minecraft.init.Items;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import binnie.core.AbstractMod; import binnie.core.AbstractMod;
import binnie.core.BinnieCore; import binnie.core.BinnieCore;
@@ -42,6 +43,7 @@ import binnie.core.craftgui.geometry.Position;
import binnie.core.craftgui.minecraft.Dialog; import binnie.core.craftgui.minecraft.Dialog;
import binnie.core.craftgui.minecraft.EnumColor; import binnie.core.craftgui.minecraft.EnumColor;
import binnie.core.craftgui.minecraft.IWindowAffectsShiftClick; import binnie.core.craftgui.minecraft.IWindowAffectsShiftClick;
import binnie.core.craftgui.minecraft.InventoryType;
import binnie.core.craftgui.minecraft.MinecraftGUI; import binnie.core.craftgui.minecraft.MinecraftGUI;
import binnie.core.craftgui.minecraft.Window; import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.minecraft.control.ControlItemDisplay; import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
@@ -55,6 +57,7 @@ import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
import binnie.core.craftgui.window.Panel; import binnie.core.craftgui.window.Panel;
import binnie.core.machines.Machine; import binnie.core.machines.Machine;
import binnie.core.machines.transfer.TransferRequest; import binnie.core.machines.transfer.TransferRequest;
import binnie.core.network.packet.MessageCraftGUI;
import binnie.core.util.I18N; import binnie.core.util.I18N;
import binnie.genetics.craftgui.WindowMachine; import binnie.genetics.craftgui.WindowMachine;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@@ -187,7 +190,11 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
for (int k = 0; k < inv.getPageSize(); ++k) { for (int k = 0; k < inv.getPageSize(); ++k) {
slotsIDs[k] = i++; 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; x += compartmentPageWidth;
if (tabs2.length > 0) { if (tabs2.length > 0) {
@@ -245,7 +252,7 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
setSize(new IPoint(Math.max(32 + compartmentWidth, 252), h())); setSize(new IPoint(Math.max(32 + compartmentWidth, 252), h()));
controlCompartment.setPosition(new IPoint((w() - controlCompartment.w()) / 2.0f, controlCompartment.y())); 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); 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.setLabel(I18N.localise("binniecore.machine.storage.tab.properties"));
slide.setSlide(false); slide.setSlide(false);
@@ -367,7 +374,7 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
}; };
slotGrid = new Control(scroll, 1.0f, 1.0f, 108.0f, 18.0f); slotGrid = new Control(scroll, 1.0f, 1.0f, 108.0f, 18.0f);
scroll.setScrollableContent(slotGrid); 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() { new ControlTextEdit(this, 16.0f, 16.0f, 100.0f, 14.0f).addEventHandler(new EventTextEdit.Handler() {
@Override @Override
@@ -459,8 +466,10 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
slotGrid.deleteAllChildren(); slotGrid.deleteAllChildren();
slotGrid.setSize(new IPoint(width, height)); slotGrid.setSize(new IPoint(width, height));
final NBTTagList actions = new NBTTagList();
for (int k : slotIds.keySet()) { for (int k : slotIds.keySet()) {
new ControlSlot(slotGrid, x, y).assign(k); new ControlSlot(slotGrid, x, y).assign(actions, InventoryType.Machine, k);
x += 18; x += 18;
if (x >= 108) { if (x >= 108) {
x = 0; x = 0;
@@ -468,6 +477,8 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
} }
} }
MessageCraftGUI.sendToServer(actions);
while (y < 108 || x != 0) { while (y < 108 || x != 0) {
new ControlSlot(slotGrid, x, y); new ControlSlot(slotGrid, x, y);
x += 18; x += 18;
@@ -1,7 +1,13 @@
package binnie.core.network.packet; package binnie.core.network.packet;
import net.minecraft.nbt.NBTTagCompound; import static binnie.core.craftgui.minecraft.ContainerCraftGUI.ACTIONS;
import static binnie.core.craftgui.minecraft.ContainerCraftGUI.ACTION_BATCH;
import static binnie.core.craftgui.minecraft.ContainerCraftGUI.ACTION_TYPE;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import binnie.core.BinnieCore;
import binnie.core.network.BinnieCorePacketID; import binnie.core.network.BinnieCorePacketID;
public class MessageCraftGUI extends MessageNBT { public class MessageCraftGUI extends MessageNBT {
@@ -13,4 +19,12 @@ public class MessageCraftGUI extends MessageNBT {
public MessageCraftGUI(NBTTagCompound action) { public MessageCraftGUI(NBTTagCompound action) {
super(BinnieCorePacketID.CraftGUIAction.ordinal(), action); super(BinnieCorePacketID.CraftGUIAction.ordinal(), action);
} }
public static void sendToServer(NBTTagList actions) {
NBTTagCompound actionsBatch = new NBTTagCompound();
actionsBatch.setString(ACTION_TYPE, ACTION_BATCH);
actionsBatch.setTag(ACTIONS, actions);
final MessageCraftGUI packet = new MessageCraftGUI(actionsBatch);
BinnieCore.proxy.sendToServer(packet);
}
} }
@@ -2,13 +2,16 @@ package binnie.extrabees.gui;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagList;
import binnie.core.AbstractMod; import binnie.core.AbstractMod;
import binnie.core.craftgui.minecraft.InventoryType;
import binnie.core.craftgui.minecraft.Window; import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory; import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
import binnie.core.craftgui.minecraft.control.ControlSlot; import binnie.core.craftgui.minecraft.control.ControlSlot;
import binnie.core.machines.Machine; import binnie.core.machines.Machine;
import binnie.core.machines.TileEntityMachine; import binnie.core.machines.TileEntityMachine;
import binnie.core.network.packet.MessageCraftGUI;
import binnie.core.util.I18N; import binnie.core.util.I18N;
import binnie.extrabees.ExtraBees; import binnie.extrabees.ExtraBees;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@@ -33,9 +36,10 @@ public class WindowAlvearyFrame extends Window {
@Override @Override
public void initialiseClient() { public void initialiseClient() {
setTitle(I18N.localise("extrabees.machine.alveay.frame")); setTitle(I18N.localise("extrabees.machine.alveay.frame"));
playerInventory = new ControlPlayerInventory(this); final NBTTagList actions = new NBTTagList();
ControlSlot slot = new ControlSlot(this, 79.0f, 30.0f); playerInventory = new ControlPlayerInventory(this).create(actions);
slot.assign(0); new ControlSlot(this, 79.0f, 30.0f).assign(actions, InventoryType.Machine, 0);
MessageCraftGUI.sendToServer(actions);
} }
@Override @Override
@@ -2,13 +2,16 @@ package binnie.extrabees.gui;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagList;
import binnie.core.AbstractMod; import binnie.core.AbstractMod;
import binnie.core.craftgui.minecraft.InventoryType;
import binnie.core.craftgui.minecraft.Window; import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory; import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
import binnie.core.craftgui.minecraft.control.ControlSlotArray; import binnie.core.craftgui.minecraft.control.ControlSlotArray;
import binnie.core.machines.Machine; import binnie.core.machines.Machine;
import binnie.core.machines.TileEntityMachine; import binnie.core.machines.TileEntityMachine;
import binnie.core.network.packet.MessageCraftGUI;
import binnie.core.util.I18N; import binnie.core.util.I18N;
import binnie.extrabees.ExtraBees; import binnie.extrabees.ExtraBees;
import binnie.extrabees.apiary.machine.hatchery.AlvearyHatchery; import binnie.extrabees.apiary.machine.hatchery.AlvearyHatchery;
@@ -33,10 +36,11 @@ public class WindowAlvearyHatchery extends Window {
@Override @Override
public void initialiseClient() { public void initialiseClient() {
final NBTTagList actions = new NBTTagList();
setTitle(I18N.localise("extrabees.machine.alveay.hatchery")); setTitle(I18N.localise("extrabees.machine.alveay.hatchery"));
playerInventory = new ControlPlayerInventory(this); playerInventory = new ControlPlayerInventory(this).create(actions);
ControlSlotArray slot = new ControlSlotArray(this, 43, 30, 5, 1); new ControlSlotArray(this, 43, 30, 5, 1).create(actions, InventoryType.Machine, AlvearyHatchery.SLOT_LARVAE);
slot.create(AlvearyHatchery.SLOT_LARVAE); MessageCraftGUI.sendToServer(actions);
} }
@Override @Override
@@ -3,18 +3,21 @@ package binnie.extrabees.gui;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagList;
import binnie.core.AbstractMod; import binnie.core.AbstractMod;
import binnie.core.craftgui.controls.ControlText; import binnie.core.craftgui.controls.ControlText;
import binnie.core.craftgui.geometry.IArea; import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.geometry.IPoint; import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.geometry.TextJustification; import binnie.core.craftgui.geometry.TextJustification;
import binnie.core.craftgui.minecraft.InventoryType;
import binnie.core.craftgui.minecraft.Window; import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.minecraft.control.ControlItemDisplay; import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory; import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
import binnie.core.craftgui.minecraft.control.ControlSlot; import binnie.core.craftgui.minecraft.control.ControlSlot;
import binnie.core.machines.Machine; import binnie.core.machines.Machine;
import binnie.core.machines.TileEntityMachine; import binnie.core.machines.TileEntityMachine;
import binnie.core.network.packet.MessageCraftGUI;
import binnie.core.util.I18N; import binnie.core.util.I18N;
import binnie.extrabees.ExtraBees; import binnie.extrabees.ExtraBees;
import binnie.extrabees.apiary.machine.mutator.AlvearyMutator; import binnie.extrabees.apiary.machine.mutator.AlvearyMutator;
@@ -39,10 +42,11 @@ public class WindowAlvearyMutator extends Window {
@Override @Override
public void initialiseClient() { public void initialiseClient() {
final NBTTagList actions = new NBTTagList();
setTitle(I18N.localise("extrabees.machine.alveay.mutator")); setTitle(I18N.localise("extrabees.machine.alveay.mutator"));
playerInventory = new ControlPlayerInventory(this); playerInventory = new ControlPlayerInventory(this).create(actions);
ControlSlot slot = new ControlSlot(this, 79.0f, 30.0f); new ControlSlot(this, 79.0f, 30.0f).assign(actions, InventoryType.Machine, AlvearyMutator.SLOT_MUTATOR);
slot.assign(AlvearyMutator.SLOT_MUTATOR);
new ControlText( new ControlText(
this, this,
new IArea(0.0f, 52.0f, w(), 16.0f), new IArea(0.0f, 52.0f, w(), 16.0f),
@@ -63,6 +67,8 @@ public class WindowAlvearyMutator extends Window {
display.hastooltip = true; display.hastooltip = true;
x += 17.0f; x += 17.0f;
} }
MessageCraftGUI.sendToServer(actions);
} }
@Override @Override
@@ -2,15 +2,18 @@ package binnie.extrabees.gui;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagList;
import binnie.core.AbstractMod; import binnie.core.AbstractMod;
import binnie.core.craftgui.geometry.Position; import binnie.core.craftgui.geometry.Position;
import binnie.core.craftgui.minecraft.InventoryType;
import binnie.core.craftgui.minecraft.Window; import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.minecraft.control.ControlEnergyBar; import binnie.core.craftgui.minecraft.control.ControlEnergyBar;
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory; import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
import binnie.core.craftgui.minecraft.control.ControlSlot; import binnie.core.craftgui.minecraft.control.ControlSlot;
import binnie.core.machines.Machine; import binnie.core.machines.Machine;
import binnie.core.machines.TileEntityMachine; import binnie.core.machines.TileEntityMachine;
import binnie.core.network.packet.MessageCraftGUI;
import binnie.core.util.I18N; import binnie.core.util.I18N;
import binnie.extrabees.ExtraBees; import binnie.extrabees.ExtraBees;
import binnie.extrabees.apiary.machine.stimulator.AlvearyStimulator; import binnie.extrabees.apiary.machine.stimulator.AlvearyStimulator;
@@ -35,11 +38,12 @@ public class WindowAlvearyStimulator extends Window {
@Override @Override
public void initialiseClient() { public void initialiseClient() {
final NBTTagList actions = new NBTTagList();
setTitle(I18N.localise("extrabees.machine.alveay.stimulator")); 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); new ControlEnergyBar(this, 75, 29, 60, 16, Position.LEFT);
ControlSlot slot = new ControlSlot(this, 41.0f, 28.0f); MessageCraftGUI.sendToServer(actions);
slot.assign(AlvearyStimulator.SLOT_CIRCUIT);
playerInventory = new ControlPlayerInventory(this);
} }
@Override @Override
@@ -97,4 +97,9 @@ public class BlockExtraBeeHive extends Block {
} }
return ret; return ret;
} }
@Override
public int damageDropped(int meta) {
return meta;
}
} }
@@ -2,9 +2,11 @@ package binnie.extratrees.craftgui;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagList;
import binnie.core.AbstractMod; import binnie.core.AbstractMod;
import binnie.core.craftgui.geometry.Position; import binnie.core.craftgui.geometry.Position;
import binnie.core.craftgui.minecraft.InventoryType;
import binnie.core.craftgui.minecraft.Window; import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.minecraft.control.ControlEnergyBar; import binnie.core.craftgui.minecraft.control.ControlEnergyBar;
import binnie.core.craftgui.minecraft.control.ControlErrorState; 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.ControlPlayerInventory;
import binnie.core.craftgui.minecraft.control.ControlSlot; import binnie.core.craftgui.minecraft.control.ControlSlot;
import binnie.core.machines.Machine; import binnie.core.machines.Machine;
import binnie.core.network.packet.MessageCraftGUI;
import binnie.extratrees.ExtraTrees; import binnie.extratrees.ExtraTrees;
import binnie.extratrees.machines.lumbermill.Lumbermill; import binnie.extratrees.machines.lumbermill.Lumbermill;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@@ -38,15 +41,20 @@ public class WindowLumbermill extends Window {
@Override @Override
public void initialiseClient() { public void initialiseClient() {
final NBTTagList actions = new NBTTagList();
setTitle(Machine.getMachine(getInventory()).getPackage().getDisplayName()); setTitle(Machine.getMachine(getInventory()).getPackage().getDisplayName());
new ControlSlot(this, 42.0f, 43.0f).assign(Lumbermill.SLOT_WOOD); new ControlSlot(this, 42.0f, 43.0f).assign(actions, InventoryType.Machine, Lumbermill.SLOT_WOOD);
new ControlSlot(this, 148.0f, 43.0f).assign(Lumbermill.SLOT_PLANKS); new ControlSlot(this, 148.0f, 43.0f).assign(actions, InventoryType.Machine, Lumbermill.SLOT_PLANKS);
new ControlSlot(this, 172.0f, 28.0f).assign(Lumbermill.SLOT_BARK); new ControlSlot(this, 172.0f, 28.0f).assign(actions, InventoryType.Machine, Lumbermill.SLOT_BARK);
new ControlSlot(this, 172.0f, 58.0f).assign(Lumbermill.SLOT_SAWDUST); new ControlSlot(this, 172.0f, 58.0f).assign(actions, InventoryType.Machine, Lumbermill.SLOT_SAWDUST);
new ControlLumbermillProgress(this, 70.0f, 43.0f); new ControlLumbermillProgress(this, 70.0f, 43.0f);
new ControlLiquidTank(this, 16, 32); new ControlLiquidTank(this, 16, 32);
new ControlEnergyBar(this, 8, 112, 16, 60, Position.BOTTOM); new ControlEnergyBar(this, 8, 112, 16, 60, Position.BOTTOM);
new ControlPlayerInventory(this); new ControlPlayerInventory(this).create(actions);
new ControlErrorState(this, 95.0f, 73.0f); 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.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagList;
import binnie.core.AbstractMod; import binnie.core.AbstractMod;
import binnie.core.craftgui.controls.ControlText; 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.IArea;
import binnie.core.craftgui.geometry.IPoint; import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.geometry.TextJustification; import binnie.core.craftgui.geometry.TextJustification;
import binnie.core.craftgui.minecraft.InventoryType;
import binnie.core.craftgui.minecraft.MinecraftGUI; import binnie.core.craftgui.minecraft.MinecraftGUI;
import binnie.core.craftgui.minecraft.Window; import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.minecraft.control.ControlErrorState; 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.minecraft.control.ControlSlot;
import binnie.core.craftgui.window.Panel; import binnie.core.craftgui.window.Panel;
import binnie.core.machines.Machine; import binnie.core.machines.Machine;
import binnie.core.network.packet.MessageCraftGUI;
import binnie.core.util.I18N; import binnie.core.util.I18N;
import binnie.extratrees.ExtraTrees; import binnie.extratrees.ExtraTrees;
import binnie.extratrees.machines.designer.Designer; import binnie.extratrees.machines.designer.Designer;
@@ -48,6 +51,8 @@ public class WindowWoodworker extends Window {
@Override @Override
public void initialiseClient() { public void initialiseClient() {
final NBTTagList actions = new NBTTagList();
setTitle(Machine.getMachine(getInventory()).getPackage().getDisplayName()); setTitle(Machine.getMachine(getInventory()).getPackage().getDisplayName());
new ControlText( new ControlText(
this, this,
@@ -58,18 +63,25 @@ public class WindowWoodworker extends Window {
textEdit = new ControlTextEdit(this, 188.0f, 178.0f, 118.0f, 12.0f); 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); 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)); 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); new ControlErrorState(this, 76.0f, 65.0f);
if (getInventory() != null) { if (getInventory() != null) {
ControlSlot slotWood1 = new ControlSlot(this, 22.0f, 34.0f); 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); 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); 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); new ControlRecipeSlot(this, 112, 34);
} }
MessageCraftGUI.sendToServer(actions);
} }
@Override @Override
@@ -2,9 +2,11 @@ package binnie.genetics.craftgui;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagList;
import binnie.core.AbstractMod; import binnie.core.AbstractMod;
import binnie.core.craftgui.geometry.Position; import binnie.core.craftgui.geometry.Position;
import binnie.core.craftgui.minecraft.InventoryType;
import binnie.core.craftgui.minecraft.Window; import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.minecraft.control.ControlEnergyBar; import binnie.core.craftgui.minecraft.control.ControlEnergyBar;
import binnie.core.craftgui.minecraft.control.ControlErrorState; import binnie.core.craftgui.minecraft.control.ControlErrorState;
@@ -13,6 +15,7 @@ import binnie.core.craftgui.minecraft.control.ControlSlot;
import binnie.core.craftgui.minecraft.control.ControlSlotArray; import binnie.core.craftgui.minecraft.control.ControlSlotArray;
import binnie.core.craftgui.resource.Texture; import binnie.core.craftgui.resource.Texture;
import binnie.core.craftgui.resource.minecraft.StandardTexture; import binnie.core.craftgui.resource.minecraft.StandardTexture;
import binnie.core.network.packet.MessageCraftGUI;
import binnie.core.util.I18N; import binnie.core.util.I18N;
import binnie.extrabees.core.ExtraBeeTexture; import binnie.extrabees.core.ExtraBeeTexture;
import binnie.genetics.Genetics; import binnie.genetics.Genetics;
@@ -40,17 +43,23 @@ public class WindowAcclimatiser extends WindowMachine {
@Override @Override
public void initialiseClient() { public void initialiseClient() {
super.initialiseClient(); super.initialiseClient();
final NBTTagList actions = new NBTTagList();
int x = 59; int x = 59;
int y = 32; 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; x += 54;
new ControlSlot(this, x + 18, y).assign(Acclimatiser.SLOT_TARGET); new ControlSlot(this, x + 18, y).assign(actions, InventoryType.Machine, Acclimatiser.SLOT_TARGET);
new ControlSlotArray(this, x, y + 18 + 18, 3, 1).create(Acclimatiser.SLOT_ACCLIMATISER); new ControlSlotArray(this, x, y + 18 + 18, 3, 1)
.create(actions, InventoryType.Machine, Acclimatiser.SLOT_ACCLIMATISER);
x += 72; 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 ControlEnergyBar(this, 21, 115, 16, 60, Position.BOTTOM);
new ControlErrorState(this, 181.0f, 83.0f); new ControlErrorState(this, 181.0f, 83.0f);
new ControlPlayerInventory(this); new ControlPlayerInventory(this).create(actions);
MessageCraftGUI.sendToServer(actions);
} }
@Override @Override
@@ -2,10 +2,12 @@ package binnie.genetics.craftgui;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagList;
import binnie.core.AbstractMod; import binnie.core.AbstractMod;
import binnie.core.craftgui.geometry.Position; import binnie.core.craftgui.geometry.Position;
import binnie.core.craftgui.minecraft.GUIIcon; import binnie.core.craftgui.minecraft.GUIIcon;
import binnie.core.craftgui.minecraft.InventoryType;
import binnie.core.craftgui.minecraft.MinecraftGUI; import binnie.core.craftgui.minecraft.MinecraftGUI;
import binnie.core.craftgui.minecraft.Window; import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.minecraft.control.ControlEnergyBar; import binnie.core.craftgui.minecraft.control.ControlEnergyBar;
@@ -19,6 +21,7 @@ import binnie.core.craftgui.minecraft.control.ControlSlotCharge;
import binnie.core.craftgui.resource.Texture; import binnie.core.craftgui.resource.Texture;
import binnie.core.craftgui.resource.minecraft.StandardTexture; import binnie.core.craftgui.resource.minecraft.StandardTexture;
import binnie.core.craftgui.window.Panel; import binnie.core.craftgui.window.Panel;
import binnie.core.network.packet.MessageCraftGUI;
import binnie.core.util.I18N; import binnie.core.util.I18N;
import binnie.extrabees.core.ExtraBeeTexture; import binnie.extrabees.core.ExtraBeeTexture;
import binnie.genetics.Genetics; import binnie.genetics.Genetics;
@@ -47,13 +50,16 @@ public class WindowAnalyser extends WindowMachine {
@Override @Override
public void initialiseClient() { public void initialiseClient() {
super.initialiseClient(); super.initialiseClient();
final NBTTagList actions = new NBTTagList();
WindowAnalyser.progressBase = new StandardTexture(0, 51, 66, 40, GeneticsTexture.GUIProcess.getTexture()); WindowAnalyser.progressBase = new StandardTexture(0, 51, 66, 40, GeneticsTexture.GUIProcess.getTexture());
WindowAnalyser.progress = new StandardTexture(66, 51, 66, 40, GeneticsTexture.GUIProcess.getTexture()); WindowAnalyser.progress = new StandardTexture(66, 51, 66, 40, GeneticsTexture.GUIProcess.getTexture());
int x = 16; int x = 16;
int y = 32; 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; x += 28;
new ControlSlot(this, x, y + 54 + 8).assign(13); new ControlSlot(this, x, y + 54 + 8).assign(actions, InventoryType.Machine, 13);
new ControlSlotCharge(this, x + 20, y + 54 + 8, 13).setColor(10040319); new ControlSlotCharge(this, x + 20, y + 54 + 8, 13).setColor(10040319);
new ControlEnergyBar(this, x + 24 + 16, y + 54 + 8 + 1, 60, 16, Position.LEFT); new ControlEnergyBar(this, x + 24 + 16, y + 54 + 8 + 1, 60, 16, Position.LEFT);
new ControlErrorState(this, x + 24 + 16 + 60 + 16, y + 54 + 8 + 1); new ControlErrorState(this, x + 24 + 16 + 60 + 16, y + 54 + 8 + 1);
@@ -62,11 +68,13 @@ public class WindowAnalyser extends WindowMachine {
x += 56; x += 56;
new Panel(this, x, y, 76.0f, 50.0f, MinecraftGUI.PanelType.Tinted); new Panel(this, x, y, 76.0f, 50.0f, MinecraftGUI.PanelType.Tinted);
new ControlProgress(this, x + 5, y + 5, WindowAnalyser.progressBase, WindowAnalyser.progress, Position.LEFT); new ControlProgress(this, x + 5, y + 5, WindowAnalyser.progressBase, WindowAnalyser.progress, Position.LEFT);
new ControlSlot(this, x + 38 - 9, y + 25 - 9).assign(Analyser.SLOT_TARGET); 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()); new ControlIconDisplay(this, x + 76 + 2, y + 18, GUIIcon.ArrowRight.getIcon());
x += 96; x += 96;
new ControlSlotArray(this, x, y, 2, 3).create(Analyser.SLOT_FINISHED); new ControlSlotArray(this, x, y, 2, 3).create(actions, InventoryType.Machine, Analyser.SLOT_FINISHED);
new ControlPlayerInventory(this); new ControlPlayerInventory(this).create(actions);
MessageCraftGUI.sendToServer(actions);
} }
@Override @Override
@@ -97,7 +97,7 @@ public class WindowGeneBank extends WindowMachine {
int boxX; int boxX;
int x = 16; int x = 16;
int y = 32; int y = 32;
new ControlPlayerInventory(this, x, y); new ControlPlayerInventory(this, x, y).createAndRegister();
x += 124; x += 124;
boxX = x; boxX = x;
int geneBoxWidth = 200; int geneBoxWidth = 200;
@@ -2,10 +2,12 @@ package binnie.genetics.craftgui;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagList;
import binnie.core.AbstractMod; import binnie.core.AbstractMod;
import binnie.core.craftgui.geometry.Position; import binnie.core.craftgui.geometry.Position;
import binnie.core.craftgui.minecraft.GUIIcon; import binnie.core.craftgui.minecraft.GUIIcon;
import binnie.core.craftgui.minecraft.InventoryType;
import binnie.core.craftgui.minecraft.Window; import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.minecraft.control.ControlEnergyBar; import binnie.core.craftgui.minecraft.control.ControlEnergyBar;
import binnie.core.craftgui.minecraft.control.ControlErrorState; import binnie.core.craftgui.minecraft.control.ControlErrorState;
@@ -18,6 +20,7 @@ import binnie.core.craftgui.minecraft.control.ControlSlotArray;
import binnie.core.craftgui.minecraft.control.ControlSlotCharge; import binnie.core.craftgui.minecraft.control.ControlSlotCharge;
import binnie.core.craftgui.resource.Texture; import binnie.core.craftgui.resource.Texture;
import binnie.core.craftgui.resource.minecraft.StandardTexture; import binnie.core.craftgui.resource.minecraft.StandardTexture;
import binnie.core.network.packet.MessageCraftGUI;
import binnie.core.util.I18N; import binnie.core.util.I18N;
import binnie.extrabees.core.ExtraBeeTexture; import binnie.extrabees.core.ExtraBeeTexture;
import binnie.genetics.Genetics; import binnie.genetics.Genetics;
@@ -40,18 +43,21 @@ public class WindowGenepool extends WindowMachine {
@Override @Override
public void initialiseClient() { public void initialiseClient() {
super.initialiseClient(); super.initialiseClient();
final NBTTagList actions = new NBTTagList();
int x = 16; int x = 16;
int y = 32; int y = 32;
new ControlLiquidTank(this, x, y).setTankID(Genepool.TANK_ETHANOL); new ControlLiquidTank(this, x, y).setTankID(Genepool.TANK_ETHANOL);
x += 26; 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; x += 38;
new ControlIconDisplay(this, x, y + 22, GUIIcon.ArrowRight.getIcon()); new ControlIconDisplay(this, x, y + 22, GUIIcon.ArrowRight.getIcon());
x += 18; x += 18;
new ControlSlot(this, x, y + 21).assign(Genepool.SLOT_BEE); new ControlSlot(this, x, y + 21).assign(actions, InventoryType.Machine, Genepool.SLOT_BEE);
x += 18; x += 18;
new ControlMachineProgress(this, x, y + 19, progressBase, progress, Position.LEFT); new ControlMachineProgress(this, x, y + 19, progressBase, progress, Position.LEFT);
@@ -59,10 +65,12 @@ public class WindowGenepool extends WindowMachine {
x += 130; x += 130;
new ControlLiquidTank(this, x, y).setTankID(Genepool.TANK_DNA); new ControlLiquidTank(this, x, y).setTankID(Genepool.TANK_DNA);
new ControlEnergyBar(this, 21, 115, 16, 60, Position.BOTTOM); new ControlEnergyBar(this, 21, 115, 16, 60, Position.BOTTOM);
new ControlSlot(this, 121.0f, 82.0f).assign(Genepool.SLOT_ENZYME); new ControlSlot(this, 121.0f, 82.0f).assign(actions, InventoryType.Machine, Genepool.SLOT_ENZYME);
new ControlSlotCharge(this, 143, 82, 7).setColor(0xefe8af); new ControlSlotCharge(this, 143, 82, 7).setColor(0xefe8af);
new ControlErrorState(this, 181.0f, 83.0f); new ControlErrorState(this, 181.0f, 83.0f);
new ControlPlayerInventory(this); new ControlPlayerInventory(this).create(actions);
MessageCraftGUI.sendToServer(actions);
} }
@Override @Override
@@ -2,10 +2,12 @@ package binnie.genetics.craftgui;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagList;
import binnie.core.AbstractMod; import binnie.core.AbstractMod;
import binnie.core.craftgui.geometry.Position; import binnie.core.craftgui.geometry.Position;
import binnie.core.craftgui.minecraft.GUIIcon; import binnie.core.craftgui.minecraft.GUIIcon;
import binnie.core.craftgui.minecraft.InventoryType;
import binnie.core.craftgui.minecraft.Window; import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.minecraft.control.ControlEnergyBar; import binnie.core.craftgui.minecraft.control.ControlEnergyBar;
import binnie.core.craftgui.minecraft.control.ControlErrorState; 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.minecraft.control.ControlSlotArray;
import binnie.core.craftgui.resource.Texture; import binnie.core.craftgui.resource.Texture;
import binnie.core.craftgui.resource.minecraft.StandardTexture; import binnie.core.craftgui.resource.minecraft.StandardTexture;
import binnie.core.network.packet.MessageCraftGUI;
import binnie.core.util.I18N; import binnie.core.util.I18N;
import binnie.genetics.Genetics; import binnie.genetics.Genetics;
import binnie.genetics.core.GeneticsTexture; import binnie.genetics.core.GeneticsTexture;
@@ -39,11 +42,14 @@ public class WindowIncubator extends WindowMachine {
@Override @Override
public void initialiseClient() { public void initialiseClient() {
super.initialiseClient(); super.initialiseClient();
final NBTTagList actions = new NBTTagList();
int x = 16; int x = 16;
int y = 32; int y = 32;
new ControlLiquidTank(this, x, y).setTankID(Incubator.TANK_INPUT); new ControlLiquidTank(this, x, y).setTankID(Incubator.TANK_INPUT);
x += 26; 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; x += 20;
new ControlIconDisplay(this, x, y + 3 + 10, GUIIcon.ArrowRight.getIcon()); new ControlIconDisplay(this, x, y + 3 + 10, GUIIcon.ArrowRight.getIcon());
x += 18; x += 18;
@@ -54,17 +60,19 @@ public class WindowIncubator extends WindowMachine {
WindowIncubator.progressBase, WindowIncubator.progressBase,
WindowIncubator.progress, WindowIncubator.progress,
Position.LEFT); Position.LEFT);
new ControlSlot(this, x + 10, y + 3 + 10).assign(Incubator.SLOT_INCUBATOR); new ControlSlot(this, x + 10, y + 3 + 10).assign(actions, InventoryType.Machine, Incubator.SLOT_INCUBATOR);
x += 40; x += 40;
new ControlIconDisplay(this, x, y + 3 + 10, GUIIcon.ArrowRight.getIcon()); new ControlIconDisplay(this, x, y + 3 + 10, GUIIcon.ArrowRight.getIcon());
x += 18; 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; x += 26;
new ControlLiquidTank(this, x, y).setTankID(Incubator.TANK_OUTPUT); new ControlLiquidTank(this, x, y).setTankID(Incubator.TANK_OUTPUT);
x += 34; x += 34;
new ControlEnergyBar(this, x, y + 3, 16, 54, Position.BOTTOM); new ControlEnergyBar(this, x, y + 3, 16, 54, Position.BOTTOM);
new ControlErrorState(this, 91.0f, 82.0f); new ControlErrorState(this, 91.0f, 82.0f);
new ControlPlayerInventory(this); new ControlPlayerInventory(this).create(actions);
MessageCraftGUI.sendToServer(actions);
} }
@Override @Override
@@ -2,12 +2,14 @@ package binnie.genetics.craftgui;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagList;
import binnie.core.AbstractMod; import binnie.core.AbstractMod;
import binnie.core.craftgui.geometry.CraftGUIUtil; import binnie.core.craftgui.geometry.CraftGUIUtil;
import binnie.core.craftgui.geometry.Position; import binnie.core.craftgui.geometry.Position;
import binnie.core.craftgui.geometry.TextJustification; import binnie.core.craftgui.geometry.TextJustification;
import binnie.core.craftgui.minecraft.GUIIcon; import binnie.core.craftgui.minecraft.GUIIcon;
import binnie.core.craftgui.minecraft.InventoryType;
import binnie.core.craftgui.minecraft.Window; import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.minecraft.control.ControlEnergyBar; import binnie.core.craftgui.minecraft.control.ControlEnergyBar;
import binnie.core.craftgui.minecraft.control.ControlErrorState; 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.minecraft.control.ControlSlotArray;
import binnie.core.craftgui.resource.Texture; import binnie.core.craftgui.resource.Texture;
import binnie.core.craftgui.resource.minecraft.StandardTexture; import binnie.core.craftgui.resource.minecraft.StandardTexture;
import binnie.core.network.packet.MessageCraftGUI;
import binnie.core.util.I18N; import binnie.core.util.I18N;
import binnie.genetics.Genetics; import binnie.genetics.Genetics;
import binnie.genetics.core.GeneticsTexture; import binnie.genetics.core.GeneticsTexture;
@@ -41,17 +44,22 @@ public class WindowInoculator extends WindowMachine {
@Override @Override
public void initialiseClient() { public void initialiseClient() {
super.initialiseClient(); super.initialiseClient();
final NBTTagList actions = new NBTTagList();
int x = 16; int x = 16;
int y = 32; int y = 32;
new ControlLiquidTank(this, x, y + 18 + 16).setTankID(0); new ControlLiquidTank(this, x, y + 18 + 16).setTankID(0);
CraftGUIUtil.horizontalGrid( CraftGUIUtil.horizontalGrid(
x, x,
y, 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 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 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; x += 18;
new ControlMachineProgress( new ControlMachineProgress(
this, this,
@@ -68,12 +76,15 @@ public class WindowInoculator extends WindowMachine {
y, y,
TextJustification.MIDDLE_LEFT, TextJustification.MIDDLE_LEFT,
8.0f, 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(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 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 + 2, GUIIcon.ArrowUpLeft.getIcon());
new ControlIconDisplay(this, x + 18, y + 18 + 18, GUIIcon.ArrowLeftDown.getIcon()); new ControlIconDisplay(this, x + 18, y + 18 + 18, GUIIcon.ArrowLeftDown.getIcon());
new ControlPlayerInventory(this); new ControlPlayerInventory(this).create(actions);
MessageCraftGUI.sendToServer(actions);
} }
@Override @Override
@@ -2,10 +2,12 @@ package binnie.genetics.craftgui;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagList;
import binnie.core.AbstractMod; import binnie.core.AbstractMod;
import binnie.core.craftgui.geometry.Position; import binnie.core.craftgui.geometry.Position;
import binnie.core.craftgui.minecraft.GUIIcon; import binnie.core.craftgui.minecraft.GUIIcon;
import binnie.core.craftgui.minecraft.InventoryType;
import binnie.core.craftgui.minecraft.Window; import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.minecraft.control.ControlEnergyBar; import binnie.core.craftgui.minecraft.control.ControlEnergyBar;
import binnie.core.craftgui.minecraft.control.ControlErrorState; import binnie.core.craftgui.minecraft.control.ControlErrorState;
@@ -18,6 +20,7 @@ import binnie.core.craftgui.minecraft.control.ControlSlotArray;
import binnie.core.craftgui.minecraft.control.ControlSlotCharge; import binnie.core.craftgui.minecraft.control.ControlSlotCharge;
import binnie.core.craftgui.resource.Texture; import binnie.core.craftgui.resource.Texture;
import binnie.core.craftgui.resource.minecraft.StandardTexture; import binnie.core.craftgui.resource.minecraft.StandardTexture;
import binnie.core.network.packet.MessageCraftGUI;
import binnie.core.util.I18N; import binnie.core.util.I18N;
import binnie.extrabees.core.ExtraBeeTexture; import binnie.extrabees.core.ExtraBeeTexture;
import binnie.genetics.Genetics; import binnie.genetics.Genetics;
@@ -40,30 +43,35 @@ public class WindowIsolator extends WindowMachine {
@Override @Override
public void initialiseClient() { public void initialiseClient() {
super.initialiseClient(); super.initialiseClient();
final NBTTagList actions = new NBTTagList();
int x = 16; int x = 16;
int y = 32; int y = 32;
new ControlLiquidTank(this, x, y).setTankID(Isolator.TANK_ETHANOL); new ControlLiquidTank(this, x, y).setTankID(Isolator.TANK_ETHANOL);
x += 26; 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; x += 20;
new ControlIconDisplay(this, x, y + 3 + 1, GUIIcon.ArrowRight.getIcon()); new ControlIconDisplay(this, x, y + 3 + 1, GUIIcon.ArrowRight.getIcon());
x += 18; x += 18;
new ControlSlot(this, x, y + 3).assign(Isolator.SLOT_TARGET); new ControlSlot(this, x, y + 3).assign(actions, InventoryType.Machine, Isolator.SLOT_TARGET);
new ControlSlot(this, x, y + 36 + 3).assign(Isolator.SLOT_ENZYME); new ControlSlot(this, x, y + 36 + 3).assign(actions, InventoryType.Machine, Isolator.SLOT_ENZYME);
new ControlSlotCharge(this, x + 18 + 2, y + 36 + 3, 0).setColor(0xefe8af); new ControlSlotCharge(this, x + 18 + 2, y + 36 + 3, 0).setColor(0xefe8af);
x += 18; x += 18;
new ControlProgress(this, x, y + 3, WindowIsolator.ProgressBase, WindowIsolator.Progress, Position.LEFT); new ControlProgress(this, x, y + 3, WindowIsolator.ProgressBase, WindowIsolator.Progress, Position.LEFT);
x += 142; x += 142;
new ControlSlot(this, x, y + 3).assign(Isolator.SLOT_RESULT); new ControlSlot(this, x, y + 3).assign(actions, InventoryType.Machine, Isolator.SLOT_RESULT);
new ControlSlot(this, x, y + 3 + 36).assign(Isolator.SLOT_SEQUENCER_VIAL); new ControlSlot(this, x, y + 3 + 36).assign(actions, InventoryType.Machine, Isolator.SLOT_SEQUENCER_VIAL);
new ControlIconDisplay(this, x + 1, y + 3 + 19, GUIIcon.ArrowUp.getIcon()); new ControlIconDisplay(this, x + 1, y + 3 + 19, GUIIcon.ArrowUp.getIcon());
x += 20; x += 20;
new ControlIconDisplay(this, x, y + 3 + 1, GUIIcon.ArrowRight.getIcon()); new ControlIconDisplay(this, x, y + 3 + 1, GUIIcon.ArrowRight.getIcon());
x += 18; 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 ControlEnergyBar(this, 260, 130, 16, 60, Position.BOTTOM);
new ControlErrorState(this, 153.0f, 81.0f); new ControlErrorState(this, 153.0f, 81.0f);
new ControlPlayerInventory(this); new ControlPlayerInventory(this).create(actions);
MessageCraftGUI.sendToServer(actions);
} }
@Override @Override
@@ -2,10 +2,12 @@ package binnie.genetics.craftgui;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagList;
import binnie.core.AbstractMod; import binnie.core.AbstractMod;
import binnie.core.craftgui.geometry.Position; import binnie.core.craftgui.geometry.Position;
import binnie.core.craftgui.minecraft.GUIIcon; import binnie.core.craftgui.minecraft.GUIIcon;
import binnie.core.craftgui.minecraft.InventoryType;
import binnie.core.craftgui.minecraft.Window; import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.minecraft.control.ControlEnergyBar; import binnie.core.craftgui.minecraft.control.ControlEnergyBar;
import binnie.core.craftgui.minecraft.control.ControlErrorState; import binnie.core.craftgui.minecraft.control.ControlErrorState;
@@ -18,6 +20,7 @@ import binnie.core.craftgui.minecraft.control.ControlSlotArray;
import binnie.core.craftgui.minecraft.control.ControlSlotCharge; import binnie.core.craftgui.minecraft.control.ControlSlotCharge;
import binnie.core.craftgui.resource.Texture; import binnie.core.craftgui.resource.Texture;
import binnie.core.craftgui.resource.minecraft.StandardTexture; import binnie.core.craftgui.resource.minecraft.StandardTexture;
import binnie.core.network.packet.MessageCraftGUI;
import binnie.core.util.I18N; import binnie.core.util.I18N;
import binnie.genetics.Genetics; import binnie.genetics.Genetics;
import binnie.genetics.core.GeneticsTexture; import binnie.genetics.core.GeneticsTexture;
@@ -45,23 +48,29 @@ public class WindowPolymeriser extends WindowMachine {
@Override @Override
public void initialiseClient() { public void initialiseClient() {
super.initialiseClient(); super.initialiseClient();
final NBTTagList actions = new NBTTagList();
int x = 16; int x = 16;
int y = 38; 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()); new ControlIconDisplay(this, x + 18, y + 1, GUIIcon.ArrowRight.getIcon());
x += 34; x += 34;
new ControlMachineProgress(this, x + 18, y - 6, progressBase, progress, Position.LEFT); new ControlMachineProgress(this, x + 18, y - 6, progressBase, progress, Position.LEFT);
new ControlSlot(this, x, y).assign(Polymeriser.SLOT_SERUM); new ControlSlot(this, x, y).assign(actions, InventoryType.Machine, Polymeriser.SLOT_SERUM);
new ControlLiquidTank(this, x, y + 18 + 16, true).setTankID(Polymeriser.TANK_BACTERIA); new ControlLiquidTank(this, x, y + 18 + 16, true).setTankID(Polymeriser.TANK_BACTERIA);
new ControlLiquidTank(this, x, y + 18 + 16 + 18 + 8, true).setTankID(Polymeriser.TANK_DNA); new ControlLiquidTank(this, x, y + 18 + 16 + 18 + 8, true).setTankID(Polymeriser.TANK_DNA);
new ControlEnergyBar(this, x + 120, 96, 64, 16, Position.LEFT); new ControlEnergyBar(this, x + 120, 96, 64, 16, Position.LEFT);
x += 40; x += 40;
new ControlSlot(this, x + 30, y + 18 + 8).assign(Polymeriser.SLOT_GOLD); 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); new ControlSlotCharge(this, x + 30 + 20, y + 18 + 8, 1).setColor(0xffd800);
x += 138; 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 ControlErrorState(this, 244.0f, 97.0f);
new ControlPlayerInventory(this); new ControlPlayerInventory(this).create(actions);
MessageCraftGUI.sendToServer(actions);
} }
@Override @Override
@@ -3,6 +3,7 @@ package binnie.genetics.craftgui;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumChatFormatting;
import binnie.core.AbstractMod; import binnie.core.AbstractMod;
@@ -12,6 +13,7 @@ import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.geometry.Position; import binnie.core.craftgui.geometry.Position;
import binnie.core.craftgui.geometry.TextJustification; import binnie.core.craftgui.geometry.TextJustification;
import binnie.core.craftgui.minecraft.GUIIcon; import binnie.core.craftgui.minecraft.GUIIcon;
import binnie.core.craftgui.minecraft.InventoryType;
import binnie.core.craftgui.minecraft.Window; import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.minecraft.control.ControlEnergyBar; import binnie.core.craftgui.minecraft.control.ControlEnergyBar;
import binnie.core.craftgui.minecraft.control.ControlErrorState; import binnie.core.craftgui.minecraft.control.ControlErrorState;
@@ -22,6 +24,7 @@ import binnie.core.craftgui.minecraft.control.ControlSlotArray;
import binnie.core.craftgui.minecraft.control.ControlSlotCharge; import binnie.core.craftgui.minecraft.control.ControlSlotCharge;
import binnie.core.craftgui.resource.Texture; import binnie.core.craftgui.resource.Texture;
import binnie.core.craftgui.resource.minecraft.StandardTexture; import binnie.core.craftgui.resource.minecraft.StandardTexture;
import binnie.core.network.packet.MessageCraftGUI;
import binnie.core.util.I18N; import binnie.core.util.I18N;
import binnie.extrabees.core.ExtraBeeTexture; import binnie.extrabees.core.ExtraBeeTexture;
import binnie.genetics.Genetics; import binnie.genetics.Genetics;
@@ -61,6 +64,9 @@ public class WindowSequencer extends WindowMachine {
@Override @Override
public void initialiseClient() { public void initialiseClient() {
super.initialiseClient(); super.initialiseClient();
final NBTTagList actions = new NBTTagList();
int x = 16; int x = 16;
int y = 32; int y = 32;
CraftGUIUtil.horizontalGrid( CraftGUIUtil.horizontalGrid(
@@ -68,13 +74,13 @@ public class WindowSequencer extends WindowMachine {
y, y,
TextJustification.MIDDLE_CENTER, TextJustification.MIDDLE_CENTER,
2.0f, 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 ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowRight.getIcon()),
new ControlSequencerProgress(this, 0, 0), new ControlSequencerProgress(this, 0, 0),
new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowRight.getIcon()), new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowRight.getIcon()),
new ControlSlot(this, 0.0f, 0.0f).assign(6)); new ControlSlot(this, 0.0f, 0.0f).assign(actions, InventoryType.Machine, 6));
ControlSlot slotTarget = new ControlSlot(this, x + 96, y + 16); ControlSlot slotTarget = new ControlSlot(this, x + 96, y + 16);
slotTarget.assign(5); slotTarget.assign(actions, InventoryType.Machine, 5);
x = 34; x = 34;
y = 92; y = 92;
slotText = new ControlText( slotText = new ControlText(
@@ -84,14 +90,16 @@ public class WindowSequencer extends WindowMachine {
TextJustification.MIDDLE_CENTER); TextJustification.MIDDLE_CENTER);
y += 20; y += 20;
ControlSlot slotDye = new ControlSlot(this, x, y); ControlSlot slotDye = new ControlSlot(this, x, y);
slotDye.assign(0); slotDye.assign(actions, InventoryType.Machine, 0);
x += 20; x += 20;
new ControlSlotCharge(this, x, y, 0).setColor(16750848); new ControlSlotCharge(this, x, y, 0).setColor(16750848);
x += 32; x += 32;
new ControlEnergyBar(this, x, y, 60, 16, Position.LEFT); new ControlEnergyBar(this, x, y, 60, 16, Position.LEFT);
x += 92; x += 92;
new ControlErrorState(this, x, y + 1); new ControlErrorState(this, x, y + 1);
new ControlPlayerInventory(this); new ControlPlayerInventory(this).create(actions);
MessageCraftGUI.sendToServer(actions);
} }
@Override @Override
@@ -2,12 +2,14 @@ package binnie.genetics.craftgui;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagList;
import binnie.core.AbstractMod; import binnie.core.AbstractMod;
import binnie.core.craftgui.geometry.CraftGUIUtil; import binnie.core.craftgui.geometry.CraftGUIUtil;
import binnie.core.craftgui.geometry.Position; import binnie.core.craftgui.geometry.Position;
import binnie.core.craftgui.geometry.TextJustification; import binnie.core.craftgui.geometry.TextJustification;
import binnie.core.craftgui.minecraft.GUIIcon; import binnie.core.craftgui.minecraft.GUIIcon;
import binnie.core.craftgui.minecraft.InventoryType;
import binnie.core.craftgui.minecraft.Window; import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.minecraft.control.ControlEnergyBar; import binnie.core.craftgui.minecraft.control.ControlEnergyBar;
import binnie.core.craftgui.minecraft.control.ControlErrorState; 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.minecraft.control.ControlSlotArray;
import binnie.core.craftgui.resource.Texture; import binnie.core.craftgui.resource.Texture;
import binnie.core.craftgui.resource.minecraft.StandardTexture; import binnie.core.craftgui.resource.minecraft.StandardTexture;
import binnie.core.network.packet.MessageCraftGUI;
import binnie.core.util.I18N; import binnie.core.util.I18N;
import binnie.genetics.Genetics; import binnie.genetics.Genetics;
import binnie.genetics.core.GeneticsTexture; import binnie.genetics.core.GeneticsTexture;
@@ -45,15 +48,20 @@ public class WindowSplicer extends WindowMachine {
@Override @Override
public void initialiseClient() { public void initialiseClient() {
super.initialiseClient(); super.initialiseClient();
final NBTTagList actions = new NBTTagList();
int x = 16; int x = 16;
new ControlSplicerProgress(this, 84.0f, 32.0f, w() - 172.0f, 102.0f); new ControlSplicerProgress(this, 84.0f, 32.0f, w() - 172.0f, 102.0f);
CraftGUIUtil.horizontalGrid( CraftGUIUtil.horizontalGrid(
x, x,
62.0f, 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 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 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 ControlIconDisplay(this, x + 12 + 36 + 4, 86.0f, GUIIcon.ArrowUpLeft.getIcon());
new ControlEnergyBar(this, 196, 64, 60, 16, Position.LEFT); new ControlEnergyBar(this, 196, 64, 60, 16, Position.LEFT);
new ControlErrorState(this, 218.0f, 86.0f); new ControlErrorState(this, 218.0f, 86.0f);
@@ -62,12 +70,15 @@ public class WindowSplicer extends WindowMachine {
32.0f, 32.0f,
TextJustification.MIDDLE_CENTER, TextJustification.MIDDLE_CENTER,
4.0f, 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 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 ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowDown.getIcon()),
new ControlSlotArray(this, 0, 0, 4, 1).create(Inoculator.SLOT_FINISHED)); new ControlSlotArray(this, 0, 0, 4, 1)
new ControlPlayerInventory(this); .create(actions, InventoryType.Machine, Inoculator.SLOT_FINISHED));
new ControlPlayerInventory(this).create(actions);
MessageCraftGUI.sendToServer(actions);
} }
@Override @Override
@@ -6,6 +6,7 @@ import java.util.List;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagList;
import binnie.Binnie; import binnie.Binnie;
import binnie.botany.api.IFlower; import binnie.botany.api.IFlower;
@@ -34,6 +35,7 @@ import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
import binnie.core.craftgui.window.Panel; import binnie.core.craftgui.window.Panel;
import binnie.core.genetics.BreedingSystem; import binnie.core.genetics.BreedingSystem;
import binnie.core.machines.inventory.SlotValidator; import binnie.core.machines.inventory.SlotValidator;
import binnie.core.network.packet.MessageCraftGUI;
import binnie.core.util.I18N; import binnie.core.util.I18N;
import binnie.genetics.Genetics; import binnie.genetics.Genetics;
import binnie.genetics.item.GeneticsItems; import binnie.genetics.item.GeneticsItems;
@@ -170,11 +172,13 @@ public class WindowAnalyst extends Window {
x += 22; x += 22;
} }
} else { } else {
new ControlSlot(this, x, y + 1).assign(InventoryType.Window, 0); final NBTTagList actions = new NBTTagList();
new ControlSlot(this, x, y + 1).assign(actions, InventoryType.Window, 0);
x += 22; x += 22;
new ControlSlot(this, x, y + 1).assign(InventoryType.Window, 1); new ControlSlot(this, x, y + 1).assign(actions, InventoryType.Window, 1);
x += 26; x += 26;
setupValidators(); setupValidators();
MessageCraftGUI.sendToServer(actions);
} }
tabBar = new Control(this, x, 28.0f, w() - 16.0f - x, 20.0f); tabBar = new Control(this, x, 28.0f, w() - 16.0f - x, 20.0f);
analystPanel = new Panel(this, 16.0f, 54.0f, 280.0f, 164.0f, MinecraftGUI.PanelType.Outline) { analystPanel = new Panel(this, 16.0f, 54.0f, 280.0f, 164.0f, MinecraftGUI.PanelType.Outline) {
@@ -275,7 +279,7 @@ public class WindowAnalyst extends Window {
244.0f, 244.0f,
80.0f, 80.0f,
Position.BOTTOM); Position.BOTTOM);
new ControlPlayerInventory(slideUpInv, true); new ControlPlayerInventory(slideUpInv, true).createAndRegister();
slideUpInv.setSlide(false); slideUpInv.setSlide(false);
} }
addEventHandler(new EventKey.Down.Handler() { addEventHandler(new EventKey.Down.Handler() {
@@ -297,7 +301,7 @@ public class WindowAnalyst extends Window {
@Override @Override
public void initialise() { public void initialise() {
new ControlTextCentered(this, 20.0f, I18N.localise("genetics.gui.analyst.info")).setColor(0x444444); new ControlTextCentered(this, 20.0f, I18N.localise("genetics.gui.analyst.info")).setColor(0x444444);
new ControlPlayerInventory(this); new ControlPlayerInventory(this).createAndRegister();
} }
}; };
} }