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 { 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 (slot.mode == Mode.ClearIfInvalid) {
if (BuildCraftAPI.isSoftBlock(world, slot.x, slot.y, if (BuildCraftAPI.isSoftBlock(world, slot.x, slot.y,
slot.z) slot.z)) {
|| BlockUtil.isUnbreakableBlock(world, slot.x,
slot.y, slot.z)) {
iterator.remove(); iterator.remove();
clearedLocations.add(new BlockIndex(slot.x,
slot.y, slot.z));
} else { } else {
if (setupForDestroy(builder, context, slot)) { if (setupForDestroy(builder, context, slot)) {
iterator.remove(); iterator.remove();

View file

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