Update for 1.4_00_01 -- if you bypassed Bukkit, you will most likely break.

By: Erik Broes <erikbroes@grum.nl>
This commit is contained in:
CraftBukkit/Spigot
2011-04-20 19:05:14 +02:00
parent 91e69e54b4
commit 070c214267
28 changed files with 255 additions and 288 deletions

View File

@@ -20,12 +20,12 @@ public class CraftChunk implements Chunk {
private WorldServer worldServer;
private int x;
private int z;
public CraftChunk(net.minecraft.server.Chunk chunk) {
this.weakChunk = new WeakReference<net.minecraft.server.Chunk>(chunk);
worldServer = (WorldServer) getHandle().d;
x = getHandle().j;
z = getHandle().k;
worldServer = (WorldServer) getHandle().world;
x = getHandle().x;
z = getHandle().z;
}
public World getWorld() {
@@ -35,7 +35,7 @@ public class CraftChunk implements Chunk {
public net.minecraft.server.Chunk getHandle() {
net.minecraft.server.Chunk c = weakChunk.get();
if (c == null) {
c = worldServer.c(x,z);
c = worldServer.getChunkAt(x,z);
weakChunk = new WeakReference<net.minecraft.server.Chunk>(c);
}
return c;
@@ -77,12 +77,12 @@ public class CraftChunk implements Chunk {
int count = 0, index = 0;
net.minecraft.server.Chunk chunk = getHandle();
for (int i = 0; i < 8; i++) {
count += chunk.m[i].size();
count += chunk.entitySlices[i].size();
}
Entity[] entities = new Entity[count];
for (int i = 0; i < 8; i++) {
for (Object obj: chunk.m[i].toArray()) {
for (Object obj: chunk.entitySlices[i].toArray()) {
if (!(obj instanceof net.minecraft.server.Entity)) continue;
entities[index++] = ((net.minecraft.server.Entity) obj).getBukkitEntity();
}
@@ -93,11 +93,11 @@ public class CraftChunk implements Chunk {
public BlockState[] getTileEntities() {
int index = 0;
net.minecraft.server.Chunk chunk = getHandle();
BlockState[] entities = new BlockState[chunk.l.size()];
for (Object obj : chunk.l.keySet().toArray()) {
if (!(obj instanceof ChunkPosition)) continue;
BlockState[] entities = new BlockState[chunk.tileEntities.size()];
for (Object obj : chunk.tileEntities.keySet().toArray()) {
if (!(obj instanceof ChunkPosition)) continue;
ChunkPosition position = (ChunkPosition) obj;
entities[index++] = worldServer.getWorld().getBlockAt(position.a + (chunk.j << 4), position.b, position.c + (chunk.k << 4)).getState();
entities[index++] = worldServer.getWorld().getBlockAt(position.x + (chunk.x << 4), position.y, position.z + (chunk.z << 4)).getState();
}
return entities;
}