added protection against NPE

This commit is contained in:
SpaceToad 2014-03-15 14:30:01 +01:00
parent 3f2eb6fe4e
commit f7c5c1cbae
3 changed files with 13 additions and 3 deletions

View file

@ -20,4 +20,12 @@ public class SchematicToBuild {
public Mode mode = Mode.Build;
public Schematic getSchematic () {
if (schematic == null) {
return schematic;
} else {
return new SchematicMask(false);
}
}
}

View file

@ -118,7 +118,10 @@ public class TileFiller extends TileBuildCraft implements IBuilderInventory, IMa
if (currentTemplate != null) {
SchematicToBuild s = currentTemplate.getNextBlock(getWorld(), this);
s.schematic.writeToWorld(context, s.x, s.y, s.z);
if (s != null) {
s.getSchematic().writeToWorld(context, s.x, s.y, s.z);
}
}
/*ItemStack stackToUse = null;

View file

@ -12,7 +12,6 @@ import java.util.LinkedList;
import net.minecraft.world.World;
import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.SchematicMask;
import buildcraft.api.blueprints.SchematicToBuild;
import buildcraft.api.blueprints.SchematicToBuild.Mode;
import buildcraft.api.core.BuildCraftAPI;
@ -38,7 +37,7 @@ public class BptBuilderTemplate extends BptBuilderBase {
if (slot == null) {
SchematicToBuild b = new SchematicToBuild();
b.schematic = new SchematicMask(false);
b.schematic = null;
b.x = xCoord;
b.y = yCoord;
b.z = zCoord;