Fixed minor schematic registration.

Enabled additional standalone schematics.
Close #1794.
This commit is contained in:
SpaceToad 2014-05-13 21:03:19 +02:00
parent 7f6a0fec90
commit 02f7daf9a0
5 changed files with 78 additions and 5 deletions

View file

@ -55,6 +55,11 @@ public final class SchematicRegistry {
}
private static void internalRegisterSchematicBlock (Block block, Class clas, Object ... params) {
if (schematicBlocks.containsKey(block)) {
throw new RuntimeException("Block " + Block.blockRegistry.getNameForObject(block)
+ " is already associated with a schematic.");
}
SchematicConstructor c = new SchematicConstructor ();
c.clas = clas;
c.params = params;

View file

@ -93,10 +93,10 @@ import buildcraft.builders.schematics.SchematicFactoryMask;
import buildcraft.builders.schematics.SchematicFarmland;
import buildcraft.builders.schematics.SchematicFire;
import buildcraft.builders.schematics.SchematicFluid;
import buildcraft.builders.schematics.SchematicGlassPane;
import buildcraft.builders.schematics.SchematicGravel;
import buildcraft.builders.schematics.SchematicHanging;
import buildcraft.builders.schematics.SchematicIgnore;
import buildcraft.builders.schematics.SchematicIgnoreMeta;
import buildcraft.builders.schematics.SchematicLever;
import buildcraft.builders.schematics.SchematicMinecart;
import buildcraft.builders.schematics.SchematicPiston;
@ -111,6 +111,7 @@ import buildcraft.builders.schematics.SchematicSeeds;
import buildcraft.builders.schematics.SchematicSign;
import buildcraft.builders.schematics.SchematicSkull;
import buildcraft.builders.schematics.SchematicStairs;
import buildcraft.builders.schematics.SchematicStandalone;
import buildcraft.builders.schematics.SchematicStone;
import buildcraft.builders.schematics.SchematicTileCreative;
import buildcraft.builders.schematics.SchematicTripWireHook;
@ -309,8 +310,6 @@ public class BuildCraftBuilders extends BuildCraftMod {
SchematicRegistry.registerSchematicBlock(Blocks.redstone_wire, SchematicRedstoneWire.class, new ItemStack(Items.redstone));
SchematicRegistry.registerSchematicBlock(Blocks.cake, SchematicCustomStack.class, new ItemStack(Items.cake));
SchematicRegistry.registerSchematicBlock(Blocks.pumpkin_stem, SchematicCustomStack.class, new ItemStack(Items.pumpkin_seeds));
SchematicRegistry.registerSchematicBlock(Blocks.melon_stem, SchematicCustomStack.class, new ItemStack(Items.melon_seeds));
SchematicRegistry.registerSchematicBlock(Blocks.glowstone, SchematicCustomStack.class, new ItemStack(Blocks.glowstone));
SchematicRegistry.registerSchematicBlock(Blocks.powered_repeater, SchematicRedstoneDiode.class, Items.repeater);
@ -326,7 +325,8 @@ public class BuildCraftBuilders extends BuildCraftMod {
SchematicRegistry.registerSchematicBlock(Blocks.lava, SchematicFluid.class, new ItemStack(Items.lava_bucket));
SchematicRegistry.registerSchematicBlock(Blocks.flowing_lava, SchematicFluid.class, new ItemStack(Items.lava_bucket));
SchematicRegistry.registerSchematicBlock(Blocks.glass_pane, SchematicIgnoreMeta.class);
SchematicRegistry.registerSchematicBlock(Blocks.glass_pane, SchematicGlassPane.class);
SchematicRegistry.registerSchematicBlock(Blocks.stained_glass_pane, SchematicGlassPane.class);
SchematicRegistry.registerSchematicBlock(Blocks.piston, SchematicPiston.class);
SchematicRegistry.registerSchematicBlock(Blocks.piston_extension, SchematicPiston.class);
@ -368,6 +368,16 @@ public class BuildCraftBuilders extends BuildCraftMod {
SchematicRegistry.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);
// Standard entities
SchematicRegistry.registerSchematicEntity(EntityMinecartEmpty.class, SchematicMinecart.class, Items.minecart);

View file

@ -152,7 +152,6 @@ public class BuildCraftFactory extends BuildCraftMod {
SchematicRegistry.registerSchematicBlock(tankBlock, SchematicTank.class);
SchematicRegistry.registerSchematicBlock(frameBlock, SchematicIgnoreMeta.class);
SchematicRegistry.registerSchematicBlock(pumpBlock, SchematicPump.class);
SchematicRegistry.registerSchematicBlock(refineryBlock, SchematicRefinery.class);
if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes();

View file

@ -0,0 +1,39 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.builders.schematics;
import java.util.LinkedList;
import net.minecraft.item.ItemStack;
import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.api.blueprints.SchematicBlock;
public class SchematicGlassPane extends SchematicBlock {
@Override
public void writeRequirementsToWorld(IBuilderContext context, LinkedList<ItemStack> requirements) {
requirements.add(new ItemStack(block, 1, 0));
}
@Override
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z) {
}
@Override
public boolean isAlreadyBuilt(IBuilderContext context, int x, int y, int z) {
return block == context.world().getBlock(x, y, z);
}
@Override
public BuildingStage getBuildStage() {
return BuildingStage.STANDALONE;
}
}

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.builders.schematics;
import buildcraft.api.blueprints.SchematicBlock;
public class SchematicStandalone extends SchematicBlock {
@Override
public BuildingStage getBuildStage() {
return BuildingStage.STANDALONE;
}
}