refactor SchematicRegistry to ISchematicRegistry

This commit is contained in:
asiekierka 2014-10-26 12:27:51 +01:00
parent 3eae592b59
commit 53cfda589e
34 changed files with 209 additions and 210 deletions

View file

@ -0,0 +1,11 @@
package buildcraft.api.blueprints;
public final class BuilderAPI {
public static ISchematicRegistry schematicRegistry;
public static int BREAK_ENERGY = 100;
public static final int BUILD_ENERGY = 200;
private BuilderAPI() {
}
}

View file

@ -9,7 +9,6 @@
package buildcraft.api.blueprints;
import net.minecraft.world.World;
import buildcraft.api.core.IBox;
import buildcraft.api.core.Position;

View file

@ -0,0 +1,14 @@
package buildcraft.api.blueprints;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
public interface ISchematicRegistry {
void registerSchematicBlock(Block block, Class<? extends Schematic> clazz, Object... params);
void registerSchematicBlock(Block block, int meta, Class<? extends Schematic> clazz, Object... params);
void registerSchematicEntity(
Class<? extends Entity> entityClass,
Class<? extends SchematicEntity> schematicClass, Object... params);
boolean isSupported(Block block, int metadata);
}

View file

@ -20,9 +20,7 @@ import net.minecraft.nbt.NBTTagByte;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagShort;
import net.minecraftforge.common.util.Constants;
import buildcraft.api.core.BCLog;
public class MappingRegistry {

View file

@ -13,7 +13,6 @@ import java.util.LinkedList;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.api.core.IInvSlot;
/**
@ -188,7 +187,7 @@ public abstract class Schematic {
if (stacksUsed != null) {
for (ItemStack s : stacksUsed) {
result += s.stackSize * SchematicRegistry.BUILD_ENERGY;
result += s.stackSize * BuilderAPI.BUILD_ENERGY;
}
}

View file

@ -17,7 +17,6 @@ import net.minecraft.block.BlockLiquid;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.fluids.BlockFluidBase;

View file

@ -19,9 +19,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagDouble;
import net.minecraft.nbt.NBTTagFloat;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.common.util.Constants;
import buildcraft.api.core.Position;
public class SchematicEntity extends Schematic {

View file

@ -11,7 +11,6 @@ package buildcraft.api.blueprints;
import java.util.LinkedList;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
public class SchematicFluid extends SchematicBlock {
@ -77,6 +76,6 @@ public class SchematicFluid extends SchematicBlock {
@Override
public int getEnergyRequirement(LinkedList<ItemStack> stacksUsed) {
return 1 * SchematicRegistry.BUILD_ENERGY;
return 1 * BuilderAPI.BUILD_ENERGY;
}
}

View file

@ -14,7 +14,6 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.WorldServer;
import buildcraft.api.core.BuildCraftAPI;
public class SchematicMask extends SchematicBlockBase {

View file

@ -15,7 +15,6 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import buildcraft.api.core.JavaTools;
public class SchematicTile extends SchematicBlock {

View file

@ -6,6 +6,6 @@
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
@API(apiVersion = "1.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|blueprints")
@API(apiVersion = "1.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|blueprints")
package buildcraft.api.blueprints;
import cpw.mods.fml.common.API;

View file

@ -40,11 +40,12 @@ import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import buildcraft.api.blueprints.BlueprintDeployer;
import buildcraft.api.blueprints.BuilderAPI;
import buildcraft.api.blueprints.ISchematicRegistry;
import buildcraft.api.blueprints.SchematicBlock;
import buildcraft.api.blueprints.SchematicEntity;
import buildcraft.api.blueprints.SchematicFactory;
import buildcraft.api.blueprints.SchematicMask;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.api.core.BCLog;
import buildcraft.api.core.JavaTools;
import buildcraft.api.filler.FillerManager;
@ -117,6 +118,7 @@ import buildcraft.core.DefaultProps;
import buildcraft.core.InterModComms;
import buildcraft.core.Version;
import buildcraft.core.blueprints.RealBlueprintDeployer;
import buildcraft.core.blueprints.SchematicRegistry;
import buildcraft.core.builders.patterns.FillerPattern;
import buildcraft.core.builders.patterns.FillerRegistry;
import buildcraft.core.builders.patterns.PatternBox;
@ -250,151 +252,152 @@ public class BuildCraftBuilders extends BuildCraftMod {
MinecraftForge.EVENT_BUS.register(new EventHandlerBuilders());
// Standard blocks
SchematicRegistry.registerSchematicBlock(Blocks.snow, SchematicIgnore.class);
SchematicRegistry.registerSchematicBlock(Blocks.tallgrass, SchematicIgnore.class);
SchematicRegistry.registerSchematicBlock(Blocks.double_plant, SchematicIgnore.class);
SchematicRegistry.registerSchematicBlock(Blocks.ice, SchematicIgnore.class);
SchematicRegistry.registerSchematicBlock(Blocks.piston_head, SchematicIgnore.class);
ISchematicRegistry schemes = BuilderAPI.schematicRegistry;
schemes.registerSchematicBlock(Blocks.snow, SchematicIgnore.class);
schemes.registerSchematicBlock(Blocks.tallgrass, SchematicIgnore.class);
schemes.registerSchematicBlock(Blocks.double_plant, SchematicIgnore.class);
schemes.registerSchematicBlock(Blocks.ice, SchematicIgnore.class);
schemes.registerSchematicBlock(Blocks.piston_head, SchematicIgnore.class);
SchematicRegistry.registerSchematicBlock(Blocks.dirt, SchematicDirt.class);
SchematicRegistry.registerSchematicBlock(Blocks.grass, SchematicDirt.class);
schemes.registerSchematicBlock(Blocks.dirt, SchematicDirt.class);
schemes.registerSchematicBlock(Blocks.grass, SchematicDirt.class);
SchematicRegistry.registerSchematicBlock(Blocks.cactus, SchematicCactus.class);
schemes.registerSchematicBlock(Blocks.cactus, SchematicCactus.class);
SchematicRegistry.registerSchematicBlock(Blocks.farmland, SchematicFarmland.class);
SchematicRegistry.registerSchematicBlock(Blocks.wheat, SchematicSeeds.class, Items.wheat_seeds);
SchematicRegistry.registerSchematicBlock(Blocks.pumpkin_stem, SchematicSeeds.class, Items.pumpkin_seeds);
SchematicRegistry.registerSchematicBlock(Blocks.melon_stem, SchematicSeeds.class, Items.melon_seeds);
SchematicRegistry.registerSchematicBlock(Blocks.nether_wart, SchematicSeeds.class, Items.nether_wart);
schemes.registerSchematicBlock(Blocks.farmland, SchematicFarmland.class);
schemes.registerSchematicBlock(Blocks.wheat, SchematicSeeds.class, Items.wheat_seeds);
schemes.registerSchematicBlock(Blocks.pumpkin_stem, SchematicSeeds.class, Items.pumpkin_seeds);
schemes.registerSchematicBlock(Blocks.melon_stem, SchematicSeeds.class, Items.melon_seeds);
schemes.registerSchematicBlock(Blocks.nether_wart, SchematicSeeds.class, Items.nether_wart);
SchematicRegistry.registerSchematicBlock(Blocks.torch, SchematicWallSide.class);
SchematicRegistry.registerSchematicBlock(Blocks.redstone_torch, SchematicWallSide.class);
SchematicRegistry.registerSchematicBlock(Blocks.unlit_redstone_torch, SchematicWallSide.class);
schemes.registerSchematicBlock(Blocks.torch, SchematicWallSide.class);
schemes.registerSchematicBlock(Blocks.redstone_torch, SchematicWallSide.class);
schemes.registerSchematicBlock(Blocks.unlit_redstone_torch, SchematicWallSide.class);
SchematicRegistry.registerSchematicBlock(Blocks.tripwire_hook, SchematicTripWireHook.class);
schemes.registerSchematicBlock(Blocks.tripwire_hook, SchematicTripWireHook.class);
SchematicRegistry.registerSchematicBlock(Blocks.skull, SchematicSkull.class);
schemes.registerSchematicBlock(Blocks.skull, SchematicSkull.class);
SchematicRegistry.registerSchematicBlock(Blocks.ladder, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true);
SchematicRegistry.registerSchematicBlock(Blocks.fence_gate, SchematicRotateMeta.class, new int[]{0, 1, 2, 3}, true);
SchematicRegistry.registerSchematicBlock(Blocks.log, SchematicRotateMeta.class, new int[]{8, 4, 8, 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.registerSchematicBlock(Blocks.anvil, SchematicRotateMeta.class, new int[]{0, 1, 2, 3}, true);
schemes.registerSchematicBlock(Blocks.ladder, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true);
schemes.registerSchematicBlock(Blocks.fence_gate, SchematicRotateMeta.class, new int[]{0, 1, 2, 3}, true);
schemes.registerSchematicBlock(Blocks.log, SchematicRotateMeta.class, new int[]{8, 4, 8, 4}, true);
schemes.registerSchematicBlock(Blocks.log2, SchematicRotateMeta.class, new int[]{8, 4, 8, 4}, true);
schemes.registerSchematicBlock(Blocks.hay_block, SchematicRotateMeta.class, new int[]{8, 4, 8, 4}, true);
schemes.registerSchematicBlock(Blocks.quartz_block, SchematicRotateMeta.class, new int[]{4, 3, 4, 3}, true);
schemes.registerSchematicBlock(Blocks.hopper, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true);
schemes.registerSchematicBlock(Blocks.anvil, SchematicRotateMeta.class, new int[]{0, 1, 2, 3}, true);
SchematicRegistry.registerSchematicBlock(Blocks.furnace, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true);
SchematicRegistry.registerSchematicBlock(Blocks.lit_furnace, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true);
SchematicRegistry.registerSchematicBlock(Blocks.chest, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true);
SchematicRegistry.registerSchematicBlock(Blocks.dispenser, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true);
SchematicRegistry.registerSchematicBlock(Blocks.dropper, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true);
schemes.registerSchematicBlock(Blocks.furnace, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true);
schemes.registerSchematicBlock(Blocks.lit_furnace, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true);
schemes.registerSchematicBlock(Blocks.chest, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true);
schemes.registerSchematicBlock(Blocks.dispenser, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true);
schemes.registerSchematicBlock(Blocks.dropper, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true);
SchematicRegistry.registerSchematicBlock(Blocks.ender_chest, SchematicEnderChest.class);
schemes.registerSchematicBlock(Blocks.ender_chest, SchematicEnderChest.class);
SchematicRegistry.registerSchematicBlock(Blocks.vine, SchematicRotateMeta.class, new int[]{1, 4, 8, 2}, false);
SchematicRegistry.registerSchematicBlock(Blocks.trapdoor, SchematicRotateMeta.class, new int[]{0, 1, 2, 3}, false);
schemes.registerSchematicBlock(Blocks.vine, SchematicRotateMeta.class, new int[]{1, 4, 8, 2}, false);
schemes.registerSchematicBlock(Blocks.trapdoor, SchematicRotateMeta.class, new int[]{0, 1, 2, 3}, false);
SchematicRegistry.registerSchematicBlock(Blocks.wooden_button, SchematicLever.class);
SchematicRegistry.registerSchematicBlock(Blocks.stone_button, SchematicLever.class);
SchematicRegistry.registerSchematicBlock(Blocks.lever, SchematicLever.class);
schemes.registerSchematicBlock(Blocks.wooden_button, SchematicLever.class);
schemes.registerSchematicBlock(Blocks.stone_button, SchematicLever.class);
schemes.registerSchematicBlock(Blocks.lever, SchematicLever.class);
SchematicRegistry.registerSchematicBlock(Blocks.stone, SchematicStone.class);
SchematicRegistry.registerSchematicBlock(Blocks.gold_ore, SchematicStone.class);
SchematicRegistry.registerSchematicBlock(Blocks.iron_ore, SchematicStone.class);
SchematicRegistry.registerSchematicBlock(Blocks.coal_ore, SchematicStone.class);
SchematicRegistry.registerSchematicBlock(Blocks.lapis_ore, SchematicStone.class);
SchematicRegistry.registerSchematicBlock(Blocks.diamond_ore, SchematicStone.class);
SchematicRegistry.registerSchematicBlock(Blocks.redstone_ore, SchematicStone.class);
SchematicRegistry.registerSchematicBlock(Blocks.lit_redstone_ore, SchematicStone.class);
SchematicRegistry.registerSchematicBlock(Blocks.emerald_ore, SchematicStone.class);
schemes.registerSchematicBlock(Blocks.stone, SchematicStone.class);
schemes.registerSchematicBlock(Blocks.gold_ore, SchematicStone.class);
schemes.registerSchematicBlock(Blocks.iron_ore, SchematicStone.class);
schemes.registerSchematicBlock(Blocks.coal_ore, SchematicStone.class);
schemes.registerSchematicBlock(Blocks.lapis_ore, SchematicStone.class);
schemes.registerSchematicBlock(Blocks.diamond_ore, SchematicStone.class);
schemes.registerSchematicBlock(Blocks.redstone_ore, SchematicStone.class);
schemes.registerSchematicBlock(Blocks.lit_redstone_ore, SchematicStone.class);
schemes.registerSchematicBlock(Blocks.emerald_ore, SchematicStone.class);
SchematicRegistry.registerSchematicBlock(Blocks.gravel, SchematicGravel.class);
schemes.registerSchematicBlock(Blocks.gravel, SchematicGravel.class);
SchematicRegistry.registerSchematicBlock(Blocks.redstone_wire, SchematicRedstoneWire.class, new ItemStack(Items.redstone));
SchematicRegistry.registerSchematicBlock(Blocks.cake, SchematicCustomStack.class, new ItemStack(Items.cake));
SchematicRegistry.registerSchematicBlock(Blocks.glowstone, SchematicCustomStack.class, new ItemStack(Blocks.glowstone));
schemes.registerSchematicBlock(Blocks.redstone_wire, SchematicRedstoneWire.class, new ItemStack(Items.redstone));
schemes.registerSchematicBlock(Blocks.cake, SchematicCustomStack.class, new ItemStack(Items.cake));
schemes.registerSchematicBlock(Blocks.glowstone, SchematicCustomStack.class, new ItemStack(Blocks.glowstone));
SchematicRegistry.registerSchematicBlock(Blocks.powered_repeater, SchematicRedstoneDiode.class, Items.repeater);
SchematicRegistry.registerSchematicBlock(Blocks.unpowered_repeater, SchematicRedstoneDiode.class, Items.repeater);
SchematicRegistry.registerSchematicBlock(Blocks.powered_comparator, SchematicRedstoneDiode.class, Items.comparator);
SchematicRegistry.registerSchematicBlock(Blocks.unpowered_comparator, SchematicRedstoneDiode.class, Items.comparator);
schemes.registerSchematicBlock(Blocks.powered_repeater, SchematicRedstoneDiode.class, Items.repeater);
schemes.registerSchematicBlock(Blocks.unpowered_repeater, SchematicRedstoneDiode.class, Items.repeater);
schemes.registerSchematicBlock(Blocks.powered_comparator, SchematicRedstoneDiode.class, Items.comparator);
schemes.registerSchematicBlock(Blocks.unpowered_comparator, SchematicRedstoneDiode.class, Items.comparator);
SchematicRegistry.registerSchematicBlock(Blocks.redstone_lamp, SchematicRedstoneLamp.class);
SchematicRegistry.registerSchematicBlock(Blocks.lit_redstone_lamp, SchematicRedstoneLamp.class);
schemes.registerSchematicBlock(Blocks.redstone_lamp, SchematicRedstoneLamp.class);
schemes.registerSchematicBlock(Blocks.lit_redstone_lamp, SchematicRedstoneLamp.class);
SchematicRegistry.registerSchematicBlock(Blocks.glass_pane, SchematicGlassPane.class);
SchematicRegistry.registerSchematicBlock(Blocks.stained_glass_pane, SchematicGlassPane.class);
schemes.registerSchematicBlock(Blocks.glass_pane, SchematicGlassPane.class);
schemes.registerSchematicBlock(Blocks.stained_glass_pane, SchematicGlassPane.class);
SchematicRegistry.registerSchematicBlock(Blocks.piston, SchematicPiston.class);
SchematicRegistry.registerSchematicBlock(Blocks.piston_extension, SchematicPiston.class);
SchematicRegistry.registerSchematicBlock(Blocks.sticky_piston, SchematicPiston.class);
schemes.registerSchematicBlock(Blocks.piston, SchematicPiston.class);
schemes.registerSchematicBlock(Blocks.piston_extension, SchematicPiston.class);
schemes.registerSchematicBlock(Blocks.sticky_piston, SchematicPiston.class);
SchematicRegistry.registerSchematicBlock(Blocks.lit_pumpkin, SchematicPumpkin.class);
schemes.registerSchematicBlock(Blocks.lit_pumpkin, SchematicPumpkin.class);
SchematicRegistry.registerSchematicBlock(Blocks.oak_stairs, SchematicStairs.class);
SchematicRegistry.registerSchematicBlock(Blocks.stone_stairs, SchematicStairs.class);
SchematicRegistry.registerSchematicBlock(Blocks.brick_stairs, SchematicStairs.class);
SchematicRegistry.registerSchematicBlock(Blocks.stone_brick_stairs, SchematicStairs.class);
SchematicRegistry.registerSchematicBlock(Blocks.nether_brick_stairs, SchematicStairs.class);
SchematicRegistry.registerSchematicBlock(Blocks.sandstone_stairs, SchematicStairs.class);
SchematicRegistry.registerSchematicBlock(Blocks.spruce_stairs, SchematicStairs.class);
SchematicRegistry.registerSchematicBlock(Blocks.birch_stairs, SchematicStairs.class);
SchematicRegistry.registerSchematicBlock(Blocks.jungle_stairs, SchematicStairs.class);
SchematicRegistry.registerSchematicBlock(Blocks.quartz_stairs, SchematicStairs.class);
SchematicRegistry.registerSchematicBlock(Blocks.acacia_stairs, SchematicStairs.class);
SchematicRegistry.registerSchematicBlock(Blocks.dark_oak_stairs, SchematicStairs.class);
schemes.registerSchematicBlock(Blocks.oak_stairs, SchematicStairs.class);
schemes.registerSchematicBlock(Blocks.stone_stairs, SchematicStairs.class);
schemes.registerSchematicBlock(Blocks.brick_stairs, SchematicStairs.class);
schemes.registerSchematicBlock(Blocks.stone_brick_stairs, SchematicStairs.class);
schemes.registerSchematicBlock(Blocks.nether_brick_stairs, SchematicStairs.class);
schemes.registerSchematicBlock(Blocks.sandstone_stairs, SchematicStairs.class);
schemes.registerSchematicBlock(Blocks.spruce_stairs, SchematicStairs.class);
schemes.registerSchematicBlock(Blocks.birch_stairs, SchematicStairs.class);
schemes.registerSchematicBlock(Blocks.jungle_stairs, SchematicStairs.class);
schemes.registerSchematicBlock(Blocks.quartz_stairs, SchematicStairs.class);
schemes.registerSchematicBlock(Blocks.acacia_stairs, SchematicStairs.class);
schemes.registerSchematicBlock(Blocks.dark_oak_stairs, SchematicStairs.class);
SchematicRegistry.registerSchematicBlock(Blocks.wooden_door, SchematicDoor.class, new ItemStack(Items.wooden_door));
SchematicRegistry.registerSchematicBlock(Blocks.iron_door, SchematicDoor.class, new ItemStack(Items.iron_door));
schemes.registerSchematicBlock(Blocks.wooden_door, SchematicDoor.class, new ItemStack(Items.wooden_door));
schemes.registerSchematicBlock(Blocks.iron_door, SchematicDoor.class, new ItemStack(Items.iron_door));
SchematicRegistry.registerSchematicBlock(Blocks.bed, SchematicBed.class);
schemes.registerSchematicBlock(Blocks.bed, SchematicBed.class);
SchematicRegistry.registerSchematicBlock(Blocks.wall_sign, SchematicSign.class, true);
SchematicRegistry.registerSchematicBlock(Blocks.standing_sign, SchematicSign.class, false);
schemes.registerSchematicBlock(Blocks.wall_sign, SchematicSign.class, true);
schemes.registerSchematicBlock(Blocks.standing_sign, SchematicSign.class, false);
SchematicRegistry.registerSchematicBlock(Blocks.portal, SchematicPortal.class);
schemes.registerSchematicBlock(Blocks.portal, SchematicPortal.class);
SchematicRegistry.registerSchematicBlock(Blocks.rail, SchematicRail.class);
SchematicRegistry.registerSchematicBlock(Blocks.activator_rail, SchematicRail.class);
SchematicRegistry.registerSchematicBlock(Blocks.detector_rail, SchematicRail.class);
SchematicRegistry.registerSchematicBlock(Blocks.golden_rail, SchematicRail.class);
schemes.registerSchematicBlock(Blocks.rail, SchematicRail.class);
schemes.registerSchematicBlock(Blocks.activator_rail, SchematicRail.class);
schemes.registerSchematicBlock(Blocks.detector_rail, SchematicRail.class);
schemes.registerSchematicBlock(Blocks.golden_rail, SchematicRail.class);
SchematicRegistry.registerSchematicBlock(Blocks.fire, SchematicFire.class);
schemes.registerSchematicBlock(Blocks.fire, SchematicFire.class);
SchematicRegistry.registerSchematicBlock(Blocks.bedrock, SchematicBlockCreative.class);
schemes.registerSchematicBlock(Blocks.bedrock, SchematicBlockCreative.class);
SchematicRegistry.registerSchematicBlock(Blocks.mob_spawner, SchematicTileCreative.class);
schemes.registerSchematicBlock(Blocks.mob_spawner, SchematicTileCreative.class);
SchematicRegistry.registerSchematicBlock(Blocks.glass, SchematicStandalone.class);
SchematicRegistry.registerSchematicBlock(Blocks.stone_slab, SchematicStandalone.class);
SchematicRegistry.registerSchematicBlock(Blocks.double_stone_slab, SchematicStandalone.class);
SchematicRegistry.registerSchematicBlock(Blocks.wooden_slab, SchematicStandalone.class);
SchematicRegistry.registerSchematicBlock(Blocks.double_wooden_slab, SchematicStandalone.class);
SchematicRegistry.registerSchematicBlock(Blocks.stained_glass, SchematicStandalone.class);
SchematicRegistry.registerSchematicBlock(Blocks.fence, SchematicStandalone.class);
SchematicRegistry.registerSchematicBlock(Blocks.daylight_detector, SchematicStandalone.class);
SchematicRegistry.registerSchematicBlock(Blocks.iron_bars, SchematicStandalone.class);
schemes.registerSchematicBlock(Blocks.glass, SchematicStandalone.class);
schemes.registerSchematicBlock(Blocks.stone_slab, SchematicStandalone.class);
schemes.registerSchematicBlock(Blocks.double_stone_slab, SchematicStandalone.class);
schemes.registerSchematicBlock(Blocks.wooden_slab, SchematicStandalone.class);
schemes.registerSchematicBlock(Blocks.double_wooden_slab, SchematicStandalone.class);
schemes.registerSchematicBlock(Blocks.stained_glass, SchematicStandalone.class);
schemes.registerSchematicBlock(Blocks.fence, SchematicStandalone.class);
schemes.registerSchematicBlock(Blocks.daylight_detector, SchematicStandalone.class);
schemes.registerSchematicBlock(Blocks.iron_bars, SchematicStandalone.class);
// Standard entities
SchematicRegistry.registerSchematicEntity(EntityMinecartEmpty.class, SchematicMinecart.class, Items.minecart);
SchematicRegistry.registerSchematicEntity(EntityMinecartFurnace.class, SchematicMinecart.class, Items.furnace_minecart);
SchematicRegistry.registerSchematicEntity(EntityMinecartTNT.class, SchematicMinecart.class, Items.tnt_minecart);
SchematicRegistry.registerSchematicEntity(EntityMinecartChest.class, SchematicMinecart.class, Items.chest_minecart);
SchematicRegistry.registerSchematicEntity(EntityMinecartHopper.class, SchematicMinecart.class, Items.hopper_minecart);
schemes.registerSchematicEntity(EntityMinecartEmpty.class, SchematicMinecart.class, Items.minecart);
schemes.registerSchematicEntity(EntityMinecartFurnace.class, SchematicMinecart.class, Items.furnace_minecart);
schemes.registerSchematicEntity(EntityMinecartTNT.class, SchematicMinecart.class, Items.tnt_minecart);
schemes.registerSchematicEntity(EntityMinecartChest.class, SchematicMinecart.class, Items.chest_minecart);
schemes.registerSchematicEntity(EntityMinecartHopper.class, SchematicMinecart.class, Items.hopper_minecart);
SchematicRegistry.registerSchematicEntity(EntityPainting.class, SchematicHanging.class, Items.painting);
SchematicRegistry.registerSchematicEntity(EntityItemFrame.class, SchematicHanging.class, Items.item_frame);
schemes.registerSchematicEntity(EntityPainting.class, SchematicHanging.class, Items.painting);
schemes.registerSchematicEntity(EntityItemFrame.class, SchematicHanging.class, Items.item_frame);
// BuildCraft blocks
SchematicRegistry.registerSchematicBlock(architectBlock, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true);
SchematicRegistry.registerSchematicBlock(builderBlock, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true);
schemes.registerSchematicBlock(architectBlock, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true);
schemes.registerSchematicBlock(builderBlock, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true);
SchematicRegistry.registerSchematicBlock(markerBlock, SchematicWallSide.class);
SchematicRegistry.registerSchematicBlock(pathMarkerBlock, SchematicWallSide.class);
SchematicRegistry.registerSchematicBlock(constructionMarkerBlock, SchematicWallSide.class);
schemes.registerSchematicBlock(markerBlock, SchematicWallSide.class);
schemes.registerSchematicBlock(pathMarkerBlock, SchematicWallSide.class);
schemes.registerSchematicBlock(constructionMarkerBlock, SchematicWallSide.class);
// Factories required to save entities in world
@ -461,7 +464,7 @@ public class BuildCraftBuilders extends BuildCraftMod {
GameRegistry.registerTileEntity(TileConstructionMarker.class, "net.minecraft.src.builders.TileConstructionMarker");
GameRegistry.registerTileEntity(TileBlueprintLibrary.class, "net.minecraft.src.builders.TileBlueprintLibrary");
SchematicRegistry.readConfiguration(BuildCraftCore.mainConfiguration);
SchematicRegistry.INSTANCE.readConfiguration(BuildCraftCore.mainConfiguration);
if (BuildCraftCore.mainConfiguration.hasChanged()) {
BuildCraftCore.mainConfiguration.save();

View file

@ -32,7 +32,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
import net.minecraft.util.IIcon;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
@ -45,7 +44,6 @@ import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.AchievementPage;
@ -56,8 +54,7 @@ import net.minecraftforge.common.config.Property;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fluids.BlockFluidBase;
import net.minecraftforge.oredict.OreDictionary;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.api.blueprints.BuilderAPI;
import buildcraft.api.core.BCLog;
import buildcraft.api.core.BlockIndex;
import buildcraft.api.core.BuildCraftAPI;
@ -86,6 +83,7 @@ import buildcraft.core.ItemWrench;
import buildcraft.core.SpringPopulate;
import buildcraft.core.TickHandlerCore;
import buildcraft.core.Version;
import buildcraft.core.blueprints.SchematicRegistry;
import buildcraft.core.network.BuildCraftChannelHandler;
import buildcraft.core.network.EntityIds;
import buildcraft.core.network.NetworkIdRegistry;
@ -250,6 +248,8 @@ public class BuildCraftCore extends BuildCraftMod {
BuildcraftFuelRegistry.fuel = FuelManager.INSTANCE;
BuildcraftFuelRegistry.coolant = CoolantManager.INSTANCE;
BuilderAPI.schematicRegistry = SchematicRegistry.INSTANCE;
mainConfiguration = new BuildCraftConfiguration(new File(evt.getModConfigurationDirectory(), "buildcraft/main.conf"));
try {
mainConfiguration.load();

View file

@ -22,7 +22,6 @@ import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.biome.BiomeGenBase;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
@ -32,7 +31,6 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.common.MinecraftForge;
@ -42,8 +40,7 @@ import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.api.blueprints.BuilderAPI;
import buildcraft.api.core.BCLog;
import buildcraft.api.core.BlockIndex;
import buildcraft.api.core.JavaTools;
@ -55,6 +52,7 @@ import buildcraft.core.BlockSpring;
import buildcraft.core.DefaultProps;
import buildcraft.core.InterModComms;
import buildcraft.core.Version;
import buildcraft.core.blueprints.SchematicRegistry;
import buildcraft.core.network.BuildCraftChannelHandler;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.energy.BlockBuildcraftFluid;
@ -326,7 +324,7 @@ public class BuildCraftEnergy extends BuildCraftMod {
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
SchematicRegistry.registerSchematicBlock(engineBlock, SchematicEngine.class);
BuilderAPI.schematicRegistry.registerSchematicBlock(engineBlock, SchematicEngine.class);
if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes();

View file

@ -18,7 +18,6 @@ import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
@ -28,19 +27,18 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.ForgeChunkManager.Ticket;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.api.blueprints.BuilderAPI;
import buildcraft.builders.schematics.SchematicIgnoreMeta;
import buildcraft.core.DefaultProps;
import buildcraft.core.InterModComms;
import buildcraft.core.Version;
import buildcraft.core.blueprints.SchematicRegistry;
import buildcraft.core.network.BuildCraftChannelHandler;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.utils.ConfigUtils;
@ -149,10 +147,10 @@ public class BuildCraftFactory extends BuildCraftMod {
FactoryProxy.proxy.initializeTileEntities();
SchematicRegistry.registerSchematicBlock(refineryBlock, SchematicRefinery.class);
SchematicRegistry.registerSchematicBlock(tankBlock, SchematicTank.class);
SchematicRegistry.registerSchematicBlock(frameBlock, SchematicIgnoreMeta.class);
SchematicRegistry.registerSchematicBlock(pumpBlock, SchematicPump.class);
BuilderAPI.schematicRegistry.registerSchematicBlock(refineryBlock, SchematicRefinery.class);
BuilderAPI.schematicRegistry.registerSchematicBlock(tankBlock, SchematicTank.class);
BuilderAPI.schematicRegistry.registerSchematicBlock(frameBlock, SchematicIgnoreMeta.class);
BuilderAPI.schematicRegistry.registerSchematicBlock(pumpBlock, SchematicPump.class);
if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes();

View file

@ -12,7 +12,6 @@ import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
@ -20,10 +19,8 @@ import cpw.mods.fml.common.event.FMLMissingMappingsEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.OreDictionary;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.api.blueprints.BuilderAPI;
import buildcraft.api.boards.RedstoneBoardRegistry;
import buildcraft.api.gates.IAction;
import buildcraft.api.gates.ITrigger;
@ -39,6 +36,7 @@ import buildcraft.core.InterModComms;
import buildcraft.core.ItemBuildCraft;
import buildcraft.core.ItemRobot;
import buildcraft.core.Version;
import buildcraft.core.blueprints.SchematicRegistry;
import buildcraft.core.network.BuildCraftChannelHandler;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.robots.RobotIntegrationRecipe;
@ -202,7 +200,7 @@ public class BuildCraftSilicon extends BuildCraftMod {
CoreProxy.proxy.registerTileEntity(TileZonePlan.class, "net.minecraft.src.buildcraft.commander.TileZonePlan");
CoreProxy.proxy.registerTileEntity(TileRequester.class, "net.minecraft.src.buildcraft.commander.TileRequester");
SchematicRegistry.registerSchematicBlock(laserBlock, SchematicRotateMeta.class, new int[] {2, 5, 3, 4}, true);
BuilderAPI.schematicRegistry.registerSchematicBlock(laserBlock, SchematicRotateMeta.class, new int[] {2, 5, 3, 4}, true);
if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes();

View file

@ -33,7 +33,7 @@ import net.minecraftforge.common.config.Property;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.RecipeSorter;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.api.blueprints.BuilderAPI;
import buildcraft.api.core.EnumColor;
import buildcraft.api.core.IIconProvider;
import buildcraft.api.core.JavaTools;
@ -51,6 +51,7 @@ import buildcraft.core.InterModComms;
import buildcraft.core.ItemBuildCraft;
import buildcraft.core.PowerMode;
import buildcraft.core.Version;
import buildcraft.core.blueprints.SchematicRegistry;
import buildcraft.core.network.BuildCraftChannelHandler;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.silicon.ItemRedstoneChipset.Chipset;
@ -476,7 +477,7 @@ public class BuildCraftTransport extends BuildCraftMod {
TransportProxy.proxy.registerTileEntities();
SchematicRegistry.registerSchematicBlock(genericPipeBlock, SchematicPipe.class);
BuilderAPI.schematicRegistry.registerSchematicBlock(genericPipeBlock, SchematicPipe.class);
new BptPipeIron(pipeItemsIron);
new BptPipeIron(pipeFluidsIron);

View file

@ -2,7 +2,7 @@ package buildcraft.builders;
import buildcraft.api.blueprints.SchematicBlock;
import buildcraft.api.blueprints.SchematicFluid;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.core.blueprints.SchematicRegistry;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraftforge.fluids.Fluid;
@ -17,7 +17,7 @@ public final class HeuristicBlockDetection {
public static void start() {
// Register fluids
for (Fluid f : FluidRegistry.getRegisteredFluids().values()) {
SchematicRegistry.registerSchematicBlock(f.getBlock(), SchematicFluid.class, new FluidStack(f, 1000));
SchematicRegistry.INSTANCE.registerSchematicBlock(f.getBlock(), SchematicFluid.class, new FluidStack(f, 1000));
}
// Register blocks
@ -28,7 +28,7 @@ public final class HeuristicBlockDetection {
}
for (int meta = 0; meta < 16; meta++) {
if (!SchematicRegistry.isSupported(block, meta)) {
if (!SchematicRegistry.INSTANCE.isSupported(block, meta)) {
// Stops dupes with (for instance) ore blocks
try {
if (block.getItemDropped(meta, null, 0) != Item.getItemFromBlock(block)) {
@ -43,7 +43,7 @@ public final class HeuristicBlockDetection {
continue;
}
SchematicRegistry.registerSchematicBlock(block, meta, SchematicBlock.class);
SchematicRegistry.INSTANCE.registerSchematicBlock(block, meta, SchematicBlock.class);
}
}
}

View file

@ -12,7 +12,6 @@ import java.util.LinkedList;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.api.blueprints.MappingRegistry;
import buildcraft.api.blueprints.SchematicBlock;

View file

@ -11,12 +11,11 @@ package buildcraft.builders.schematics;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.api.blueprints.MappingNotFoundException;
import buildcraft.api.blueprints.MappingRegistry;
import buildcraft.api.blueprints.SchematicBlock;
import buildcraft.api.blueprints.SchematicFactory;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.core.blueprints.SchematicRegistry;
public class SchematicFactoryBlock extends SchematicFactory<SchematicBlock> {
@ -33,7 +32,7 @@ public class SchematicFactoryBlock extends SchematicFactory<SchematicBlock> {
return s;
} else {
SchematicBlock s = SchematicRegistry.newSchematicBlock(b, nbt.getInteger("blockMeta"));
SchematicBlock s = SchematicRegistry.INSTANCE.createSchematicBlock(b, nbt.getInteger("blockMeta"));
if (s != null) {
s.readFromNBT(nbt, registry);

View file

@ -9,12 +9,11 @@
package buildcraft.builders.schematics;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.api.blueprints.MappingNotFoundException;
import buildcraft.api.blueprints.MappingRegistry;
import buildcraft.api.blueprints.SchematicEntity;
import buildcraft.api.blueprints.SchematicFactory;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.core.blueprints.SchematicRegistry;
public class SchematicFactoryEntity extends SchematicFactory<SchematicEntity> {
@ -22,7 +21,7 @@ public class SchematicFactoryEntity extends SchematicFactory<SchematicEntity> {
protected SchematicEntity loadSchematicFromWorldNBT(NBTTagCompound nbt, MappingRegistry registry)
throws MappingNotFoundException {
int entityId = nbt.getInteger("entityId");
SchematicEntity s = SchematicRegistry.newSchematicEntity(registry.getEntityForId(entityId));
SchematicEntity s = SchematicRegistry.INSTANCE.createSchematicEntity(registry.getEntityForId(entityId));
if (s != null) {
s.readFromNBT(nbt, registry);

View file

@ -9,7 +9,6 @@
package buildcraft.builders.schematics;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.api.blueprints.MappingRegistry;
import buildcraft.api.blueprints.SchematicFactory;
import buildcraft.api.blueprints.SchematicMask;

View file

@ -16,16 +16,13 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.Constants;
import buildcraft.BuildCraftBuilders;
import buildcraft.api.blueprints.BuildingPermission;
import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.api.blueprints.MappingNotFoundException;
import buildcraft.api.blueprints.SchematicBlock;
import buildcraft.api.blueprints.SchematicEntity;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.api.blueprints.Translation;
import buildcraft.api.core.BCLog;
import buildcraft.builders.blueprints.BlueprintId.Kind;
@ -86,7 +83,7 @@ public class Blueprint extends BlueprintBase {
return;
}
SchematicBlock slot = SchematicRegistry.newSchematicBlock(block, meta);
SchematicBlock slot = SchematicRegistry.INSTANCE.createSchematicBlock(block, meta);
if (slot == null) {
return;
@ -99,7 +96,7 @@ public class Blueprint extends BlueprintBase {
slot.block = block;
slot.meta = meta;
if (!SchematicRegistry.isSupported(block, meta)) {
if (!SchematicRegistry.INSTANCE.isSupported(block, meta)) {
return;
}
@ -139,7 +136,7 @@ public class Blueprint extends BlueprintBase {
Entity e = (Entity) o;
if (context.surroundingBox().contains(e.posX, e.posY, e.posZ)) {
SchematicEntity s = SchematicRegistry.newSchematicEntity(e.getClass());
SchematicEntity s = SchematicRegistry.INSTANCE.createSchematicEntity(e.getClass());
if (s != null) {
s.readFromWorld(context, e);
@ -213,7 +210,7 @@ public class Blueprint extends BlueprintBase {
}
if (block != null) {
contents[x][y][z] = SchematicRegistry.newSchematicBlock(block, cpt.getInteger("blockMeta"));
contents[x][y][z] = SchematicRegistry.INSTANCE.createSchematicBlock(block, cpt.getInteger("blockMeta"));
contents[x][y][z].readFromNBT(cpt, mapping);
if (!contents[x][y][z].doNotUse()) {
@ -263,7 +260,7 @@ public class Blueprint extends BlueprintBase {
}
if (entity != null) {
SchematicEntity s = SchematicRegistry.newSchematicEntity(entity);
SchematicEntity s = SchematicRegistry.INSTANCE.createSchematicEntity(entity);
s.readFromNBT(cpt, mapping);
s.idsToWorld(mapping);
entities.add(s);

View file

@ -18,10 +18,8 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraft.world.WorldSettings.GameType;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.blueprints.BuildingPermission;
import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.api.blueprints.MappingRegistry;

View file

@ -22,9 +22,9 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
import buildcraft.BuildCraftBuilders;
import buildcraft.api.blueprints.BuilderAPI;
import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.api.blueprints.MappingNotFoundException;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.api.core.BCLog;
import buildcraft.api.core.BlockIndex;
import buildcraft.api.core.IAreaProvider;
@ -198,13 +198,13 @@ public abstract class BptBuilderBase implements IAreaProvider {
int hardness = getHardness(slot);
return builder.energyAvailable() >= hardness * SchematicRegistry.BREAK_ENERGY;
return builder.energyAvailable() >= hardness * BuilderAPI.BREAK_ENERGY;
}
public void consumeEnergyToDestroy(TileAbstractBuilder builder, BuildingSlotBlock slot) {
int hardness = getHardness(slot);
builder.consumeEnergy(hardness * SchematicRegistry.BREAK_ENERGY);
builder.consumeEnergy(hardness * BuilderAPI.BREAK_ENERGY);
}
public void createDestroyItems(BuildingSlotBlock slot) {

View file

@ -31,10 +31,10 @@ import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import buildcraft.api.blueprints.BuilderAPI;
import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.SchematicBlock;
import buildcraft.api.blueprints.SchematicEntity;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.api.core.BCLog;
import buildcraft.api.core.BlockIndex;
import buildcraft.api.core.BuildCraftAPI;
@ -95,7 +95,7 @@ public class BptBuilderBlueprint extends BptBuilderBase {
slot.block = Blocks.air;
}
if (!SchematicRegistry.isAllowedForBuilding(slot.block, slot.meta)) {
if (!SchematicRegistry.INSTANCE.isAllowedForBuilding(slot.block, slot.meta)) {
continue;
}
@ -131,7 +131,7 @@ public class BptBuilderBlueprint extends BptBuilderBase {
continue;
}
if (!SchematicRegistry.isAllowedForBuilding(slot.block, slot.meta)) {
if (!SchematicRegistry.INSTANCE.isAllowedForBuilding(slot.block, slot.meta)) {
continue;
}
@ -308,7 +308,7 @@ public class BptBuilderBlueprint extends BptBuilderBase {
* returned, possibly for reservation, with no building.
*/
private BuildingSlot internalGetNextBlock(World world, TileAbstractBuilder builder) {
if (builder != null && builder.energyAvailable() < SchematicRegistry.BREAK_ENERGY) {
if (builder != null && builder.energyAvailable() < BuilderAPI.BREAK_ENERGY) {
// If there's no more energy available, then set reset the list and
// quit. This will avoid situations where energy is given at a
// random point in time, and therefore builder doesn't start from

View file

@ -13,8 +13,8 @@ import java.util.LinkedList;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.blueprints.BuilderAPI;
import buildcraft.api.blueprints.SchematicBlockBase;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.api.core.BlockIndex;
import buildcraft.api.core.BuildCraftAPI;
import buildcraft.api.core.IInvSlot;
@ -188,7 +188,7 @@ public class BptBuilderTemplate extends BptBuilderBase {
iterator.remove();
builtLocations.add(new BlockIndex(slot.x, slot.y, slot.z));
} else {
if (builder.consumeEnergy(SchematicRegistry.BUILD_ENERGY) && firstSlotToConsume != null) {
if (builder.consumeEnergy(BuilderAPI.BUILD_ENERGY) && firstSlotToConsume != null) {
slot.addStackConsumed(firstSlotToConsume.decreaseStackInSlot(1));
result = slot;
iterator.remove();

View file

@ -6,7 +6,7 @@
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.blueprints;
package buildcraft.core.blueprints;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
@ -24,29 +24,29 @@ import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.oredict.OreDictionary;
import buildcraft.api.blueprints.ISchematicRegistry;
import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.SchematicBlock;
import buildcraft.api.blueprints.SchematicEntity;
import buildcraft.api.core.BlockMetaPair;
import buildcraft.api.core.JavaTools;
public final class SchematicRegistry {
public class SchematicRegistry implements ISchematicRegistry {
public static int BREAK_ENERGY = 100;
public static final int BUILD_ENERGY = 200;
private static final HashMap<BlockMetaPair, SchematicConstructor> schematicBlocks =
public static SchematicRegistry INSTANCE = new SchematicRegistry();
private final HashMap<BlockMetaPair, SchematicConstructor> schematicBlocks =
new HashMap<BlockMetaPair, SchematicConstructor>();
private static final HashMap<Class<? extends Entity>, SchematicConstructor> schematicEntities = new HashMap<Class<? extends Entity>, SchematicConstructor>();
private final HashMap<Class<? extends Entity>, SchematicConstructor> schematicEntities = new HashMap<Class<? extends Entity>, SchematicConstructor>();
private static final HashSet<String> modsForbidden = new HashSet<String>();
private static final HashSet<String> blocksForbidden = new HashSet<String>();
private final HashSet<String> modsForbidden = new HashSet<String>();
private final HashSet<String> blocksForbidden = new HashSet<String>();
/**
* Deactivate constructor
*/
private SchematicRegistry() {
}
private static class SchematicConstructor {
private class SchematicConstructor {
public final Class<? extends Schematic> clazz;
public final Object[] params;
@ -94,18 +94,18 @@ public final class SchematicRegistry {
}
}
public static void registerSchematicBlock(Block block, Class<? extends Schematic> clazz, Object... params) {
public void registerSchematicBlock(Block block, Class<? extends Schematic> clazz, Object... params) {
registerSchematicBlock(block, OreDictionary.WILDCARD_VALUE, clazz, params);
}
public static void registerSchematicBlock(Block block, int meta, Class<? extends Schematic> clazz, Object... params) {
public void registerSchematicBlock(Block block, int meta, Class<? extends Schematic> clazz, Object... params) {
if (schematicBlocks.containsKey(new BlockMetaPair(block, meta))) {
throw new RuntimeException("Block " + Block.blockRegistry.getNameForObject(block) + " is already associated with a schematic.");
}
schematicBlocks.put(new BlockMetaPair(block, meta), new SchematicConstructor(clazz, params));
}
public static void registerSchematicEntity(
public void registerSchematicEntity(
Class<? extends Entity> entityClass,
Class<? extends SchematicEntity> schematicClass, Object... params) {
if (schematicEntities.containsKey(entityClass)) {
@ -114,7 +114,7 @@ public final class SchematicRegistry {
schematicEntities.put(entityClass, new SchematicConstructor(schematicClass, params));
}
public static SchematicBlock newSchematicBlock(Block block, int metadata) {
public SchematicBlock createSchematicBlock(Block block, int metadata) {
if (block == Blocks.air) {
return null;
}
@ -151,7 +151,7 @@ public final class SchematicRegistry {
return null;
}
public static SchematicEntity newSchematicEntity(Class<? extends Entity> entityClass) {
public SchematicEntity createSchematicEntity(Class<? extends Entity> entityClass) {
if (!schematicEntities.containsKey(entityClass)) {
return null;
}
@ -174,17 +174,17 @@ public final class SchematicRegistry {
return null;
}
public static boolean isSupported(Block block, int metadata) {
public boolean isSupported(Block block, int metadata) {
return schematicBlocks.containsKey(new BlockMetaPair(block, OreDictionary.WILDCARD_VALUE))
|| schematicBlocks.containsKey(new BlockMetaPair(block, metadata));
}
public static boolean isAllowedForBuilding(Block block, int metadata) {
public boolean isAllowedForBuilding(Block block, int metadata) {
String name = Block.blockRegistry.getNameForObject(block);
return isSupported(block, metadata) && !blocksForbidden.contains(name) && !modsForbidden.contains(name.split(":", 2)[0]);
}
public static void readConfiguration(Configuration conf) {
public void readConfiguration(Configuration conf) {
Property excludedMods = conf.get(Configuration.CATEGORY_GENERAL, "builder.excludedMods", new String[0],
"mods that should be excluded from the builder.");
Property excludedBlocks = conf.get(Configuration.CATEGORY_GENERAL, "builder.excludedBlocks", new String[0],

View file

@ -12,7 +12,6 @@ import java.util.LinkedList;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.api.blueprints.MappingNotFoundException;
import buildcraft.api.blueprints.MappingRegistry;

View file

@ -14,9 +14,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.Constants;
import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.api.blueprints.MappingNotFoundException;
import buildcraft.api.blueprints.MappingRegistry;

View file

@ -13,7 +13,6 @@ import java.util.LinkedList;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.api.blueprints.MappingNotFoundException;
import buildcraft.api.blueprints.MappingRegistry;

View file

@ -13,13 +13,14 @@ import java.util.LinkedList;
import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.api.blueprints.BuilderAPI;
import buildcraft.api.blueprints.ITileBuilder;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.api.core.NetworkData;
import buildcraft.core.IBoxProvider;
import buildcraft.core.LaserData;
import buildcraft.core.RFBattery;
import buildcraft.core.TileBuildCraft;
import buildcraft.core.blueprints.SchematicRegistry;
import buildcraft.core.network.RPC;
import buildcraft.core.network.RPCHandler;
import buildcraft.core.network.RPCMessageInfo;
@ -33,7 +34,7 @@ public abstract class TileAbstractBuilder extends TileBuildCraft implements ITil
* plus a safeguard. That's a nice way to evaluate maximum amount of energy
* that need to be in a builder.
*/
private static final int FULL_CHEST_ENERGY = 9 * 3 * 64 * SchematicRegistry.BUILD_ENERGY + 10000;
private static final int FULL_CHEST_ENERGY = 9 * 3 * 64 * BuilderAPI.BUILD_ENERGY + 10000;
@NetworkData
public LinkedList<LaserData> pathLasers = new LinkedList<LaserData> ();

View file

@ -16,12 +16,12 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import buildcraft.api.blueprints.SchematicMask;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.api.filler.IFillerPattern;
import buildcraft.core.Box;
import buildcraft.core.blueprints.Blueprint;
import buildcraft.core.blueprints.BlueprintBase;
import buildcraft.core.blueprints.BptBuilderTemplate;
import buildcraft.core.blueprints.SchematicRegistry;
import buildcraft.core.blueprints.Template;
import buildcraft.core.utils.StringUtils;
@ -122,8 +122,8 @@ public abstract class FillerPattern implements IFillerPattern {
for (int y = 0; y < box.sizeY(); ++y) {
for (int z = 0; z < box.sizeZ(); ++z) {
if (tmpl.contents[x][y][z] != null) {
result.contents[x][y][z] = SchematicRegistry
.newSchematicBlock(block, meta);
result.contents[x][y][z] = SchematicRegistry.INSTANCE
.createSchematicBlock(block, meta);
}
}

View file

@ -15,9 +15,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.blueprints.BuildingPermission;
import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.api.blueprints.MappingNotFoundException;