diff --git a/common/buildcraft/core/triggers/ActionTriggerIconProvider.java b/common/buildcraft/core/triggers/ActionTriggerIconProvider.java index 3097196d..ad928323 100644 --- a/common/buildcraft/core/triggers/ActionTriggerIconProvider.java +++ b/common/buildcraft/core/triggers/ActionTriggerIconProvider.java @@ -99,8 +99,8 @@ public class ActionTriggerIconProvider implements IIconProvider { icons[ActionTriggerIconProvider.Trigger_PipeSignal_Green_Inactive] = iconRegister.registerIcon("buildcraft:triggers/trigger_pipesignal_green_inactive"); icons[ActionTriggerIconProvider.Trigger_PipeSignal_Yellow_Active] = iconRegister.registerIcon("buildcraft:triggers/trigger_pipesignal_yellow_active"); icons[ActionTriggerIconProvider.Trigger_PipeSignal_Yellow_Inactive] = iconRegister.registerIcon("buildcraft:triggers/trigger_pipesignal_yellow_inactive"); -// icons[ActionTriggerIconProvider.Trigger_RedstoneInput_Active] = iconRegister.registerIcon("buildcraft:triggers/trigger_redstoneinput_active"); -// icons[ActionTriggerIconProvider.Trigger_RedstoneInput_Inactive] = iconRegister.registerIcon("buildcraft:triggers/trigger_redstoneinput_inactive"); + icons[ActionTriggerIconProvider.Trigger_RedstoneInput_Active] = iconRegister.registerIcon("buildcraft:triggers/trigger_redstoneinput_active"); + icons[ActionTriggerIconProvider.Trigger_RedstoneInput_Inactive] = iconRegister.registerIcon("buildcraft:triggers/trigger_redstoneinput_inactive"); icons[ActionTriggerIconProvider.Trigger_Inventory_Below25] = iconRegister.registerIcon("buildcraft:triggers/trigger_inventory_below25"); icons[ActionTriggerIconProvider.Trigger_Inventory_Below50] = iconRegister.registerIcon("buildcraft:triggers/trigger_inventory_below50"); icons[ActionTriggerIconProvider.Trigger_Inventory_Below75] = iconRegister.registerIcon("buildcraft:triggers/trigger_inventory_below75"); diff --git a/common/buildcraft/transport/gui/ContainerGateInterface.java b/common/buildcraft/transport/gui/ContainerGateInterface.java index 68c929bd..e728e2e8 100644 --- a/common/buildcraft/transport/gui/ContainerGateInterface.java +++ b/common/buildcraft/transport/gui/ContainerGateInterface.java @@ -117,7 +117,6 @@ public class ContainerGateInterface extends BuildCraftContainer { * @param packet */ public void updateActions(PacketUpdate packet) { - _potentialActions.clear(); PacketPayloadArrays payload = (PacketPayloadArrays) packet.payload; int length = payload.intPayload[0]; @@ -125,7 +124,6 @@ public class ContainerGateInterface extends BuildCraftContainer { for (int i = 0; i < length; i++) { _potentialActions.add(ActionManager.actions.get(payload.stringPayload[i])); } - } /** @@ -148,31 +146,31 @@ public class ContainerGateInterface extends BuildCraftContainer { * * @param packet */ - public void setSelection(PacketUpdate packet) { + public void setSelection(PacketUpdate packet, boolean notify) { PacketPayloadArrays payload = (PacketPayloadArrays) packet.payload; int position = payload.intPayload[0]; - setTrigger(position, ActionManager.triggers.get(payload.stringPayload[0]), false); - setAction(position, ActionManager.actions.get(payload.stringPayload[1]), false); + setTrigger(position, ActionManager.triggers.get(payload.stringPayload[0]), notify); + setAction(position, ActionManager.actions.get(payload.stringPayload[1]), notify); int itemID = payload.intPayload[1]; if (itemID <= 0) { - setTriggerParameter(position, null, false); + setTriggerParameter(position, null, notify); return; } ITriggerParameter param = new TriggerParameter(); param.set(new ItemStack(itemID, payload.intPayload[2], payload.intPayload[3])); - setTriggerParameter(position, param, false); + setTriggerParameter(position, param, notify); } - - private PacketPayload getSelectionPayload(int position){ + + private PacketPayload getSelectionPayload(int position) { PacketPayloadArrays payload = new PacketPayloadArrays(4, 0, 2); payload.intPayload[0] = position; - if (pipe.gate.actions[position] != null) { - payload.stringPayload[0] = pipe.gate.actions[position].getUniqueTag(); + if (pipe.gate.triggers[position] != null) { + payload.stringPayload[0] = pipe.gate.triggers[position].getUniqueTag(); } else { payload.stringPayload[0] = ""; } @@ -270,7 +268,7 @@ public class ContainerGateInterface extends BuildCraftContainer { int length = _potentialActions.size(); PacketPayloadArrays payload = new PacketPayloadArrays(1, 0, length); - payload.intPayload[1] = length; + payload.intPayload[0] = length; for (int i = 0; i < length; i++) { payload.stringPayload[i] = _potentialActions.get(i).getUniqueTag(); } @@ -358,7 +356,7 @@ public class ContainerGateInterface extends BuildCraftContainer { } public boolean isNearbyTriggerActive(ITrigger trigger, ITriggerParameter parameter) { - return pipe.gate != null && pipe.gate.isNearbyTriggerActive(trigger, parameter); + return pipe.gate.isNearbyTriggerActive(trigger, parameter); } public void setTrigger(int position, ITrigger trigger, boolean notify) { @@ -379,15 +377,15 @@ public class ContainerGateInterface extends BuildCraftContainer { * ACTIONS * */ public boolean hasActions() { - return _potentialActions.size() > 0; + return !_potentialActions.isEmpty(); } public IAction getFirstAction() { - return _potentialActions.size() > 0 ? _potentialActions.getFirst() : null; + return _potentialActions.peekFirst(); } public IAction getLastAction() { - return _potentialActions.size() > 0 ? _potentialActions.getLast() : null; + return _potentialActions.peekLast(); } public Iterator getActionIterator(boolean descending) { diff --git a/common/buildcraft/transport/network/PacketHandlerTransport.java b/common/buildcraft/transport/network/PacketHandlerTransport.java index c29d6c55..bc3bc5e8 100644 --- a/common/buildcraft/transport/network/PacketHandlerTransport.java +++ b/common/buildcraft/transport/network/PacketHandlerTransport.java @@ -155,7 +155,7 @@ public class PacketHandlerTransport implements IPacketHandler { if (!(container instanceof ContainerGateInterface)) return; - ((ContainerGateInterface) container).setSelection(packet); + ((ContainerGateInterface) container).setSelection(packet, false); } private void onPipeContentNBT(EntityPlayer player, PacketPipeTransportNBT packet) { @@ -258,7 +258,7 @@ public class PacketHandlerTransport implements IPacketHandler { if (!(playerEntity.openContainer instanceof ContainerGateInterface)) return; - ((ContainerGateInterface) playerEntity.openContainer).setSelection(packet); + ((ContainerGateInterface) playerEntity.openContainer).setSelection(packet, true); } /**