diff --git a/common/buildcraft/BuildCraftFactory.java b/common/buildcraft/BuildCraftFactory.java index d60f32ff..d5672730 100644 --- a/common/buildcraft/BuildCraftFactory.java +++ b/common/buildcraft/BuildCraftFactory.java @@ -57,8 +57,6 @@ import buildcraft.factory.FactoryProxy; import buildcraft.factory.FactoryProxyClient; import buildcraft.factory.GuiHandler; import buildcraft.factory.PumpDimensionList; -import buildcraft.factory.SchematicRefinery; -import buildcraft.factory.SchematicTank; import buildcraft.factory.TileAutoWorkbench; import buildcraft.factory.TileFloodGate; import buildcraft.factory.TileHopper; @@ -68,6 +66,9 @@ import buildcraft.factory.TileQuarry; import buildcraft.factory.TileRefinery; import buildcraft.factory.TileTank; import buildcraft.factory.network.PacketHandlerFactory; +import buildcraft.factory.schematics.SchematicPump; +import buildcraft.factory.schematics.SchematicRefinery; +import buildcraft.factory.schematics.SchematicTank; @Mod(name = "BuildCraft Factory", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Factory", dependencies = DefaultProps.DEPENDENCY_CORE) public class BuildCraftFactory extends BuildCraftMod { @@ -150,6 +151,8 @@ public class BuildCraftFactory extends BuildCraftMod { SchematicRegistry.registerSchematicBlock(refineryBlock, SchematicRefinery.class); SchematicRegistry.registerSchematicBlock(tankBlock, SchematicTank.class); SchematicRegistry.registerSchematicBlock(frameBlock, SchematicIgnoreMeta.class); + SchematicRegistry.registerSchematicBlock(pumpBlock, SchematicPump.class); + SchematicRegistry.registerSchematicBlock(refineryBlock, SchematicRefinery.class); if (BuildCraftCore.loadDefaultRecipes) { loadRecipes(); diff --git a/common/buildcraft/factory/schematics/SchematicPump.java b/common/buildcraft/factory/schematics/SchematicPump.java new file mode 100755 index 00000000..10bb1748 --- /dev/null +++ b/common/buildcraft/factory/schematics/SchematicPump.java @@ -0,0 +1,48 @@ +/** + * 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.factory.schematics; + +import java.util.LinkedList; + +import net.minecraft.item.ItemStack; + +import buildcraft.BuildCraftFactory; +import buildcraft.api.blueprints.IBuilderContext; +import buildcraft.api.blueprints.SchematicTile; + +public class SchematicPump extends SchematicTile { + + @Override + public void writeRequirementsToWorld(IBuilderContext context, LinkedList requirements) { + requirements.add(new ItemStack(BuildCraftFactory.pumpBlock)); + } + + @Override + public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) { + + } + + @Override + public void writeToBlueprint(IBuilderContext context, int x, int y, int z) { + super.writeToBlueprint(context, x, y, z); + + tileNBT.removeTag("tank"); + tileNBT.removeTag("mjStored"); + } + + @Override + public void writeToWorld(IBuilderContext context, int x, int y, int z, LinkedList stacks) { + context.world().setBlock(x, y, z, block, 0, 3); + } + + @Override + public BuildingStage getBuildStage() { + return BuildingStage.STANDALONE; + } +} diff --git a/common/buildcraft/factory/SchematicRefinery.java b/common/buildcraft/factory/schematics/SchematicRefinery.java similarity index 57% rename from common/buildcraft/factory/SchematicRefinery.java rename to common/buildcraft/factory/schematics/SchematicRefinery.java index 173aa5dc..62cd83d0 100644 --- a/common/buildcraft/factory/SchematicRefinery.java +++ b/common/buildcraft/factory/schematics/SchematicRefinery.java @@ -6,7 +6,7 @@ * 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.factory; +package buildcraft.factory.schematics; import java.util.LinkedList; @@ -14,11 +14,22 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; +import buildcraft.BuildCraftFactory; import buildcraft.api.blueprints.IBuilderContext; import buildcraft.api.blueprints.SchematicTile; public class SchematicRefinery extends SchematicTile { + @Override + public void writeRequirementsToWorld(IBuilderContext context, LinkedList requirements) { + requirements.add(new ItemStack(BuildCraftFactory.refineryBlock)); + } + + @Override + public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) { + + } + @Override public void rotateLeft(IBuilderContext context) { meta = ForgeDirection.values()[meta].getRotation(ForgeDirection.UP).ordinal(); @@ -26,32 +37,23 @@ public class SchematicRefinery extends SchematicTile { @Override public void writeToBlueprint(IBuilderContext context, int x, int y, int z) { - TileRefinery refinery = (TileRefinery) context.world().getTileEntity(x, y, z); + super.writeToBlueprint(context, x, y, z); -// slot.cpt.setInteger("filter0", refinery.getFilter(0)); -// slot.cpt.setInteger("filter1", refinery.getFilter(1)); + tileNBT.removeTag("tank1"); + tileNBT.removeTag("tank2"); + tileNBT.removeTag("result"); + tileNBT.removeTag("mjStored"); } @Override public void writeToWorld(IBuilderContext context, int x, int y, int z, LinkedList stacks) { + // to support refineries coming from older blueprints + tileNBT.removeTag("tank1"); + tileNBT.removeTag("tank2"); + tileNBT.removeTag("result"); + tileNBT.removeTag("mjStored"); + super.writeToWorld(context, x, y, z, stacks); - - TileRefinery refinery = (TileRefinery) context.world().getTileEntity(x, y, z); - - int filter0 = tileNBT.getInteger("filter0"); - int filter1 = tileNBT.getInteger("filter1"); - int filterMeta0 = 0; - int filterMeta1 = 0; - - if (tileNBT.hasKey("filterMeta0")) { - filterMeta0 = tileNBT.getInteger("filterMeta0"); - } - if (tileNBT.hasKey("filterMeta1")) { - filterMeta1 = tileNBT.getInteger("filterMeta1"); - } - -// refinery.setFilter(0, filter0, filterMeta0); -// refinery.setFilter(1, filter1, filterMeta1); } } diff --git a/common/buildcraft/factory/SchematicTank.java b/common/buildcraft/factory/schematics/SchematicTank.java similarity index 96% rename from common/buildcraft/factory/SchematicTank.java rename to common/buildcraft/factory/schematics/SchematicTank.java index edcb7084..37724fcc 100644 --- a/common/buildcraft/factory/SchematicTank.java +++ b/common/buildcraft/factory/schematics/SchematicTank.java @@ -6,7 +6,7 @@ * 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.factory; +package buildcraft.factory.schematics; import java.util.LinkedList;