From 2df8069c578252009b99e0a6bb77c94b1c9a89e1 Mon Sep 17 00:00:00 2001 From: Andrew Hill Date: Fri, 14 Sep 2012 07:37:57 +1000 Subject: [PATCH] correctly save and restore hasPulsar() tested by saving and restoring a std. aut. gate. --- common/buildcraft/transport/GateVanilla.java | 2 +- .../transport/blueprints/BptBlockPipe.java | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/common/buildcraft/transport/GateVanilla.java b/common/buildcraft/transport/GateVanilla.java index 9eca7dbd..ffb75f4b 100644 --- a/common/buildcraft/transport/GateVanilla.java +++ b/common/buildcraft/transport/GateVanilla.java @@ -74,7 +74,7 @@ public class GateVanilla extends Gate { } // / INFORMATION - private boolean hasPulser() { + public boolean hasPulser() { return pulser != null; } diff --git a/common/buildcraft/transport/blueprints/BptBlockPipe.java b/common/buildcraft/transport/blueprints/BptBlockPipe.java index cc32692a..6692a537 100644 --- a/common/buildcraft/transport/blueprints/BptBlockPipe.java +++ b/common/buildcraft/transport/blueprints/BptBlockPipe.java @@ -55,7 +55,10 @@ public class BptBlockPipe extends BptBlock { if (slot.cpt.hasKey("gate")) { int gateId = slot.cpt.getInteger("gate"); - requirements.add(new ItemStack(BuildCraftTransport.pipeGate, 1, gateId - 1)); + if(slot.cpt.hasKey("hasPulser") && slot.cpt.getBoolean("hasPulser")) + requirements.add(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, gateId - 1)); + else + requirements.add(new ItemStack(BuildCraftTransport.pipeGate, 1, gateId - 1)); } if (BuildCraftCore.itemBptProps[pipeId] != null) @@ -93,8 +96,12 @@ public class BptBlockPipe extends BptBlock { if (slot.cpt.hasKey("gate")) { // / TODO: Does not save/load custom gates int gateId = slot.cpt.getInteger("gate"); - pipe.gate = new GateVanilla(pipe); - pipe.gate.kind = Gate.GateKind.values()[gateId]; + GateVanilla newGate; + if(slot.cpt.hasKey("hasPulser") && slot.cpt.getBoolean("hasPulser")) + newGate= new GateVanilla(pipe,new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, gateId - 1)); + else + newGate= new GateVanilla(pipe,new ItemStack(BuildCraftTransport.pipeGate, 1, gateId - 1)); + pipe.gate = newGate; for (int i = 0; i < 8; ++i) { if (slot.cpt.hasKey("trigger" + i)) @@ -134,6 +141,8 @@ public class BptBlockPipe extends BptBlock { // / TODO: Does not save/load custom gates if (pipe.hasGate()) { bptSlot.cpt.setInteger("gate", pipe.gate.kind.ordinal()); + if(pipe.gate instanceof GateVanilla) + bptSlot.cpt.setBoolean("hasPulser", ((GateVanilla)pipe.gate).hasPulser()); for (int i = 0; i < 8; ++i) { if (pipe.activatedTriggers[i] != null)