fixed blocks building too early

This commit is contained in:
SpaceToad 2014-03-29 18:41:45 +01:00
parent d08d15d4c1
commit 967650a073

View file

@ -37,23 +37,30 @@ public class BuildingSlotBlock extends BuildingSlot implements Comparable<Buildi
@Override
public void writeToWorld(IBuilderContext context) {
try {
getSchematic().writeToWorld(context, x, y, z);
// Once the schematic has been written, we're going to issue calls
// to various functions, in particular updating the tile entity.
// If these calls issue problems, in order to avoid corrupting
// the world, we're logging the problem and setting the block to
// air.
TileEntity e = context.world().getTileEntity(x, y, z);
if (e != null) {
e.updateEntity();
if (mode == Mode.ClearIfInvalid) {
if (!getSchematic().isValid(context, x, y, z)) {
context.world().setBlockToAir(x, y, z);
}
} else {
try {
getSchematic().writeToWorld(context, x, y, z);
// Once the schematic has been written, we're going to issue
// calls
// to various functions, in particular updating the tile entity.
// If these calls issue problems, in order to avoid corrupting
// the world, we're logging the problem and setting the block to
// air.
TileEntity e = context.world().getTileEntity(x, y, z);
if (e != null) {
e.updateEntity();
}
} catch (Throwable t) {
t.printStackTrace();
context.world().setBlockToAir(x, y, z);
}
} catch (Throwable t) {
t.printStackTrace();
context.world().setBlockToAir(x, y, z);
}
}