Code cleanup, fixed doors, chunk entity fetching

Dieser Commit ist enthalten in:
Tahg 2011-03-11 16:25:35 -05:00
Ursprung 786fdfb9fe
Commit 078f48c0fb
17 geänderte Dateien mit 61 neuen und 52 gelöschten Zeilen

Datei anzeigen

@ -175,10 +175,13 @@ public class BlockDoor extends Block {
CraftWorld craftWorld = ((WorldServer) world).getWorld();
CraftServer server = ((WorldServer) world).getServer();
org.bukkit.block.Block block = craftWorld.getBlockAt(i, j, k);
org.bukkit.block.Block blockTop = craftWorld.getBlockAt(i, j + 1, k);
int power = block.getBlockPower();
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, (world.getData(i, j, k) & 4) > 0 ? 15: 0, flag1 ? 15 : 0);
int powerTop = blockTop.getBlockPower();
if (powerTop > power) power = powerTop;
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, (world.getData(i, j, k) & 4) > 0 ? 15: 0, power);
server.getPluginManager().callEvent(eventRedstone);
this.a(world, i, j, k, eventRedstone.getNewCurrent());
this.a(world, i, j, k, eventRedstone.getNewCurrent() > 0);
// Craftbukkit end
}
}

Datei anzeigen

@ -280,7 +280,9 @@ public class BlockRedstoneWire extends Block {
if (!flag) {
this.b_(world, i, j, k, i1);
world.e(i, j, k, 0);
} else if((Block.byId[l] != null && Block.byId[l].c()) || Block.DIODE_OFF.id == l && Block.DIODE_ON.id == l) { //condition added by Craftbukkit
} else
// Craftbukkit
if ((Block.byId[l] != null && Block.byId[l].c()) || Block.DIODE_OFF.id == l && Block.DIODE_ON.id == l) {
this.g(world, i, j, k);
}

Datei anzeigen

@ -73,7 +73,9 @@ public class CraftChunk implements Chunk {
}
Entity[] entities = new Entity[count];
for (int i = 0; i < 8; i++) {
for (net.minecraft.server.Entity entity : (net.minecraft.server.Entity[])chunk.m[i].toArray()) {
for (Object obj : (net.minecraft.server.Entity[])chunk.m[i].toArray()) {
if (!(obj instanceof net.minecraft.server.Entity)) continue;
net.minecraft.server.Entity entity = (net.minecraft.server.Entity) obj;
entities[index++] = entity.getBukkitEntity();
}
}
@ -84,7 +86,9 @@ public class CraftChunk implements Chunk {
int index = 0;
net.minecraft.server.Chunk chunk = getHandle();
BlockState[] entities = new BlockState[chunk.l.size()];
for (ChunkPosition position : (ChunkPosition[])chunk.l.keySet().toArray()) {
for (Object obj : chunk.l.keySet().toArray()) {
if (!(obj instanceof ChunkPosition)) continue;
ChunkPosition position = (ChunkPosition) obj;
entities[index++] = worldServer.getWorld().getBlockAt(position.a, position.b, position.c).getState();
}
return entities;