fixed behavior of redstone in blueprints, fix #1651

This commit is contained in:
SpaceToad 2014-04-30 20:44:21 +02:00
parent 5353198eaa
commit bdd646dbdd
2 changed files with 42 additions and 1 deletions

View file

@ -86,6 +86,7 @@ import buildcraft.builders.schematics.SchematicPortal;
import buildcraft.builders.schematics.SchematicPumpkin;
import buildcraft.builders.schematics.SchematicRail;
import buildcraft.builders.schematics.SchematicRedstoneDiode;
import buildcraft.builders.schematics.SchematicRedstoneWire;
import buildcraft.builders.schematics.SchematicRotateMeta;
import buildcraft.builders.schematics.SchematicSeeds;
import buildcraft.builders.schematics.SchematicSign;
@ -224,7 +225,7 @@ public class BuildCraftBuilders extends BuildCraftMod {
SchematicRegistry.registerSchematicBlock(Blocks.gravel, SchematicGravel.class);
SchematicRegistry.registerSchematicBlock(Blocks.redstone_wire, SchematicCustomStack.class, new ItemStack(Items.redstone));
SchematicRegistry.registerSchematicBlock(Blocks.redstone_wire, SchematicRedstoneWire.class, new ItemStack(Items.redstone));
SchematicRegistry.registerSchematicBlock(Blocks.cake, SchematicCustomStack.class, new ItemStack(Items.cake));
SchematicRegistry.registerSchematicBlock(Blocks.pumpkin_stem, SchematicCustomStack.class, new ItemStack(Items.pumpkin_seeds));
SchematicRegistry.registerSchematicBlock(Blocks.melon_stem, SchematicCustomStack.class, new ItemStack(Items.melon_seeds));

View file

@ -0,0 +1,40 @@
/**
* 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.builders.schematics;
import java.util.LinkedList;
import net.minecraft.item.ItemStack;
import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.api.blueprints.SchematicBlock;
public class SchematicRedstoneWire extends SchematicBlock {
final ItemStack customStack;
public SchematicRedstoneWire(ItemStack customStack) {
this.customStack = customStack;
}
@Override
public void addRequirements(IBuilderContext context, LinkedList<ItemStack> requirements) {
requirements.add(customStack.copy());
}
@Override
public void writeToWorld(IBuilderContext context, int x, int y, int z, LinkedList <ItemStack> stacks) {
context.world().setBlock(x, y, z, block, 0, 3);
}
@Override
public boolean isAlreadyBuilt(IBuilderContext context, int x, int y, int z) {
return block == context.world().getBlock(x, y, z);
}
}