implemented support for rail in blueprint, close #1516
This commit is contained in:
parent
3c090c75f3
commit
4bf1d3cd49
2 changed files with 74 additions and 1 deletions
|
@ -61,6 +61,7 @@ import buildcraft.builders.schematics.SchematicLever;
|
|||
import buildcraft.builders.schematics.SchematicPiston;
|
||||
import buildcraft.builders.schematics.SchematicPortal;
|
||||
import buildcraft.builders.schematics.SchematicPumpkin;
|
||||
import buildcraft.builders.schematics.SchematicRail;
|
||||
import buildcraft.builders.schematics.SchematicRedstoneDiode;
|
||||
import buildcraft.builders.schematics.SchematicRotateInventory;
|
||||
import buildcraft.builders.schematics.SchematicRotateMeta;
|
||||
|
@ -169,7 +170,6 @@ public class BuildCraftBuilders extends BuildCraftMod {
|
|||
SchematicRegistry.registerSchematicClass(Blocks.vine, SchematicRotateMeta.class, new int[]{1, 4, 8, 2}, false);
|
||||
SchematicRegistry.registerSchematicClass(Blocks.trapdoor, SchematicRotateMeta.class, new int[]{0, 1, 2, 3}, false);
|
||||
|
||||
|
||||
SchematicRegistry.registerSchematicClass(Blocks.wooden_button, SchematicLever.class);
|
||||
SchematicRegistry.registerSchematicClass(Blocks.stone_button, SchematicLever.class);
|
||||
SchematicRegistry.registerSchematicClass(Blocks.lever, SchematicLever.class);
|
||||
|
@ -225,6 +225,11 @@ public class BuildCraftBuilders extends BuildCraftMod {
|
|||
|
||||
SchematicRegistry.registerSchematicClass(Blocks.portal, SchematicPortal.class);
|
||||
|
||||
SchematicRegistry.registerSchematicClass(Blocks.rail, SchematicRail.class);
|
||||
SchematicRegistry.registerSchematicClass(Blocks.activator_rail, SchematicRail.class);
|
||||
SchematicRegistry.registerSchematicClass(Blocks.detector_rail, SchematicRail.class);
|
||||
SchematicRegistry.registerSchematicClass(Blocks.golden_rail, SchematicRail.class);
|
||||
|
||||
// BUILDCRAFT BLOCKS
|
||||
|
||||
SchematicRegistry.registerSchematicClass(architectBlock, SchematicRotateInventory.class, new int[]{2, 5, 3, 4}, true);
|
||||
|
|
68
common/buildcraft/builders/schematics/SchematicRail.java
Executable file
68
common/buildcraft/builders/schematics/SchematicRail.java
Executable file
|
@ -0,0 +1,68 @@
|
|||
/**
|
||||
* 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.IBuilderContext;
|
||||
import buildcraft.api.blueprints.SchematicBlock;
|
||||
|
||||
public class SchematicRail extends SchematicBlock {
|
||||
|
||||
@Override
|
||||
public void rotateLeft(IBuilderContext context) {
|
||||
switch (meta) {
|
||||
case 0:
|
||||
meta = 1;
|
||||
break;
|
||||
case 1:
|
||||
meta = 0;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
meta = 5;
|
||||
break;
|
||||
case 3:
|
||||
meta = 4;
|
||||
break;
|
||||
case 4:
|
||||
meta = 2;
|
||||
break;
|
||||
case 5:
|
||||
meta = 3;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
meta = 7;
|
||||
break;
|
||||
case 7:
|
||||
meta = 8;
|
||||
break;
|
||||
case 8:
|
||||
meta = 9;
|
||||
break;
|
||||
case 9:
|
||||
meta = 6;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToWorld(IBuilderContext context, int x, int y, int z) {
|
||||
context.world().setBlock(x, y, z, block, 0, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(IBuilderContext context, int x, int y, int z) {
|
||||
return block == context.world().getBlock(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postProcessing(IBuilderContext context, int x, int y, int z) {
|
||||
context.world().setBlockMetadataWithNotify(x, y, z, meta, 3);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue