Cleared up spawn distance calculation.

This commit is contained in:
FeepingCreature 2011-01-16 06:59:51 +08:00 committed by Dinner Bone
parent 0e821e60c9
commit 2c5dd11c62

View File

@ -71,12 +71,7 @@ public class ItemBlock extends Item {
CraftItemStack itemInHand = new CraftItemStack(itemstack); CraftItemStack itemInHand = new CraftItemStack(itemstack);
CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer); CraftPlayer thePlayer = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entityplayer);
int xFromSpawn = (int) MathHelper.e(i - world.m); int distanceFromSpawn = (int) Math.max(Math.abs(i - world.m), Math.abs(k - world.o));
int distanceFromSpawn = (int) MathHelper.e(k - world.o);
if (xFromSpawn > distanceFromSpawn) {
distanceFromSpawn = xFromSpawn;
}
// CraftBukkit hardcoded Spawn distance for now // CraftBukkit hardcoded Spawn distance for now
boolean canBuild = distanceFromSpawn > 16 || thePlayer.isOp(); boolean canBuild = distanceFromSpawn > 16 || thePlayer.isOp();