minor enhancements to pipe support in blueprints
This commit is contained in:
parent
ef2980ccc2
commit
a18f58f60c
2 changed files with 25 additions and 1 deletions
|
@ -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;
|
||||
|
|
|
@ -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()) {
|
||||
|
|
Loading…
Reference in a new issue