Updated to Minecraft 1.1

This commit is contained in:
Erik Broes
2012-01-12 23:10:13 +01:00
parent dd5ef8725c
commit 7219d4dd85
82 changed files with 1472 additions and 1687 deletions

View File

@@ -83,7 +83,7 @@ public class World implements IBlockAccess {
public boolean isStatic;
public WorldChunkManager getWorldChunkManager() {
return this.worldProvider.b;
return this.worldProvider.c;
}
// CraftBukkit start
@@ -192,53 +192,57 @@ public class World implements IBlockAccess {
}
protected void c() {
this.isLoading = true;
WorldChunkManager worldchunkmanager = this.getWorldChunkManager();
List list = worldchunkmanager.a();
Random random = new Random(this.getSeed());
ChunkPosition chunkposition = worldchunkmanager.a(0, 0, 256, list, random);
int i = 0;
int j = this.height / 2;
int k = 0;
if (!this.worldProvider.c()) {
this.worldData.setSpawn(0, this.worldProvider.getSeaLevel(), 0);
} else {
this.isLoading = true;
WorldChunkManager worldchunkmanager = this.getWorldChunkManager();
List list = worldchunkmanager.a();
Random random = new Random(this.getSeed());
ChunkPosition chunkposition = worldchunkmanager.a(0, 0, 256, list, random);
int i = 0;
int j = this.worldProvider.getSeaLevel();
int k = 0;
// CraftBukkit start
if (this.generator != null) {
Random rand = new Random(this.getSeed());
Location spawn = this.generator.getFixedSpawnLocation(((WorldServer) this).getWorld(), rand);
// CraftBukkit start
if (this.generator != null) {
Random rand = new Random(this.getSeed());
Location spawn = this.generator.getFixedSpawnLocation(((WorldServer) this).getWorld(), rand);
if (spawn != null) {
if (spawn.getWorld() != ((WorldServer) this).getWorld()) {
throw new IllegalStateException("Cannot set spawn point for " + this.worldData.name + " to be in another world (" + spawn.getWorld().getName() + ")");
} else {
this.worldData.setSpawn(spawn.getBlockX(), spawn.getBlockY(), spawn.getBlockZ());
this.isLoading = false;
return;
if (spawn != null) {
if (spawn.getWorld() != ((WorldServer) this).getWorld()) {
throw new IllegalStateException("Cannot set spawn point for " + this.worldData.name + " to be in another world (" + spawn.getWorld().getName() + ")");
} else {
this.worldData.setSpawn(spawn.getBlockX(), spawn.getBlockY(), spawn.getBlockZ());
this.isLoading = false;
return;
}
}
}
}
// CraftBukkit end
// CraftBukkit end
if (chunkposition != null) {
i = chunkposition.x;
k = chunkposition.z;
} else {
System.out.println("Unable to find spawn biome");
}
int l = 0;
// CraftBukkit - use out own canSpawn
while (!this.canSpawn(i, k)) {
i += random.nextInt(64) - random.nextInt(64);
k += random.nextInt(64) - random.nextInt(64);
++l;
if (l == 1000) {
break;
if (chunkposition != null) {
i = chunkposition.x;
k = chunkposition.z;
} else {
System.out.println("Unable to find spawn biome");
}
}
this.worldData.setSpawn(i, j, k);
this.isLoading = false;
int l = 0;
// CraftBukkit - use out own canSpawn
while (!this.canSpawn(i, k)) {
i += random.nextInt(64) - random.nextInt(64);
k += random.nextInt(64) - random.nextInt(64);
++l;
if (l == 1000) {
break;
}
}
this.worldData.setSpawn(i, j, k);
this.isLoading = false;
}
}
public ChunkCoordinates d() {
@@ -472,7 +476,7 @@ public class World implements IBlockAccess {
k = i1;
}
if (!this.worldProvider.e) {
if (!this.worldProvider.f) {
for (i1 = k; i1 <= l; ++i1) {
this.b(EnumSkyBlock.SKY, i, i1, j);
}
@@ -652,7 +656,7 @@ public class World implements IBlockAccess {
}
public float m(int i, int j, int k) {
return this.worldProvider.f[this.getLightLevel(i, j, k)];
return this.worldProvider.g[this.getLightLevel(i, j, k)];
}
public boolean e() {
@@ -945,10 +949,10 @@ public class World implements IBlockAccess {
this.everyoneSleeping();
}
int i = entity.bX;
int j = entity.bZ;
int i = entity.ca;
int j = entity.cc;
if (entity.bW && this.isChunkLoaded(i, j)) {
if (entity.bZ && this.isChunkLoaded(i, j)) {
this.getChunkAt(i, j).b(entity);
}
@@ -1099,7 +1103,7 @@ public class World implements IBlockAccess {
continue;
}
// CraftBukkit end
entity.w_();
entity.y_();
if (entity.dead) {
this.j.remove(i--);
}
@@ -1113,9 +1117,9 @@ public class World implements IBlockAccess {
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)) {
j = entity.ca;
k = entity.cc;
if (entity.bZ && this.isChunkLoaded(j, k)) {
this.getChunkAt(j, k).b(entity);
}
}
@@ -1144,9 +1148,9 @@ public class World implements IBlockAccess {
// MethodProfiler.a("remove"); // CraftBukkit - not in production code
if (entity.dead) {
j = entity.bX;
k = entity.bZ;
if (entity.bW && this.isChunkLoaded(j, k)) {
j = entity.ca;
k = entity.cc;
if (entity.bZ && this.isChunkLoaded(j, k)) {
this.getChunkAt(j, k).b(entity);
}
@@ -1241,30 +1245,30 @@ public class World implements IBlockAccess {
byte b0 = 32;
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.bL = entity.locX;
entity.bM = entity.locY;
entity.bN = entity.locZ;
entity.lastYaw = entity.yaw;
entity.lastPitch = entity.pitch;
if (flag && entity.bW) {
if (flag && entity.bZ) {
if (entity.vehicle != null) {
entity.M();
entity.N();
} else {
entity.w_();
entity.y_();
}
}
// MethodProfiler.a("chunkCheck"); // CraftBukkit - not in production code
if (Double.isNaN(entity.locX) || Double.isInfinite(entity.locX)) {
entity.locX = entity.bI;
entity.locX = entity.bL;
}
if (Double.isNaN(entity.locY) || Double.isInfinite(entity.locY)) {
entity.locY = entity.bJ;
entity.locY = entity.bM;
}
if (Double.isNaN(entity.locZ) || Double.isInfinite(entity.locZ)) {
entity.locZ = entity.bK;
entity.locZ = entity.bN;
}
if (Double.isNaN((double) entity.pitch) || Double.isInfinite((double) entity.pitch)) {
@@ -1279,21 +1283,21 @@ public class World implements IBlockAccess {
int l = MathHelper.floor(entity.locY / 16.0D);
int i1 = MathHelper.floor(entity.locZ / 16.0D);
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 (!entity.bZ || entity.ca != k || entity.cb != l || entity.cc != i1) {
if (entity.bZ && this.isChunkLoaded(entity.ca, entity.cc)) {
this.getChunkAt(entity.ca, entity.cc).a(entity, entity.cb);
}
if (this.isChunkLoaded(k, i1)) {
entity.bW = true;
entity.bZ = true;
this.getChunkAt(k, i1).a(entity);
} else {
entity.bW = false;
entity.bZ = false;
}
}
// MethodProfiler.a(); // CraftBukkit - not in production code
if (flag && entity.bW && entity.passenger != null) {
if (flag && entity.bZ && entity.passenger != null) {
if (!entity.passenger.dead && entity.passenger.vehicle == entity) {
this.playerJoinedWorld(entity.passenger);
} else {
@@ -1305,12 +1309,12 @@ public class World implements IBlockAccess {
}
public boolean containsEntity(AxisAlignedBB axisalignedbb) {
List list = this.getEntities(null, axisalignedbb);
List list = this.getEntities((Entity) null, axisalignedbb);
for (int i = 0; i < list.size(); ++i) {
Entity entity = (Entity) list.get(i);
if (!entity.dead && entity.bc) {
if (!entity.dead && entity.bf) {
return false;
}
}
@@ -1753,7 +1757,7 @@ public class World implements IBlockAccess {
}
protected void i() {
if (!this.worldProvider.e) {
if (!this.worldProvider.f) {
if (this.r > 0) {
--this.r;
}
@@ -1941,35 +1945,37 @@ public class World implements IBlockAccess {
}
// MethodProfiler.b("iceandsnow"); // CraftBukkit - not in production code
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);
if (this.random.nextInt(16) == 0) {
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);
BlockFormEvent iceBlockForm = new BlockFormEvent(blockState.getBlock(), blockState);
this.getServer().getPluginManager().callEvent(iceBlockForm);
if (!iceBlockForm.isCancelled()) {
blockState.update(true);
}
// CraftBukkit end
}
// 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.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);
BlockFormEvent snow = new BlockFormEvent(blockState.getBlock(), blockState);
this.getServer().getPluginManager().callEvent(snow);
if (!snow.isCancelled()) {
blockState.update(true);
BlockFormEvent snow = new BlockFormEvent(blockState.getBlock(), blockState);
this.getServer().getPluginManager().callEvent(snow);
if (!snow.isCancelled()) {
blockState.update(true);
}
// CraftBukkit end
}
// CraftBukkit end
}
// MethodProfiler.b("checkLight"); // CraftBukkit - not in production code
@@ -2065,7 +2071,7 @@ public class World implements IBlockAccess {
}
public void s(int i, int j, int k) {
if (!this.worldProvider.e) {
if (!this.worldProvider.f) {
this.b(EnumSkyBlock.SKY, i, j, k);
}