Implemented 1.6!

This commit is contained in:
Dinnerbone
2011-05-26 13:48:22 +01:00
parent f463453d73
commit 6903f20242
76 changed files with 2699 additions and 2266 deletions

View File

@@ -28,9 +28,7 @@ class PlayerInstance {
this.chunkX = i;
this.chunkZ = j;
this.e = new ChunkCoordIntPair(i, j);
// CraftBukkit
playermanager.world.chunkProviderServer.getChunkAt(i, j);
playermanager.a().chunkProviderServer.getChunkAt(i, j);
}
public void a(EntityPlayer entityplayer) {
@@ -51,23 +49,22 @@ class PlayerInstance {
public void b(EntityPlayer entityplayer) {
if (!this.b.contains(entityplayer)) {
// CraftBukkit - reduce console spam under certain conditions
// (new IllegalStateException("Failed to remove player. " + entityplayer + " isn\'t in chunk " + this.chunkX + ", " + this.chunkZ)).printStackTrace();
// (new IllegalStateException("Failed to remove player. " + entityplayer + " isn\'t in chunk " + this.bF + ", " + this.bH)).printStackTrace();
} else {
this.b.remove(entityplayer);
if (this.b.size() == 0) {
long i = (long) this.chunkX + 2147483647L | (long) this.chunkZ + 2147483647L << 32;
PlayerManager.b(this.playerManager).b(i);
PlayerManager.a(this.playerManager).b(i);
if (this.dirtyCount > 0) {
PlayerManager.c(this.playerManager).remove(this);
PlayerManager.b(this.playerManager).remove(this);
}
// CraftBukkit
((WorldServer) entityplayer.world).chunkProviderServer.queueUnload(this.chunkX, this.chunkZ);
this.playerManager.a().chunkProviderServer.queueUnload(this.chunkX, this.chunkZ);
}
entityplayer.f.remove(this.e);
// CraftBukkit - contains -> remove
// CraftBukkit - contains -> remove -- TODO VERIFY!!!!
if (entityplayer.g.remove(this.e)) {
entityplayer.netServerHandler.sendPacket(new Packet50PreChunk(this.chunkX, this.chunkZ, false));
}
@@ -76,7 +73,7 @@ class PlayerInstance {
public void a(int i, int j, int k) {
if (this.dirtyCount == 0) {
PlayerManager.c(this.playerManager).add(this);
PlayerManager.b(this.playerManager).add(this);
this.h = this.i = i;
this.j = this.k = j;
this.l = this.m = k;
@@ -130,6 +127,8 @@ class PlayerInstance {
}
public void a() {
WorldServer worldserver = this.playerManager.a();
if (this.dirtyCount != 0) {
int i;
int j;
@@ -139,13 +138,10 @@ class PlayerInstance {
i = this.chunkX * 16 + this.h;
j = this.j;
k = this.chunkZ * 16 + this.l;
// CraftBukkit start
this.sendAll(new Packet53BlockChange(i, j, k, this.playerManager.world));
if (Block.isTileEntity[this.playerManager.world.getTypeId(i, j, k)]) {
this.sendTileEntity(this.playerManager.world.getTileEntity(i, j, k));
this.sendAll(new Packet53BlockChange(i, j, k, worldserver));
if (Block.isTileEntity[worldserver.getTypeId(i, j, k)]) {
this.sendTileEntity(worldserver.getTileEntity(i, j, k));
}
// CraftBukkit end
} else {
int l;
@@ -159,17 +155,14 @@ class PlayerInstance {
int i1 = this.k - this.j + 2;
int j1 = this.m - this.l + 1;
// CraftBukkit start
this.sendAll(new Packet51MapChunk(i, j, k, l, i1, j1, this.playerManager.world));
List list = this.playerManager.world.getTileEntities(i, j, k, i + l, j + i1, k + j1);
// CraftBukkit end
this.sendAll(new Packet51MapChunk(i, j, k, l, i1, j1, worldserver));
List list = worldserver.getTileEntities(i, j, k, i + l, j + i1, k + j1);
for (int k1 = 0; k1 < list.size(); ++k1) {
this.sendTileEntity((TileEntity) list.get(k1));
}
} else {
// CraftBukkit
this.sendAll(new Packet52MultiBlockChange(this.chunkX, this.chunkZ, this.dirtyBlocks, this.dirtyCount, this.playerManager.world));
this.sendAll(new Packet52MultiBlockChange(this.chunkX, this.chunkZ, this.dirtyBlocks, this.dirtyCount, worldserver));
for (i = 0; i < this.dirtyCount; ++i) {
// CraftBukkit start - Fixes TileEntity updates occurring upon a multi-block change; dirtyCount -> dirtyBlocks[i]
@@ -178,12 +171,10 @@ class PlayerInstance {
l = this.chunkZ * 16 + (this.dirtyBlocks[i] >> 8 & 15);
// CraftBukkit end
// CraftBukkit start
if (Block.isTileEntity[this.playerManager.world.getTypeId(j, k, l)]) {
if (Block.isTileEntity[worldserver.getTypeId(j, k, l)]) {
// System.out.println("Sending!"); // CraftBukkit
this.sendTileEntity(this.playerManager.world.getTileEntity(j, k, l));
this.sendTileEntity(worldserver.getTileEntity(j, k, l));
}
// CraftBukkit end
}
}
}