summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/World.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/minecraft/server/World.java')
-rw-r--r--src/main/java/net/minecraft/server/World.java865
1 files changed, 553 insertions, 312 deletions
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 1872cd94..cebf2c18 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -31,57 +31,54 @@ import org.bukkit.block.BlockState;
public class World implements IBlockAccess {
- public final int heightBits = 7;
- public final int heightBitsPlusFour = 11;
- public final int height = 128;
- public final int heightMinusOne = 127;
- public final int seaLevel = 63;
- public boolean f = false;
- public List entityList = new ArrayList();
- private List M = new ArrayList();
- private TreeSet N = new TreeSet();
- private Set O = new HashSet();
- public List h = new ArrayList();
- private List P = new ArrayList();
- private List Q = new ArrayList();
- public List players = new ArrayList();
- public List j = new ArrayList();
- private long R = 16777215L;
- public int k = 0;
- protected int l = (new Random()).nextInt();
- protected final int m = 1013904223;
+ public int heightBits = 7;
+ public int heightBitsPlusFour;
+ public int height;
+ public int heightMinusOne;
+ public int seaLevel;
+ public boolean f;
+ public List entityList;
+ private List J;
+ private TreeSet K;
+ private Set L;
+ public List h;
+ private List M;
+ private List N;
+ public List players;
+ public List j;
+ private long O;
+ public int k;
+ protected int l;
+ protected final int m;
protected float n;
protected float o;
protected float p;
protected float q;
- protected int r = 0;
- public int s = 0;
- public boolean suppressPhysics = false;
- private long S = System.currentTimeMillis();
- protected int u = 40;
+ protected int r;
+ public int s;
+ public boolean suppressPhysics;
+ private long P;
+ protected int u;
public int difficulty;
- public Random random = new Random();
- public boolean x = false;
+ public Random random;
+ public boolean x;
public WorldProvider worldProvider; // CraftBukkit - remove final
- protected List z = new ArrayList();
+ protected List z;
public IChunkProvider chunkProvider; // CraftBukkit - protected -> public
protected final IDataManager B;
public WorldData worldData; // CraftBukkit - protected -> public
public boolean isLoading;
- private boolean T;
+ private boolean Q;
public WorldMapCollection worldMaps;
- private ArrayList U = new ArrayList();
- private boolean V;
- public boolean allowMonsters = true; // CraftBukkit - private -> public
- public boolean allowAnimals = true; // CraftBukkit - private -> public
- private Set W = new HashSet();
- private int X;
+ private ArrayList R;
+ private boolean S;
+ public boolean allowMonsters; // CraftBukkit - private -> public
+ public boolean allowAnimals; // CraftBukkit - private -> public
+ private Set T;
+ private int U;
int[] H;
- private List Y;
+ private List V;
public boolean isStatic;
- public double J;
- public double K;
- public double L;
public WorldChunkManager getWorldChunkManager() {
return this.worldProvider.b;
@@ -119,9 +116,39 @@ public class World implements IBlockAccess {
this.world = new CraftWorld((WorldServer) this, gen, env);
// CraftBukkit end
- this.X = this.random.nextInt(12000);
+ this.heightBitsPlusFour = this.heightBits + 4;
+ this.height = 1 << this.heightBits;
+ this.heightMinusOne = this.height - 1;
+ this.seaLevel = this.height / 2 - 1;
+ this.f = false;
+ this.entityList = new ArrayList();
+ this.J = new ArrayList();
+ this.K = new TreeSet();
+ this.L = new HashSet();
+ this.h = new ArrayList();
+ this.M = new ArrayList();
+ this.N = new ArrayList();
+ this.players = new ArrayList();
+ this.j = new ArrayList();
+ this.O = 16777215L;
+ this.k = 0;
+ this.l = (new Random()).nextInt();
+ this.m = 1013904223;
+ this.r = 0;
+ this.s = 0;
+ this.suppressPhysics = false;
+ this.P = System.currentTimeMillis();
+ this.u = 40;
+ this.random = new Random();
+ this.x = false;
+ this.z = new ArrayList();
+ this.R = new ArrayList();
+ this.allowMonsters = true;
+ this.allowAnimals = true;
+ this.T = new HashSet();
+ this.U = this.random.nextInt(12000);
this.H = new int['\u8000'];
- this.Y = new ArrayList();
+ this.V = new ArrayList();
this.isStatic = false;
this.B = idatamanager;
this.worldMaps = new WorldMapCollection(idatamanager);
@@ -129,8 +156,8 @@ public class World implements IBlockAccess {
this.x = this.worldData == null;
if (worldprovider != null) {
this.worldProvider = worldprovider;
- } else if (this.worldData != null && this.worldData.h() == -1) {
- this.worldProvider = WorldProvider.byDimension(-1);
+ } else if (this.worldData != null && this.worldData.h() != 0) {
+ this.worldProvider = WorldProvider.byDimension(this.worldData.h());
} else {
this.worldProvider = WorldProvider.byDimension(0);
}
@@ -150,8 +177,8 @@ public class World implements IBlockAccess {
this.c();
}
- this.f();
- this.x();
+ this.g();
+ this.z();
this.getServer().addWorld(this.world); // CraftBukkit
}
@@ -169,8 +196,8 @@ public class World implements IBlockAccess {
Random random = new Random(this.getSeed());
ChunkPosition chunkposition = worldchunkmanager.a(0, 0, 256, list, random);
int i = 0;
- byte b0 = 64;
- int j = 0;
+ int j = this.height / 2;
+ int k = 0;
// CraftBukkit start
if (this.generator != null) {
@@ -191,31 +218,35 @@ public class World implements IBlockAccess {
if (chunkposition != null) {
i = chunkposition.x;
- j = chunkposition.z;
+ k = chunkposition.z;
} else {
System.out.println("Unable to find spawn biome");
}
- int k = 0;
+ int l = 0;
// CraftBukkit - use out own canSpawn
- while (!canSpawn(i, j)) {
+ while (!this.canSpawn(i, k)) {
i += random.nextInt(64) - random.nextInt(64);
- j += random.nextInt(64) - random.nextInt(64);
- ++k;
- if (k == 1000) {
+ k += random.nextInt(64) - random.nextInt(64);
+ ++l;
+ if (l == 1000) {
break;
}
}
- this.worldData.setSpawn(i, b0, j);
+ this.worldData.setSpawn(i, j, k);
this.isLoading = false;
}
+ public ChunkCoordinates d() {
+ return this.worldProvider.d();
+ }
+
public int a(int i, int j) {
int k;
- for (k = 63; !this.isEmpty(i, k + 1, j); ++k) {
+ for (k = this.seaLevel; !this.isEmpty(i, k + 1, j); ++k) {
;
}
@@ -228,7 +259,7 @@ public class World implements IBlockAccess {
iprogressupdate.a("Saving level");
}
- this.w();
+ this.y();
if (iprogressupdate != null) {
iprogressupdate.b("Saving chunks");
}
@@ -237,14 +268,14 @@ public class World implements IBlockAccess {
}
}
- private void w() {
- this.j();
+ private void y() {
+ this.l();
this.B.a(this.worldData, this.players);
this.worldMaps.a();
}
public int getTypeId(int i, int j, int k) {
- return i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000 ? (j < 0 ? 0 : (j >= 128 ? 0 : this.getChunkAt(i >> 4, k >> 4).getTypeId(i & 15, j, k & 15))) : 0;
+ return i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000 ? (j < 0 ? 0 : (j >= this.height ? 0 : this.getChunkAt(i >> 4, k >> 4).getTypeId(i & 15, j, k & 15))) : 0;
}
public boolean isEmpty(int i, int j, int k) {
@@ -252,7 +283,7 @@ public class World implements IBlockAccess {
}
public boolean isLoaded(int i, int j, int k) {
- return j >= 0 && j < 128 ? this.isChunkLoaded(i >> 4, k >> 4) : false;
+ return j >= 0 && j < this.height ? this.isChunkLoaded(i >> 4, k >> 4) : false;
}
public boolean areChunksLoaded(int i, int j, int k, int l) {
@@ -260,7 +291,7 @@ public class World implements IBlockAccess {
}
public boolean a(int i, int j, int k, int l, int i1, int j1) {
- if (i1 >= 0 && j < 128) {
+ if (i1 >= 0 && j < this.height) {
i >>= 4;
j >>= 4;
k >>= 4;
@@ -309,13 +340,13 @@ public class World implements IBlockAccess {
if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) {
if (j < 0) {
return false;
- } else if (j >= 128) {
+ } else if (j >= this.height) {
return false;
} else {
Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
boolean flag = chunk.a(i & 15, j, k & 15, l, i1);
- this.p(i, j, k);
+ this.s(i, j, k);
return flag;
}
} else {
@@ -327,13 +358,13 @@ public class World implements IBlockAccess {
if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) {
if (j < 0) {
return false;
- } else if (j >= 128) {
+ } else if (j >= this.height) {
return false;
} else {
Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
boolean flag = chunk.a(i & 15, j, k & 15, l);
- this.p(i, j, k);
+ this.s(i, j, k);
return flag;
}
} else {
@@ -351,7 +382,7 @@ public class World implements IBlockAccess {
if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) {
if (j < 0) {
return 0;
- } else if (j >= 128) {
+ } else if (j >= this.height) {
return 0;
} else {
Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
@@ -381,15 +412,14 @@ public class World implements IBlockAccess {
if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) {
if (j < 0) {
return false;
- } else if (j >= 128) {
+ } else if (j >= this.height) {
return false;
} else {
Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
i &= 15;
k &= 15;
- chunk.b(i, j, k, l);
- return true;
+ return chunk.b(i, j, k, l);
}
} else {
return false;
@@ -440,8 +470,10 @@ public class World implements IBlockAccess {
k = i1;
}
- for (i1 = k; i1 <= l; ++i1) {
- this.b(EnumSkyBlock.SKY, i, i1, j);
+ if (!this.worldProvider.e) {
+ for (i1 = k; i1 <= l; ++i1) {
+ this.b(EnumSkyBlock.SKY, i, i1, j);
+ }
}
this.b(i, k, j, i, l, j);
@@ -498,8 +530,8 @@ public class World implements IBlockAccess {
if (j < 0) {
return 0;
} else {
- if (j >= 128) {
- j = 127;
+ if (j >= this.height) {
+ j = this.height - 1;
}
return this.getChunkAt(i >> 4, k >> 4).c(i & 15, j, k & 15, 0);
@@ -545,8 +577,8 @@ public class World implements IBlockAccess {
if (j < 0) {
return 0;
} else {
- if (j >= 128) {
- j = 127;
+ if (j >= this.height) {
+ j = this.height - 1;
}
Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
@@ -579,11 +611,11 @@ public class World implements IBlockAccess {
j = 0;
}
- if (j >= 128) {
- j = 127;
+ if (j >= this.height) {
+ j = this.height - 1;
}
- if (j >= 0 && j < 128 && i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) {
+ if (j >= 0 && j < this.height && i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) {
int l = i >> 4;
int i1 = k >> 4;
@@ -602,7 +634,7 @@ public class World implements IBlockAccess {
public void a(EnumSkyBlock enumskyblock, int i, int j, int k, int l) {
if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) {
if (j >= 0) {
- if (j < 128) {
+ if (j < this.height) {
if (this.isChunkLoaded(i >> 4, k >> 4)) {
Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
@@ -621,7 +653,7 @@ public class World implements IBlockAccess {
return this.worldProvider.f[this.getLightLevel(i, j, k)];
}
- public boolean d() {
+ public boolean e() {
return this.k < 4;
}
@@ -911,10 +943,10 @@ public class World implements IBlockAccess {
this.everyoneSleeping();
}
- int i = entity.bW;
- int j = entity.bY;
+ int i = entity.bX;
+ int j = entity.bZ;
- if (entity.bV && this.isChunkLoaded(i, j)) {
+ if (entity.bW && this.isChunkLoaded(i, j)) {
this.getChunkAt(i, j).b(entity);
}
@@ -927,7 +959,7 @@ public class World implements IBlockAccess {
}
public List getEntities(Entity entity, AxisAlignedBB axisalignedbb) {
- this.U.clear();
+ this.R.clear();
int i = MathHelper.floor(axisalignedbb.a);
int j = MathHelper.floor(axisalignedbb.d + 1.0D);
int k = MathHelper.floor(axisalignedbb.b);
@@ -937,12 +969,12 @@ public class World implements IBlockAccess {
for (int k1 = i; k1 < j; ++k1) {
for (int l1 = i1; l1 < j1; ++l1) {
- if (this.isLoaded(k1, 64, l1)) {
+ if (this.isLoaded(k1, this.height / 2, l1)) {
for (int i2 = k - 1; i2 < l; ++i2) {
Block block = Block.byId[this.getTypeId(k1, i2, l1)];
if (block != null) {
- block.a(this, k1, i2, l1, axisalignedbb, this.U);
+ block.a(this, k1, i2, l1, axisalignedbb, this.R);
}
}
}
@@ -953,19 +985,19 @@ public class World implements IBlockAccess {
List list = this.b(entity, axisalignedbb.b(d0, d0, d0));
for (int j2 = 0; j2 < list.size(); ++j2) {
- AxisAlignedBB axisalignedbb1 = ((Entity) list.get(j2)).f();
+ AxisAlignedBB axisalignedbb1 = ((Entity) list.get(j2)).h_();
if (axisalignedbb1 != null && axisalignedbb1.a(axisalignedbb)) {
- this.U.add(axisalignedbb1);
+ this.R.add(axisalignedbb1);
}
- axisalignedbb1 = entity.b((Entity) list.get(j2));
+ axisalignedbb1 = entity.a_((Entity) list.get(j2));
if (axisalignedbb1 != null && axisalignedbb1.a(axisalignedbb)) {
- this.U.add(axisalignedbb1);
+ this.R.add(axisalignedbb1);
}
}
- return this.U;
+ return this.R;
}
public int a(float f) {
@@ -988,7 +1020,7 @@ public class World implements IBlockAccess {
}
public float b(float f) {
- return this.worldProvider.a(this.worldData.f(), f) + (float) (this.J + (this.K - this.J) * (double) f);
+ return this.worldProvider.a(this.worldData.f(), f);
}
public int e(int i, int j) {
@@ -997,7 +1029,7 @@ public class World implements IBlockAccess {
public int f(int i, int j) {
Chunk chunk = this.getChunkAtWorldCoords(i, j);
- int k = 127;
+ int k = this.height - 1;
i &= 15;
@@ -1030,15 +1062,31 @@ public class World implements IBlockAccess {
nextticklistentry.a((long) i1 + this.worldData.f());
}
- if (!this.O.contains(nextticklistentry)) {
- this.O.add(nextticklistentry);
- this.N.add(nextticklistentry);
+ if (!this.L.contains(nextticklistentry)) {
+ this.L.add(nextticklistentry);
+ this.K.add(nextticklistentry);
}
}
}
}
+ public void d(int i, int j, int k, int l, int i1) {
+ NextTickListEntry nextticklistentry = new NextTickListEntry(i, j, k, l);
+
+ if (l > 0) {
+ nextticklistentry.a((long) i1 + this.worldData.f());
+ }
+
+ if (!this.L.contains(nextticklistentry)) {
+ this.L.add(nextticklistentry);
+ this.K.add(nextticklistentry);
+ }
+ }
+
public void tickEntities() {
+ MethodProfiler.a("entities");
+ MethodProfiler.a("global");
+
int i;
Entity entity;
@@ -1049,31 +1097,33 @@ public class World implements IBlockAccess {
continue;
}
// CraftBukkit end
- entity.s_();
+ entity.w_();
if (entity.dead) {
this.j.remove(i--);
}
}
- this.entityList.removeAll(this.M);
+ MethodProfiler.b("remove");
+ this.entityList.removeAll(this.J);
int j;
int k;
- for (i = 0; i < this.M.size(); ++i) {
- entity = (Entity) this.M.get(i);
- j = entity.bW;
- k = entity.bY;
- if (entity.bV && this.isChunkLoaded(j, k)) {
+ for (i = 0; i < this.J.size(); ++i) {
+ entity = (Entity) this.J.get(i);
+ j = entity.bX;
+ k = entity.bZ;
+ if (entity.bW && this.isChunkLoaded(j, k)) {
this.getChunkAt(j, k).b(entity);
}
}
- for (i = 0; i < this.M.size(); ++i) {
- this.d((Entity) this.M.get(i));
+ for (i = 0; i < this.J.size(); ++i) {
+ this.d((Entity) this.J.get(i));
}
- this.M.clear();
+ this.J.clear();
+ MethodProfiler.b("regular");
for (i = 0; i < this.entityList.size(); ++i) {
entity = (Entity) this.entityList.get(i);
@@ -1090,29 +1140,33 @@ public class World implements IBlockAccess {
this.playerJoinedWorld(entity);
}
+ MethodProfiler.a("remove");
if (entity.dead) {
- j = entity.bW;
- k = entity.bY;
- if (entity.bV && this.isChunkLoaded(j, k)) {
+ j = entity.bX;
+ k = entity.bZ;
+ if (entity.bW && this.isChunkLoaded(j, k)) {
this.getChunkAt(j, k).b(entity);
}
this.entityList.remove(i--);
this.d(entity);
}
+
+ MethodProfiler.a();
}
- this.V = true;
+ MethodProfiler.b("tileEntities");
+ this.S = true;
Iterator iterator = this.h.iterator();
while (iterator.hasNext()) {
TileEntity tileentity = (TileEntity) iterator.next();
- if (!tileentity.m() && tileentity.world != null) {
- tileentity.h_();
+ if (!tileentity.l() && tileentity.world != null && this.isLoaded(tileentity.x, tileentity.y, tileentity.z)) {
+ tileentity.l_();
}
- if (tileentity.m()) {
+ if (tileentity.l()) {
iterator.remove();
if (this.isChunkLoaded(tileentity.x >> 4, tileentity.z >> 4)) {
Chunk chunk = this.getChunkAt(tileentity.x >> 4, tileentity.z >> 4);
@@ -1124,19 +1178,20 @@ public class World implements IBlockAccess {
}
}
- this.V = false;
- if (!this.Q.isEmpty()) {
- this.h.removeAll(this.Q);
- this.Q.clear();
+ this.S = false;
+ if (!this.N.isEmpty()) {
+ this.h.removeAll(this.N);
+ this.N.clear();
}
- if (!this.P.isEmpty()) {
- Iterator iterator1 = this.P.iterator();
+ MethodProfiler.b("pendingTileEntities");
+ if (!this.M.isEmpty()) {
+ Iterator iterator1 = this.M.iterator();
while (iterator1.hasNext()) {
TileEntity tileentity1 = (TileEntity) iterator1.next();
- if (!tileentity1.m()) {
+ if (!tileentity1.l()) {
// CraftBukkit - order matters, moved down
/* if (!this.h.contains(tileentity1)) {
this.h.add(tileentity1);
@@ -1159,13 +1214,16 @@ public class World implements IBlockAccess {
}
}
- this.P.clear();
+ this.M.clear();
}
+
+ MethodProfiler.a();
+ MethodProfiler.a();
}
public void a(Collection collection) {
- if (this.V) {
- this.P.addAll(collection);
+ if (this.S) {
+ this.M.addAll(collection);
} else {
this.h.addAll(collection);
}
@@ -1180,30 +1238,31 @@ public class World implements IBlockAccess {
int j = MathHelper.floor(entity.locZ);
byte b0 = 32;
- if (!flag || this.a(i - b0, 0, j - b0, i + b0, 128, j + b0)) {
- entity.bE = entity.locX;
- entity.bF = entity.locY;
- entity.bG = entity.locZ;
+ if (!flag || this.a(i - b0, 0, j - b0, i + b0, this.height, j + b0)) {
+ entity.bI = entity.locX;
+ entity.bJ = entity.locY;
+ entity.bK = entity.locZ;
entity.lastYaw = entity.yaw;
entity.lastPitch = entity.pitch;
- if (flag && entity.bV) {
+ if (flag && entity.bW) {
if (entity.vehicle != null) {
- entity.I();
+ entity.M();
} else {
- entity.s_();
+ entity.w_();
}
}
+ MethodProfiler.a("chunkCheck");
if (Double.isNaN(entity.locX) || Double.isInfinite(entity.locX)) {
- entity.locX = entity.bE;
+ entity.locX = entity.bI;
}
if (Double.isNaN(entity.locY) || Double.isInfinite(entity.locY)) {
- entity.locY = entity.bF;
+ entity.locY = entity.bJ;
}
if (Double.isNaN(entity.locZ) || Double.isInfinite(entity.locZ)) {
- entity.locZ = entity.bG;
+ entity.locZ = entity.bK;
}
if (Double.isNaN((double) entity.pitch) || Double.isInfinite((double) entity.pitch)) {
@@ -1218,20 +1277,21 @@ public class World implements IBlockAccess {
int l = MathHelper.floor(entity.locY / 16.0D);
int i1 = MathHelper.floor(entity.locZ / 16.0D);
- if (!entity.bV || entity.bW != k || entity.bX != l || entity.bY != i1) {
- if (entity.bV && this.isChunkLoaded(entity.bW, entity.bY)) {
- this.getChunkAt(entity.bW, entity.bY).a(entity, entity.bX);
+ if (!entity.bW || entity.bX != k || entity.bY != l || entity.bZ != i1) {
+ if (entity.bW && this.isChunkLoaded(entity.bX, entity.bZ)) {
+ this.getChunkAt(entity.bX, entity.bZ).a(entity, entity.bY);
}
if (this.isChunkLoaded(k, i1)) {
- entity.bV = true;
+ entity.bW = true;
this.getChunkAt(k, i1).a(entity);
} else {
- entity.bV = false;
+ entity.bW = false;
}
}
- if (flag && entity.bV && entity.passenger != null) {
+ MethodProfiler.a();
+ if (flag && entity.bW && entity.passenger != null) {
if (!entity.passenger.dead && entity.passenger.vehicle == entity) {
this.playerJoinedWorld(entity.passenger);
} else {
@@ -1248,7 +1308,7 @@ public class World implements IBlockAccess {
for (int i = 0; i < list.size(); ++i) {
Entity entity = (Entity) list.get(i);
- if (!entity.dead && entity.aY) {
+ if (!entity.dead && entity.bc) {
return false;
}
}
@@ -1371,7 +1431,7 @@ public class World implements IBlockAccess {
Block block = Block.byId[this.getTypeId(k1, l1, i2)];
if (block != null && block.material == material) {
- double d0 = (double) ((float) (l1 + 1) - BlockFluids.c(this.getData(k1, l1, i2)));
+ double d0 = (double) ((float) (l1 + 1) - BlockFluids.d(this.getData(k1, l1, i2)));
if ((double) l >= d0) {
flag = true;
@@ -1523,16 +1583,35 @@ public class World implements IBlockAccess {
public TileEntity getTileEntity(int i, int j, int k) {
Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
- return chunk != null ? chunk.d(i & 15, j, k & 15) : null;
+ if (chunk == null) {
+ return null;
+ } else {
+ TileEntity tileentity = chunk.d(i & 15, j, k & 15);
+
+ if (tileentity == null) {
+ Iterator iterator = this.M.iterator();
+
+ while (iterator.hasNext()) {
+ TileEntity tileentity1 = (TileEntity) iterator.next();
+
+ if (!tileentity1.l() && tileentity1.x == i && tileentity1.y == j && tileentity1.z == k) {
+ tileentity = tileentity1;
+ break;
+ }
+ }
+ }
+
+ return tileentity;
+ }
}
public void setTileEntity(int i, int j, int k, TileEntity tileentity) {
- if (tileentity != null && !tileentity.m()) {
- if (this.V) {
+ if (tileentity != null && !tileentity.l()) {
+ if (this.S) {
tileentity.x = i;
tileentity.y = j;
tileentity.z = k;
- this.P.add(tileentity);
+ this.M.add(tileentity);
} else {
// CraftBukkit - order matters, moved down
// this.h.add(tileentity);
@@ -1549,10 +1628,12 @@ public class World implements IBlockAccess {
public void n(int i, int j, int k) {
TileEntity tileentity = this.getTileEntity(i, j, k);
- if (tileentity != null && this.V) {
+ if (tileentity != null && this.S) {
tileentity.i();
+ this.M.remove(tileentity);
} else {
if (tileentity != null) {
+ this.M.remove(tileentity);
this.h.remove(tileentity);
}
@@ -1565,7 +1646,7 @@ public class World implements IBlockAccess {
}
public void a(TileEntity tileentity) {
- this.Q.add(tileentity);
+ this.N.add(tileentity);
}
public boolean o(int i, int j, int k) {
@@ -1580,7 +1661,23 @@ public class World implements IBlockAccess {
return block == null ? false : block.material.j() && block.b();
}
- public void f() {
+ public boolean b(int i, int j, int k, boolean flag) {
+ if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) {
+ Chunk chunk = this.chunkProvider.getOrCreateChunk(i >> 4, k >> 4);
+
+ if (chunk != null && !chunk.isEmpty()) {
+ Block block = Block.byId[this.getTypeId(i, j, k)];
+
+ return block == null ? false : block.material.j() && block.b();
+ } else {
+ return flag;
+ }
+ } else {
+ return flag;
+ }
+ }
+
+ public void g() {
int i = this.a(1.0F);
if (i != this.k) {
@@ -1594,33 +1691,35 @@ public class World implements IBlockAccess {
}
public void doTick() {
- this.J = this.K;
- this.K += this.L;
- this.L *= 0.98D;
+ if (this.r().isHardcore() && this.difficulty < 3) {
+ this.difficulty = 3;
+ }
+
this.getWorldChunkManager().b();
- this.h();
+ this.i();
long i;
if (this.everyoneDeeplySleeping()) {
boolean flag = false;
if (this.allowMonsters && this.difficulty >= 1) {
- flag = SpawnerCreature.a(this, this.players);
+ ;
}
if (!flag) {
i = this.worldData.f() + 24000L;
this.worldData.a(i - i % 24000L);
- this.r();
+ this.t();
}
}
+ MethodProfiler.a("mobSpawner");
// CraftBukkit start - Only call spawner if we have players online and the world allows for mobs or animals
if ((this.allowMonsters || this.allowAnimals) && (this instanceof WorldServer && this.getServer().getHandle().players.size() > 0)) {
SpawnerCreature.spawnEntities(this, this.allowMonsters, this.allowAnimals && this.worldData.f() % 400L == 0L);
}
// CraftBukkit end
-
+ MethodProfiler.b("chunkSource");
this.chunkProvider.unloadChunks();
int j = this.a(1.0F);
@@ -1630,15 +1729,19 @@ public class World implements IBlockAccess {
i = this.worldData.f() + 1L;
if (i % (long) this.u == 0L) {
+ MethodProfiler.b("save");
this.save(false, (IProgressUpdate) null);
}
this.worldData.a(i);
+ MethodProfiler.b("tickPending");
this.a(false);
- this.i();
+ MethodProfiler.b("tickTiles");
+ this.k();
+ MethodProfiler.a();
}
- private void x() {
+ private void z() {
if (this.worldData.hasStorm()) {
this.o = 1.0F;
if (this.worldData.isThundering()) {
@@ -1647,7 +1750,7 @@ public class World implements IBlockAccess {
}
}
- protected void h() {
+ protected void i() {
if (!this.worldProvider.e) {
if (this.r > 0) {
--this.r;
@@ -1730,7 +1833,7 @@ public class World implements IBlockAccess {
}
}
- private void y() {
+ private void A() {
// CraftBukkit start
WeatherChangeEvent weather = new WeatherChangeEvent(this.getWorld(), false);
this.getServer().getPluginManager().callEvent(weather);
@@ -1748,154 +1851,218 @@ public class World implements IBlockAccess {
// CraftBukkit end
}
- protected void i() {
- this.W.clear();
+ public void j() {
+ this.worldData.setWeatherDuration(1);
+ }
+
+ protected void k() {
+ this.T.clear();
+ MethodProfiler.a("buildList");
int i;
int j;
- int k;
- int l;
- for (int i1 = 0; i1 < this.players.size(); ++i1) {
- EntityHuman entityhuman = (EntityHuman) this.players.get(i1);
+ for (i = 0; i < this.players.size(); ++i) {
+ EntityHuman entityhuman = (EntityHuman) this.players.get(i);
+ int k = MathHelper.floor(entityhuman.locX / 16.0D);
+ int l = MathHelper.floor(entityhuman.locZ / 16.0D);
+ byte b0 = 7;
- i = MathHelper.floor(entityhuman.locX / 16.0D);
- j = MathHelper.floor(entityhuman.locZ / 16.0D);
- byte b0 = 9;
-
- for (k = -b0; k <= b0; ++k) {
- for (l = -b0; l <= b0; ++l) {
- this.W.add(new ChunkCoordIntPair(k + i, l + j));
+ for (j = -b0; j <= b0; ++j) {
+ for (int i1 = -b0; i1 <= b0; ++i1) {
+ this.T.add(new ChunkCoordIntPair(j + k, i1 + l));
}
}
}
- if (this.X > 0) {
- --this.X;
+ if (this.U > 0) {
+ --this.U;
}
- Iterator iterator = this.W.iterator();
+ i = 0;
+ int j1 = 0;
+
+ MethodProfiler.a();
+ Iterator iterator = this.T.iterator();
while (iterator.hasNext()) {
ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next();
+ int k1 = chunkcoordintpair.x * 16;
- i = chunkcoordintpair.x * 16;
j = chunkcoordintpair.z * 16;
+ MethodProfiler.a("getChunk");
Chunk chunk = this.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z);
- chunk.h();
- int j1;
- int k1;
+ MethodProfiler.b("tickChunk");
+ chunk.i();
+ MethodProfiler.b("moodSound");
int l1;
+ int i2;
+ int j2;
+ int k2;
+ int l2;
- if (this.X == 0) {
+ if (this.U == 0) {
this.l = this.l * 3 + 1013904223;
- k = this.l >> 2;
- l = k & 15;
- j1 = k >> 8 & 15;
- k1 = k >> 16 & 127;
- l1 = chunk.getTypeId(l, k1, j1);
- l += i;
- j1 += j;
- if (l1 == 0 && this.k(l, k1, j1) <= this.random.nextInt(8) && this.a(EnumSkyBlock.SKY, l, k1, j1) <= 0) {
- EntityHuman entityhuman1 = this.a((double) l + 0.5D, (double) k1 + 0.5D, (double) j1 + 0.5D, 8.0D);
-
- if (entityhuman1 != null && entityhuman1.e((double) l + 0.5D, (double) k1 + 0.5D, (double) j1 + 0.5D) > 4.0D) {
- this.makeSound((double) l + 0.5D, (double) k1 + 0.5D, (double) j1 + 0.5D, "ambient.cave.cave", 0.7F, 0.8F + this.random.nextFloat() * 0.2F);
- this.X = this.random.nextInt(12000) + 6000;
+ l1 = this.l >> 2;
+ i2 = l1 & 15;
+ j2 = l1 >> 8 & 15;
+ k2 = l1 >> 16 & this.heightMinusOne;
+ l2 = chunk.getTypeId(i2, k2, j2);
+ i2 += k1;
+ j2 += j;
+ if (l2 == 0 && this.k(i2, k2, j2) <= this.random.nextInt(8) && this.a(EnumSkyBlock.SKY, i2, k2, j2) <= 0) {
+ EntityHuman entityhuman1 = this.a((double) i2 + 0.5D, (double) k2 + 0.5D, (double) j2 + 0.5D, 8.0D);
+
+ if (entityhuman1 != null && entityhuman1.e((double) i2 + 0.5D, (double) k2 + 0.5D, (double) j2 + 0.5D) > 4.0D) {
+ this.makeSound((double) i2 + 0.5D, (double) k2 + 0.5D, (double) j2 + 0.5D, "ambient.cave.cave", 0.7F, 0.8F + this.random.nextFloat() * 0.2F);
+ this.U = this.random.nextInt(12000) + 6000;
}
}
}
- if (this.random.nextInt(100000) == 0 && this.u() && this.t()) {
+ MethodProfiler.b("thunder");
+ if (this.random.nextInt(100000) == 0 && this.w() && this.v()) {
this.l = this.l * 3 + 1013904223;
- k = this.l >> 2;
- l = i + (k & 15);
- j1 = j + (k >> 8 & 15);
- k1 = this.e(l, j1);
- if (this.s(l, k1, j1)) {
- this.strikeLightning(new EntityWeatherStorm(this, (double) l, (double) k1, (double) j1));
+ l1 = this.l >> 2;
+ i2 = k1 + (l1 & 15);
+ j2 = j + (l1 >> 8 & 15);
+ k2 = this.e(i2, j2);
+ if (this.v(i2, k2, j2)) {
+ this.strikeLightning(new EntityWeatherStorm(this, (double) i2, (double) k2, (double) j2));
this.r = 2;
}
}
- int i2;
+ MethodProfiler.b("iceandsnow");
+ this.l = this.l * 3 + 1013904223;
+ l1 = this.l >> 2;
+ i2 = l1 & 15;
+ j2 = l1 >> 8 & 15;
+ k2 = this.e(i2 + k1, j2 + j);
+ if (this.q(i2 + k1, k2 - 1, j2 + j)) {
+ // CraftBukkit start
+ BlockState blockState = this.getWorld().getBlockAt(i2 + k1, k2 - 1, j2 + j).getState();
+ blockState.setTypeId(Block.ICE.id);
+
+ BlockFormEvent iceBlockForm = new BlockFormEvent(blockState.getBlock(), blockState);
+ this.getServer().getPluginManager().callEvent(iceBlockForm);
+ if (!iceBlockForm.isCancelled()) {
+ blockState.update(true);
+ }
+ // CraftBukkit end
+ }
+
+ if (this.w() && this.r(i2 + k1, k2, j2 + j)) {
+ // CraftBukkit start
+ BlockState blockState = this.getWorld().getBlockAt(i2 + k1, k2, j2 + j).getState();
+ blockState.setTypeId(Block.SNOW.id);
- if (this.random.nextInt(16) == 0) {
+ BlockFormEvent snow = new BlockFormEvent(blockState.getBlock(), blockState);
+ this.getServer().getPluginManager().callEvent(snow);
+ if (!snow.isCancelled()) {
+ blockState.update(true);
+ }
+ // CraftBukkit end
+ }
+
+ MethodProfiler.b("checkLight");
+ this.s(k1 + this.random.nextInt(16), this.random.nextInt(this.height), j + this.random.nextInt(16));
+ MethodProfiler.b("tickTiles");
+
+ for (l1 = 0; l1 < 20; ++l1) {
this.l = this.l * 3 + 1013904223;
- k = this.l >> 2;
- l = k & 15;
- j1 = k >> 8 & 15;
- k1 = this.e(l + i, j1 + j);
- if (this.getWorldChunkManager().getBiome(l + i, j1 + j).b() && k1 >= 0 && k1 < 128 && chunk.a(EnumSkyBlock.BLOCK, l, k1, j1) < 10) {
- l1 = chunk.getTypeId(l, k1 - 1, j1);
- i2 = chunk.getTypeId(l, k1, j1);
- if (this.u() && i2 == 0 && Block.SNOW.canPlace(this, l + i, k1, j1 + j) && l1 != 0 && l1 != Block.ICE.id && Block.byId[l1].material.isSolid()) {
- // CraftBukkit start
- BlockState blockState = this.getWorld().getBlockAt(l + i, k1, j1 + j).getState();
- blockState.setTypeId(Block.SNOW.id);
-
- BlockFormEvent snow = new BlockFormEvent(blockState.getBlock(), blockState);
- this.getServer().getPluginManager().callEvent(snow);
- if (!snow.isCancelled()) {
- blockState.update(true);
- }
- // CraftBukkit end
- }
+ i2 = this.l >> 2;
+ j2 = i2 & 15;
+ k2 = i2 >> 8 & 15;
+ l2 = i2 >> 16 & this.heightMinusOne;
+ int i3 = chunk.b[j2 << this.heightBitsPlusFour | k2 << this.heightBits | l2] & 255;
+
+ ++j1;
+ if (Block.n[i3]) {
+ ++i;
+ Block.byId[i3].a(this, j2 + k1, l2, k2 + j, this.random);
+ }
+ }
+
+ MethodProfiler.a();
+ }
+ }
- if (l1 == Block.STATIONARY_WATER.id && chunk.getData(l, k1 - 1, j1) == 0) {
- boolean flag = true;
+ public boolean p(int i, int j, int k) {
+ return this.c(i, j, k, false);
+ }
- if (flag && this.getMaterial(l + i - 1, k1 - 1, j1 + j) != Material.WATER) {
- flag = false;
- }
+ public boolean q(int i, int j, int k) {
+ return this.c(i, j, k, true);
+ }
- if (flag && this.getMaterial(l + i + 1, k1 - 1, j1 + j) != Material.WATER) {
- flag = false;
- }
+ public boolean c(int i, int j, int k, boolean flag) {
+ float f = this.getWorldChunkManager().a(i, j, k);
- if (flag && this.getMaterial(l + i, k1 - 1, j1 + j - 1) != Material.WATER) {
- flag = false;
- }
+ if (f > 0.15F) {
+ return false;
+ } else {
+ if (j >= 0 && j < this.height && this.a(EnumSkyBlock.BLOCK, i, j, k) < 10) {
+ int l = this.getTypeId(i, j, k);
- if (flag && this.getMaterial(l + i, k1 - 1, j1 + j + 1) != Material.WATER) {
- flag = false;
- }
+ if ((l == Block.STATIONARY_WATER.id || l == Block.WATER.id) && this.getData(i, j, k) == 0) {
+ if (!flag) {
+ return true;
+ }
- if (!flag) {
- // CraftBukkit start
- BlockState blockState = this.getWorld().getBlockAt(l + i, k1 - 1, j1 + j).getState();
- blockState.setTypeId(Block.ICE.id);
+ boolean flag1 = true;
- BlockFormEvent iceBlockForm = new BlockFormEvent(blockState.getBlock(), blockState);
- this.getServer().getPluginManager().callEvent(iceBlockForm);
- if (!iceBlockForm.isCancelled()) {
- blockState.update(true);
- }
- // CraftBukkit end
- }
+ if (flag1 && this.getMaterial(i - 1, j, k) != Material.WATER) {
+ flag1 = false;
+ }
+
+ if (flag1 && this.getMaterial(i + 1, j, k) != Material.WATER) {
+ flag1 = false;
+ }
+
+ if (flag1 && this.getMaterial(i, j, k - 1) != Material.WATER) {
+ flag1 = false;
+ }
+
+ if (flag1 && this.getMaterial(i, j, k + 1) != Material.WATER) {
+ flag1 = false;
+ }
+
+ if (!flag1) {
+ return true;
}
}
}
- this.p(i + this.random.nextInt(16), this.random.nextInt(128), j + this.random.nextInt(16));
+ return false;
+ }
+ }
+
+ public boolean r(int i, int j, int k) {
+ float f = this.getWorldChunkManager().a(i, j, k);
- for (k = 0; k < 80; ++k) {
- this.l = this.l * 3 + 1013904223;
- l = this.l >> 2;
- j1 = l & 15;
- k1 = l >> 8 & 15;
- l1 = l >> 16 & 127;
- i2 = chunk.b[j1 << 11 | k1 << 7 | l1] & 255;
- if (Block.n[i2]) {
- Block.byId[i2].a(this, j1 + i, l1, k1 + j, this.random);
+ if (f > 0.15F) {
+ return false;
+ } else {
+ if (j >= 0 && j < this.height && this.a(EnumSkyBlock.BLOCK, i, j, k) < 10) {
+ int l = this.getTypeId(i, j - 1, k);
+ int i1 = this.getTypeId(i, j, k);
+
+ if (i1 == 0 && Block.SNOW.canPlace(this, i, j, k) && l != 0 && l != Block.ICE.id && Block.byId[l].material.isSolid()) {
+ return true;
}
}
+
+ return false;
}
}
- public void p(int i, int j, int k) {
- this.b(EnumSkyBlock.SKY, i, j, k);
+ public void s(int i, int j, int k) {
+ if (!this.worldProvider.e) {
+ this.b(EnumSkyBlock.SKY, i, j, k);
+ }
+
this.b(EnumSkyBlock.BLOCK, i, j, k);
}
@@ -2008,7 +2175,6 @@ public class World implements IBlockAccess {
l2 = this.a(enumskyblock, k1, l1, i2);
if (l2 == k2) {
this.a(enumskyblock, k1, l1, i2, 0);
- --k2;
if (k2 > 0) {
i3 = k1 - i;
k3 = l1 - j;
@@ -2033,8 +2199,14 @@ public class World implements IBlockAccess {
int l4 = i2 + (l3 / 2 + 2) % 3 / 2 * i4;
l2 = this.a(enumskyblock, j4, k4, l4);
- if (l2 == k2) {
- this.H[i1++] = j4 - i + 32 + (k4 - j + 32 << 6) + (l4 - k + 32 << 12) + (k2 << 18);
+ int i5 = Block.q[this.getTypeId(j4, k4, l4)];
+
+ if (i5 == 0) {
+ i5 = 1;
+ }
+
+ if (l2 == k2 - i5) {
+ this.H[i1++] = j4 - i + 32 + (k4 - j + 32 << 6) + (l4 - k + 32 << 12) + (k2 - i5 << 18);
}
}
}
@@ -2047,12 +2219,12 @@ public class World implements IBlockAccess {
while (l < i1) {
j1 = this.H[l++];
- int i5 = (j1 & 63) - 32 + i;
+ int j5 = (j1 & 63) - 32 + i;
j2 = (j1 >> 6 & 63) - 32 + j;
k1 = (j1 >> 12 & 63) - 32 + k;
- l1 = this.a(enumskyblock, i5, j2, k1);
- i2 = this.getTypeId(i5, j2, k1);
+ l1 = this.a(enumskyblock, j5, j2, k1);
+ i2 = this.getTypeId(j5, j2, k1);
k2 = Block.q[i2];
if (k2 == 0) {
k2 = 1;
@@ -2061,15 +2233,15 @@ public class World implements IBlockAccess {
boolean flag2 = false;
if (enumskyblock == EnumSkyBlock.SKY) {
- l2 = this.d(l1, i5, j2, k1, i2, k2);
+ l2 = this.d(l1, j5, j2, k1, i2, k2);
} else {
- l2 = this.e(l1, i5, j2, k1, i2, k2);
+ l2 = this.e(l1, j5, j2, k1, i2, k2);
}
if (l2 != l1) {
- this.a(enumskyblock, i5, j2, k1, l2);
+ this.a(enumskyblock, j5, j2, k1, l2);
if (l2 > l1) {
- i3 = i5 - i;
+ i3 = j5 - i;
k3 = j2 - j;
j3 = k1 - k;
if (i3 < 0) {
@@ -2085,28 +2257,28 @@ public class World implements IBlockAccess {
}
if (i3 + k3 + j3 < 17 && i1 < this.H.length - 6) {
- if (this.a(enumskyblock, i5 - 1, j2, k1) < l2) {
- this.H[i1++] = i5 - 1 - i + 32 + (j2 - j + 32 << 6) + (k1 - k + 32 << 12);
+ if (this.a(enumskyblock, j5 - 1, j2, k1) < l2) {
+ this.H[i1++] = j5 - 1 - i + 32 + (j2 - j + 32 << 6) + (k1 - k + 32 << 12);
}
- if (this.a(enumskyblock, i5 + 1, j2, k1) < l2) {
- this.H[i1++] = i5 + 1 - i + 32 + (j2 - j + 32 << 6) + (k1 - k + 32 << 12);
+ if (this.a(enumskyblock, j5 + 1, j2, k1) < l2) {
+ this.H[i1++] = j5 + 1 - i + 32 + (j2 - j + 32 << 6) + (k1 - k + 32 << 12);
}
- if (this.a(enumskyblock, i5, j2 - 1, k1) < l2) {
- this.H[i1++] = i5 - i + 32 + (j2 - 1 - j + 32 << 6) + (k1 - k + 32 << 12);
+ if (this.a(enumskyblock, j5, j2 - 1, k1) < l2) {
+ this.H[i1++] = j5 - i + 32 + (j2 - 1 - j + 32 << 6) + (k1 - k + 32 << 12);
}
- if (this.a(enumskyblock, i5, j2 + 1, k1) < l2) {
- this.H[i1++] = i5 - i + 32 + (j2 + 1 - j + 32 << 6) + (k1 - k + 32 << 12);
+ if (this.a(enumskyblock, j5, j2 + 1, k1) < l2) {
+ this.H[i1++] = j5 - i + 32 + (j2 + 1 - j + 32 << 6) + (k1 - k + 32 << 12);
}
- if (this.a(enumskyblock, i5, j2, k1 - 1) < l2) {
- this.H[i1++] = i5 - i + 32 + (j2 - j + 32 << 6) + (k1 - 1 - k + 32 << 12);
+ if (this.a(enumskyblock, j5, j2, k1 - 1) < l2) {
+ this.H[i1++] = j5 - i + 32 + (j2 - j + 32 << 6) + (k1 - 1 - k + 32 << 12);
}
- if (this.a(enumskyblock, i5, j2, k1 + 1) < l2) {
- this.H[i1++] = i5 - i + 32 + (j2 - j + 32 << 6) + (k1 + 1 - k + 32 << 12);
+ if (this.a(enumskyblock, j5, j2, k1 + 1) < l2) {
+ this.H[i1++] = j5 - i + 32 + (j2 - j + 32 << 6) + (k1 + 1 - k + 32 << 12);
}
}
}
@@ -2116,9 +2288,9 @@ public class World implements IBlockAccess {
}
public boolean a(boolean flag) {
- int i = this.N.size();
+ int i = this.K.size();
- if (i != this.O.size()) {
+ if (i != this.L.size()) {
throw new IllegalStateException("TickNextTick list out of synch");
} else {
if (i > 1000) {
@@ -2126,14 +2298,14 @@ public class World implements IBlockAccess {
}
for (int j = 0; j < i; ++j) {
- NextTickListEntry nextticklistentry = (NextTickListEntry) this.N.first();
+ NextTickListEntry nextticklistentry = (NextTickListEntry) this.K.first();
if (!flag && nextticklistentry.e > this.worldData.f()) {
break;
}
- this.N.remove(nextticklistentry);
- this.O.remove(nextticklistentry);
+ this.K.remove(nextticklistentry);
+ this.L.remove(nextticklistentry);
byte b0 = 8;
if (this.a(nextticklistentry.a - b0, nextticklistentry.b - b0, nextticklistentry.c - b0, nextticklistentry.a + b0, nextticklistentry.b + b0, nextticklistentry.c + b0)) {
@@ -2145,12 +2317,41 @@ public class World implements IBlockAccess {
}
}
- return this.N.size() != 0;
+ return this.K.size() != 0;
}
}
+ public List a(Chunk chunk, boolean flag) {
+ ArrayList arraylist = null;
+ ChunkCoordIntPair chunkcoordintpair = chunk.j();
+ int i = chunkcoordintpair.x << 4;
+ int j = i + 16;
+ int k = chunkcoordintpair.z << 4;
+ int l = k + 16;
+ Iterator iterator = this.L.iterator();
+
+ while (iterator.hasNext()) {
+ NextTickListEntry nextticklistentry = (NextTickListEntry) iterator.next();
+
+ if (nextticklistentry.a >= i && nextticklistentry.a < j && nextticklistentry.c >= k && nextticklistentry.c < l) {
+ if (flag) {
+ this.K.remove(nextticklistentry);
+ iterator.remove();
+ }
+
+ if (arraylist == null) {
+ arraylist = new ArrayList();
+ }
+
+ arraylist.add(nextticklistentry);
+ }
+ }
+
+ return arraylist;
+ }
+
public List b(Entity entity, AxisAlignedBB axisalignedbb) {
- this.Y.clear();
+ this.V.clear();
int i = MathHelper.floor((axisalignedbb.a - 2.0D) / 16.0D);
int j = MathHelper.floor((axisalignedbb.d + 2.0D) / 16.0D);
int k = MathHelper.floor((axisalignedbb.c - 2.0D) / 16.0D);
@@ -2159,12 +2360,12 @@ public class World implements IBlockAccess {
for (int i1 = i; i1 <= j; ++i1) {
for (int j1 = k; j1 <= l; ++j1) {
if (this.isChunkLoaded(i1, j1)) {
- this.getChunkAt(i1, j1).a(entity, axisalignedbb, this.Y);
+ this.getChunkAt(i1, j1).a(entity, axisalignedbb, this.V);
}
}
}
- return this.Y;
+ return this.V;
}
public List a(Class oclass, AxisAlignedBB axisalignedbb) {
@@ -2226,7 +2427,7 @@ public class World implements IBlockAccess {
}
public void b(List list) {
- this.M.addAll(list);
+ this.J.addAll(list);
}
public boolean a(int i, int j, int k, int l, boolean flag, int i1) {
@@ -2260,6 +2461,7 @@ public class World implements IBlockAccess {
}
public PathEntity findPath(Entity entity, Entity entity1, float f) {
+ MethodProfiler.a("pathfind");
int i = MathHelper.floor(entity.locX);
int j = MathHelper.floor(entity.locY);
int k = MathHelper.floor(entity.locZ);
@@ -2271,11 +2473,14 @@ public class World implements IBlockAccess {
int i2 = j + l;
int j2 = k + l;
ChunkCache chunkcache = new ChunkCache(this, i1, j1, k1, l1, i2, j2);
+ PathEntity pathentity = (new Pathfinder(chunkcache)).a(entity, entity1, f);
- return (new Pathfinder(chunkcache)).a(entity, entity1, f);
+ MethodProfiler.a();
+ return pathentity;
}
public PathEntity a(Entity entity, int i, int j, int k, float f) {
+ MethodProfiler.a("pathfind");
int l = MathHelper.floor(entity.locX);
int i1 = MathHelper.floor(entity.locY);
int j1 = MathHelper.floor(entity.locZ);
@@ -2287,8 +2492,10 @@ public class World implements IBlockAccess {
int l2 = i1 + k1;
int i3 = j1 + k1;
ChunkCache chunkcache = new ChunkCache(this, l1, i2, j2, k2, l2, i3);
+ PathEntity pathentity = (new Pathfinder(chunkcache)).a(entity, i, j, k, f);
- return (new Pathfinder(chunkcache)).a(entity, i, j, k, f);
+ MethodProfiler.a();
+ return pathentity;
}
public boolean isBlockFacePowered(int i, int j, int k, int l) {
@@ -2341,6 +2548,30 @@ public class World implements IBlockAccess {
return entityhuman;
}
+ public EntityHuman b(Entity entity, double d0) {
+ return this.b(entity.locX, entity.locY, entity.locZ, d0);
+ }
+
+ public EntityHuman b(double d0, double d1, double d2, double d3) {
+ double d4 = -1.0D;
+ EntityHuman entityhuman = null;
+
+ for (int i = 0; i < this.players.size(); ++i) {
+ EntityHuman entityhuman1 = (EntityHuman) this.players.get(i);
+
+ if (!entityhuman1.abilities.isInvulnerable) {
+ double d5 = entityhuman1.e(d0, d1, d2);
+
+ if ((d3 < 0.0D || d5 < d3 * d3) && (d4 == -1.0D || d5 < d4)) {
+ d4 = d5;
+ entityhuman = entityhuman1;
+ }
+ }
+ }
+
+ return entityhuman;
+ }
+
public EntityHuman a(String s) {
for (int i = 0; i < this.players.size(); ++i) {
if (s.equals(((EntityHuman) this.players.get(i)).name)) {
@@ -2365,8 +2596,8 @@ public class World implements IBlockAccess {
l2 = 0;
}
- if (i3 > 128) {
- i3 = 128;
+ if (i3 > this.height) {
+ i3 = this.height;
}
for (int j3 = k1; j3 <= i2; ++j3) {
@@ -2400,7 +2631,7 @@ public class World implements IBlockAccess {
return abyte;
}
- public void j() {
+ public void l() {
this.B.b();
}
@@ -2413,7 +2644,7 @@ public class World implements IBlockAccess {
NextTickListEntry nextticklistentry;
- for (Iterator iterator = this.O.iterator(); iterator.hasNext(); nextticklistentry.e += j) {
+ for (Iterator iterator = this.L.iterator(); iterator.hasNext(); nextticklistentry.e += j) {
nextticklistentry = (NextTickListEntry) iterator.next();
}
@@ -2438,7 +2669,7 @@ public class World implements IBlockAccess {
public void a(Entity entity, byte b0) {}
- public IChunkProvider n() {
+ public IChunkProvider p() {
return this.chunkProvider;
}
@@ -2450,16 +2681,16 @@ public class World implements IBlockAccess {
}
}
- public IDataManager o() {
+ public IDataManager q() {
return this.B;
}
- public WorldData p() {
+ public WorldData r() {
return this.worldData;
}
public void everyoneSleeping() {
- this.T = !this.players.isEmpty();
+ this.Q = !this.players.isEmpty();
Iterator iterator = this.players.iterator();
while (iterator.hasNext()) {
@@ -2467,7 +2698,7 @@ public class World implements IBlockAccess {
// CraftBukkit
if (!entityhuman.isSleeping() && !entityhuman.fauxSleeping) {
- this.T = false;
+ this.Q = false;
break;
}
}
@@ -2483,8 +2714,8 @@ public class World implements IBlockAccess {
}
// CraftBukkit end
- protected void r() {
- this.T = false;
+ protected void t() {
+ this.Q = false;
Iterator iterator = this.players.iterator();
while (iterator.hasNext()) {
@@ -2495,11 +2726,11 @@ public class World implements IBlockAccess {
}
}
- this.y();
+ this.A();
}
public boolean everyoneDeeplySleeping() {
- if (this.T && !this.isStatic) {
+ if (this.Q && !this.isStatic) {
Iterator iterator = this.players.iterator();
// CraftBukkit - This allows us to assume that some people are in bed but not really, allowing time to pass in spite of AFKers
@@ -2535,16 +2766,16 @@ public class World implements IBlockAccess {
return this.n + (this.o - this.n) * f;
}
- public boolean t() {
+ public boolean v() {
return (double) this.c(1.0F) > 0.9D;
}
- public boolean u() {
+ public boolean w() {
return (double) this.d(1.0F) > 0.2D;
}
- public boolean s(int i, int j, int k) {
- if (!this.u()) {
+ public boolean v(int i, int j, int k) {
+ if (!this.w()) {
return false;
} else if (!this.isChunkLoaded(i, j, k)) {
return false;
@@ -2569,7 +2800,7 @@ public class World implements IBlockAccess {
return this.worldMaps.a(s);
}
- public void e(int i, int j, int k, int l, int i1) {
+ public void f(int i, int j, int k, int l, int i1) {
this.a((EntityHuman) null, i, j, k, l, i1);
}
@@ -2579,19 +2810,29 @@ public class World implements IBlockAccess {
}
}
- public Random t(int i, int j, int k) {
- long l = (long) i * 341873128712L + (long) j * 132897987541L + this.p().getSeed() + (long) k;
+ public Random w(int i, int j, int k) {
+ long l = (long) i * 341873128712L + (long) j * 132897987541L + this.r().getSeed() + (long) k;
this.random.setSeed(l);
return this.random;
}
- public boolean v() {
+ public boolean x() {
return false;
}
public void a(EnumSkyBlock enumskyblock, int i, int j, int k, int l, int i1, int j1) {}
+ public BiomeMeta a(EnumCreatureType enumcreaturetype, int i, int j, int k) {
+ List list = this.p().a(enumcreaturetype, i, j, k);
+
+ return list != null && !list.isEmpty() ? (BiomeMeta) WeightedRandom.a(this.random, (Collection) list) : null;
+ }
+
+ public ChunkPosition b(String s, int i, int j, int k) {
+ return this.p().a(this, s, i, j, k);
+ }
+
// CraftBukkit start
public UUID getUUID() {
return this.B.getUUID();