refactored class names and some schematic functions

This commit is contained in:
SpaceToad 2014-03-05 20:42:44 +01:00
parent 12e215c611
commit 707e048eb8
45 changed files with 348 additions and 362 deletions

View file

@ -18,26 +18,26 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property; import net.minecraftforge.common.config.Property;
import buildcraft.api.blueprints.BlueprintManager; import buildcraft.api.blueprints.BlueprintManager;
import buildcraft.api.bptblocks.BptBlockBed;
import buildcraft.api.bptblocks.BptBlockCustomStack;
import buildcraft.api.bptblocks.BptBlockDirt;
import buildcraft.api.bptblocks.BptBlockDoor;
import buildcraft.api.bptblocks.BptBlockFluid;
import buildcraft.api.bptblocks.BptBlockIgnore;
import buildcraft.api.bptblocks.BptBlockIgnoreMeta;
import buildcraft.api.bptblocks.BptBlockInventory;
import buildcraft.api.bptblocks.BptBlockLever;
import buildcraft.api.bptblocks.BptBlockPiston;
import buildcraft.api.bptblocks.BptBlockPumpkin;
import buildcraft.api.bptblocks.BptBlockRedstoneRepeater;
import buildcraft.api.bptblocks.BptBlockRotateInventory;
import buildcraft.api.bptblocks.BptBlockRotateMeta;
import buildcraft.api.bptblocks.BptBlockSign;
import buildcraft.api.bptblocks.BptBlockStairs;
import buildcraft.api.bptblocks.BptBlockWallSide;
import buildcraft.api.filler.FillerManager; import buildcraft.api.filler.FillerManager;
import buildcraft.api.filler.IFillerPattern; import buildcraft.api.filler.IFillerPattern;
import buildcraft.api.gates.ActionManager; import buildcraft.api.gates.ActionManager;
import buildcraft.api.schematics.SchematicBed;
import buildcraft.api.schematics.SchematicCustomStack;
import buildcraft.api.schematics.SchematicDirt;
import buildcraft.api.schematics.SchematicDoor;
import buildcraft.api.schematics.SchematicFluid;
import buildcraft.api.schematics.SchematicIgnore;
import buildcraft.api.schematics.SchematicIgnoreMeta;
import buildcraft.api.schematics.SchematicInventory;
import buildcraft.api.schematics.SchematicLever;
import buildcraft.api.schematics.SchematicPiston;
import buildcraft.api.schematics.SchematicPumpkin;
import buildcraft.api.schematics.SchematicRedstoneRepeater;
import buildcraft.api.schematics.SchematicRotateInventory;
import buildcraft.api.schematics.SchematicRotateMeta;
import buildcraft.api.schematics.SchematicSign;
import buildcraft.api.schematics.SchematicStairs;
import buildcraft.api.schematics.SchematicWallSide;
import buildcraft.builders.BlockArchitect; import buildcraft.builders.BlockArchitect;
import buildcraft.builders.BlockBlueprintLibrary; import buildcraft.builders.BlockBlueprintLibrary;
import buildcraft.builders.BlockBuilder; import buildcraft.builders.BlockBuilder;
@ -141,85 +141,85 @@ public class BuildCraftBuilders extends BuildCraftMod {
// Register save handler // Register save handler
MinecraftForge.EVENT_BUS.register(new EventHandlerBuilders()); MinecraftForge.EVENT_BUS.register(new EventHandlerBuilders());
BlueprintManager.registerSchematicClass(Blocks.snow, BptBlockIgnore.class); BlueprintManager.registerSchematicClass(Blocks.snow, SchematicIgnore.class);
BlueprintManager.registerSchematicClass(Blocks.tallgrass, BptBlockIgnore.class); BlueprintManager.registerSchematicClass(Blocks.tallgrass, SchematicIgnore.class);
BlueprintManager.registerSchematicClass(Blocks.ice, BptBlockIgnore.class); BlueprintManager.registerSchematicClass(Blocks.ice, SchematicIgnore.class);
BlueprintManager.registerSchematicClass(Blocks.piston_head, BptBlockIgnore.class); BlueprintManager.registerSchematicClass(Blocks.piston_head, SchematicIgnore.class);
BlueprintManager.registerSchematicClass(Blocks.dirt, BptBlockDirt.class); BlueprintManager.registerSchematicClass(Blocks.dirt, SchematicDirt.class);
BlueprintManager.registerSchematicClass(Blocks.grass, BptBlockDirt.class); BlueprintManager.registerSchematicClass(Blocks.grass, SchematicDirt.class);
BlueprintManager.registerSchematicClass(Blocks.farmland, BptBlockDirt.class); BlueprintManager.registerSchematicClass(Blocks.farmland, SchematicDirt.class);
BlueprintManager.registerSchematicClass(Blocks.torch, BptBlockWallSide.class); BlueprintManager.registerSchematicClass(Blocks.torch, SchematicWallSide.class);
BlueprintManager.registerSchematicClass(Blocks.redstone_torch, BptBlockWallSide.class); BlueprintManager.registerSchematicClass(Blocks.redstone_torch, SchematicWallSide.class);
BlueprintManager.registerSchematicClass(Blocks.unlit_redstone_torch, BptBlockWallSide.class); BlueprintManager.registerSchematicClass(Blocks.unlit_redstone_torch, SchematicWallSide.class);
BlueprintManager.registerSchematicClass(Blocks.ladder, BptBlockRotateMeta.class, new int[]{2, 5, 3, 4}, true); BlueprintManager.registerSchematicClass(Blocks.ladder, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true);
BlueprintManager.registerSchematicClass(Blocks.fence_gate, BptBlockRotateMeta.class, new int[]{0, 1, 2, 3}, true); BlueprintManager.registerSchematicClass(Blocks.fence_gate, SchematicRotateMeta.class, new int[]{0, 1, 2, 3}, true);
BlueprintManager.registerSchematicClass(Blocks.furnace, BptBlockRotateInventory.class, new int[]{2, 5, 3, 4}, true); BlueprintManager.registerSchematicClass(Blocks.furnace, SchematicRotateInventory.class, new int[]{2, 5, 3, 4}, true);
BlueprintManager.registerSchematicClass(Blocks.lit_furnace, BptBlockRotateInventory.class, new int[]{2, 5, 3, 4}, true); BlueprintManager.registerSchematicClass(Blocks.lit_furnace, SchematicRotateInventory.class, new int[]{2, 5, 3, 4}, true);
BlueprintManager.registerSchematicClass(Blocks.chest, BptBlockRotateInventory.class, new int[]{2, 5, 3, 4}, true); BlueprintManager.registerSchematicClass(Blocks.chest, SchematicRotateInventory.class, new int[]{2, 5, 3, 4}, true);
BlueprintManager.registerSchematicClass(Blocks.dispenser, BptBlockRotateInventory.class, new int[]{2, 5, 3, 4}, true); BlueprintManager.registerSchematicClass(Blocks.dispenser, SchematicRotateInventory.class, new int[]{2, 5, 3, 4}, true);
BlueprintManager.registerSchematicClass(Blocks.brewing_stand, BptBlockInventory.class); BlueprintManager.registerSchematicClass(Blocks.brewing_stand, SchematicInventory.class);
BlueprintManager.registerSchematicClass(Blocks.vine, BptBlockRotateMeta.class, new int[]{1, 4, 8, 2}, false); BlueprintManager.registerSchematicClass(Blocks.vine, SchematicRotateMeta.class, new int[]{1, 4, 8, 2}, false);
BlueprintManager.registerSchematicClass(Blocks.trapdoor, BptBlockRotateMeta.class, new int[]{0, 1, 2, 3}, false); BlueprintManager.registerSchematicClass(Blocks.trapdoor, SchematicRotateMeta.class, new int[]{0, 1, 2, 3}, false);
BlueprintManager.registerSchematicClass(Blocks.wooden_button, BptBlockLever.class); BlueprintManager.registerSchematicClass(Blocks.wooden_button, SchematicLever.class);
BlueprintManager.registerSchematicClass(Blocks.stone_button, BptBlockLever.class); BlueprintManager.registerSchematicClass(Blocks.stone_button, SchematicLever.class);
BlueprintManager.registerSchematicClass(Blocks.lever, BptBlockLever.class); BlueprintManager.registerSchematicClass(Blocks.lever, SchematicLever.class);
BlueprintManager.registerSchematicClass(Blocks.stone, BptBlockCustomStack.class, new ItemStack(Blocks.stone)); BlueprintManager.registerSchematicClass(Blocks.stone, SchematicCustomStack.class, new ItemStack(Blocks.stone));
BlueprintManager.registerSchematicClass(Blocks.redstone_wire, BptBlockCustomStack.class, new ItemStack(Items.redstone)); BlueprintManager.registerSchematicClass(Blocks.redstone_wire, SchematicCustomStack.class, new ItemStack(Items.redstone));
BlueprintManager.registerSchematicClass(Blocks.cake, BptBlockCustomStack.class, new ItemStack(Items.cake)); BlueprintManager.registerSchematicClass(Blocks.cake, SchematicCustomStack.class, new ItemStack(Items.cake));
//new BptBlockCustomStack(Blocks.crops.blockID, new ItemStack(Items.seeds)); //new BptBlockCustomStack(Blocks.crops.blockID, new ItemStack(Items.seeds));
BlueprintManager.registerSchematicClass(Blocks.pumpkin_stem, BptBlockCustomStack.class, new ItemStack(Items.pumpkin_seeds)); BlueprintManager.registerSchematicClass(Blocks.pumpkin_stem, SchematicCustomStack.class, new ItemStack(Items.pumpkin_seeds));
BlueprintManager.registerSchematicClass(Blocks.melon_stem, BptBlockCustomStack.class, new ItemStack(Items.melon_seeds)); BlueprintManager.registerSchematicClass(Blocks.melon_stem, SchematicCustomStack.class, new ItemStack(Items.melon_seeds));
BlueprintManager.registerSchematicClass(Blocks.glowstone, BptBlockCustomStack.class, new ItemStack(Blocks.glowstone)); BlueprintManager.registerSchematicClass(Blocks.glowstone, SchematicCustomStack.class, new ItemStack(Blocks.glowstone));
BlueprintManager.registerSchematicClass(Blocks.powered_repeater, BptBlockRedstoneRepeater.class); BlueprintManager.registerSchematicClass(Blocks.powered_repeater, SchematicRedstoneRepeater.class);
BlueprintManager.registerSchematicClass(Blocks.unpowered_repeater, BptBlockRedstoneRepeater.class); BlueprintManager.registerSchematicClass(Blocks.unpowered_repeater, SchematicRedstoneRepeater.class);
BlueprintManager.registerSchematicClass(Blocks.water, BptBlockFluid.class, new ItemStack(Items.water_bucket)); BlueprintManager.registerSchematicClass(Blocks.water, SchematicFluid.class, new ItemStack(Items.water_bucket));
BlueprintManager.registerSchematicClass(Blocks.flowing_water, BptBlockFluid.class, new ItemStack(Items.water_bucket)); BlueprintManager.registerSchematicClass(Blocks.flowing_water, SchematicFluid.class, new ItemStack(Items.water_bucket));
BlueprintManager.registerSchematicClass(Blocks.lava, BptBlockFluid.class, new ItemStack(Items.lava_bucket)); BlueprintManager.registerSchematicClass(Blocks.lava, SchematicFluid.class, new ItemStack(Items.lava_bucket));
BlueprintManager.registerSchematicClass(Blocks.flowing_lava, BptBlockFluid.class, new ItemStack(Items.lava_bucket)); BlueprintManager.registerSchematicClass(Blocks.flowing_lava, SchematicFluid.class, new ItemStack(Items.lava_bucket));
BlueprintManager.registerSchematicClass(Blocks.rail, BptBlockIgnoreMeta.class); BlueprintManager.registerSchematicClass(Blocks.rail, SchematicIgnoreMeta.class);
BlueprintManager.registerSchematicClass(Blocks.detector_rail, BptBlockIgnoreMeta.class); BlueprintManager.registerSchematicClass(Blocks.detector_rail, SchematicIgnoreMeta.class);
BlueprintManager.registerSchematicClass(Blocks.glass_pane, BptBlockIgnoreMeta.class); BlueprintManager.registerSchematicClass(Blocks.glass_pane, SchematicIgnoreMeta.class);
BlueprintManager.registerSchematicClass(Blocks.piston, BptBlockPiston.class); BlueprintManager.registerSchematicClass(Blocks.piston, SchematicPiston.class);
BlueprintManager.registerSchematicClass(Blocks.piston_extension, BptBlockPiston.class); BlueprintManager.registerSchematicClass(Blocks.piston_extension, SchematicPiston.class);
BlueprintManager.registerSchematicClass(Blocks.sticky_piston, BptBlockPiston.class); BlueprintManager.registerSchematicClass(Blocks.sticky_piston, SchematicPiston.class);
BlueprintManager.registerSchematicClass(Blocks.lit_pumpkin, BptBlockPumpkin.class); BlueprintManager.registerSchematicClass(Blocks.lit_pumpkin, SchematicPumpkin.class);
BlueprintManager.registerSchematicClass(Blocks.stone_stairs, BptBlockStairs.class); BlueprintManager.registerSchematicClass(Blocks.stone_stairs, SchematicStairs.class);
BlueprintManager.registerSchematicClass(Blocks.oak_stairs, BptBlockStairs.class); BlueprintManager.registerSchematicClass(Blocks.oak_stairs, SchematicStairs.class);
BlueprintManager.registerSchematicClass(Blocks.nether_brick_stairs, BptBlockStairs.class); BlueprintManager.registerSchematicClass(Blocks.nether_brick_stairs, SchematicStairs.class);
BlueprintManager.registerSchematicClass(Blocks.brick_stairs, BptBlockStairs.class); BlueprintManager.registerSchematicClass(Blocks.brick_stairs, SchematicStairs.class);
BlueprintManager.registerSchematicClass(Blocks.stone_brick_stairs, BptBlockStairs.class); BlueprintManager.registerSchematicClass(Blocks.stone_brick_stairs, SchematicStairs.class);
BlueprintManager.registerSchematicClass(Blocks.wooden_button, BptBlockDoor.class, new ItemStack(Items.wooden_door)); BlueprintManager.registerSchematicClass(Blocks.wooden_button, SchematicDoor.class, new ItemStack(Items.wooden_door));
BlueprintManager.registerSchematicClass(Blocks.iron_door, BptBlockDoor.class, new ItemStack(Items.iron_door)); BlueprintManager.registerSchematicClass(Blocks.iron_door, SchematicDoor.class, new ItemStack(Items.iron_door));
BlueprintManager.registerSchematicClass(Blocks.bed, BptBlockBed.class); BlueprintManager.registerSchematicClass(Blocks.bed, SchematicBed.class);
BlueprintManager.registerSchematicClass(Blocks.wall_sign, BptBlockSign.class, true); BlueprintManager.registerSchematicClass(Blocks.wall_sign, SchematicSign.class, true);
BlueprintManager.registerSchematicClass(Blocks.standing_sign, BptBlockSign.class, false); BlueprintManager.registerSchematicClass(Blocks.standing_sign, SchematicSign.class, false);
// BUILDCRAFT BLOCKS // BUILDCRAFT BLOCKS
BlueprintManager.registerSchematicClass(architectBlock, BptBlockRotateInventory.class, new int[]{2, 5, 3, 4}, true); BlueprintManager.registerSchematicClass(architectBlock, SchematicRotateInventory.class, new int[]{2, 5, 3, 4}, true);
BlueprintManager.registerSchematicClass(builderBlock, BptBlockRotateInventory.class, new int[]{2, 5, 3, 4}, true); BlueprintManager.registerSchematicClass(builderBlock, SchematicRotateInventory.class, new int[]{2, 5, 3, 4}, true);
BlueprintManager.registerSchematicClass(libraryBlock, BptBlockInventory.class); BlueprintManager.registerSchematicClass(libraryBlock, SchematicInventory.class);
BlueprintManager.registerSchematicClass(markerBlock, BptBlockWallSide.class); BlueprintManager.registerSchematicClass(markerBlock, SchematicWallSide.class);
BlueprintManager.registerSchematicClass(pathMarkerBlock, BptBlockWallSide.class); BlueprintManager.registerSchematicClass(pathMarkerBlock, SchematicWallSide.class);
if (BuildCraftCore.loadDefaultRecipes) { if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes(); loadRecipes();

View file

@ -40,7 +40,7 @@ import buildcraft.energy.BlockBuildcraftFluid;
import buildcraft.energy.BlockEnergyEmitter; import buildcraft.energy.BlockEnergyEmitter;
import buildcraft.energy.BlockEnergyReceiver; import buildcraft.energy.BlockEnergyReceiver;
import buildcraft.energy.BlockEngine; import buildcraft.energy.BlockEngine;
import buildcraft.energy.BptBlockEngine; import buildcraft.energy.SchematicEngine;
import buildcraft.energy.EnergyProxy; import buildcraft.energy.EnergyProxy;
import buildcraft.energy.GuiHandler; import buildcraft.energy.GuiHandler;
import buildcraft.energy.ItemBucketBuildcraft; import buildcraft.energy.ItemBucketBuildcraft;
@ -251,7 +251,7 @@ public class BuildCraftEnergy extends BuildCraftMod {
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler()); NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
BlueprintManager.registerSchematicClass(engineBlock, BptBlockEngine.class); BlueprintManager.registerSchematicClass(engineBlock, SchematicEngine.class);
if (BuildCraftCore.loadDefaultRecipes) { if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes(); loadRecipes();

View file

@ -38,10 +38,10 @@ import buildcraft.factory.BlockPump;
import buildcraft.factory.BlockQuarry; import buildcraft.factory.BlockQuarry;
import buildcraft.factory.BlockRefinery; import buildcraft.factory.BlockRefinery;
import buildcraft.factory.BlockTank; import buildcraft.factory.BlockTank;
import buildcraft.factory.BptBlockAutoWorkbench; import buildcraft.factory.SchematicAutoWorkbench;
import buildcraft.factory.BptBlockFrame; import buildcraft.factory.SchematicFrame;
import buildcraft.factory.BptBlockRefinery; import buildcraft.factory.SchematicRefinery;
import buildcraft.factory.BptBlockTank; import buildcraft.factory.SchematicTank;
import buildcraft.factory.FactoryProxy; import buildcraft.factory.FactoryProxy;
import buildcraft.factory.FactoryProxyClient; import buildcraft.factory.FactoryProxyClient;
import buildcraft.factory.GuiHandler; import buildcraft.factory.GuiHandler;
@ -146,10 +146,10 @@ public class BuildCraftFactory extends BuildCraftMod {
FactoryProxy.proxy.initializeTileEntities(); FactoryProxy.proxy.initializeTileEntities();
BlueprintManager.registerSchematicClass(autoWorkbenchBlock, BptBlockAutoWorkbench.class); BlueprintManager.registerSchematicClass(autoWorkbenchBlock, SchematicAutoWorkbench.class);
BlueprintManager.registerSchematicClass(frameBlock, BptBlockFrame.class); BlueprintManager.registerSchematicClass(frameBlock, SchematicFrame.class);
BlueprintManager.registerSchematicClass(refineryBlock, BptBlockRefinery.class); BlueprintManager.registerSchematicClass(refineryBlock, SchematicRefinery.class);
BlueprintManager.registerSchematicClass(tankBlock, BptBlockTank.class); BlueprintManager.registerSchematicClass(tankBlock, SchematicTank.class);
if (BuildCraftCore.loadDefaultRecipes) { if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes(); loadRecipes();

View file

@ -16,9 +16,9 @@ import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import buildcraft.api.blueprints.BlueprintManager; import buildcraft.api.blueprints.BlueprintManager;
import buildcraft.api.bptblocks.BptBlockInventory;
import buildcraft.api.bptblocks.BptBlockRotateMeta;
import buildcraft.api.recipes.BuildcraftRecipes; import buildcraft.api.recipes.BuildcraftRecipes;
import buildcraft.api.schematics.SchematicInventory;
import buildcraft.api.schematics.SchematicRotateMeta;
import buildcraft.api.transport.PipeWire; import buildcraft.api.transport.PipeWire;
import buildcraft.core.DefaultProps; import buildcraft.core.DefaultProps;
import buildcraft.core.InterModComms; import buildcraft.core.InterModComms;
@ -94,8 +94,8 @@ public class BuildCraftSilicon extends BuildCraftMod {
CoreProxy.proxy.registerTileEntity(TileAdvancedCraftingTable.class, "net.minecraft.src.buildcraft.factory.TileAssemblyAdvancedWorkbench"); CoreProxy.proxy.registerTileEntity(TileAdvancedCraftingTable.class, "net.minecraft.src.buildcraft.factory.TileAssemblyAdvancedWorkbench");
CoreProxy.proxy.registerTileEntity(TileIntegrationTable.class, "net.minecraft.src.buildcraft.factory.TileIntegrationTable"); CoreProxy.proxy.registerTileEntity(TileIntegrationTable.class, "net.minecraft.src.buildcraft.factory.TileIntegrationTable");
BlueprintManager.registerSchematicClass(laserBlock, BptBlockRotateMeta.class, new int[]{2, 5, 3, 4}, true); BlueprintManager.registerSchematicClass(laserBlock, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true);
BlueprintManager.registerSchematicClass(assemblyTableBlock, BptBlockInventory.class); BlueprintManager.registerSchematicClass(assemblyTableBlock, SchematicInventory.class);
if (BuildCraftCore.loadDefaultRecipes) { if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes(); loadRecipes();

View file

@ -52,7 +52,7 @@ import buildcraft.transport.PipeIconProvider;
import buildcraft.transport.PipeTriggerProvider; import buildcraft.transport.PipeTriggerProvider;
import buildcraft.transport.TransportProxy; import buildcraft.transport.TransportProxy;
import buildcraft.transport.WireIconProvider; import buildcraft.transport.WireIconProvider;
import buildcraft.transport.blueprints.BptBlockPipe; import buildcraft.transport.blueprints.SchematicPipe;
import buildcraft.transport.blueprints.BptItemPipeFilters; import buildcraft.transport.blueprints.BptItemPipeFilters;
import buildcraft.transport.blueprints.BptPipeIron; import buildcraft.transport.blueprints.BptPipeIron;
import buildcraft.transport.blueprints.BptPipeWooden; import buildcraft.transport.blueprints.BptPipeWooden;
@ -430,7 +430,7 @@ public class BuildCraftTransport extends BuildCraftMod {
TransportProxy.proxy.registerTileEntities(); TransportProxy.proxy.registerTileEntities();
BlueprintManager.registerSchematicClass(genericPipeBlock, BptBlockPipe.class); BlueprintManager.registerSchematicClass(genericPipeBlock, SchematicPipe.class);
new BptPipeIron(pipeItemsIron); new BptPipeIron(pipeItemsIron);
new BptPipeIron(pipeFluidsIron); new BptPipeIron(pipeFluidsIron);

View file

@ -31,14 +31,14 @@ public class BlueprintManager {
schematicClasses.put(block, c); schematicClasses.put(block, c);
} }
public static BptBlock newSchematic (Block block) { public static Schematic newSchematic (Block block) {
if (!schematicClasses.containsKey(block)) { if (!schematicClasses.containsKey(block)) {
registerSchematicClass(block, BptBlock.class); registerSchematicClass(block, Schematic.class);
} }
try { try {
SchematicConstructor c = schematicClasses.get(block); SchematicConstructor c = schematicClasses.get(block);
return (BptBlock) c.clas.getConstructors() [0].newInstance(c.params); return (Schematic) c.clas.getConstructors() [0].newInstance(c.params);
} catch (InstantiationException e) { } catch (InstantiationException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();

View file

@ -16,7 +16,7 @@ import buildcraft.api.core.Position;
* This interface provide contextual information when building or initializing * This interface provide contextual information when building or initializing
* blueprint slots. * blueprint slots.
*/ */
public interface IBptContext { public interface IBuilderContext {
public Position rotatePositionLeft(Position pos); public Position rotatePositionLeft(Position pos);

View file

@ -30,22 +30,12 @@ import buildcraft.core.utils.Utils;
* load in the blueprint * load in the blueprint
* *
* Default implementations of this can be seen in the package * Default implementations of this can be seen in the package
* buildcraft.api.bptblocks. The class BptBlockUtils provide some additional * buildcraft.api.schematics. The class SchematicUtils provide some additional
* utilities. * utilities.
* *
* Blueprints perform "id translation" in case the block ids between a blueprint * Blueprints perform "id translation" in case the block ids between a blueprint
* and the world installation are different. In order to translate block ids, * and the world installation are different. Mapping is done through the
* blocks needs to be uniquely identified. By default, this identification is * builder context.
* done by:
*
* - the block simple class name - the tile simple class name (if any) - the
* block name
*
* In certain circumstances, the above is not enough (e.g. if several blocks
* share the same class and the same name, with no tile). In this case,
* additional data may be provided by children of this class:
*
* - mod name - custom signature
* *
* At blueprint load time, BuildCraft will check that each block id of the * At blueprint load time, BuildCraft will check that each block id of the
* blueprint corresponds to the block id in the installation. If not, it will * blueprint corresponds to the block id in the installation. If not, it will
@ -54,7 +44,7 @@ import buildcraft.core.utils.Utils;
* such block id is found, BuildCraft will assume that the block is not * such block id is found, BuildCraft will assume that the block is not
* installed and will not load the blueprint. * installed and will not load the blueprint.
*/ */
public class BptBlock { public class Schematic {
public Block block = null; public Block block = null;
public int x, y, z, meta = 0; public int x, y, z, meta = 0;
@ -62,13 +52,13 @@ public class BptBlock {
/** /**
* This field contains requirements for a given block when stored in the * This field contains requirements for a given block when stored in the
* blueprint. Modders can either rely on this list or compute their own int * blueprint. Modders can either rely on this list or compute their own int
* BptBlock. * Schematic.
*/ */
public ArrayList<ItemStack> storedRequirements = new ArrayList<ItemStack>(); public ArrayList<ItemStack> storedRequirements = new ArrayList<ItemStack>();
/** /**
* This tree contains additional data to be stored in the blueprint. By * This tree contains additional data to be stored in the blueprint. By
* default, it will be initialized from BptBlock.initializeFromWorld with * default, it will be initialized from Schematic.readFromWord with
* the standard readNBT function of the corresponding tile (if any) and will * the standard readNBT function of the corresponding tile (if any) and will
* be loaded from BptBlock.buildBlock using the standard writeNBT function. * be loaded from BptBlock.buildBlock using the standard writeNBT function.
*/ */
@ -82,8 +72,8 @@ public class BptBlock {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public BptBlock clone() { public Schematic clone() {
BptBlock obj = BlueprintManager.newSchematic(block); Schematic obj = BlueprintManager.newSchematic(block);
obj.x = x; obj.x = x;
obj.y = y; obj.y = y;
@ -97,7 +87,7 @@ public class BptBlock {
return obj; return obj;
} }
public final LinkedList<ItemStack> getRequirements(IBptContext context) { public final LinkedList<ItemStack> getRequirements(IBuilderContext context) {
LinkedList<ItemStack> res = new LinkedList<ItemStack>(); LinkedList<ItemStack> res = new LinkedList<ItemStack>();
addRequirements(context, res); addRequirements(context, res);
@ -111,7 +101,7 @@ public class BptBlock {
* requirements are met, they will be removed all at once from the builder, * requirements are met, they will be removed all at once from the builder,
* before calling buildBlock. * before calling buildBlock.
*/ */
public void addRequirements(IBptContext context, LinkedList<ItemStack> requirements) { public void addRequirements(IBuilderContext context, LinkedList<ItemStack> requirements) {
if (block != null) { if (block != null) {
if (storedRequirements.size() != 0) { if (storedRequirements.size() != 0) {
requirements.addAll(storedRequirements); requirements.addAll(storedRequirements);
@ -138,7 +128,7 @@ public class BptBlock {
* returns: what was used (similer to req, but created from stack, so that * returns: what was used (similer to req, but created from stack, so that
* any NBT based differences are drawn from the correct source) * any NBT based differences are drawn from the correct source)
*/ */
public ItemStack useItem(IBptContext context, ItemStack req, ItemStack stack) { public ItemStack useItem(IBuilderContext context, ItemStack req, ItemStack stack) {
ItemStack result = stack.copy(); ItemStack result = stack.copy();
if (stack.isItemStackDamageable()) { if (stack.isItemStackDamageable()) {
if (req.getItemDamage() + stack.getItemDamage() <= stack.getMaxDamage()) { if (req.getItemDamage() + stack.getItemDamage() <= stack.getMaxDamage()) {
@ -176,21 +166,21 @@ public class BptBlock {
* the blueprint at the location given by the slot. By default, this * the blueprint at the location given by the slot. By default, this
* subprogram is permissive and doesn't take into account metadata. * subprogram is permissive and doesn't take into account metadata.
*/ */
public boolean isValid(IBptContext context) { public boolean isValid(IBuilderContext context) {
return block == context.world().getBlock(x, y, z) && meta == context.world().getBlockMetadata(x, y, z); return block == context.world().getBlock(x, y, z) && meta == context.world().getBlockMetadata(x, y, z);
} }
/** /**
* Perform a 90 degree rotation to the slot. * Perform a 90 degree rotation to the slot.
*/ */
public void rotateLeft(IBptContext context) { public void rotateLeft(IBuilderContext context) {
} }
/** /**
* Places the block in the world, at the location specified in the slot. * Places the block in the world, at the location specified in the slot.
*/ */
public void buildBlock(IBptContext context) { public void writeToWorld(IBuilderContext context) {
// Meta needs to be specified twice, depending on the block behavior // Meta needs to be specified twice, depending on the block behavior
context.world().setBlock(x, y, z, block, meta, 3); context.world().setBlock(x, y, z, block, meta, 3);
context.world().setBlockMetadataWithNotify(x, y, z, meta, 3); context.world().setBlockMetadataWithNotify(x, y, z, meta, 3);
@ -234,7 +224,7 @@ public class BptBlock {
* By default, if the block is a BlockContainer, tile information will be to * By default, if the block is a BlockContainer, tile information will be to
* save / load the block. * save / load the block.
*/ */
public void initializeFromWorld(IBptContext context, int x, int y, int z) { public void readFromWorld(IBuilderContext context, int x, int y, int z) {
if (block instanceof BlockContainer) { if (block instanceof BlockContainer) {
TileEntity tile = context.world().getTileEntity(x, y, z); TileEntity tile = context.world().getTileEntity(x, y, z);
@ -258,14 +248,10 @@ public class BptBlock {
* blocks. This may be useful to adjust variable depending on surrounding * blocks. This may be useful to adjust variable depending on surrounding
* blocks that may not be there already at initial building. * blocks that may not be there already at initial building.
*/ */
public void postProcessing(IBptContext context) { public void postProcessing(IBuilderContext context) {
} }
private boolean starMatch(String s1, String s2) {
return s1.equals("*") || s2.equals("*") || s1.equals(s2);
}
public void writeToNBT(NBTTagCompound nbt, MappingRegistry registry) { public void writeToNBT(NBTTagCompound nbt, MappingRegistry registry) {
nbt.setInteger("blockId", registry.getIdForBlock(block)); nbt.setInteger("blockId", registry.getIdForBlock(block));
nbt.setInteger("blockMeta", meta); nbt.setInteger("blockMeta", meta);

View file

@ -15,9 +15,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
public class BptBlockUtils { public class SchematicUtils {
public static void requestInventoryContents(BptBlock slot, IBptContext context, LinkedList<ItemStack> requirements) { public static void requestInventoryContents(Schematic slot, IBuilderContext context, LinkedList<ItemStack> requirements) {
ItemStack[] stacks = getItemStacks(slot, context); ItemStack[] stacks = getItemStacks(slot, context);
for (ItemStack stack : stacks) { for (ItemStack stack : stacks) {
@ -27,7 +27,7 @@ public class BptBlockUtils {
} }
} }
public static void initializeInventoryContents(BptBlock slot, IBptContext context, IInventory inventory) { public static void initializeInventoryContents(Schematic slot, IBuilderContext context, IInventory inventory) {
ItemStack[] stacks = new ItemStack[inventory.getSizeInventory()]; ItemStack[] stacks = new ItemStack[inventory.getSizeInventory()];
for (int i = 0; i < inventory.getSizeInventory(); ++i) { for (int i = 0; i < inventory.getSizeInventory(); ++i) {
@ -37,7 +37,7 @@ public class BptBlockUtils {
setItemStacks(slot, context, stacks); setItemStacks(slot, context, stacks);
} }
public static void buildInventoryContents(BptBlock slot, IBptContext context, IInventory inventory) { public static void buildInventoryContents(Schematic slot, IBuilderContext context, IInventory inventory) {
ItemStack[] stacks = getItemStacks(slot, context); ItemStack[] stacks = getItemStacks(slot, context);
for (int i = 0; i < stacks.length; ++i) { for (int i = 0; i < stacks.length; ++i) {
@ -45,7 +45,7 @@ public class BptBlockUtils {
} }
} }
public static ItemStack[] getItemStacks(BptBlock slot, IBptContext context) { public static ItemStack[] getItemStacks(Schematic slot, IBuilderContext context) {
NBTTagList list = (NBTTagList) slot.cpt.getTag("inv"); NBTTagList list = (NBTTagList) slot.cpt.getTag("inv");
if (list == null) { if (list == null) {
@ -65,7 +65,7 @@ public class BptBlockUtils {
return stacks; return stacks;
} }
public static void setItemStacks(BptBlock slot, IBptContext context, ItemStack[] stacks) { public static void setItemStacks(Schematic slot, IBuilderContext context, ItemStack[] stacks) {
NBTTagList nbttaglist = new NBTTagList(); NBTTagList nbttaglist = new NBTTagList();
for (ItemStack stack : stacks) { for (ItemStack stack : stacks) {

View file

@ -6,26 +6,26 @@
* License 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.schematics;
import java.util.LinkedList; import java.util.LinkedList;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
public class BptBlockBed extends BptBlock { public class SchematicBed extends Schematic {
@Override @Override
public void addRequirements(IBptContext context, LinkedList<ItemStack> requirements) { public void addRequirements(IBuilderContext context, LinkedList<ItemStack> requirements) {
if ((meta & 8) == 0) { if ((meta & 8) == 0) {
requirements.add(new ItemStack(Items.bed)); requirements.add(new ItemStack(Items.bed));
} }
} }
@Override @Override
public void rotateLeft(IBptContext context) { public void rotateLeft(IBuilderContext context) {
int orientation = (meta & 7); int orientation = (meta & 7);
int others = meta - orientation; int others = meta - orientation;
@ -46,7 +46,7 @@ public class BptBlockBed extends BptBlock {
} }
@Override @Override
public void buildBlock(IBptContext context) { public void writeToWorld(IBuilderContext context) {
if ((meta & 8) != 0) { if ((meta & 8) != 0) {
return; return;
} }

View file

@ -6,24 +6,24 @@
* License 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.schematics;
import java.util.LinkedList; import java.util.LinkedList;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
public class BptBlockCustomStack extends BptBlock { public class SchematicCustomStack extends Schematic {
final ItemStack customStack; final ItemStack customStack;
public BptBlockCustomStack(ItemStack customStack) { public SchematicCustomStack(ItemStack customStack) {
this.customStack = customStack; this.customStack = customStack;
} }
@Override @Override
public void addRequirements(IBptContext context, LinkedList<ItemStack> requirements) { public void addRequirements(IBuilderContext context, LinkedList<ItemStack> requirements) {
requirements.add(customStack.copy()); requirements.add(customStack.copy());
} }

View file

@ -6,30 +6,30 @@
* License 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.schematics;
import java.util.LinkedList; import java.util.LinkedList;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
public class BptBlockDirt extends BptBlock { public class SchematicDirt extends Schematic {
@Override @Override
public void addRequirements(IBptContext context, LinkedList<ItemStack> requirements) { public void addRequirements(IBuilderContext context, LinkedList<ItemStack> requirements) {
requirements.add(new ItemStack(Blocks.dirt)); requirements.add(new ItemStack(Blocks.dirt));
} }
@Override @Override
public void buildBlock(IBptContext context) { public void writeToWorld(IBuilderContext context) {
context.world().setBlock(x, y, z, Blocks.dirt, meta, 3); context.world().setBlock(x, y, z, Blocks.dirt, meta, 3);
} }
@Override @Override
public boolean isValid(IBptContext context) { public boolean isValid(IBuilderContext context) {
Block block = context.world().getBlock(x, y, z); Block block = context.world().getBlock(x, y, z);
return block == Blocks.dirt || block == Blocks.grass || block == Blocks.farmland; return block == Blocks.dirt || block == Blocks.grass || block == Blocks.farmland;

View file

@ -6,31 +6,31 @@
* License 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.schematics;
import java.util.LinkedList; import java.util.LinkedList;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
public class BptBlockDoor extends BptBlock { public class SchematicDoor extends Schematic {
final ItemStack stack; final ItemStack stack;
public BptBlockDoor(ItemStack stack) { public SchematicDoor(ItemStack stack) {
this.stack = stack; this.stack = stack;
} }
@Override @Override
public void addRequirements(IBptContext context, LinkedList<ItemStack> requirements) { public void addRequirements(IBuilderContext context, LinkedList<ItemStack> requirements) {
if ((meta & 8) == 0) { if ((meta & 8) == 0) {
requirements.add(stack.copy()); requirements.add(stack.copy());
} }
} }
@Override @Override
public void rotateLeft(IBptContext context) { public void rotateLeft(IBuilderContext context) {
int orientation = (meta & 3); int orientation = (meta & 3);
int others = meta - orientation; int others = meta - orientation;
@ -56,7 +56,7 @@ public class BptBlockDoor extends BptBlock {
} }
@Override @Override
public void buildBlock(IBptContext context) { public void writeToWorld(IBuilderContext context) {
context.world().setBlock(x, y, z, block, meta, 3); context.world().setBlock(x, y, z, block, meta, 3);
context.world().setBlock(x, y + 1, z, block, meta + 8, 3); context.world().setBlock(x, y + 1, z, block, meta + 8, 3);

View file

@ -6,31 +6,31 @@
* License 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.schematics;
import java.util.LinkedList; import java.util.LinkedList;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
public class BptBlockFluid extends BptBlock { public class SchematicFluid extends Schematic {
private final ItemStack bucketStack; private final ItemStack bucketStack;
public BptBlockFluid(ItemStack bucketStack) { public SchematicFluid(ItemStack bucketStack) {
this.bucketStack = bucketStack; this.bucketStack = bucketStack;
} }
@Override @Override
public void addRequirements(IBptContext context, LinkedList<ItemStack> requirements) { public void addRequirements(IBuilderContext context, LinkedList<ItemStack> requirements) {
if (meta == 0) { if (meta == 0) {
requirements.add(bucketStack.copy()); requirements.add(bucketStack.copy());
} }
} }
@Override @Override
public boolean isValid(IBptContext context) { public boolean isValid(IBuilderContext context) {
if (meta == 0) { if (meta == 0) {
return block == context.world().getBlock(x, y, z) && context.world().getBlockMetadata(x, y, z) == 0; return block == context.world().getBlock(x, y, z) && context.world().getBlockMetadata(x, y, z) == 0;
} else { } else {
@ -39,7 +39,7 @@ public class BptBlockFluid extends BptBlock {
} }
@Override @Override
public void rotateLeft(IBptContext context) { public void rotateLeft(IBuilderContext context) {
} }
@ -49,7 +49,7 @@ public class BptBlockFluid extends BptBlock {
} }
@Override @Override
public void buildBlock(IBptContext context) { public void writeToWorld(IBuilderContext context) {
if (meta == 0) { if (meta == 0) {
context.world().setBlock(x, y, z, block, 0,1); context.world().setBlock(x, y, z, block, 0,1);
} }

View file

@ -6,28 +6,28 @@
* License 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.schematics;
import java.util.LinkedList; import java.util.LinkedList;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
public class BptBlockIgnore extends BptBlock { public class SchematicIgnore extends Schematic {
@Override @Override
public void addRequirements(IBptContext context, LinkedList<ItemStack> requirements) { public void addRequirements(IBuilderContext context, LinkedList<ItemStack> requirements) {
requirements.add(new ItemStack(block, 0, 0)); requirements.add(new ItemStack(block, 0, 0));
} }
@Override @Override
public boolean isValid(IBptContext context) { public boolean isValid(IBuilderContext context) {
return true; return true;
} }
@Override @Override
public void rotateLeft(IBptContext context) { public void rotateLeft(IBuilderContext context) {
} }

View file

@ -6,23 +6,23 @@
* License 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.schematics;
import java.util.LinkedList; import java.util.LinkedList;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
public class BptBlockIgnoreMeta extends BptBlock { public class SchematicIgnoreMeta extends Schematic {
@Override @Override
public void addRequirements(IBptContext context, LinkedList<ItemStack> requirements) { public void addRequirements(IBuilderContext context, LinkedList<ItemStack> requirements) {
requirements.add(new ItemStack(block, 1, 0)); requirements.add(new ItemStack(block, 1, 0));
} }
@Override @Override
public boolean isValid(IBptContext context) { public boolean isValid(IBuilderContext context) {
return block == context.world().getBlock(x, y, z); return block == context.world().getBlock(x, y, z);
} }
} }

View file

@ -6,17 +6,17 @@
* License 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.schematics;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
public class BptBlockInventory extends BptBlock { public class SchematicInventory extends Schematic {
@Override @Override
public void buildBlock(IBptContext context) { public void writeToWorld(IBuilderContext context) {
super.buildBlock(context); super.writeToWorld(context);
IInventory inv = (IInventory) context.world().getTileEntity(x, y, z); IInventory inv = (IInventory) context.world().getTileEntity(x, y, z);

View file

@ -6,22 +6,22 @@
* License 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.schematics;
import java.util.LinkedList; import java.util.LinkedList;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
public class BptBlockLever extends BptBlockWallSide { public class SchematicLever extends SchematicWallSide {
@Override @Override
public void addRequirements(IBptContext context, LinkedList<ItemStack> requirements) { public void addRequirements(IBuilderContext context, LinkedList<ItemStack> requirements) {
//requirements.add(new ItemStack(slot.blockId, 1, 0)); //requirements.add(new ItemStack(slot.blockId, 1, 0));
} }
@Override @Override
public void rotateLeft(IBptContext context) { public void rotateLeft(IBuilderContext context) {
int status = meta - (meta & 7); int status = meta - (meta & 7);
meta -= status; meta -= status;

View file

@ -6,18 +6,18 @@
* License 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.schematics;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
public class BptBlockPiston extends BptBlockRotateMeta { public class SchematicPiston extends SchematicRotateMeta {
public BptBlockPiston() { public SchematicPiston() {
super(new int[] { 2, 5, 3, 4 }, true); super(new int[] { 2, 5, 3, 4 }, true);
} }
@Override @Override
public void buildBlock(IBptContext context) { public void writeToWorld(IBuilderContext context) {
int localMeta = meta & 7; int localMeta = meta & 7;
context.world().setBlock(x, y, z, block, localMeta, 3); context.world().setBlock(x, y, z, block, localMeta, 3);

View file

@ -6,37 +6,37 @@
* License 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.schematics;
import java.util.LinkedList; import java.util.LinkedList;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
public class BptBlockStairs extends BptBlock { public class SchematicPumpkin extends Schematic {
@Override @Override
public void addRequirements(IBptContext context, LinkedList<ItemStack> requirements) { public void addRequirements(IBuilderContext context, LinkedList<ItemStack> requirements) {
requirements.add(new ItemStack(block, 1, 0)); requirements.add(new ItemStack(block, 1, 0));
} }
@Override @Override
public boolean isValid(IBptContext context) { public boolean isValid(IBuilderContext context) {
return block == context.world().getBlock(x, y, z); return block == context.world().getBlock(x, y, z);
} }
@Override @Override
public void rotateLeft(IBptContext context) { public void rotateLeft(IBuilderContext context) {
switch (meta) { switch (meta) {
case 0: case 0:
meta = 2; meta = 1;
break; break;
case 1: case 1:
meta = 3; meta = 2;
break; break;
case 2: case 2:
meta = 1; meta = 3;
break; break;
case 3: case 3:
meta = 0; meta = 0;

View file

@ -6,24 +6,24 @@
* License 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.schematics;
import java.util.LinkedList; import java.util.LinkedList;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
public class BptBlockRedstoneRepeater extends BptBlock { public class SchematicRedstoneRepeater extends Schematic {
@Override @Override
public void addRequirements(IBptContext context, LinkedList<ItemStack> requirements) { public void addRequirements(IBuilderContext context, LinkedList<ItemStack> requirements) {
requirements.add(new ItemStack(Items.repeater)); requirements.add(new ItemStack(Items.repeater));
} }
@Override @Override
public void rotateLeft(IBptContext context) { public void rotateLeft(IBuilderContext context) {
int step = meta - (meta & 3); int step = meta - (meta & 3);
switch (meta - step) { switch (meta - step) {

View file

@ -6,21 +6,21 @@
* License 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.schematics;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
public class BptBlockRotateInventory extends BptBlockRotateMeta { public class SchematicRotateInventory extends SchematicRotateMeta {
public BptBlockRotateInventory(int[] rotations, boolean rotateForward) { public SchematicRotateInventory(int[] rotations, boolean rotateForward) {
super(rotations, rotateForward); super(rotations, rotateForward);
} }
@Override @Override
public void buildBlock(IBptContext context) { public void writeToWorld(IBuilderContext context) {
super.buildBlock(context); super.writeToWorld(context);
IInventory inv = (IInventory) context.world().getTileEntity(x, y, z); IInventory inv = (IInventory) context.world().getTileEntity(x, y, z);

View file

@ -6,22 +6,22 @@
* License 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.schematics;
import java.util.LinkedList; import java.util.LinkedList;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
public class BptBlockRotateMeta extends BptBlock { public class SchematicRotateMeta extends Schematic {
int[] rot; int[] rot;
boolean rotateForward; boolean rotateForward;
int infoMask = 0; int infoMask = 0;
public BptBlockRotateMeta(int[] rotations, boolean rotateForward) { public SchematicRotateMeta(int[] rotations, boolean rotateForward) {
rot = rotations; rot = rotations;
for (int element : rot) { for (int element : rot) {
@ -38,17 +38,17 @@ public class BptBlockRotateMeta extends BptBlock {
} }
@Override @Override
public void addRequirements(IBptContext context, LinkedList<ItemStack> requirements) { public void addRequirements(IBuilderContext context, LinkedList<ItemStack> requirements) {
requirements.add(new ItemStack(block, 1, 0)); requirements.add(new ItemStack(block, 1, 0));
} }
@Override @Override
public boolean isValid(IBptContext context) { public boolean isValid(IBuilderContext context) {
return block == context.world().getBlock(x, y, z); return block == context.world().getBlock(x, y, z);
} }
@Override @Override
public void rotateLeft(IBptContext context) { public void rotateLeft(IBuilderContext context) {
int pos = meta & infoMask; int pos = meta & infoMask;
int others = meta - pos; int others = meta - pos;

View file

@ -6,31 +6,31 @@
* License 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.schematics;
import java.util.LinkedList; import java.util.LinkedList;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
public class BptBlockSign extends BptBlock { public class SchematicSign extends Schematic {
boolean isWall; boolean isWall;
public BptBlockSign(boolean isWall) { public SchematicSign(boolean isWall) {
this.isWall = isWall; this.isWall = isWall;
} }
@Override @Override
public void addRequirements(IBptContext context, LinkedList<ItemStack> requirements) { public void addRequirements(IBuilderContext context, LinkedList<ItemStack> requirements) {
requirements.add(new ItemStack(Items.sign)); requirements.add(new ItemStack(Items.sign));
} }
@Override @Override
public void rotateLeft(IBptContext context) { public void rotateLeft(IBuilderContext context) {
if (!isWall) { if (!isWall) {
double angle = ((meta) * 360.0) / 16.0; double angle = ((meta) * 360.0) / 16.0;
angle += 90.0; angle += 90.0;

View file

@ -6,38 +6,38 @@
* License 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.schematics;
import java.util.LinkedList; import java.util.LinkedList;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
public class BptBlockPumpkin extends BptBlock { public class SchematicStairs extends Schematic {
@Override @Override
public void addRequirements(IBptContext context, LinkedList<ItemStack> requirements) { public void addRequirements(IBuilderContext context, LinkedList<ItemStack> requirements) {
requirements.add(new ItemStack(block, 1, 0)); requirements.add(new ItemStack(block, 1, 0));
} }
@Override @Override
public boolean isValid(IBptContext context) { public boolean isValid(IBuilderContext context) {
return block == context.world().getBlock(x, y, z); return block == context.world().getBlock(x, y, z);
} }
@Override @Override
public void rotateLeft(IBptContext context) { public void rotateLeft(IBuilderContext context) {
switch (meta) { switch (meta) {
case 0: case 0:
meta = 1;
break;
case 1:
meta = 2; meta = 2;
break; break;
case 2: case 1:
meta = 3; meta = 3;
break; break;
case 2:
meta = 1;
break;
case 3: case 3:
meta = 0; meta = 0;
break; break;

View file

@ -6,23 +6,23 @@
* License 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.schematics;
import java.util.LinkedList; import java.util.LinkedList;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
public class BptBlockWallSide extends BptBlock { public class SchematicWallSide extends Schematic {
@Override @Override
public void addRequirements(IBptContext context, LinkedList<ItemStack> requirements) { public void addRequirements(IBuilderContext context, LinkedList<ItemStack> requirements) {
requirements.add(new ItemStack(block, 1, 0)); requirements.add(new ItemStack(block, 1, 0));
} }
@Override @Override
public void rotateLeft(IBptContext context) { public void rotateLeft(IBuilderContext context) {
final int XPos = 2; final int XPos = 2;
final int XNeg = 1; final int XNeg = 1;
final int ZPos = 4; final int ZPos = 4;

View file

@ -1,3 +1,3 @@
@API(apiVersion="1.0",owner="BuildCraftAPI|blueprints",provides="BuildCraftAPI|bptblocks") @API(apiVersion="1.0",owner="BuildCraftAPI|blueprints",provides="BuildCraftAPI|bptblocks")
package buildcraft.api.bptblocks; package buildcraft.api.schematics;
import cpw.mods.fml.common.API; import cpw.mods.fml.common.API;

View file

@ -17,7 +17,7 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.BuildCraftBuilders; import buildcraft.BuildCraftBuilders;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.api.core.IAreaProvider; import buildcraft.api.core.IAreaProvider;
import buildcraft.core.Box; import buildcraft.core.Box;
import buildcraft.core.Box.Kind; import buildcraft.core.Box.Kind;
@ -157,7 +157,7 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
private BlueprintBase createBptBlueprint() { private BlueprintBase createBptBlueprint() {
Blueprint result = new Blueprint(box.sizeX(), box.sizeY(), box.sizeZ()); Blueprint result = new Blueprint(box.sizeX(), box.sizeY(), box.sizeZ());
IBptContext context = result.getContext(worldObj, box); IBuilderContext context = result.getContext(worldObj, box);
for (int x = box.xMin; x <= box.xMax; ++x) { for (int x = box.xMin; x <= box.xMax; ++x) {
for (int y = box.yMin; y <= box.yMax; ++y) { for (int y = box.yMin; y <= box.yMax; ++y) {

View file

@ -20,7 +20,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.BuildCraftBuilders; import buildcraft.BuildCraftBuilders;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.gates.IAction; import buildcraft.api.gates.IAction;
import buildcraft.api.power.IPowerReceptor; import buildcraft.api.power.IPowerReceptor;
import buildcraft.api.power.PowerHandler; import buildcraft.api.power.PowerHandler;
@ -637,10 +637,10 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory,
public void debugForceBlueprintCompletion () { public void debugForceBlueprintCompletion () {
if (bluePrintBuilder != null) { if (bluePrintBuilder != null) {
BptBlock slot = bluePrintBuilder.getNextBlock(worldObj, this); Schematic slot = bluePrintBuilder.getNextBlock(worldObj, this);
if (slot != null) { if (slot != null) {
slot.buildBlock(bluePrintBuilder.context); slot.writeToWorld(bluePrintBuilder.context);
} }
} }
} }

View file

@ -14,8 +14,8 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import buildcraft.api.blueprints.BlueprintManager; import buildcraft.api.blueprints.BlueprintManager;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.core.utils.BCLog; import buildcraft.core.utils.BCLog;
import buildcraft.core.utils.Utils; import buildcraft.core.utils.Utils;
@ -28,10 +28,10 @@ public class Blueprint extends BlueprintBase {
super(sizeX, sizeY, sizeZ); super(sizeX, sizeY, sizeZ);
} }
public void readFromWorld(IBptContext context, TileEntity anchorTile, int x, int y, int z) { public void readFromWorld(IBuilderContext context, TileEntity anchorTile, int x, int y, int z) {
Block block = anchorTile.getWorldObj().getBlock(x, y, z); Block block = anchorTile.getWorldObj().getBlock(x, y, z);
BptBlock slot = BlueprintManager.newSchematic(block); Schematic slot = BlueprintManager.newSchematic(block);
slot.x = (int) (x - context.surroundingBox().pMin().x); slot.x = (int) (x - context.surroundingBox().pMin().x);
slot.y = (int) (y - context.surroundingBox().pMin().y); slot.y = (int) (y - context.surroundingBox().pMin().y);
@ -44,7 +44,7 @@ public class Blueprint extends BlueprintBase {
} }
try { try {
slot.initializeFromWorld(context, x, y, z); slot.readFromWorld(context, x, y, z);
contents[slot.x][slot.y][slot.z] = slot; contents[slot.x][slot.y][slot.z] = slot;
} catch (Throwable t) { } catch (Throwable t) {
// Defensive code against errors in implementers // Defensive code against errors in implementers

View file

@ -12,7 +12,7 @@ import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
import buildcraft.api.blueprints.BlueprintManager; import buildcraft.api.blueprints.BlueprintManager;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.MappingRegistry; import buildcraft.api.blueprints.MappingRegistry;
import buildcraft.builders.blueprints.BlueprintId; import buildcraft.builders.blueprints.BlueprintId;
import buildcraft.core.Box; import buildcraft.core.Box;
@ -21,7 +21,7 @@ import buildcraft.core.utils.BCLog;
public abstract class BlueprintBase { public abstract class BlueprintBase {
public BptBlock contents[][][]; public Schematic contents[][][];
public int anchorX, anchorY, anchorZ; public int anchorX, anchorY, anchorZ;
public int sizeX, sizeY, sizeZ; public int sizeX, sizeY, sizeZ;
public BlueprintId id = new BlueprintId(); public BlueprintId id = new BlueprintId();
@ -33,7 +33,7 @@ public abstract class BlueprintBase {
} }
public BlueprintBase(int sizeX, int sizeY, int sizeZ) { public BlueprintBase(int sizeX, int sizeY, int sizeZ) {
contents = new BptBlock[sizeX][sizeY][sizeZ]; contents = new Schematic[sizeX][sizeY][sizeZ];
this.sizeX = sizeX; this.sizeX = sizeX;
this.sizeY = sizeY; this.sizeY = sizeY;
@ -56,7 +56,7 @@ public abstract class BlueprintBase {
} }
public void rotateLeft(BptContext context) { public void rotateLeft(BptContext context) {
BptBlock newContents[][][] = new BptBlock[sizeZ][sizeY][sizeX]; Schematic newContents[][][] = new Schematic[sizeZ][sizeY][sizeX];
for (int x = 0; x < sizeZ; ++x) { for (int x = 0; x < sizeZ; ++x) {
for (int y = 0; y < sizeY; ++y) { for (int y = 0; y < sizeY; ++y) {
@ -147,7 +147,7 @@ public abstract class BlueprintBase {
author = nbt.getString("author"); author = nbt.getString("author");
contents = new BptBlock [sizeX][sizeY][sizeZ]; contents = new Schematic [sizeX][sizeY][sizeZ];
try { try {
loadContents (nbt); loadContents (nbt);
@ -219,7 +219,7 @@ public abstract class BlueprintBase {
res.id = id; res.id = id;
res.author = author; res.author = author;
res.contents = new BptBlock[sizeX][sizeY][sizeZ]; res.contents = new Schematic[sizeX][sizeY][sizeZ];
res.mapping = mapping.clone (); res.mapping = mapping.clone ();

View file

@ -10,7 +10,7 @@ package buildcraft.core.blueprints;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World; import net.minecraft.world.World;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.core.IAreaProvider; import buildcraft.api.core.IAreaProvider;
import buildcraft.core.Box; import buildcraft.core.Box;
import buildcraft.core.IBuilderInventory; import buildcraft.core.IBuilderInventory;
@ -35,7 +35,7 @@ public abstract class BptBuilderBase implements IAreaProvider {
context = bluePrint.getContext(world, box); context = bluePrint.getContext(world, box);
} }
public abstract BptBlock getNextBlock(World world, IBuilderInventory inv); public abstract Schematic getNextBlock(World world, IBuilderInventory inv);
@Override @Override
public int xMin() { public int xMin() {

View file

@ -18,8 +18,8 @@ import java.util.Map.Entry;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldSettings.GameType; import net.minecraft.world.WorldSettings.GameType;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.BptBlock.Mode; import buildcraft.api.blueprints.Schematic.Mode;
import buildcraft.api.core.StackKey; import buildcraft.api.core.StackKey;
import buildcraft.core.IBuilderInventory; import buildcraft.core.IBuilderInventory;
import buildcraft.core.utils.BCLog; import buildcraft.core.utils.BCLog;
@ -27,11 +27,11 @@ import buildcraft.core.utils.BlockUtil;
public class BptBuilderBlueprint extends BptBuilderBase { public class BptBuilderBlueprint extends BptBuilderBase {
LinkedList<BptBlock> clearList = new LinkedList<BptBlock>(); LinkedList<Schematic> clearList = new LinkedList<Schematic>();
LinkedList<BptBlock> primaryList = new LinkedList<BptBlock>(); LinkedList<Schematic> primaryList = new LinkedList<Schematic>();
LinkedList<BptBlock> secondaryList = new LinkedList<BptBlock>(); LinkedList<Schematic> secondaryList = new LinkedList<Schematic>();
LinkedList<BptBlock> postProcessingList = new LinkedList<BptBlock>(); LinkedList<Schematic> postProcessingList = new LinkedList<Schematic>();
public LinkedList <ItemStack> neededItems = new LinkedList <ItemStack> (); public LinkedList <ItemStack> neededItems = new LinkedList <ItemStack> ();
@ -45,12 +45,12 @@ public class BptBuilderBlueprint extends BptBuilderBase {
int yCoord = j + y - bluePrint.anchorY; int yCoord = j + y - bluePrint.anchorY;
int zCoord = k + z - bluePrint.anchorZ; int zCoord = k + z - bluePrint.anchorZ;
BptBlock slot = bluePrint.contents[i][j][k]; Schematic slot = bluePrint.contents[i][j][k];
if (slot != null) { if (slot != null) {
slot = slot.clone(); slot = slot.clone();
} else { } else {
slot = new BptBlock(); slot = new Schematic();
slot.meta = 0; slot.meta = 0;
slot.block = null; slot.block = null;
} }
@ -74,12 +74,12 @@ public class BptBuilderBlueprint extends BptBuilderBase {
int yCoord = j + y - bluePrint.anchorY; int yCoord = j + y - bluePrint.anchorY;
int zCoord = k + z - bluePrint.anchorZ; int zCoord = k + z - bluePrint.anchorZ;
BptBlock slot = bluePrint.contents[i][j][k]; Schematic slot = bluePrint.contents[i][j][k];
if (slot != null) { if (slot != null) {
slot = slot.clone(); slot = slot.clone();
} else { } else {
slot = new BptBlock(); slot = new Schematic();
slot.meta = 0; slot.meta = 0;
slot.block = null; slot.block = null;
} }
@ -117,9 +117,9 @@ public class BptBuilderBlueprint extends BptBuilderBase {
} }
@Override @Override
public BptBlock getNextBlock(World world, IBuilderInventory inv) { public Schematic getNextBlock(World world, IBuilderInventory inv) {
if (clearList.size() != 0) { if (clearList.size() != 0) {
BptBlock slot = internalGetNextBlock(world, inv, clearList); Schematic slot = internalGetNextBlock(world, inv, clearList);
checkDone(); checkDone();
if (slot != null) { if (slot != null) {
@ -128,7 +128,7 @@ public class BptBuilderBlueprint extends BptBuilderBase {
} }
if (primaryList.size() != 0) { if (primaryList.size() != 0) {
BptBlock slot = internalGetNextBlock(world, inv, primaryList); Schematic slot = internalGetNextBlock(world, inv, primaryList);
checkDone(); checkDone();
if (slot != null) { if (slot != null) {
@ -137,7 +137,7 @@ public class BptBuilderBlueprint extends BptBuilderBase {
} }
if (secondaryList.size() != 0) { if (secondaryList.size() != 0) {
BptBlock slot = internalGetNextBlock(world, inv, secondaryList); Schematic slot = internalGetNextBlock(world, inv, secondaryList);
checkDone(); checkDone();
if (slot != null) { if (slot != null) {
@ -150,13 +150,13 @@ public class BptBuilderBlueprint extends BptBuilderBase {
return null; return null;
} }
public BptBlock internalGetNextBlock(World world, IBuilderInventory inv, LinkedList<BptBlock> list) { public Schematic internalGetNextBlock(World world, IBuilderInventory inv, LinkedList<Schematic> list) {
LinkedList<BptBlock> failSlots = new LinkedList<BptBlock>(); LinkedList<Schematic> failSlots = new LinkedList<Schematic>();
BptBlock result = null; Schematic result = null;
while (list.size() > 0) { while (list.size() > 0) {
BptBlock slot = list.removeFirst(); Schematic slot = list.removeFirst();
boolean getNext = false; boolean getNext = false;
@ -197,7 +197,7 @@ public class BptBuilderBlueprint extends BptBuilderBase {
return result; return result;
} }
public boolean checkRequirements(IBuilderInventory inv, BptBlock slot) { public boolean checkRequirements(IBuilderInventory inv, Schematic slot) {
if (slot.block == null) { if (slot.block == null) {
return true; return true;
} }
@ -258,7 +258,7 @@ public class BptBuilderBlueprint extends BptBuilderBase {
return true; return true;
} }
public void useRequirements(IBuilderInventory inv, BptBlock slot) { public void useRequirements(IBuilderInventory inv, Schematic slot) {
if (slot.block == null) { if (slot.block == null) {
return; return;
} }
@ -334,7 +334,7 @@ public class BptBuilderBlueprint extends BptBuilderBase {
HashMap <StackKey, Integer> computeStacks = new HashMap <StackKey, Integer> (); HashMap <StackKey, Integer> computeStacks = new HashMap <StackKey, Integer> ();
for (BptBlock slot : primaryList) { for (Schematic slot : primaryList) {
LinkedList<ItemStack> stacks = new LinkedList<ItemStack>(); LinkedList<ItemStack> stacks = new LinkedList<ItemStack>();
@ -365,7 +365,7 @@ public class BptBuilderBlueprint extends BptBuilderBase {
} }
} }
for (BptBlock slot : secondaryList) { for (Schematic slot : secondaryList) {
LinkedList<ItemStack> stacks = slot.getRequirements(context); LinkedList<ItemStack> stacks = slot.getRequirements(context);
for (ItemStack stack : stacks) { for (ItemStack stack : stacks) {
@ -414,7 +414,7 @@ public class BptBuilderBlueprint extends BptBuilderBase {
@Override @Override
public void postProcessing(World world) { public void postProcessing(World world) {
for (BptBlock s : postProcessingList) { for (Schematic s : postProcessingList) {
try { try {
s.postProcessing(context); s.postProcessing(context);
} catch (Throwable t) { } catch (Throwable t) {

View file

@ -11,14 +11,14 @@ package buildcraft.core.blueprints;
import java.util.LinkedList; import java.util.LinkedList;
import net.minecraft.world.World; import net.minecraft.world.World;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.BptBlock.Mode; import buildcraft.api.blueprints.Schematic.Mode;
import buildcraft.core.IBuilderInventory; import buildcraft.core.IBuilderInventory;
public class BptBuilderTemplate extends BptBuilderBase { public class BptBuilderTemplate extends BptBuilderBase {
LinkedList<BptBlock> clearList = new LinkedList<BptBlock>(); LinkedList<Schematic> clearList = new LinkedList<Schematic>();
LinkedList<BptBlock> buildList = new LinkedList<BptBlock>(); LinkedList<Schematic> buildList = new LinkedList<Schematic>();
public BptBuilderTemplate(BlueprintBase bluePrint, World world, int x, int y, int z) { public BptBuilderTemplate(BlueprintBase bluePrint, World world, int x, int y, int z) {
super(bluePrint, world, x, y, z); super(bluePrint, world, x, y, z);
@ -30,10 +30,10 @@ public class BptBuilderTemplate extends BptBuilderBase {
int yCoord = j + y - bluePrint.anchorY; int yCoord = j + y - bluePrint.anchorY;
int zCoord = k + z - bluePrint.anchorZ; int zCoord = k + z - bluePrint.anchorZ;
BptBlock slot = bluePrint.contents[i][j][k]; Schematic slot = bluePrint.contents[i][j][k];
if (slot == null || slot.block == null) { if (slot == null || slot.block == null) {
slot = new BptBlock(); slot = new Schematic();
slot.meta = 0; slot.meta = 0;
slot.block = null; slot.block = null;
slot.x = xCoord; slot.x = xCoord;
@ -55,12 +55,12 @@ public class BptBuilderTemplate extends BptBuilderBase {
int yCoord = j + y - bluePrint.anchorY; int yCoord = j + y - bluePrint.anchorY;
int zCoord = k + z - bluePrint.anchorZ; int zCoord = k + z - bluePrint.anchorZ;
BptBlock slot = bluePrint.contents[i][j][k]; Schematic slot = bluePrint.contents[i][j][k];
if (slot != null) { if (slot != null) {
slot = slot.clone(); slot = slot.clone();
} else { } else {
slot = new BptBlock(); slot = new Schematic();
slot.meta = 0; slot.meta = 0;
slot.block = null; slot.block = null;
} }
@ -88,9 +88,9 @@ public class BptBuilderTemplate extends BptBuilderBase {
} }
@Override @Override
public BptBlock getNextBlock(World world, IBuilderInventory inv) { public Schematic getNextBlock(World world, IBuilderInventory inv) {
if (clearList.size() != 0) { if (clearList.size() != 0) {
BptBlock slot = internalGetNextBlock(world, inv, clearList); Schematic slot = internalGetNextBlock(world, inv, clearList);
checkDone(); checkDone();
if (slot != null) { if (slot != null) {
@ -101,7 +101,7 @@ public class BptBuilderTemplate extends BptBuilderBase {
} }
if (buildList.size() != 0) { if (buildList.size() != 0) {
BptBlock slot = internalGetNextBlock(world, inv, buildList); Schematic slot = internalGetNextBlock(world, inv, buildList);
checkDone(); checkDone();
if (slot != null) { if (slot != null) {
@ -116,11 +116,11 @@ public class BptBuilderTemplate extends BptBuilderBase {
return null; return null;
} }
public BptBlock internalGetNextBlock(World world, IBuilderInventory inv, LinkedList<BptBlock> list) { public Schematic internalGetNextBlock(World world, IBuilderInventory inv, LinkedList<Schematic> list) {
BptBlock result = null; Schematic result = null;
while (list.size() > 0) { while (list.size() > 0) {
BptBlock slot = list.getFirst(); Schematic slot = list.getFirst();
// Note from CJ: I have no idea what this code is supposed to do, so I'm not touching it. // Note from CJ: I have no idea what this code is supposed to do, so I'm not touching it.
/*if (slot.blockId == world.getBlockId(slot.x, slot.y, slot.z)) { /*if (slot.blockId == world.getBlockId(slot.x, slot.y, slot.z)) {

View file

@ -9,13 +9,13 @@
package buildcraft.core.blueprints; package buildcraft.core.blueprints;
import net.minecraft.world.World; import net.minecraft.world.World;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.api.blueprints.MappingRegistry; import buildcraft.api.blueprints.MappingRegistry;
import buildcraft.api.core.IBox; import buildcraft.api.core.IBox;
import buildcraft.api.core.Position; import buildcraft.api.core.Position;
import buildcraft.core.Box; import buildcraft.core.Box;
public class BptContext implements IBptContext { public class BptContext implements IBuilderContext {
public Box box; public Box box;
public World world; public World world;

View file

@ -9,13 +9,13 @@
package buildcraft.energy; package buildcraft.energy;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
public class BptBlockEngine extends BptBlock { public class SchematicEngine extends Schematic {
@Override @Override
public void rotateLeft(IBptContext context) { public void rotateLeft(IBuilderContext context) {
int o = cpt.getInteger("orientation"); int o = cpt.getInteger("orientation");
o = ForgeDirection.values()[o].getRotation(ForgeDirection.DOWN).ordinal(); o = ForgeDirection.values()[o].getRotation(ForgeDirection.DOWN).ordinal();
@ -24,14 +24,14 @@ public class BptBlockEngine extends BptBlock {
} }
@Override @Override
public void initializeFromWorld(IBptContext context, int x, int y, int z) { public void readFromWorld(IBuilderContext context, int x, int y, int z) {
TileEngine engine = (TileEngine) context.world().getTileEntity(x, y, z); TileEngine engine = (TileEngine) context.world().getTileEntity(x, y, z);
cpt.setInteger("orientation", engine.orientation.ordinal()); cpt.setInteger("orientation", engine.orientation.ordinal());
} }
@Override @Override
public void buildBlock(IBptContext context) { public void writeToWorld(IBuilderContext context) {
context.world().setBlock(x, y, z, block, meta,1); context.world().setBlock(x, y, z, block, meta,1);
TileEngine engine = (TileEngine) context.world().getTileEntity(x, y, z); TileEngine engine = (TileEngine) context.world().getTileEntity(x, y, z);

View file

@ -12,33 +12,33 @@ import java.util.LinkedList;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.BptBlockUtils; import buildcraft.api.blueprints.SchematicUtils;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
public class BptBlockAutoWorkbench extends BptBlock { public class SchematicAutoWorkbench extends Schematic {
@Override @Override
public void addRequirements(IBptContext context, LinkedList<ItemStack> requirements) { public void addRequirements(IBuilderContext context, LinkedList<ItemStack> requirements) {
super.addRequirements(context, requirements); super.addRequirements(context, requirements);
BptBlockUtils.requestInventoryContents(this, context, requirements); SchematicUtils.requestInventoryContents(this, context, requirements);
} }
@Override @Override
public void initializeFromWorld(IBptContext context, int x, int y, int z) { public void readFromWorld(IBuilderContext context, int x, int y, int z) {
IInventory inventory = (IInventory) context.world().getTileEntity(x, y, z); IInventory inventory = (IInventory) context.world().getTileEntity(x, y, z);
BptBlockUtils.initializeInventoryContents(this, context, inventory); SchematicUtils.initializeInventoryContents(this, context, inventory);
} }
@Override @Override
public void buildBlock(IBptContext context) { public void writeToWorld(IBuilderContext context) {
super.buildBlock(context); super.writeToWorld(context);
IInventory inventory = (IInventory) context.world().getTileEntity(x, y, z); IInventory inventory = (IInventory) context.world().getTileEntity(x, y, z);
BptBlockUtils.buildInventoryContents(this, context, inventory); SchematicUtils.buildInventoryContents(this, context, inventory);
} }
} }

View file

@ -11,13 +11,13 @@ package buildcraft.factory;
import java.util.LinkedList; import java.util.LinkedList;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
public class BptBlockFrame extends BptBlock { public class SchematicFrame extends Schematic {
@Override @Override
public void addRequirements(IBptContext context, LinkedList<ItemStack> requirements) { public void addRequirements(IBuilderContext context, LinkedList<ItemStack> requirements) {
} }

View file

@ -9,18 +9,18 @@
package buildcraft.factory; package buildcraft.factory;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
public class BptBlockRefinery extends BptBlock { public class SchematicRefinery extends Schematic {
@Override @Override
public void rotateLeft(IBptContext context) { public void rotateLeft(IBuilderContext context) {
meta = ForgeDirection.values()[meta].getRotation(ForgeDirection.DOWN).ordinal(); meta = ForgeDirection.values()[meta].getRotation(ForgeDirection.DOWN).ordinal();
} }
@Override @Override
public void initializeFromWorld(IBptContext context, int x, int y, int z) { public void readFromWorld(IBuilderContext context, int x, int y, int z) {
TileRefinery refinery = (TileRefinery) context.world().getTileEntity(x, y, z); TileRefinery refinery = (TileRefinery) context.world().getTileEntity(x, y, z);
// slot.cpt.setInteger("filter0", refinery.getFilter(0)); // slot.cpt.setInteger("filter0", refinery.getFilter(0));
@ -28,8 +28,8 @@ public class BptBlockRefinery extends BptBlock {
} }
@Override @Override
public void buildBlock(IBptContext context) { public void writeToWorld(IBuilderContext context) {
super.buildBlock(context); super.writeToWorld(context);
TileRefinery refinery = (TileRefinery) context.world().getTileEntity(x, y, z); TileRefinery refinery = (TileRefinery) context.world().getTileEntity(x, y, z);

View file

@ -8,18 +8,18 @@
*/ */
package buildcraft.factory; package buildcraft.factory;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
public class BptBlockTank extends BptBlock { public class SchematicTank extends Schematic {
@Override @Override
public void initializeFromWorld(IBptContext context, int x, int y, int z) { public void readFromWorld(IBuilderContext context, int x, int y, int z) {
} }
@Override @Override
public void buildBlock(IBptContext context) { public void writeToWorld(IBuilderContext context) {
context.world().setBlock(x, y, z, block, meta, 3); context.world().setBlock(x, y, z, block, meta, 3);
} }

View file

@ -10,8 +10,8 @@ package buildcraft.transport.blueprints;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.core.inventory.SimpleInventory; import buildcraft.core.inventory.SimpleInventory;
public class BptItemPipeFilters extends BptPipeExtension { public class BptItemPipeFilters extends BptPipeExtension {
@ -22,7 +22,7 @@ public class BptItemPipeFilters extends BptPipeExtension {
@Override @Override
public void rotateLeft(BptBlock slot, IBptContext context) { public void rotateLeft(Schematic slot, IBuilderContext context) {
SimpleInventory inv = new SimpleInventory(54, "Filters", 1); SimpleInventory inv = new SimpleInventory(54, "Filters", 1);
SimpleInventory newInv = new SimpleInventory(54, "Filters", 1); SimpleInventory newInv = new SimpleInventory(54, "Filters", 1);
inv.readFromNBT(slot.cpt); inv.readFromNBT(slot.cpt);

View file

@ -3,8 +3,8 @@ package buildcraft.transport.blueprints;
import java.util.HashMap; import java.util.HashMap;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
public class BptPipeExtension { public class BptPipeExtension {
@ -14,11 +14,11 @@ public class BptPipeExtension {
bptPipeExtensionRegistry.put(i, this); bptPipeExtensionRegistry.put(i, this);
} }
public void postProcessing(BptBlock slot, IBptContext context) { public void postProcessing(Schematic slot, IBuilderContext context) {
} }
public void rotateLeft(BptBlock slot, IBptContext context) { public void rotateLeft(Schematic slot, IBuilderContext context) {
} }

View file

@ -10,8 +10,8 @@ package buildcraft.transport.blueprints;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
public class BptPipeIron extends BptPipeExtension { public class BptPipeIron extends BptPipeExtension {
@ -20,7 +20,7 @@ public class BptPipeIron extends BptPipeExtension {
} }
@Override @Override
public void rotateLeft(BptBlock slot, IBptContext context) { public void rotateLeft(Schematic slot, IBuilderContext context) {
int orientation = slot.meta & 7; int orientation = slot.meta & 7;
int others = slot.meta - orientation; int others = slot.meta - orientation;

View file

@ -10,8 +10,8 @@ package buildcraft.transport.blueprints;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
public class BptPipeWooden extends BptPipeExtension { public class BptPipeWooden extends BptPipeExtension {
@ -20,7 +20,7 @@ public class BptPipeWooden extends BptPipeExtension {
} }
@Override @Override
public void rotateLeft(BptBlock slot, IBptContext context) { public void rotateLeft(Schematic slot, IBuilderContext context) {
int orientation = slot.meta & 7; int orientation = slot.meta & 7;
int others = slot.meta - orientation; int others = slot.meta - orientation;

View file

@ -13,16 +13,16 @@ import java.util.LinkedList;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.transport.BlockGenericPipe; import buildcraft.transport.BlockGenericPipe;
import buildcraft.transport.Pipe; import buildcraft.transport.Pipe;
import buildcraft.transport.TileGenericPipe.SideProperties; import buildcraft.transport.TileGenericPipe.SideProperties;
public class BptBlockPipe extends BptBlock { public class SchematicPipe extends Schematic {
@Override @Override
public void addRequirements(IBptContext context, LinkedList<ItemStack> requirements) { public void addRequirements(IBuilderContext context, LinkedList<ItemStack> requirements) {
Item pipeItem = context.getMappingRegistry().getItemForId (cpt.getInteger("pipeId")); Item pipeItem = context.getMappingRegistry().getItemForId (cpt.getInteger("pipeId"));
requirements.add(new ItemStack(pipeItem)); requirements.add(new ItemStack(pipeItem));
@ -31,7 +31,7 @@ public class BptBlockPipe extends BptBlock {
} }
@Override @Override
public boolean isValid(IBptContext context) { public boolean isValid(IBuilderContext context) {
Pipe pipe = BlockGenericPipe.getPipe(context.world(), x, y, z); Pipe pipe = BlockGenericPipe.getPipe(context.world(), x, y, z);
if (BlockGenericPipe.isValid(pipe)) { if (BlockGenericPipe.isValid(pipe)) {
@ -43,7 +43,7 @@ public class BptBlockPipe extends BptBlock {
} }
@Override @Override
public void rotateLeft(IBptContext context) { public void rotateLeft(IBuilderContext context) {
SideProperties props = new SideProperties (); SideProperties props = new SideProperties ();
props.readFromNBT(cpt); props.readFromNBT(cpt);
@ -58,7 +58,7 @@ public class BptBlockPipe extends BptBlock {
} }
@Override @Override
public void buildBlock(IBptContext context) { public void writeToWorld(IBuilderContext context) {
cpt.setInteger("x", x); cpt.setInteger("x", x);
cpt.setInteger("y", y); cpt.setInteger("y", y);
cpt.setInteger("z", z); cpt.setInteger("z", z);
@ -74,7 +74,7 @@ public class BptBlockPipe extends BptBlock {
} }
@Override @Override
public void initializeFromWorld(IBptContext context, int x, int y, int z) { public void readFromWorld(IBuilderContext context, int x, int y, int z) {
TileEntity tile = context.world().getTileEntity(x, y, z); TileEntity tile = context.world().getTileEntity(x, y, z);
Pipe pipe = BlockGenericPipe.getPipe(context.world(), x, y, z); Pipe pipe = BlockGenericPipe.getPipe(context.world(), x, y, z);
@ -90,7 +90,7 @@ public class BptBlockPipe extends BptBlock {
} }
@Override @Override
public void postProcessing(IBptContext context) { public void postProcessing(IBuilderContext context) {
Item pipeItem = context.getMappingRegistry().getItemForId(cpt.getInteger("pipeId")); Item pipeItem = context.getMappingRegistry().getItemForId(cpt.getInteger("pipeId"));
if (BptPipeExtension.contains(pipeItem)) { if (BptPipeExtension.contains(pipeItem)) {