Fix npes.

This commit is contained in:
asofold 2012-12-07 05:47:16 +01:00
parent 898a9a5212
commit 934644633f
2 changed files with 8 additions and 6 deletions

View File

@ -29,26 +29,27 @@ public class BlockCacheCB2511 extends BlockCache implements IBlockAccess{
}
@Override
public void setAccess(World world) {
this.world = ((CraftWorld) world).getHandle();
public void setAccess(final World world) {
this.world = world == null ? null : ((CraftWorld) world).getHandle();
}
@Override
public int fetchTypeId(int x, int y, int z) {
public int fetchTypeId(final int x, final int y, final int z) {
return world.getTypeId(x, y, z);
}
@Override
public int fetchData(int x, int y, int z) {
public int fetchData(final int x, final int y, final int z) {
return world.getData(x, y, z);
}
@Override
public double[] fetchBounds(int x, int y, int z){
public double[] fetchBounds(final int x, final int y, final int z){
// TODO: change api for this / use nodes (!)
final int id = getTypeId(x, y, z);
final net.minecraft.server.Block block = net.minecraft.server.Block.byId[id];
if (block == null) return null;
block.updateShape(this, x, y, z); // TODO: use THIS instead of world.
// minX, minY, minZ, maxX, maxY, maxZ

View File

@ -30,7 +30,7 @@ public class BlockCacheCB2512 extends BlockCache implements IBlockAccess{ // TOD
@Override
public void setAccess(World world) {
this.world = ((CraftWorld) world).getHandle();
this.world = world == null ? null : ((CraftWorld) world).getHandle();
}
@Override
@ -49,6 +49,7 @@ public class BlockCacheCB2512 extends BlockCache implements IBlockAccess{ // TOD
// TODO: change api for this / use nodes (!)
final int id = getTypeId(x, y, z);
final net.minecraft.server.v1_4_5.Block block = net.minecraft.server.v1_4_5.Block.byId[id];
if (block == null) return null;
block.updateShape(this, x, y, z); // TODO: use THIS instead of world.
// minX, minY, minZ, maxX, maxY, maxZ