diff --git a/common/buildcraft/api/blueprints/MappingRegistry.java b/common/buildcraft/api/blueprints/MappingRegistry.java index fee588bc..1ebf601d 100755 --- a/common/buildcraft/api/blueprints/MappingRegistry.java +++ b/common/buildcraft/api/blueprints/MappingRegistry.java @@ -1,3 +1,11 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ package buildcraft.api.blueprints; import java.util.HashMap; diff --git a/common/buildcraft/transport/blueprints/BptBlockPipe.java b/common/buildcraft/transport/blueprints/BptBlockPipe.java index e9c9dc7e..4ea4689a 100644 --- a/common/buildcraft/transport/blueprints/BptBlockPipe.java +++ b/common/buildcraft/transport/blueprints/BptBlockPipe.java @@ -13,6 +13,7 @@ import java.util.LinkedList; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import buildcraft.BuildCraftTransport; import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.BptSlotInfo; @@ -48,6 +49,10 @@ public class BptBlockPipe extends BptBlock { requirements.add(new ItemStack(BuildCraftTransport.pipeWire, 1, 3)); } + if (slot.cpt.hasKey("gate")) { + requirements.add (ItemStack.loadItemStackFromNBT(slot.cpt.getCompoundTag("gate"))); + } + /*if (slot.cpt.hasKey("gate")) { int gateId = slot.cpt.getInteger("gate"); if (slot.cpt.hasKey("hasPulser") && slot.cpt.getBoolean("hasPulser")) { @@ -85,6 +90,7 @@ public class BptBlockPipe extends BptBlock { @Override public void buildBlock(BptSlotInfo slot, IBptContext context) { + // TODO: use directly an NBT built from the pipe here. int pipeId = slot.cpt.getInteger("pipeId"); Pipe pipe = BlockGenericPipe.createPipe(context.getMappingRegistry() @@ -96,6 +102,8 @@ public class BptBlockPipe extends BptBlock { } } + + /*if (slot.cpt.hasKey("gate")) { int gateId = slot.cpt.getInteger("gate"); GateVanilla newGate; @@ -143,10 +151,18 @@ public class BptBlockPipe extends BptBlock { bptSlot.cpt.setInteger("pipeId", context.getMappingRegistry() .getIdForItem(pipe.item)); - for (int i = 0; i < pipe.wireSet.length; ++i) + for (int i = 0; i < pipe.wireSet.length; ++i) { if (pipe.wireSet[i]) { bptSlot.cpt.setInteger("wire" + i, 1); } + } + + if (pipe.hasGate()) { + NBTTagCompound gateNBT = new NBTTagCompound(); + pipe.gate.getGateItem().writeToNBT(gateNBT); + bptSlot.cpt.setTag("gate", gateNBT); + } + // / TODO: Does not save/load custom gates /*if (pipe.hasGate()) {