Set maxBlockY from given world.

This commit is contained in:
asofold 2014-02-25 11:22:39 +01:00
parent 1cb9a18174
commit cb557122b8
13 changed files with 68 additions and 12 deletions

View File

@ -21,6 +21,9 @@ public class BlockCacheBukkit extends BlockCache{
@Override
public void setAccess(World world) {
this.world = world;
if (world != null) {
this.maxBlockY = world.getMaxHeight() - 1;
}
}
@Override

View File

@ -30,7 +30,12 @@ public class BlockCacheCB2512 extends BlockCache implements IBlockAccess{
@Override
public void setAccess(World world) {
this.world = world == null ? null : ((CraftWorld) world).getHandle();
if (world != null) {
this.maxBlockY = world.getMaxHeight() - 1;
this.world = ((CraftWorld) world).getHandle();
} else {
this.world = null;
}
}
@Override

View File

@ -30,7 +30,12 @@ public class BlockCacheCB2545 extends BlockCache implements IBlockAccess{
@Override
public void setAccess(World world) {
this.world = world == null ? null : ((CraftWorld) world).getHandle();
if (world != null) {
this.maxBlockY = world.getMaxHeight() - 1;
this.world = ((CraftWorld) world).getHandle();
} else {
this.world = null;
}
}
@Override

View File

@ -30,7 +30,12 @@ public class BlockCacheCB2602 extends BlockCache implements IBlockAccess{
@Override
public void setAccess(World world) {
this.world = world == null ? null : ((CraftWorld) world).getHandle();
if (world != null) {
this.maxBlockY = world.getMaxHeight() - 1;
this.world = ((CraftWorld) world).getHandle();
} else {
this.world = null;
}
}
@Override

View File

@ -30,7 +30,12 @@ public class BlockCacheCB2645 extends BlockCache implements IBlockAccess{
@Override
public void setAccess(World world) {
this.world = world == null ? null : ((CraftWorld) world).getHandle();
if (world != null) {
this.maxBlockY = world.getMaxHeight() - 1;
this.world = ((CraftWorld) world).getHandle();
} else {
this.world = null;
}
}
@Override

View File

@ -30,7 +30,12 @@ public class BlockCacheCB2691 extends BlockCache implements IBlockAccess{
@Override
public void setAccess(World world) {
this.world = world == null ? null : ((CraftWorld) world).getHandle();
if (world != null) {
this.maxBlockY = world.getMaxHeight() - 1;
this.world = ((CraftWorld) world).getHandle();
} else {
this.world = null;
}
}
@Override

View File

@ -30,7 +30,12 @@ public class BlockCacheCB2763 extends BlockCache implements IBlockAccess{
@Override
public void setAccess(World world) {
this.world = world == null ? null : ((CraftWorld) world).getHandle();
if (world != null) {
this.maxBlockY = world.getMaxHeight() - 1;
this.world = ((CraftWorld) world).getHandle();
} else {
this.world = null;
}
}
@Override

View File

@ -30,7 +30,12 @@ public class BlockCacheCB2794 extends BlockCache implements IBlockAccess{
@Override
public void setAccess(World world) {
this.world = world == null ? null : ((CraftWorld) world).getHandle();
if (world != null) {
this.maxBlockY = world.getMaxHeight() - 1;
this.world = ((CraftWorld) world).getHandle();
} else {
this.world = null;
}
}
@Override

View File

@ -30,7 +30,12 @@ public class BlockCacheCB2808 extends BlockCache implements IBlockAccess{
@Override
public void setAccess(World world) {
this.world = world == null ? null : ((CraftWorld) world).getHandle();
if (world != null) {
this.maxBlockY = world.getMaxHeight() - 1;
this.world = ((CraftWorld) world).getHandle();
} else {
this.world = null;
}
}
@Override

View File

@ -30,7 +30,12 @@ public class BlockCacheCB2882 extends BlockCache implements IBlockAccess{
@Override
public void setAccess(World world) {
this.world = world == null ? null : ((CraftWorld) world).getHandle();
if (world != null) {
this.maxBlockY = world.getMaxHeight() - 1;
this.world = ((CraftWorld) world).getHandle();
} else {
this.world = null;
}
}
@Override

View File

@ -30,7 +30,12 @@ public class BlockCacheCBDev extends BlockCache implements IBlockAccess{
@Override
public void setAccess(World world) {
this.world = world == null ? null : ((CraftWorld) world).getHandle();
if (world != null) {
this.maxBlockY = world.getMaxHeight() - 1;
this.world = ((CraftWorld) world).getHandle();
} else {
this.world = null;
}
}
@Override

View File

@ -63,7 +63,7 @@ public abstract class BlockCache {
/** Cached shape values. */
private final CoordMap<double[]> boundsMap = new CoordMap<double[]>(23);
private int maxBlockY = 255;
protected int maxBlockY = 255;
// TODO: switch to nodes with all details on, store a working node ?

View File

@ -2067,7 +2067,10 @@ public class BlockProperties {
final int iMinX = Location.locToBlock(minX);
final int iMaxX = Location.locToBlock(maxX);
final int iMinY = Location.locToBlock(minY - 0.5626);
if (iMinY > maxBlockY) return false;
if (iMinY > maxBlockY) {
// TODO: Keep checking this, does not apply for biger values of yOnGround.
return false;
}
final int iMaxY = Math.min(Location.locToBlock(maxY), maxBlockY);
final int iMinZ = Location.locToBlock(minZ);
final int iMaxZ = Location.locToBlock(maxZ);