improve builder logic for certain vanilla blocks
This commit is contained in:
parent
c0c29f7521
commit
832d979fe8
|
@ -129,6 +129,7 @@ import buildcraft.core.TilePathMarker;
|
|||
import buildcraft.core.Version;
|
||||
import buildcraft.core.blueprints.SchematicRegistry;
|
||||
import buildcraft.core.builders.schematics.SchematicBlockCreative;
|
||||
import buildcraft.core.builders.schematics.SchematicBlockFloored;
|
||||
import buildcraft.core.builders.schematics.SchematicFree;
|
||||
import buildcraft.core.builders.schematics.SchematicIgnore;
|
||||
import buildcraft.core.builders.schematics.SchematicRotateMeta;
|
||||
|
@ -369,6 +370,7 @@ public class BuildCraftBuilders extends BuildCraftMod {
|
|||
schemes.registerSchematicBlock(Blocks.redstone_torch, SchematicWallSide.class);
|
||||
schemes.registerSchematicBlock(Blocks.unlit_redstone_torch, SchematicWallSide.class);
|
||||
|
||||
schemes.registerSchematicBlock(Blocks.tripwire, SchematicBlockFloored.class);
|
||||
schemes.registerSchematicBlock(Blocks.tripwire_hook, SchematicTripWireHook.class);
|
||||
|
||||
schemes.registerSchematicBlock(Blocks.skull, SchematicSkull.class);
|
||||
|
|
|
@ -15,8 +15,9 @@ import net.minecraft.item.ItemStack;
|
|||
|
||||
import buildcraft.api.blueprints.IBuilderContext;
|
||||
import buildcraft.api.blueprints.SchematicBlock;
|
||||
import buildcraft.core.builders.schematics.SchematicBlockFloored;
|
||||
|
||||
public class SchematicCactus extends SchematicBlock {
|
||||
public class SchematicCactus extends SchematicBlockFloored {
|
||||
|
||||
@Override
|
||||
public void getRequirementsForPlacement(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
|
|
|
@ -16,8 +16,9 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import buildcraft.api.blueprints.IBuilderContext;
|
||||
import buildcraft.api.blueprints.MappingRegistry;
|
||||
import buildcraft.api.blueprints.SchematicBlock;
|
||||
import buildcraft.core.builders.schematics.SchematicBlockFloored;
|
||||
|
||||
public class SchematicDoor extends SchematicBlock {
|
||||
public class SchematicDoor extends SchematicBlockFloored {
|
||||
|
||||
final ItemStack stack;
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@ import net.minecraft.item.ItemStack;
|
|||
|
||||
import buildcraft.api.blueprints.IBuilderContext;
|
||||
import buildcraft.api.blueprints.SchematicBlock;
|
||||
import buildcraft.core.builders.schematics.SchematicBlockFloored;
|
||||
|
||||
public class SchematicRail extends SchematicBlock {
|
||||
|
||||
public class SchematicRail extends SchematicBlockFloored {
|
||||
@Override
|
||||
public void rotateLeft(IBuilderContext context) {
|
||||
switch (meta) {
|
||||
|
|
|
@ -15,8 +15,9 @@ import net.minecraft.item.ItemStack;
|
|||
|
||||
import buildcraft.api.blueprints.IBuilderContext;
|
||||
import buildcraft.api.blueprints.SchematicBlock;
|
||||
import buildcraft.core.builders.schematics.SchematicBlockFloored;
|
||||
|
||||
public class SchematicRedstoneDiode extends SchematicBlock {
|
||||
public class SchematicRedstoneDiode extends SchematicBlockFloored {
|
||||
private Item baseItem;
|
||||
|
||||
public SchematicRedstoneDiode(Item baseItem) {
|
||||
|
|
|
@ -14,9 +14,9 @@ import net.minecraft.item.ItemStack;
|
|||
|
||||
import buildcraft.api.blueprints.IBuilderContext;
|
||||
import buildcraft.api.blueprints.SchematicBlock;
|
||||
import buildcraft.core.builders.schematics.SchematicBlockFloored;
|
||||
|
||||
public class SchematicRedstoneWire extends SchematicBlock {
|
||||
|
||||
public class SchematicRedstoneWire extends SchematicBlockFloored {
|
||||
final ItemStack customStack;
|
||||
|
||||
public SchematicRedstoneWire(ItemStack customStack) {
|
||||
|
@ -42,5 +42,4 @@ public class SchematicRedstoneWire extends SchematicBlock {
|
|||
public boolean isAlreadyBuilt(IBuilderContext context, int x, int y, int z) {
|
||||
return block == context.world().getBlock(x, y, z);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,9 +15,9 @@ import net.minecraft.item.ItemStack;
|
|||
|
||||
import buildcraft.api.blueprints.IBuilderContext;
|
||||
import buildcraft.api.blueprints.SchematicBlock;
|
||||
import buildcraft.core.builders.schematics.SchematicBlockFloored;
|
||||
|
||||
public class SchematicSeeds extends SchematicBlock {
|
||||
|
||||
public class SchematicSeeds extends SchematicBlockFloored {
|
||||
public Item seeds;
|
||||
|
||||
public SchematicSeeds (Item seeds) {
|
||||
|
|
|
@ -117,7 +117,6 @@ public class BptBuilderBlueprint extends BptBuilderBase {
|
|||
}
|
||||
|
||||
LinkedList<BuildingSlotBlock> tmpStandalone = new LinkedList<BuildingSlotBlock>();
|
||||
LinkedList<BuildingSlotBlock> tmpSupported = new LinkedList<BuildingSlotBlock>();
|
||||
LinkedList<BuildingSlotBlock> tmpExpanding = new LinkedList<BuildingSlotBlock>();
|
||||
|
||||
for (int j = 0; j < blueprint.sizeY; ++j) {
|
||||
|
@ -156,13 +155,9 @@ public class BptBuilderBlueprint extends BptBuilderBase {
|
|||
tmpStandalone.add(b);
|
||||
b.buildStage = 1;
|
||||
break;
|
||||
case SUPPORTED:
|
||||
tmpSupported.add(b);
|
||||
b.buildStage = 2;
|
||||
break;
|
||||
case EXPANDING:
|
||||
tmpExpanding.add(b);
|
||||
b.buildStage = 3;
|
||||
b.buildStage = 2;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
@ -175,9 +170,6 @@ public class BptBuilderBlueprint extends BptBuilderBase {
|
|||
for (BuildingSlotBlock b : tmpStandalone) {
|
||||
addToBuildList(b);
|
||||
}
|
||||
for (BuildingSlotBlock b : tmpSupported) {
|
||||
addToBuildList(b);
|
||||
}
|
||||
for (BuildingSlotBlock b : tmpExpanding) {
|
||||
addToBuildList(b);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package buildcraft.core.builders.schematics;
|
||||
|
||||
import buildcraft.api.blueprints.IBuilderContext;
|
||||
import buildcraft.api.blueprints.SchematicBlock;
|
||||
|
||||
public class SchematicBlockFloored extends SchematicBlock {
|
||||
@Override
|
||||
public boolean canPlaceInWorld(IBuilderContext context, int x, int y, int z) {
|
||||
return y > 0 && !context.world().isAirBlock(x, y - 1, z);
|
||||
}
|
||||
}
|
|
@ -12,6 +12,31 @@ import buildcraft.api.blueprints.IBuilderContext;
|
|||
import buildcraft.api.blueprints.SchematicBlock;
|
||||
|
||||
public class SchematicWallSide extends SchematicBlock {
|
||||
@Override
|
||||
public boolean canPlaceInWorld(IBuilderContext context, int x, int y, int z) {
|
||||
final int yPos = 0;
|
||||
final int yNeg = 5;
|
||||
final int xPos = 2;
|
||||
final int xNeg = 1;
|
||||
final int zPos = 4;
|
||||
final int zNeg = 3;
|
||||
|
||||
switch (meta & 7) {
|
||||
case xPos:
|
||||
return !context.world().isAirBlock(x + 1, y, z);
|
||||
case xNeg:
|
||||
return !context.world().isAirBlock(x - 1, y, z);
|
||||
case yPos:
|
||||
return !context.world().isAirBlock(x, y + 1, z);
|
||||
case yNeg:
|
||||
return !context.world().isAirBlock(x, y - 1, z);
|
||||
case zPos:
|
||||
return !context.world().isAirBlock(x, y, z + 1);
|
||||
case zNeg:
|
||||
return !context.world().isAirBlock(x, y, z - 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rotateLeft(IBuilderContext context) {
|
||||
|
|
Loading…
Reference in a new issue