added provision for world bounds when building, fix #1652

This commit is contained in:
SpaceToad 2014-04-30 20:53:35 +02:00
parent bdd646dbdd
commit 1ba976baff
2 changed files with 16 additions and 4 deletions

View file

@ -64,8 +64,12 @@ public class BptBuilderBlueprint extends BptBuilderBase {
int yCoord = j + y - blueprint.anchorY;
int zCoord = k + z - blueprint.anchorZ;
if (!clearedLocations.contains(new BlockIndex(xCoord,
yCoord, zCoord))) {
if (yCoord < 0 || yCoord >= context.world.getHeight()) {
continue;
}
if (!clearedLocations.contains(new BlockIndex(
xCoord, yCoord, zCoord))) {
SchematicBlock slot = (SchematicBlock) blueprint.contents[i][j][k];
if (slot == null && !blueprint.excavate) {
@ -105,7 +109,7 @@ public class BptBuilderBlueprint extends BptBuilderBase {
SchematicBlock slot = (SchematicBlock) blueprint.contents[i][j][k];
if (slot == null) {
if (slot == null || yCoord < 0 || yCoord >= context.world.getHeight()) {
continue;
}

View file

@ -15,11 +15,11 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.blueprints.SchematicBlockBase;
import buildcraft.api.core.BuildCraftAPI;
import buildcraft.api.core.IInvSlot;
import buildcraft.builders.TileAbstractBuilder;
import buildcraft.core.BlockIndex;
import buildcraft.core.blueprints.BuildingSlotBlock.Mode;
import buildcraft.core.inventory.InventoryIterator;
import buildcraft.api.core.IInvSlot;
import buildcraft.core.utils.BlockUtil;
public class BptBuilderTemplate extends BptBuilderBase {
@ -41,6 +41,10 @@ public class BptBuilderTemplate extends BptBuilderBase {
int yCoord = j + y - blueprint.anchorY;
int zCoord = k + z - blueprint.anchorZ;
if (yCoord < 0 || yCoord >= context.world.getHeight()) {
continue;
}
SchematicBlockBase slot = blueprint.contents[i][j][k];
if (slot == null
@ -69,6 +73,10 @@ public class BptBuilderTemplate extends BptBuilderBase {
int yCoord = j + y - blueprint.anchorY;
int zCoord = k + z - blueprint.anchorZ;
if (yCoord < 0 || yCoord >= context.world.getHeight()) {
continue;
}
SchematicBlockBase slot = blueprint.contents[i][j][k];
if (slot != null && !builtLocations.contains(new BlockIndex(xCoord, yCoord, zCoord))) {