fixed handling of unbreakable blocks, #1789

This commit is contained in:
SpaceToad 2014-05-12 23:46:20 +02:00
parent 1f21a80d70
commit 68205d0ca2
2 changed files with 26 additions and 7 deletions

View file

@ -298,13 +298,24 @@ public class BptBuilderBlueprint extends BptBuilderBase {
}
try {
if (!slot.isAlreadyBuilt(context)) {
if (BlockUtil.isUnbreakableBlock(world, slot.x, slot.y, slot.z)) {
// if the block can't be broken, just forget this iterator
iterator.remove();
if (slot.mode == Mode.ClearIfInvalid) {
clearedLocations.add(new BlockIndex(slot.x,
slot.y, slot.z));
} else {
builtLocations.add(new BlockIndex(slot.x,
slot.y, slot.z));
}
} else if (!slot.isAlreadyBuilt(context)) {
if (slot.mode == Mode.ClearIfInvalid) {
if (BuildCraftAPI.isSoftBlock(world, slot.x, slot.y,
slot.z)
|| BlockUtil.isUnbreakableBlock(world, slot.x,
slot.y, slot.z)) {
slot.z)) {
iterator.remove();
clearedLocations.add(new BlockIndex(slot.x,
slot.y, slot.z));
} else {
if (setupForDestroy(builder, context, slot)) {
iterator.remove();

View file

@ -12,7 +12,9 @@ import java.util.LinkedList;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.blueprints.SchematicBlockBase;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.api.core.BuildCraftAPI;
@ -152,9 +154,15 @@ public class BptBuilderTemplate extends BptBuilderBase {
return null;
}
if (slot.mode == Mode.ClearIfInvalid) {
if (BuildCraftAPI.isSoftBlock(world, slot.x, slot.y, slot.z)
|| BlockUtil.isUnbreakableBlock(world, slot.x, slot.y, slot.z)) {
if (BlockUtil.isUnbreakableBlock(world, slot.x, slot.y, slot.z)) {
iterator.remove();
if (slot.mode == Mode.ClearIfInvalid) {
clearedLocations.add(new BlockIndex(slot.x, slot.y, slot.z));
} else {
builtLocations.add(new BlockIndex(slot.x, slot.y, slot.z));
}
} else if (slot.mode == Mode.ClearIfInvalid) {
if (BuildCraftAPI.isSoftBlock(world, slot.x, slot.y, slot.z)) {
iterator.remove();
clearedLocations.add(new BlockIndex(slot.x, slot.y, slot.z));
} else {