Add BlockCache to isOnGround (breaking duration).

This commit is contained in:
asofold 2012-12-04 05:27:11 +01:00
parent 2d1beaf3a9
commit cfa397fabc

View File

@ -245,6 +245,7 @@ public class BlockProperties {
Material.POTATO, Material.POTATO,
}; };
private static BlockCache blockCache = new BlockCache();
private static final PlayerLocation pLoc = new PlayerLocation(); private static final PlayerLocation pLoc = new PlayerLocation();
protected static final long[] blockFlags = new long[maxBlocks]; protected static final long[] blockFlags = new long[maxBlocks];
@ -871,13 +872,16 @@ public class BlockProperties {
public static boolean isOnGround(Player player, Location location) { public static boolean isOnGround(Player player, Location location) {
// return blockId != 0 && net.minecraft.server.Block.byId[blockId].//.c();// d(); // return blockId != 0 && net.minecraft.server.Block.byId[blockId].//.c();// d();
// Bit fat workaround, maybe put the object through from check listener ? // Bit fat workaround, maybe put the object through from check listener ?
pLoc.setBlockCache(blockCache);
pLoc.set(location, player, 0.3); pLoc.set(location, player, 0.3);
if (pLoc.isIllegal()) { if (pLoc.isIllegal()) {
blockCache.cleanup();
pLoc.cleanup(); pLoc.cleanup();
CheckUtils.onIllegalMove(player); CheckUtils.onIllegalMove(player);
return false; return false;
} }
final boolean onGround = pLoc.isOnGround(); final boolean onGround = pLoc.isOnGround();
blockCache.cleanup();
pLoc.cleanup(); pLoc.cleanup();
return onGround; return onGround;
} }