Making progress with entity support in blueprints, for #1517.

Some refactorings, in particular removal of the clone operations for blueprints,
not needed anymore now that blueprints are loaded on demand by builders.
This commit is contained in:
SpaceToad 2014-03-22 11:56:12 +01:00
parent ba2d66e81a
commit 583d09d82e
37 changed files with 593 additions and 315 deletions

View file

@ -10,6 +10,7 @@ package buildcraft;
import java.io.File; import java.io.File;
import net.minecraft.entity.item.EntityItemFrame;
import net.minecraft.init.Blocks; 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;
@ -55,6 +56,7 @@ import buildcraft.builders.schematics.SchematicDirt;
import buildcraft.builders.schematics.SchematicDoor; import buildcraft.builders.schematics.SchematicDoor;
import buildcraft.builders.schematics.SchematicFire; import buildcraft.builders.schematics.SchematicFire;
import buildcraft.builders.schematics.SchematicFluid; import buildcraft.builders.schematics.SchematicFluid;
import buildcraft.builders.schematics.SchematicHanging;
import buildcraft.builders.schematics.SchematicIgnore; import buildcraft.builders.schematics.SchematicIgnore;
import buildcraft.builders.schematics.SchematicIgnoreMeta; import buildcraft.builders.schematics.SchematicIgnoreMeta;
import buildcraft.builders.schematics.SchematicInventory; import buildcraft.builders.schematics.SchematicInventory;
@ -140,108 +142,114 @@ public class BuildCraftBuilders extends BuildCraftMod {
// Register save handler // Register save handler
MinecraftForge.EVENT_BUS.register(new EventHandlerBuilders()); MinecraftForge.EVENT_BUS.register(new EventHandlerBuilders());
SchematicRegistry.registerSchematicClass(Blocks.snow, SchematicIgnore.class); // Standard blocks
SchematicRegistry.registerSchematicClass(Blocks.tallgrass, SchematicIgnore.class);
SchematicRegistry.registerSchematicClass(Blocks.ice, SchematicIgnore.class);
SchematicRegistry.registerSchematicClass(Blocks.piston_head, SchematicIgnore.class);
SchematicRegistry.registerSchematicClass(Blocks.dirt, SchematicDirt.class); SchematicRegistry.registerSchematicBlock(Blocks.snow, SchematicIgnore.class);
SchematicRegistry.registerSchematicClass(Blocks.grass, SchematicDirt.class); SchematicRegistry.registerSchematicBlock(Blocks.tallgrass, SchematicIgnore.class);
SchematicRegistry.registerSchematicClass(Blocks.farmland, SchematicDirt.class); SchematicRegistry.registerSchematicBlock(Blocks.ice, SchematicIgnore.class);
SchematicRegistry.registerSchematicBlock(Blocks.piston_head, SchematicIgnore.class);
SchematicRegistry.registerSchematicClass(Blocks.torch, SchematicWallSide.class); SchematicRegistry.registerSchematicBlock(Blocks.dirt, SchematicDirt.class);
SchematicRegistry.registerSchematicClass(Blocks.redstone_torch, SchematicWallSide.class); SchematicRegistry.registerSchematicBlock(Blocks.grass, SchematicDirt.class);
SchematicRegistry.registerSchematicClass(Blocks.unlit_redstone_torch, SchematicWallSide.class); SchematicRegistry.registerSchematicBlock(Blocks.farmland, SchematicDirt.class);
SchematicRegistry.registerSchematicClass(Blocks.ladder, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true); SchematicRegistry.registerSchematicBlock(Blocks.torch, SchematicWallSide.class);
SchematicRegistry.registerSchematicClass(Blocks.fence_gate, SchematicRotateMeta.class, new int[]{0, 1, 2, 3}, true); SchematicRegistry.registerSchematicBlock(Blocks.redstone_torch, SchematicWallSide.class);
SchematicRegistry.registerSchematicClass(Blocks.log, SchematicRotateMeta.class, new int[]{8, 4, 8, 4}, true); SchematicRegistry.registerSchematicBlock(Blocks.unlit_redstone_torch, SchematicWallSide.class);
SchematicRegistry.registerSchematicClass(Blocks.log2, SchematicRotateMeta.class, new int[]{8, 4, 8, 4}, true);
SchematicRegistry.registerSchematicClass(Blocks.hay_block, SchematicRotateMeta.class, new int[]{8, 4, 8, 4}, true);
SchematicRegistry.registerSchematicClass(Blocks.quartz_block, SchematicRotateMeta.class, new int[]{4, 3, 4, 3}, true);
SchematicRegistry.registerSchematicClass(Blocks.hopper, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true);
SchematicRegistry.registerSchematicClass(Blocks.furnace, SchematicRotateInventory.class, new int[]{2, 5, 3, 4}, true); SchematicRegistry.registerSchematicBlock(Blocks.ladder, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true);
SchematicRegistry.registerSchematicClass(Blocks.lit_furnace, SchematicRotateInventory.class, new int[]{2, 5, 3, 4}, true); SchematicRegistry.registerSchematicBlock(Blocks.fence_gate, SchematicRotateMeta.class, new int[]{0, 1, 2, 3}, true);
SchematicRegistry.registerSchematicClass(Blocks.chest, SchematicRotateInventory.class, new int[]{2, 5, 3, 4}, true); SchematicRegistry.registerSchematicBlock(Blocks.log, SchematicRotateMeta.class, new int[]{8, 4, 8, 4}, true);
SchematicRegistry.registerSchematicClass(Blocks.dispenser, SchematicRotateInventory.class, new int[]{2, 5, 3, 4}, true); SchematicRegistry.registerSchematicBlock(Blocks.log2, SchematicRotateMeta.class, new int[]{8, 4, 8, 4}, true);
SchematicRegistry.registerSchematicBlock(Blocks.hay_block, SchematicRotateMeta.class, new int[]{8, 4, 8, 4}, true);
SchematicRegistry.registerSchematicBlock(Blocks.quartz_block, SchematicRotateMeta.class, new int[]{4, 3, 4, 3}, true);
SchematicRegistry.registerSchematicBlock(Blocks.hopper, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true);
SchematicRegistry.registerSchematicClass(Blocks.brewing_stand, SchematicInventory.class); SchematicRegistry.registerSchematicBlock(Blocks.furnace, SchematicRotateInventory.class, new int[]{2, 5, 3, 4}, true);
SchematicRegistry.registerSchematicBlock(Blocks.lit_furnace, SchematicRotateInventory.class, new int[]{2, 5, 3, 4}, true);
SchematicRegistry.registerSchematicBlock(Blocks.chest, SchematicRotateInventory.class, new int[]{2, 5, 3, 4}, true);
SchematicRegistry.registerSchematicBlock(Blocks.dispenser, SchematicRotateInventory.class, new int[]{2, 5, 3, 4}, true);
SchematicRegistry.registerSchematicClass(Blocks.vine, SchematicRotateMeta.class, new int[]{1, 4, 8, 2}, false); SchematicRegistry.registerSchematicBlock(Blocks.brewing_stand, SchematicInventory.class);
SchematicRegistry.registerSchematicClass(Blocks.trapdoor, SchematicRotateMeta.class, new int[]{0, 1, 2, 3}, false);
SchematicRegistry.registerSchematicClass(Blocks.wooden_button, SchematicLever.class); SchematicRegistry.registerSchematicBlock(Blocks.vine, SchematicRotateMeta.class, new int[]{1, 4, 8, 2}, false);
SchematicRegistry.registerSchematicClass(Blocks.stone_button, SchematicLever.class); SchematicRegistry.registerSchematicBlock(Blocks.trapdoor, SchematicRotateMeta.class, new int[]{0, 1, 2, 3}, false);
SchematicRegistry.registerSchematicClass(Blocks.lever, SchematicLever.class);
SchematicRegistry.registerSchematicClass(Blocks.stone, SchematicCustomStack.class, new ItemStack(Blocks.stone)); SchematicRegistry.registerSchematicBlock(Blocks.wooden_button, SchematicLever.class);
SchematicRegistry.registerSchematicClass(Blocks.redstone_wire, SchematicCustomStack.class, new ItemStack(Items.redstone)); SchematicRegistry.registerSchematicBlock(Blocks.stone_button, SchematicLever.class);
SchematicRegistry.registerSchematicClass(Blocks.cake, SchematicCustomStack.class, new ItemStack(Items.cake)); SchematicRegistry.registerSchematicBlock(Blocks.lever, SchematicLever.class);
SchematicRegistry.registerSchematicBlock(Blocks.stone, SchematicCustomStack.class, new ItemStack(Blocks.stone));
SchematicRegistry.registerSchematicBlock(Blocks.redstone_wire, SchematicCustomStack.class, new ItemStack(Items.redstone));
SchematicRegistry.registerSchematicBlock(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));
SchematicRegistry.registerSchematicClass(Blocks.pumpkin_stem, SchematicCustomStack.class, new ItemStack(Items.pumpkin_seeds)); SchematicRegistry.registerSchematicBlock(Blocks.pumpkin_stem, SchematicCustomStack.class, new ItemStack(Items.pumpkin_seeds));
SchematicRegistry.registerSchematicClass(Blocks.melon_stem, SchematicCustomStack.class, new ItemStack(Items.melon_seeds)); SchematicRegistry.registerSchematicBlock(Blocks.melon_stem, SchematicCustomStack.class, new ItemStack(Items.melon_seeds));
SchematicRegistry.registerSchematicClass(Blocks.glowstone, SchematicCustomStack.class, new ItemStack(Blocks.glowstone)); SchematicRegistry.registerSchematicBlock(Blocks.glowstone, SchematicCustomStack.class, new ItemStack(Blocks.glowstone));
SchematicRegistry.registerSchematicClass(Blocks.powered_repeater, SchematicRedstoneDiode.class); SchematicRegistry.registerSchematicBlock(Blocks.powered_repeater, SchematicRedstoneDiode.class);
SchematicRegistry.registerSchematicClass(Blocks.unpowered_repeater, SchematicRedstoneDiode.class); SchematicRegistry.registerSchematicBlock(Blocks.unpowered_repeater, SchematicRedstoneDiode.class);
SchematicRegistry.registerSchematicClass(Blocks.powered_comparator, SchematicRedstoneDiode.class); SchematicRegistry.registerSchematicBlock(Blocks.powered_comparator, SchematicRedstoneDiode.class);
SchematicRegistry.registerSchematicClass(Blocks.unpowered_comparator, SchematicRedstoneDiode.class); SchematicRegistry.registerSchematicBlock(Blocks.unpowered_comparator, SchematicRedstoneDiode.class);
SchematicRegistry.registerSchematicClass(Blocks.water, SchematicFluid.class, new ItemStack(Items.water_bucket)); SchematicRegistry.registerSchematicBlock(Blocks.water, SchematicFluid.class, new ItemStack(Items.water_bucket));
SchematicRegistry.registerSchematicClass(Blocks.flowing_water, SchematicFluid.class, new ItemStack(Items.water_bucket)); SchematicRegistry.registerSchematicBlock(Blocks.flowing_water, SchematicFluid.class, new ItemStack(Items.water_bucket));
SchematicRegistry.registerSchematicClass(Blocks.lava, SchematicFluid.class, new ItemStack(Items.lava_bucket)); SchematicRegistry.registerSchematicBlock(Blocks.lava, SchematicFluid.class, new ItemStack(Items.lava_bucket));
SchematicRegistry.registerSchematicClass(Blocks.flowing_lava, SchematicFluid.class, new ItemStack(Items.lava_bucket)); SchematicRegistry.registerSchematicBlock(Blocks.flowing_lava, SchematicFluid.class, new ItemStack(Items.lava_bucket));
SchematicRegistry.registerSchematicClass(Blocks.rail, SchematicIgnoreMeta.class); SchematicRegistry.registerSchematicBlock(Blocks.rail, SchematicIgnoreMeta.class);
SchematicRegistry.registerSchematicClass(Blocks.detector_rail, SchematicIgnoreMeta.class); SchematicRegistry.registerSchematicBlock(Blocks.detector_rail, SchematicIgnoreMeta.class);
SchematicRegistry.registerSchematicClass(Blocks.glass_pane, SchematicIgnoreMeta.class); SchematicRegistry.registerSchematicBlock(Blocks.glass_pane, SchematicIgnoreMeta.class);
SchematicRegistry.registerSchematicClass(Blocks.piston, SchematicPiston.class); SchematicRegistry.registerSchematicBlock(Blocks.piston, SchematicPiston.class);
SchematicRegistry.registerSchematicClass(Blocks.piston_extension, SchematicPiston.class); SchematicRegistry.registerSchematicBlock(Blocks.piston_extension, SchematicPiston.class);
SchematicRegistry.registerSchematicClass(Blocks.sticky_piston, SchematicPiston.class); SchematicRegistry.registerSchematicBlock(Blocks.sticky_piston, SchematicPiston.class);
SchematicRegistry.registerSchematicClass(Blocks.lit_pumpkin, SchematicPumpkin.class); SchematicRegistry.registerSchematicBlock(Blocks.lit_pumpkin, SchematicPumpkin.class);
SchematicRegistry.registerSchematicClass(Blocks.oak_stairs, SchematicStairs.class); SchematicRegistry.registerSchematicBlock(Blocks.oak_stairs, SchematicStairs.class);
SchematicRegistry.registerSchematicClass(Blocks.stone_stairs, SchematicStairs.class); SchematicRegistry.registerSchematicBlock(Blocks.stone_stairs, SchematicStairs.class);
SchematicRegistry.registerSchematicClass(Blocks.brick_stairs, SchematicStairs.class); SchematicRegistry.registerSchematicBlock(Blocks.brick_stairs, SchematicStairs.class);
SchematicRegistry.registerSchematicClass(Blocks.stone_brick_stairs, SchematicStairs.class); SchematicRegistry.registerSchematicBlock(Blocks.stone_brick_stairs, SchematicStairs.class);
SchematicRegistry.registerSchematicClass(Blocks.nether_brick_stairs, SchematicStairs.class); SchematicRegistry.registerSchematicBlock(Blocks.nether_brick_stairs, SchematicStairs.class);
SchematicRegistry.registerSchematicClass(Blocks.sandstone_stairs, SchematicStairs.class); SchematicRegistry.registerSchematicBlock(Blocks.sandstone_stairs, SchematicStairs.class);
SchematicRegistry.registerSchematicClass(Blocks.spruce_stairs, SchematicStairs.class); SchematicRegistry.registerSchematicBlock(Blocks.spruce_stairs, SchematicStairs.class);
SchematicRegistry.registerSchematicClass(Blocks.birch_stairs, SchematicStairs.class); SchematicRegistry.registerSchematicBlock(Blocks.birch_stairs, SchematicStairs.class);
SchematicRegistry.registerSchematicClass(Blocks.jungle_stairs, SchematicStairs.class); SchematicRegistry.registerSchematicBlock(Blocks.jungle_stairs, SchematicStairs.class);
SchematicRegistry.registerSchematicClass(Blocks.quartz_stairs, SchematicStairs.class); SchematicRegistry.registerSchematicBlock(Blocks.quartz_stairs, SchematicStairs.class);
SchematicRegistry.registerSchematicClass(Blocks.acacia_stairs, SchematicStairs.class); SchematicRegistry.registerSchematicBlock(Blocks.acacia_stairs, SchematicStairs.class);
SchematicRegistry.registerSchematicClass(Blocks.dark_oak_stairs, SchematicStairs.class); SchematicRegistry.registerSchematicBlock(Blocks.dark_oak_stairs, SchematicStairs.class);
SchematicRegistry.registerSchematicClass(Blocks.wooden_door, SchematicDoor.class, new ItemStack(Items.wooden_door)); SchematicRegistry.registerSchematicBlock(Blocks.wooden_door, SchematicDoor.class, new ItemStack(Items.wooden_door));
SchematicRegistry.registerSchematicClass(Blocks.iron_door, SchematicDoor.class, new ItemStack(Items.iron_door)); SchematicRegistry.registerSchematicBlock(Blocks.iron_door, SchematicDoor.class, new ItemStack(Items.iron_door));
SchematicRegistry.registerSchematicClass(Blocks.bed, SchematicBed.class); SchematicRegistry.registerSchematicBlock(Blocks.bed, SchematicBed.class);
SchematicRegistry.registerSchematicClass(Blocks.wall_sign, SchematicSign.class, true); SchematicRegistry.registerSchematicBlock(Blocks.wall_sign, SchematicSign.class, true);
SchematicRegistry.registerSchematicClass(Blocks.standing_sign, SchematicSign.class, false); SchematicRegistry.registerSchematicBlock(Blocks.standing_sign, SchematicSign.class, false);
SchematicRegistry.registerSchematicClass(Blocks.portal, SchematicPortal.class); SchematicRegistry.registerSchematicBlock(Blocks.portal, SchematicPortal.class);
SchematicRegistry.registerSchematicClass(Blocks.rail, SchematicRail.class); SchematicRegistry.registerSchematicBlock(Blocks.rail, SchematicRail.class);
SchematicRegistry.registerSchematicClass(Blocks.activator_rail, SchematicRail.class); SchematicRegistry.registerSchematicBlock(Blocks.activator_rail, SchematicRail.class);
SchematicRegistry.registerSchematicClass(Blocks.detector_rail, SchematicRail.class); SchematicRegistry.registerSchematicBlock(Blocks.detector_rail, SchematicRail.class);
SchematicRegistry.registerSchematicClass(Blocks.golden_rail, SchematicRail.class); SchematicRegistry.registerSchematicBlock(Blocks.golden_rail, SchematicRail.class);
SchematicRegistry.registerSchematicClass(Blocks.fire, SchematicFire.class); SchematicRegistry.registerSchematicBlock(Blocks.fire, SchematicFire.class);
// BUILDCRAFT BLOCKS // Standard entities
SchematicRegistry.registerSchematicClass(architectBlock, SchematicRotateInventory.class, new int[]{2, 5, 3, 4}, true); SchematicRegistry.registerSchematicEntity(EntityItemFrame.class, SchematicHanging.class);
SchematicRegistry.registerSchematicClass(builderBlock, SchematicRotateInventory.class, new int[]{2, 5, 3, 4}, true);
SchematicRegistry.registerSchematicClass(libraryBlock, SchematicInventory.class); // BuildCraft blocks
SchematicRegistry.registerSchematicClass(markerBlock, SchematicWallSide.class); SchematicRegistry.registerSchematicBlock(architectBlock, SchematicRotateInventory.class, new int[]{2, 5, 3, 4}, true);
SchematicRegistry.registerSchematicClass(pathMarkerBlock, SchematicWallSide.class); SchematicRegistry.registerSchematicBlock(builderBlock, SchematicRotateInventory.class, new int[]{2, 5, 3, 4}, true);
SchematicRegistry.registerSchematicBlock(libraryBlock, SchematicInventory.class);
SchematicRegistry.registerSchematicBlock(markerBlock, SchematicWallSide.class);
SchematicRegistry.registerSchematicBlock(pathMarkerBlock, SchematicWallSide.class);
if (BuildCraftCore.loadDefaultRecipes) { if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes(); loadRecipes();

View file

@ -255,7 +255,7 @@ public class BuildCraftEnergy extends BuildCraftMod {
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler()); NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
SchematicRegistry.registerSchematicClass(engineBlock, SchematicEngine.class); SchematicRegistry.registerSchematicBlock(engineBlock, SchematicEngine.class);
if (BuildCraftCore.loadDefaultRecipes) { if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes(); loadRecipes();

View file

@ -145,9 +145,9 @@ public class BuildCraftFactory extends BuildCraftMod {
FactoryProxy.proxy.initializeTileEntities(); FactoryProxy.proxy.initializeTileEntities();
SchematicRegistry.registerSchematicClass(frameBlock, SchematicFrame.class); SchematicRegistry.registerSchematicBlock(frameBlock, SchematicFrame.class);
SchematicRegistry.registerSchematicClass(refineryBlock, SchematicRefinery.class); SchematicRegistry.registerSchematicBlock(refineryBlock, SchematicRefinery.class);
SchematicRegistry.registerSchematicClass(tankBlock, SchematicTank.class); SchematicRegistry.registerSchematicBlock(tankBlock, SchematicTank.class);
if (BuildCraftCore.loadDefaultRecipes) { if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes(); loadRecipes();

View file

@ -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");
SchematicRegistry.registerSchematicClass(laserBlock, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true); SchematicRegistry.registerSchematicBlock(laserBlock, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true);
SchematicRegistry.registerSchematicClass(assemblyTableBlock, SchematicInventory.class); SchematicRegistry.registerSchematicBlock(assemblyTableBlock, SchematicInventory.class);
if (BuildCraftCore.loadDefaultRecipes) { if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes(); loadRecipes();

View file

@ -437,7 +437,7 @@ public class BuildCraftTransport extends BuildCraftMod {
TransportProxy.proxy.registerTileEntities(); TransportProxy.proxy.registerTileEntities();
SchematicRegistry.registerSchematicClass(genericPipeBlock, SchematicPipe.class); SchematicRegistry.registerSchematicBlock(genericPipeBlock, SchematicPipe.class);
new BptPipeIron(pipeItemsIron); new BptPipeIron(pipeItemsIron);
new BptPipeIron(pipeFluidsIron); new BptPipeIron(pipeFluidsIron);

View file

@ -0,0 +1,28 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.blueprints;
import java.util.LinkedList;
import net.minecraft.item.ItemStack;
public class BuildingSlot {
public void writeToWorld(IBuilderContext context) {
}
public void postProcessing (IBuilderContext context) {
}
public LinkedList<ItemStack> getRequirements (IBuilderContext context) {
return new LinkedList<ItemStack>();
}
}

View file

@ -1,17 +1,11 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.blueprints; package buildcraft.api.blueprints;
import java.util.LinkedList;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
public class BuildingSlotBlock extends BuildingSlot {
public class SchematicToBuild {
public int x, y, z; public int x, y, z;
public Schematic schematic; public Schematic schematic;
@ -30,7 +24,8 @@ public class SchematicToBuild {
} }
} }
public void writeToWorld(IBuilderContext context, int x, int y, int z) { @Override
public void writeToWorld(IBuilderContext context) {
try { try {
getSchematic().writeToWorld(context, x, y, z); getSchematic().writeToWorld(context, x, y, z);
@ -51,4 +46,13 @@ public class SchematicToBuild {
} }
} }
@Override
public void postProcessing (IBuilderContext context) {
getSchematic().postProcessing(context, x, y, z);
}
@Override
public LinkedList<ItemStack> getRequirements (IBuilderContext context) {
return getSchematic().getRequirements(context);
}
} }

View file

@ -0,0 +1,20 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.blueprints;
public class BuildingSlotEntity extends BuildingSlot {
public CoordTransformation transform;
public SchematicEntity schematic;
@Override
public void writeToWorld(IBuilderContext context) {
schematic.writeToWorld(context, transform);
}
}

View file

@ -0,0 +1,29 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.blueprints;
import buildcraft.api.core.Position;
public class CoordTransformation {
public double x = 0;
public double y = 0;
public double z = 0;
public Position transform (Position p) {
Position p2 = new Position (p);
p2.x = p.x + x;
p2.y = p.y + y;
p2.z = p.z + z;
return p2;
}
}

View file

@ -12,26 +12,23 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import buildcraft.core.network.NetworkData;
import buildcraft.core.utils.Utils; import buildcraft.core.utils.Utils;
public class MappingRegistry { public class MappingRegistry {
@NetworkData
public HashMap <Block, Integer> blockToId = new HashMap<Block, Integer>(); public HashMap <Block, Integer> blockToId = new HashMap<Block, Integer>();
@NetworkData
public ArrayList <Block> idToBlock = new ArrayList<Block>(); public ArrayList <Block> idToBlock = new ArrayList<Block>();
@NetworkData
public HashMap <Item, Integer> itemToId = new HashMap<Item, Integer>(); public HashMap <Item, Integer> itemToId = new HashMap<Item, Integer>();
@NetworkData
public ArrayList <Item> idToItem = new ArrayList<Item>(); public ArrayList <Item> idToItem = new ArrayList<Item>();
public HashMap <Class <? extends Entity>, Integer> entityToId = new HashMap<Class <? extends Entity>, Integer>();
public ArrayList <Class <? extends Entity>> idToEntity = new ArrayList<Class <? extends Entity>>();
private void registerItem (Item item) { private void registerItem (Item item) {
if (!itemToId.containsKey(item)) { if (!itemToId.containsKey(item)) {
idToItem.add(item); idToItem.add(item);
@ -46,6 +43,14 @@ public class MappingRegistry {
} }
} }
private void registerEntity (Class <? extends Entity> entityClass) {
if (!entityToId.containsKey(entityClass)) {
idToEntity.add(entityClass);
entityToId.put(entityClass, idToEntity.size() - 1);
}
}
public Item getItemForId(int id) { public Item getItemForId(int id) {
if (id >= idToItem.size()) { if (id >= idToItem.size()) {
return null; return null;
@ -78,6 +83,22 @@ public class MappingRegistry {
return blockToId.get(block); return blockToId.get(block);
} }
public Class <? extends Entity> getEntityForId(int id) {
if (id >= idToEntity.size()) {
return null;
}
return idToEntity.get(id);
}
public int getIdForEntity(Class <? extends Entity> entity) {
if (!entityToId.containsKey(entity)) {
registerEntity (entity);
}
return entityToId.get(entity);
}
public void write (NBTTagCompound nbt) { public void write (NBTTagCompound nbt) {
NBTTagList blocksMapping = new NBTTagList(); NBTTagList blocksMapping = new NBTTagList();
@ -100,6 +121,16 @@ public class MappingRegistry {
} }
nbt.setTag("itemsMapping", itemsMapping); nbt.setTag("itemsMapping", itemsMapping);
NBTTagList entitiesMapping = new NBTTagList();
for (Class <? extends Entity> e : idToEntity) {
NBTTagCompound sub = new NBTTagCompound();
sub.setString("name", e.getCanonicalName());
entitiesMapping.appendTag(sub);
}
nbt.setTag("entitiesMapping", entitiesMapping);
} }
public void read (NBTTagCompound nbt) { public void read (NBTTagCompound nbt) {
@ -122,6 +153,23 @@ public class MappingRegistry {
Item item = (Item) Item.itemRegistry.getObject(name); Item item = (Item) Item.itemRegistry.getObject(name);
registerItem (item); registerItem (item);
} }
NBTTagList entitiesMapping = nbt.getTagList("entitiesMapping",
Utils.NBTTag_Types.NBTTagCompound.ordinal());
for (int i = 0; i < entitiesMapping.tagCount(); ++i) {
NBTTagCompound sub = entitiesMapping.getCompoundTagAt(i);
String name = sub.getString("name");
Class<? extends Entity> e = null;
try {
e = (Class <? extends Entity>) Class.forName(name);
} catch (ClassNotFoundException e1) {
e1.printStackTrace();
}
registerEntity (e);
}
} }
@Override @Override
@ -131,6 +179,8 @@ public class MappingRegistry {
result.idToBlock = (ArrayList<Block>) idToBlock.clone(); result.idToBlock = (ArrayList<Block>) idToBlock.clone();
result.itemToId = (HashMap<Item, Integer>) itemToId.clone(); result.itemToId = (HashMap<Item, Integer>) itemToId.clone();
result.idToItem = (ArrayList<Item>) idToItem.clone(); result.idToItem = (ArrayList<Item>) idToItem.clone();
result.entityToId = (HashMap<Class <? extends Entity>, Integer>) entityToId.clone();
result.idToEntity = (ArrayList<Class <? extends Entity>>) idToEntity.clone();
return result; return result;
} }

View file

@ -39,20 +39,6 @@ import net.minecraft.nbt.NBTTagCompound;
*/ */
public class Schematic { public class Schematic {
@SuppressWarnings("unchecked")
@Override
public Schematic clone() {
Schematic obj;
try {
obj = (Schematic) super.clone();
} catch (CloneNotSupportedException e) {
return null;
}
return obj;
}
public final LinkedList<ItemStack> getRequirements(IBuilderContext context) { public final LinkedList<ItemStack> getRequirements(IBuilderContext context) {
LinkedList<ItemStack> res = new LinkedList<ItemStack>(); LinkedList<ItemStack> res = new LinkedList<ItemStack>();

View file

@ -9,7 +9,6 @@
package buildcraft.api.blueprints; package buildcraft.api.blueprints;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList; import java.util.LinkedList;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -31,19 +30,6 @@ public class SchematicBlock extends Schematic {
*/ */
public ItemStack [] storedRequirements = new ItemStack [0]; public ItemStack [] storedRequirements = new ItemStack [0];
@SuppressWarnings("unchecked")
@Override
public SchematicBlock clone() {
SchematicBlock obj = SchematicRegistry.newSchematic(block);
obj.block = block;
obj.meta = meta;
obj.storedRequirements = Arrays.copyOf(storedRequirements,
storedRequirements.length);
return obj;
}
/** /**
* Returns the requirements needed to build this block. When the * Returns the requirements needed to build this block. When the
* 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,

View file

@ -0,0 +1,73 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.blueprints;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagDouble;
import net.minecraft.nbt.NBTTagList;
import buildcraft.api.core.Position;
public class SchematicEntity {
public Class <? extends Entity> entity;
public NBTTagCompound cpt = new NBTTagCompound();
public void writeToWorld(IBuilderContext context, CoordTransformation transform) {
NBTTagList nbttaglist = cpt.getTagList("Pos", 6);
Position pos = new Position(nbttaglist.func_150309_d(0),
nbttaglist.func_150309_d(1), nbttaglist.func_150309_d(2));
pos = transform.transform(pos);
cpt.setTag("Pos", this.newDoubleNBTList(new double[] {pos.x, pos.y, pos.z}));
Entity e = EntityList.createEntityFromNBT(cpt, context.world());
context.world().spawnEntityInWorld(e);
}
public void readFromWorld(IBuilderContext context, Entity entity, CoordTransformation transform) {
entity.writeToNBTOptional(cpt);
NBTTagList nbttaglist = cpt.getTagList("Pos", 6);
Position pos = new Position(nbttaglist.func_150309_d(0),
nbttaglist.func_150309_d(1), nbttaglist.func_150309_d(2));
pos = transform.transform(pos);
cpt.setTag("Pos", this.newDoubleNBTList(new double[] {pos.x, pos.y, pos.z}));
}
public void rotateLeft(IBuilderContext context) {
}
public void writeToNBT(NBTTagCompound nbt, MappingRegistry registry) {
nbt.setInteger ("entityId", registry.getIdForEntity(entity));
nbt.setTag("entity", cpt);
}
public void readFromNBT(NBTTagCompound nbt, MappingRegistry registry) {
cpt = nbt.getCompoundTag("entity");
}
protected NBTTagList newDoubleNBTList(double ... par1ArrayOfDouble)
{
NBTTagList nbttaglist = new NBTTagList();
double[] adouble = par1ArrayOfDouble;
int i = par1ArrayOfDouble.length;
for (int j = 0; j < i; ++j)
{
double d1 = adouble[j];
nbttaglist.appendTag(new NBTTagDouble(d1));
}
return nbttaglist;
}
}

View file

@ -19,11 +19,6 @@ public class SchematicMask extends Schematic {
this.isConcrete = isConcrete; this.isConcrete = isConcrete;
} }
@Override
public Schematic clone() {
return new SchematicMask(isConcrete);
}
@Override @Override
public void writeToWorld(IBuilderContext context, int x, int y, int z) { public void writeToWorld(IBuilderContext context, int x, int y, int z) {
if (isConcrete) { if (isConcrete) {

View file

@ -13,41 +13,56 @@ import java.util.HashMap;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.ITileEntityProvider;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
public class SchematicRegistry { public class SchematicRegistry {
private static class SchematicConstructor { private static class SchematicConstructor {
Class clas; Class <? extends SchematicEntity> clas;
Object [] params; Object [] params;
} }
private static final HashMap <Block, SchematicConstructor> schematicClasses = private static final HashMap <Block, SchematicConstructor> schematicBlocks =
new HashMap<Block, SchematicConstructor>(); new HashMap<Block, SchematicConstructor>();
public static void registerSchematicClass (Block block, Class clas, Object ... params) { private static final HashMap <Class <? extends Entity>, SchematicConstructor> schematicEntities =
new HashMap<Class <? extends Entity>, SchematicConstructor>();
public static void registerSchematicBlock (Block block, Class clas, Object ... params) {
SchematicConstructor c = new SchematicConstructor (); SchematicConstructor c = new SchematicConstructor ();
c.clas = clas; c.clas = clas;
c.params = params; c.params = params;
schematicClasses.put(block, c); schematicBlocks.put(block, c);
} }
public static SchematicBlock newSchematic (Block block) { public static void registerSchematicEntity(
Class<? extends Entity> entityClass,
Class<? extends SchematicEntity> schematicClass, Object... params) {
SchematicConstructor c = new SchematicConstructor ();
c.clas = schematicClass;
c.params = params;
schematicEntities.put(entityClass, c);
}
public static SchematicBlock newSchematicBlock (Block block) {
if (block == Blocks.air) { if (block == Blocks.air) {
return null; return null;
} }
if (!schematicClasses.containsKey(block)) { if (!schematicBlocks.containsKey(block)) {
if (block instanceof ITileEntityProvider) { if (block instanceof ITileEntityProvider) {
registerSchematicClass(block, SchematicTile.class); registerSchematicBlock(block, SchematicTile.class);
} else { } else {
registerSchematicClass(block, SchematicBlock.class); registerSchematicBlock(block, SchematicBlock.class);
} }
} }
try { try {
SchematicConstructor c = schematicClasses.get(block); SchematicConstructor c = schematicBlocks.get(block);
SchematicBlock s = (SchematicBlock) c.clas.getConstructors() [0].newInstance(c.params); SchematicBlock s = (SchematicBlock) c.clas.getConstructors() [0].newInstance(c.params);
s.block = block; s.block = block;
return s; return s;
@ -65,4 +80,30 @@ public class SchematicRegistry {
return null; return null;
} }
public static SchematicEntity newSchematicEntity (Class <? extends Entity> entityClass) {
if (!schematicEntities.containsKey(entityClass)) {
return null;
}
try {
SchematicConstructor c = schematicEntities.get(entityClass);
SchematicEntity s = (SchematicEntity) c.clas.getConstructors() [0].newInstance(c.params);
s.entity = entityClass;
return s;
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (SecurityException e) {
e.printStackTrace();
}
return null;
}
} }

View file

@ -26,16 +26,6 @@ public class SchematicTile extends SchematicBlock {
*/ */
public NBTTagCompound cpt = new NBTTagCompound(); public NBTTagCompound cpt = new NBTTagCompound();
@SuppressWarnings("unchecked")
@Override
public SchematicBlock clone() {
SchematicTile s = (SchematicTile) super.clone();
s.cpt = (NBTTagCompound) cpt.copy();
return s;
}
/** /**
* 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.
*/ */

View file

@ -14,7 +14,7 @@ public interface IBox {
public void contract(int amount); public void contract(int amount);
public boolean contains(int x, int y, int z); public boolean contains(double x, double y, double z);
public Position pMin(); public Position pMin();

View file

@ -37,6 +37,6 @@ public @interface MjBattery {
public double maxCapacity () default 100.0; public double maxCapacity () default 100.0;
public double maxReceivedPerCycle () default 10.0; public double maxReceivedPerCycle () default 10.0;
public double miniumConsumption () default 0.1; public double minimumConsumption () default 0.1;
} }

View file

@ -70,6 +70,8 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
/ (float) blockScanner.totalBlocks()) * 100); / (float) blockScanner.totalBlocks()) * 100);
if (blockScanner.blocksLeft() == 0) { if (blockScanner.blocksLeft() == 0) {
writingBlueprint.readEntitiesFromWorld (writingContext, this);
ForgeDirection o = ForgeDirection.values()[worldObj.getBlockMetadata( ForgeDirection o = ForgeDirection.values()[worldObj.getBlockMetadata(
xCoord, yCoord, zCoord)].getOpposite(); xCoord, yCoord, zCoord)].getOpposite();
@ -124,32 +126,6 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
blockScanner = null; blockScanner = null;
} }
/*public BlueprintBase createBptTemplate() {
int mask1 = 1;
int mask0 = 0;
if (worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) {
mask1 = 0;
mask0 = 1;
}
BlueprintBase result = new Template(box.sizeX(), box.sizeY(), box.sizeZ());
for (int x = box.xMin; x <= box.xMax; ++x) {
for (int y = box.yMin; y <= box.yMax; ++y) {
for (int z = box.zMin; z <= box.zMax; ++z) {
if (worldObj.getBlock(x, y, z) != Blocks.air) {
result.setBlock(x - box.xMin, y - box.yMin, z - box.zMin, Blocks.stone);
} else {
result.setBlock(x - box.xMin, y - box.yMin, z - box.zMin, Blocks.air);
}
}
}
}
return result;
}*/
@RPC (RPCSide.SERVER) @RPC (RPCSide.SERVER)
public void handleClientInput(char c) { public void handleClientInput(char c) {
if (c == 8) { if (c == 8) {

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.SchematicToBuild; import buildcraft.api.blueprints.BuildingSlot;
import buildcraft.api.core.Position; import buildcraft.api.core.Position;
import buildcraft.api.core.SafeTimeTracker; import buildcraft.api.core.SafeTimeTracker;
import buildcraft.api.gates.IAction; import buildcraft.api.gates.IAction;
@ -269,8 +269,6 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IM
return null; return null;
} }
bpt = bpt.clone();
BptContext context = bpt.getContext(worldObj, bpt.getBoxForPos(x, y, z)); BptContext context = bpt.getContext(worldObj, bpt.getBoxForPos(x, y, z));
if (o == ForgeDirection.EAST) { if (o == ForgeDirection.EAST) {
@ -670,18 +668,24 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IM
} }
if (bluePrintBuilder != null) { if (bluePrintBuilder != null) {
SchematicToBuild slot = bluePrintBuilder.getNextBlock(worldObj, this); BuildingSlot slot = bluePrintBuilder.getNextBlock(worldObj, this);
if (slot != null) { if (slot != null) {
if (slot.schematic == null) { slot.writeToWorld(bluePrintBuilder.context);
getWorld().setBlockToAir(slot.x, slot.y, slot.z);
} else {
slot.writeToWorld(bluePrintBuilder.context, slot.x,
slot.y, slot.z);
} }
} else {
if (slot == null || bluePrintBuilder.done) {
bluePrintBuilder.postProcessing(worldObj); bluePrintBuilder.postProcessing(worldObj);
bluePrintBuilder = null; bluePrintBuilder = null;
for (int i = 1; i < items.length; ++i) {
if (items [i] == null) {
items [i] = items [0];
break;
}
}
items [0] = null;
} }
if (bluePrintBuilder instanceof BptBuilderBlueprint) { if (bluePrintBuilder instanceof BptBuilderBlueprint) {

View file

@ -17,7 +17,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import buildcraft.BuildCraftCore; import buildcraft.BuildCraftCore;
import buildcraft.api.blueprints.SchematicToBuild; import buildcraft.api.blueprints.BuildingSlot;
import buildcraft.api.core.IAreaProvider; import buildcraft.api.core.IAreaProvider;
import buildcraft.api.filler.FillerManager; import buildcraft.api.filler.FillerManager;
import buildcraft.api.filler.IFillerPattern; import buildcraft.api.filler.IFillerPattern;
@ -119,10 +119,10 @@ public class TileFiller extends TileBuildCraft implements IBuilderInventory, IMa
} }
if (currentTemplate != null) { if (currentTemplate != null) {
SchematicToBuild s = currentTemplate.getNextBlock(getWorld(), this); BuildingSlot s = currentTemplate.getNextBlock(getWorld(), this);
if (s != null) { if (s != null) {
s.getSchematic().writeToWorld(context, s.x, s.y, s.z); s.writeToWorld(context);
} }
if (!done && s == null || currentTemplate.done) { if (!done && s == null || currentTemplate.done) {

View file

@ -57,7 +57,7 @@ public class PatternPyramid extends FillerPattern {
while (step <= xSize / 2 && step <= zSize / 2 && height >= yMin && height <= yMax) { while (step <= xSize / 2 && step <= zSize / 2 && height >= yMin && height <= yMax) {
for (int x = xMin + step; x <= xMax - step; ++x) { for (int x = xMin + step; x <= xMax - step; ++x) {
for (int z = zMin + step; z <= zMax - step; ++z) { for (int z = zMin + step; z <= zMax - step; ++z) {
bpt.contents [x - xMin][height - yMin][z - zMin] = SchematicRegistry.newSchematic(Blocks.stone); bpt.contents [x - xMin][height - yMin][z - zMin] = SchematicRegistry.newSchematicBlock(Blocks.stone);
} }
} }

View file

@ -0,0 +1,46 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.builders.schematics;
import net.minecraft.entity.Entity;
import buildcraft.api.blueprints.CoordTransformation;
import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.api.blueprints.SchematicEntity;
import buildcraft.api.core.Position;
public class SchematicHanging extends SchematicEntity {
@Override
public void writeToWorld(IBuilderContext context, CoordTransformation transform) {
/*par1NBTTagCompound.setByte("Direction", (byte)this.hangingDirection);
par1NBTTagCompound.setInteger("TileX", this.field_146063_b);
par1NBTTagCompound.setInteger("TileY", this.field_146064_c);
par1NBTTagCompound.setInteger("TileZ", this.field_146062_d);*/
Position pos = new Position (cpt.getInteger("TileX"), cpt.getInteger("TileY"), cpt.getInteger("TileZ"));
pos = transform.transform(pos);
cpt.setInteger("TileX", (int) pos.x);
cpt.setInteger("TileY", (int) pos.y);
cpt.setInteger("TileZ", (int) pos.z);
super.writeToWorld(context, transform);
}
@Override
public void readFromWorld(IBuilderContext context, Entity entity, CoordTransformation transform) {
super.readFromWorld(context, entity, transform);
Position pos = new Position (cpt.getInteger("TileX"), cpt.getInteger("TileY"), cpt.getInteger("TileZ"));
pos = transform.transform(pos);
cpt.setInteger("TileX", (int) pos.x);
cpt.setInteger("TileY", (int) pos.y);
cpt.setInteger("TileZ", (int) pos.z);
}
}

View file

@ -8,7 +8,7 @@
*/ */
package buildcraft.builders.urbanism; package buildcraft.builders.urbanism;
import buildcraft.api.blueprints.SchematicToBuild; import buildcraft.api.blueprints.BuildingSlotBlock;
import buildcraft.builders.urbanism.TileUrbanist.FrameTask; import buildcraft.builders.urbanism.TileUrbanist.FrameTask;
import buildcraft.core.robots.AIMoveAround; import buildcraft.core.robots.AIMoveAround;
import buildcraft.core.robots.EntityRobot; import buildcraft.core.robots.EntityRobot;
@ -16,11 +16,11 @@ import buildcraft.core.robots.IRobotTask;
public class TaskBuildSchematic implements IRobotTask { public class TaskBuildSchematic implements IRobotTask {
SchematicToBuild builder; BuildingSlotBlock builder;
boolean inBuild = false; boolean inBuild = false;
FrameTask task; FrameTask task;
public TaskBuildSchematic (SchematicToBuild builder, FrameTask task) { public TaskBuildSchematic (BuildingSlotBlock builder, FrameTask task) {
this.builder = builder; this.builder = builder;
this.task = task; this.task = task;
} }

View file

@ -156,7 +156,7 @@ public class Box implements IBox {
} }
@Override @Override
public boolean contains(int x, int y, int z) { public boolean contains(double x, double y, double z) {
if (x >= xMin && x <= xMax && y >= yMin && y <= yMax && z >= zMin && z <= zMax) { if (x >= xMin && x <= xMax && y >= yMin && y <= yMax && z >= zMin && z <= zMax) {
return true; return true;
} else { } else {

View file

@ -28,7 +28,7 @@ public class ReflectMjAPI {
if (left > 0) { if (left > 0) {
return left; return left;
} else { } else {
return battery.miniumConsumption(); return battery.minimumConsumption();
} }
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
e.printStackTrace(); e.printStackTrace();
@ -74,7 +74,7 @@ public class ReflectMjAPI {
} }
public double minimumConsumption() { public double minimumConsumption() {
return f.battery.miniumConsumption(); return f.battery.minimumConsumption();
} }
public double maxReceivedPerCycle() { public double maxReceivedPerCycle() {

View file

@ -8,21 +8,28 @@
*/ */
package buildcraft.core.blueprints; package buildcraft.core.blueprints;
import java.util.LinkedList;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack; 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;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import buildcraft.BuildCraftBuilders; import buildcraft.BuildCraftBuilders;
import buildcraft.api.blueprints.CoordTransformation;
import buildcraft.api.blueprints.IBuilderContext; import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.api.blueprints.SchematicBlock; import buildcraft.api.blueprints.SchematicBlock;
import buildcraft.api.blueprints.SchematicEntity;
import buildcraft.api.blueprints.SchematicRegistry; import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.core.utils.BCLog; import buildcraft.core.utils.BCLog;
import buildcraft.core.utils.NBTUtils; import buildcraft.core.utils.NBTUtils;
import buildcraft.core.utils.Utils; import buildcraft.core.utils.Utils;
public class Blueprint extends BlueprintBase { public class Blueprint extends BlueprintBase {
public LinkedList <SchematicEntity> entities = new LinkedList <SchematicEntity> ();
public Blueprint() { public Blueprint() {
super (); super ();
} }
@ -35,7 +42,7 @@ public class Blueprint extends BlueprintBase {
public void readFromWorld(IBuilderContext 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);
SchematicBlock slot = SchematicRegistry.newSchematic(block); SchematicBlock slot = SchematicRegistry.newSchematicBlock(block);
if (slot == null) { if (slot == null) {
return; return;
@ -62,6 +69,30 @@ public class Blueprint extends BlueprintBase {
} }
} }
@Override
public void readEntitiesFromWorld(IBuilderContext context, TileEntity anchorTile) {
CoordTransformation transform = new CoordTransformation();
/*transform.x = -context.surroundingBox().pMin().x;
transform.y = -context.surroundingBox().pMin().y;
transform.z = -context.surroundingBox().pMin().z;*/
transform.x = -anchorTile.xCoord;
transform.y = -anchorTile.yCoord;
transform.z = -anchorTile.zCoord;
for (Object o : context.world().loadedEntityList) {
Entity e = (Entity) o;
if (context.surroundingBox().contains(e.posX, e.posY, e.posZ)) {
SchematicEntity s = SchematicRegistry.newSchematicEntity(e.getClass());
if (s != null) {
s.readFromWorld(context, e, transform);
entities.add(s);
}
}
}
}
@Override @Override
public void saveContents(NBTTagCompound nbt) { public void saveContents(NBTTagCompound nbt) {
@ -83,6 +114,16 @@ public class Blueprint extends BlueprintBase {
nbt.setTag("contents", nbtContents); nbt.setTag("contents", nbtContents);
NBTTagList entitiesNBT = new NBTTagList();
for (SchematicEntity s : entities) {
NBTTagCompound subNBT = new NBTTagCompound();
s.writeToNBT(subNBT, mapping);
entitiesNBT.appendTag(subNBT);
}
nbt.setTag("entities", entitiesNBT);
NBTTagCompound contextNBT = new NBTTagCompound(); NBTTagCompound contextNBT = new NBTTagCompound();
mapping.write (contextNBT); mapping.write (contextNBT);
nbt.setTag("idMapping", contextNBT); nbt.setTag("idMapping", contextNBT);
@ -106,7 +147,7 @@ public class Blueprint extends BlueprintBase {
if (cpt.hasKey("blockId")) { if (cpt.hasKey("blockId")) {
int blockId = cpt.getInteger("blockId"); int blockId = cpt.getInteger("blockId");
contents[x][y][z] = SchematicRegistry.newSchematic(mapping.getBlockForId(blockId)); contents[x][y][z] = SchematicRegistry.newSchematicBlock(mapping.getBlockForId(blockId));
contents[x][y][z].readFromNBT(cpt, mapping); contents[x][y][z].readFromNBT(cpt, mapping);
} else { } else {
contents[x][y][z] = null; contents[x][y][z] = null;
@ -114,6 +155,20 @@ public class Blueprint extends BlueprintBase {
} }
} }
} }
NBTTagList entitiesNBT = nbt.getTagList("entities",
Utils.NBTTag_Types.NBTTagCompound.ordinal());
for (int i = 0; i < entitiesNBT.tagCount(); ++i) {
NBTTagCompound cpt = entitiesNBT.getCompoundTagAt(i);
if (cpt.hasKey("entityId")) {
int entityId = cpt.getInteger("entityId");
SchematicEntity s = SchematicRegistry.newSchematicEntity(mapping.getEntityForId(entityId));
s.readFromNBT(cpt, mapping);
entities.add(s);
}
}
} }
@Override @Override

View file

@ -151,52 +151,6 @@ public abstract class BlueprintBase {
} }
} }
@Override
public final BlueprintBase clone() {
BlueprintBase res = null;
try {
res = getClass().newInstance();
} catch (InstantiationException e) {
e.printStackTrace();
return null;
} catch (IllegalAccessException e) {
e.printStackTrace();
return null;
}
res.anchorX = anchorX;
res.anchorY = anchorY;
res.anchorZ = anchorZ;
res.sizeX = sizeX;
res.sizeY = sizeY;
res.sizeZ = sizeZ;
res.id = id;
res.author = author;
res.contents = new Schematic [sizeX][sizeY][sizeZ];
res.mapping = mapping.clone ();
for (int x = 0; x < sizeX; ++x) {
for (int y = 0; y < sizeY; ++y) {
for (int z = 0; z < sizeZ; ++z) {
if (contents[x][y][z] != null) {
res.contents[x][y][z] = contents[x][y][z].clone();
}
}
}
}
copyTo(res);
return res;
}
protected void copyTo(BlueprintBase base) { protected void copyTo(BlueprintBase base) {
} }
@ -265,4 +219,8 @@ public abstract class BlueprintBase {
public abstract void readFromWorld(IBuilderContext context, TileEntity anchorTile, int x, int y, int z); public abstract void readFromWorld(IBuilderContext context, TileEntity anchorTile, int x, int y, int z);
public abstract ItemStack getStack (); public abstract ItemStack getStack ();
public void readEntitiesFromWorld(IBuilderContext context, TileEntity anchorTile) {
}
} }

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.SchematicToBuild; import buildcraft.api.blueprints.BuildingSlot;
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 SchematicToBuild getNextBlock(World world, IBuilderInventory inv); public abstract BuildingSlot getNextBlock(World world, IBuilderInventory inv);
@Override @Override
public int xMin() { public int xMin() {

View file

@ -20,9 +20,13 @@ import net.minecraft.item.Item;
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.BuildingSlot;
import buildcraft.api.blueprints.BuildingSlotBlock;
import buildcraft.api.blueprints.BuildingSlotBlock.Mode;
import buildcraft.api.blueprints.BuildingSlotEntity;
import buildcraft.api.blueprints.CoordTransformation;
import buildcraft.api.blueprints.SchematicBlock; import buildcraft.api.blueprints.SchematicBlock;
import buildcraft.api.blueprints.SchematicToBuild; import buildcraft.api.blueprints.SchematicEntity;
import buildcraft.api.blueprints.SchematicToBuild.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;
@ -30,10 +34,11 @@ import buildcraft.core.utils.BlockUtil;
public class BptBuilderBlueprint extends BptBuilderBase { public class BptBuilderBlueprint extends BptBuilderBase {
LinkedList<SchematicToBuild> clearList = new LinkedList<SchematicToBuild>(); LinkedList<BuildingSlotBlock> clearList = new LinkedList<BuildingSlotBlock>();
LinkedList<SchematicToBuild> primaryList = new LinkedList<SchematicToBuild>(); LinkedList<BuildingSlotBlock> primaryList = new LinkedList<BuildingSlotBlock>();
LinkedList<SchematicToBuild> secondaryList = new LinkedList<SchematicToBuild>(); LinkedList<BuildingSlotBlock> secondaryList = new LinkedList<BuildingSlotBlock>();
LinkedList<SchematicToBuild> postProcessing = new LinkedList<SchematicToBuild>(); LinkedList<BuildingSlotEntity> entityList = new LinkedList<BuildingSlotEntity>();
LinkedList<BuildingSlot> postProcessing = new LinkedList<BuildingSlot>();
public LinkedList <ItemStack> neededItems = new LinkedList <ItemStack> (); public LinkedList <ItemStack> neededItems = new LinkedList <ItemStack> ();
@ -43,9 +48,9 @@ public class BptBuilderBlueprint extends BptBuilderBase {
for (int j = bluePrint.sizeY - 1; j >= 0; --j) { for (int j = bluePrint.sizeY - 1; j >= 0; --j) {
for (int i = 0; i < bluePrint.sizeX; ++i) { for (int i = 0; i < bluePrint.sizeX; ++i) {
for (int k = 0; k < bluePrint.sizeZ; ++k) { for (int k = 0; k < bluePrint.sizeZ; ++k) {
int xCoord = i + x - bluePrint.anchorX; int xCoord = i + x - blueprint.anchorX;
int yCoord = j + y - bluePrint.anchorY; int yCoord = j + y - blueprint.anchorY;
int zCoord = k + z - bluePrint.anchorZ; int zCoord = k + z - blueprint.anchorZ;
SchematicBlock slot = (SchematicBlock) bluePrint.contents[i][j][k]; SchematicBlock slot = (SchematicBlock) bluePrint.contents[i][j][k];
@ -55,7 +60,7 @@ public class BptBuilderBlueprint extends BptBuilderBase {
slot.block = Blocks.air; slot.block = Blocks.air;
} }
SchematicToBuild b = new SchematicToBuild (); BuildingSlotBlock b = new BuildingSlotBlock ();
b.schematic = slot; b.schematic = slot;
b.x = xCoord; b.x = xCoord;
b.y = yCoord; b.y = yCoord;
@ -71,9 +76,9 @@ public class BptBuilderBlueprint extends BptBuilderBase {
for (int j = 0; j < bluePrint.sizeY; ++j) { for (int j = 0; j < bluePrint.sizeY; ++j) {
for (int i = 0; i < bluePrint.sizeX; ++i) { for (int i = 0; i < bluePrint.sizeX; ++i) {
for (int k = 0; k < bluePrint.sizeZ; ++k) { for (int k = 0; k < bluePrint.sizeZ; ++k) {
int xCoord = i + x - bluePrint.anchorX; int xCoord = i + x - blueprint.anchorX;
int yCoord = j + y - bluePrint.anchorY; int yCoord = j + y - blueprint.anchorY;
int zCoord = k + z - bluePrint.anchorZ; int zCoord = k + z - blueprint.anchorZ;
SchematicBlock slot = (SchematicBlock) bluePrint.contents[i][j][k]; SchematicBlock slot = (SchematicBlock) bluePrint.contents[i][j][k];
@ -83,7 +88,7 @@ public class BptBuilderBlueprint extends BptBuilderBase {
slot.block = Blocks.air; slot.block = Blocks.air;
} }
SchematicToBuild b = new SchematicToBuild (); BuildingSlotBlock b = new BuildingSlotBlock ();
b.schematic = slot; b.schematic = slot;
b.x = xCoord; b.x = xCoord;
b.y = yCoord; b.y = yCoord;
@ -99,13 +104,27 @@ public class BptBuilderBlueprint extends BptBuilderBase {
} }
} }
CoordTransformation transform = new CoordTransformation();
transform.x = x;
transform.y = y;
transform.z = z;
for (SchematicEntity e : bluePrint.entities) {
BuildingSlotEntity b = new BuildingSlotEntity();
b.schematic = e;
b.transform = transform;
entityList.add(b);
}
recomputeNeededItems(); recomputeNeededItems();
} }
private void checkDone() { private void checkDone() {
recomputeNeededItems(); recomputeNeededItems();
if (clearList.size() == 0 && primaryList.size() == 0 && secondaryList.size() == 0) { if (clearList.size() == 0 && primaryList.size() == 0
&& secondaryList.size() == 0 && entityList.size() == 0) {
done = true; done = true;
} else { } else {
done = false; done = false;
@ -113,9 +132,9 @@ public class BptBuilderBlueprint extends BptBuilderBase {
} }
@Override @Override
public SchematicToBuild getNextBlock(World world, IBuilderInventory inv) { public BuildingSlot getNextBlock(World world, IBuilderInventory inv) {
if (clearList.size() != 0) { if (clearList.size() != 0) {
SchematicToBuild slot = internalGetNextBlock(world, inv, clearList); BuildingSlot slot = internalGetNextBlock(world, inv, clearList);
checkDone(); checkDone();
if (slot != null) { if (slot != null) {
@ -124,7 +143,7 @@ public class BptBuilderBlueprint extends BptBuilderBase {
} }
if (primaryList.size() != 0) { if (primaryList.size() != 0) {
SchematicToBuild slot = internalGetNextBlock(world, inv, primaryList); BuildingSlot slot = internalGetNextBlock(world, inv, primaryList);
checkDone(); checkDone();
if (slot != null) { if (slot != null) {
@ -133,7 +152,16 @@ public class BptBuilderBlueprint extends BptBuilderBase {
} }
if (secondaryList.size() != 0) { if (secondaryList.size() != 0) {
SchematicToBuild slot = internalGetNextBlock(world, inv, secondaryList); BuildingSlot slot = internalGetNextBlock(world, inv, secondaryList);
checkDone();
if (slot != null) {
return slot;
}
}
if (entityList.size() != 0) {
BuildingSlot slot = entityList.removeFirst();
checkDone (); checkDone ();
if (slot != null) { if (slot != null) {
@ -146,13 +174,13 @@ public class BptBuilderBlueprint extends BptBuilderBase {
return null; return null;
} }
private SchematicToBuild internalGetNextBlock(World world, IBuilderInventory inv, LinkedList<SchematicToBuild> list) { private BuildingSlot internalGetNextBlock(World world, IBuilderInventory inv, LinkedList<BuildingSlotBlock> list) {
LinkedList<SchematicToBuild> failSlots = new LinkedList<SchematicToBuild>(); LinkedList<BuildingSlotBlock> failSlots = new LinkedList<BuildingSlotBlock>();
SchematicToBuild result = null; BuildingSlot result = null;
while (list.size() > 0) { while (list.size() > 0) {
SchematicToBuild slot = list.removeFirst(); BuildingSlotBlock slot = list.removeFirst();
postProcessing.add(slot); postProcessing.add(slot);
boolean getNext = false; boolean getNext = false;
@ -332,11 +360,11 @@ public class BptBuilderBlueprint extends BptBuilderBase {
HashMap <StackKey, Integer> computeStacks = new HashMap <StackKey, Integer> (); HashMap <StackKey, Integer> computeStacks = new HashMap <StackKey, Integer> ();
for (SchematicToBuild slot : primaryList) { for (BuildingSlot slot : primaryList) {
LinkedList<ItemStack> stacks = new LinkedList<ItemStack>(); LinkedList<ItemStack> stacks = new LinkedList<ItemStack>();
try { try {
stacks = slot.schematic.getRequirements(context); stacks = slot.getRequirements(context);
} catch (Throwable t) { } catch (Throwable t) {
// Defensive code against errors in implementers // Defensive code against errors in implementers
t.printStackTrace(); t.printStackTrace();
@ -362,8 +390,8 @@ public class BptBuilderBlueprint extends BptBuilderBase {
} }
} }
for (SchematicToBuild slot : secondaryList) { for (BuildingSlot slot : secondaryList) {
LinkedList<ItemStack> stacks = slot.schematic.getRequirements(context); LinkedList<ItemStack> stacks = slot.getRequirements(context);
for (ItemStack stack : stacks) { for (ItemStack stack : stacks) {
if (stack == null || stack.getItem() == null || stack.stackSize == 0) { if (stack == null || stack.getItem() == null || stack.stackSize == 0) {
@ -438,9 +466,9 @@ public class BptBuilderBlueprint extends BptBuilderBase {
@Override @Override
public void postProcessing(World world) { public void postProcessing(World world) {
for (SchematicToBuild s : postProcessing) { for (BuildingSlot s : postProcessing) {
try { try {
s.schematic.postProcessing(context, s.x, s.y, s.z); s.postProcessing(context);
} catch (Throwable t) { } catch (Throwable t) {
// Defensive code against errors in implementers // Defensive code against errors in implementers
t.printStackTrace(); t.printStackTrace();

View file

@ -11,16 +11,17 @@ 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.BuildingSlot;
import buildcraft.api.blueprints.BuildingSlotBlock;
import buildcraft.api.blueprints.BuildingSlotBlock.Mode;
import buildcraft.api.blueprints.Schematic; import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.SchematicToBuild;
import buildcraft.api.blueprints.SchematicToBuild.Mode;
import buildcraft.api.core.BuildCraftAPI; import buildcraft.api.core.BuildCraftAPI;
import buildcraft.core.IBuilderInventory; import buildcraft.core.IBuilderInventory;
public class BptBuilderTemplate extends BptBuilderBase { public class BptBuilderTemplate extends BptBuilderBase {
LinkedList<SchematicToBuild> clearList = new LinkedList<SchematicToBuild>(); LinkedList<BuildingSlotBlock> clearList = new LinkedList<BuildingSlotBlock>();
LinkedList<SchematicToBuild> buildList = new LinkedList<SchematicToBuild>(); LinkedList<BuildingSlotBlock> buildList = new LinkedList<BuildingSlotBlock>();
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);
@ -28,14 +29,14 @@ public class BptBuilderTemplate extends BptBuilderBase {
for (int j = bluePrint.sizeY - 1; j >= 0; --j) { for (int j = bluePrint.sizeY - 1; j >= 0; --j) {
for (int i = 0; i < bluePrint.sizeX; ++i) { for (int i = 0; i < bluePrint.sizeX; ++i) {
for (int k = 0; k < bluePrint.sizeZ; ++k) { for (int k = 0; k < bluePrint.sizeZ; ++k) {
int xCoord = i + x - bluePrint.anchorX; int xCoord = i + x - blueprint.anchorX;
int yCoord = j + y - bluePrint.anchorY; int yCoord = j + y - blueprint.anchorY;
int zCoord = k + z - bluePrint.anchorZ; int zCoord = k + z - blueprint.anchorZ;
Schematic slot = bluePrint.contents[i][j][k]; Schematic slot = bluePrint.contents[i][j][k];
if (slot == null) { if (slot == null) {
SchematicToBuild b = new SchematicToBuild(); BuildingSlotBlock b = new BuildingSlotBlock();
b.schematic = null; b.schematic = null;
b.x = xCoord; b.x = xCoord;
@ -52,14 +53,14 @@ public class BptBuilderTemplate extends BptBuilderBase {
for (int j = 0; j < bluePrint.sizeY; ++j) { for (int j = 0; j < bluePrint.sizeY; ++j) {
for (int i = 0; i < bluePrint.sizeX; ++i) { for (int i = 0; i < bluePrint.sizeX; ++i) {
for (int k = 0; k < bluePrint.sizeZ; ++k) { for (int k = 0; k < bluePrint.sizeZ; ++k) {
int xCoord = i + x - bluePrint.anchorX; int xCoord = i + x - blueprint.anchorX;
int yCoord = j + y - bluePrint.anchorY; int yCoord = j + y - blueprint.anchorY;
int zCoord = k + z - bluePrint.anchorZ; int zCoord = k + z - blueprint.anchorZ;
Schematic slot = bluePrint.contents[i][j][k]; Schematic slot = bluePrint.contents[i][j][k];
if (slot != null) { if (slot != null) {
SchematicToBuild b = new SchematicToBuild(); BuildingSlotBlock b = new BuildingSlotBlock();
b.schematic = slot; b.schematic = slot;
b.x = xCoord; b.x = xCoord;
@ -84,9 +85,9 @@ public class BptBuilderTemplate extends BptBuilderBase {
} }
@Override @Override
public SchematicToBuild getNextBlock(World world, IBuilderInventory inv) { public BuildingSlot getNextBlock(World world, IBuilderInventory inv) {
if (clearList.size() != 0) { if (clearList.size() != 0) {
SchematicToBuild slot = internalGetNextBlock(world, inv, clearList); BuildingSlotBlock slot = internalGetNextBlock(world, inv, clearList);
checkDone(); checkDone();
if (slot != null) { if (slot != null) {
@ -95,7 +96,7 @@ public class BptBuilderTemplate extends BptBuilderBase {
} }
if (buildList.size() != 0) { if (buildList.size() != 0) {
SchematicToBuild slot = internalGetNextBlock(world, inv, buildList); BuildingSlotBlock slot = internalGetNextBlock(world, inv, buildList);
checkDone(); checkDone();
if (slot != null) { if (slot != null) {
@ -108,11 +109,11 @@ public class BptBuilderTemplate extends BptBuilderBase {
return null; return null;
} }
public SchematicToBuild internalGetNextBlock(World world, IBuilderInventory inv, LinkedList<SchematicToBuild> list) { public BuildingSlotBlock internalGetNextBlock(World world, IBuilderInventory inv, LinkedList<BuildingSlotBlock> list) {
SchematicToBuild result = null; BuildingSlotBlock result = null;
while (list.size() > 0) { while (list.size() > 0) {
SchematicToBuild slot = list.removeFirst(); BuildingSlotBlock slot = list.removeFirst();
if (slot.mode == Mode.ClearIfInvalid if (slot.mode == Mode.ClearIfInvalid
&& !BuildCraftAPI.softBlocks.contains(context.world() && !BuildCraftAPI.softBlocks.contains(context.world()

View file

@ -27,7 +27,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.BuildCraftCore; import buildcraft.BuildCraftCore;
import buildcraft.BuildCraftFactory; import buildcraft.BuildCraftFactory;
import buildcraft.api.blueprints.SchematicRegistry; import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.api.blueprints.SchematicToBuild; import buildcraft.api.blueprints.BuildingSlot;
import buildcraft.api.core.IAreaProvider; import buildcraft.api.core.IAreaProvider;
import buildcraft.api.gates.IAction; import buildcraft.api.gates.IAction;
import buildcraft.api.power.IPowerReceptor; import buildcraft.api.power.IPowerReceptor;
@ -193,7 +193,7 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept
} }
protected void buildFrame() { protected void buildFrame() {
SchematicToBuild schematic = blueprintBuilder.getNextBlock(getWorld(), this); BuildingSlot schematic = blueprintBuilder.getNextBlock(getWorld(), this);
if (schematic == null) { if (schematic == null) {
return; return;
@ -636,21 +636,21 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept
for (int it = 0; it < 2; it++) { for (int it = 0; it < 2; it++) {
for (int i = 0; i < blueprint.sizeX; ++i) { for (int i = 0; i < blueprint.sizeX; ++i) {
blueprint.contents [i][it * (box.sizeY() - 1)][0] = SchematicRegistry.newSchematic(BuildCraftFactory.frameBlock); blueprint.contents [i][it * (box.sizeY() - 1)][0] = SchematicRegistry.newSchematicBlock(BuildCraftFactory.frameBlock);
blueprint.contents [i][it * (box.sizeY() - 1)][blueprint.sizeZ - 1] = SchematicRegistry.newSchematic(BuildCraftFactory.frameBlock); blueprint.contents [i][it * (box.sizeY() - 1)][blueprint.sizeZ - 1] = SchematicRegistry.newSchematicBlock(BuildCraftFactory.frameBlock);
} }
for (int k = 0; k < blueprint.sizeZ; ++k) { for (int k = 0; k < blueprint.sizeZ; ++k) {
blueprint.contents [0][it * (box.sizeY() - 1)][k] = SchematicRegistry.newSchematic(BuildCraftFactory.frameBlock); blueprint.contents [0][it * (box.sizeY() - 1)][k] = SchematicRegistry.newSchematicBlock(BuildCraftFactory.frameBlock);
blueprint.contents [blueprint.sizeX - 1][it * (box.sizeY() - 1)][k] = SchematicRegistry.newSchematic(BuildCraftFactory.frameBlock); blueprint.contents [blueprint.sizeX - 1][it * (box.sizeY() - 1)][k] = SchematicRegistry.newSchematicBlock(BuildCraftFactory.frameBlock);
} }
} }
for (int h = 1; h < box.sizeY(); ++h) { for (int h = 1; h < box.sizeY(); ++h) {
blueprint.contents [0][h][0] = SchematicRegistry.newSchematic(BuildCraftFactory.frameBlock); blueprint.contents [0][h][0] = SchematicRegistry.newSchematicBlock(BuildCraftFactory.frameBlock);
blueprint.contents [0][h][blueprint.sizeZ - 1] = SchematicRegistry.newSchematic(BuildCraftFactory.frameBlock); blueprint.contents [0][h][blueprint.sizeZ - 1] = SchematicRegistry.newSchematicBlock(BuildCraftFactory.frameBlock);
blueprint.contents [blueprint.sizeX - 1][h][0] = SchematicRegistry.newSchematic(BuildCraftFactory.frameBlock); blueprint.contents [blueprint.sizeX - 1][h][0] = SchematicRegistry.newSchematicBlock(BuildCraftFactory.frameBlock);
blueprint.contents [blueprint.sizeX - 1][h][blueprint.sizeZ - 1] = SchematicRegistry.newSchematic(BuildCraftFactory.frameBlock); blueprint.contents [blueprint.sizeX - 1][h][blueprint.sizeZ - 1] = SchematicRegistry.newSchematicBlock(BuildCraftFactory.frameBlock);
} }
blueprintBuilder = new BptBuilderBlueprint(blueprint, worldObj, box.xMin, yCoord, box.zMin); //ForgeDirection.NORTH blueprintBuilder = new BptBuilderBlueprint(blueprint, worldObj, box.xMin, yCoord, box.zMin); //ForgeDirection.NORTH

View file

@ -30,7 +30,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class PipeFluidsWood extends Pipe<PipeTransportFluids> { public class PipeFluidsWood extends Pipe<PipeTransportFluids> {
@MjBattery (maxCapacity = 250, maxReceivedPerCycle = 100, miniumConsumption = 0) @MjBattery (maxCapacity = 250, maxReceivedPerCycle = 100, minimumConsumption = 0)
public double mjStored = 0; public double mjStored = 0;
public @NetworkData public @NetworkData

View file

@ -40,7 +40,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class PipeItemsObsidian extends Pipe<PipeTransportItems> { public class PipeItemsObsidian extends Pipe<PipeTransportItems> {
@MjBattery (maxCapacity = 256, maxReceivedPerCycle = 64, miniumConsumption = 0) @MjBattery (maxCapacity = 256, maxReceivedPerCycle = 64, minimumConsumption = 0)
public double mjStored = 0; public double mjStored = 0;
private static final PowerHandler.PerditionCalculator PERDITION = new PowerHandler.PerditionCalculator(0.5F); private static final PowerHandler.PerditionCalculator PERDITION = new PowerHandler.PerditionCalculator(0.5F);

View file

@ -32,7 +32,7 @@ import buildcraft.transport.utils.TransportUtils;
public class PipeItemsStripes extends Pipe <PipeTransportItems> { public class PipeItemsStripes extends Pipe <PipeTransportItems> {
@MjBattery (maxCapacity = 1, maxReceivedPerCycle = 1, miniumConsumption = 0) @MjBattery (maxCapacity = 1, maxReceivedPerCycle = 1, minimumConsumption = 0)
public double mjStored = 0; public double mjStored = 0;
public PipeItemsStripes(Item item) { public PipeItemsStripes(Item item) {

View file

@ -32,7 +32,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class PipeItemsWood extends Pipe<PipeTransportItems> { public class PipeItemsWood extends Pipe<PipeTransportItems> {
@MjBattery (maxCapacity = 64, maxReceivedPerCycle = 64, miniumConsumption = 0) @MjBattery (maxCapacity = 64, maxReceivedPerCycle = 64, minimumConsumption = 0)
public double mjStored = 0; public double mjStored = 0;
protected int standardIconIndex = PipeIconProvider.TYPE.PipeItemsWood_Standard.ordinal(); protected int standardIconIndex = PipeIconProvider.TYPE.PipeItemsWood_Standard.ordinal();

View file

@ -26,7 +26,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class PipePowerWood extends Pipe<PipeTransportPower> implements IPipeTransportPowerHook { public class PipePowerWood extends Pipe<PipeTransportPower> implements IPipeTransportPowerHook {
@MjBattery (maxCapacity = 1500, maxReceivedPerCycle = 500, miniumConsumption = 0) @MjBattery (maxCapacity = 1500, maxReceivedPerCycle = 500, minimumConsumption = 0)
public double mjStored = 0; public double mjStored = 0;
protected int standardIconIndex = PipeIconProvider.TYPE.PipePowerWood_Standard.ordinal(); protected int standardIconIndex = PipeIconProvider.TYPE.PipePowerWood_Standard.ordinal();