Code cleanup, fixed doors, chunk entity fetching

This commit is contained in:
Tahg
2011-03-11 16:25:35 -05:00
parent 786fdfb9fe
commit 078f48c0fb
17 changed files with 61 additions and 52 deletions

View File

@@ -10,9 +10,9 @@ public class BlockBloodStone extends Block {
super(i, j, Material.STONE);
}
//Craftbukkit start
// Craftbukkit start
public void a(World world, int i, int j, int k, int l) {
if(net.minecraft.server.Block.byId[l].c()) {
if (net.minecraft.server.Block.byId[l].c()) {
CraftWorld craftWorld = ((WorldServer) world).getWorld();
CraftServer server = ((WorldServer) world).getServer();
org.bukkit.block.Block block = craftWorld.getBlockAt(i, j, k);
@@ -21,5 +21,5 @@ public class BlockBloodStone extends Block {
server.getPluginManager().callEvent(eventRedstone);
}
}
//Craftbukkit end
// Craftbukkit end
}

View File

@@ -171,15 +171,18 @@ public class BlockDoor extends Block {
} else if (l > 0 && Block.byId[l].c()) {
boolean flag1 = world.p(i, j, k) || world.p(i, j + 1, k);
//Craftbukkit start
// Craftbukkit start
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());
//Craftbukkit end
this.a(world, i, j, k, eventRedstone.getNewCurrent() > 0);
// Craftbukkit end
}
}
}

View File

@@ -51,9 +51,9 @@ public class BlockPumpkin extends Block {
world.c(i, j, k, l);
}
//Craftbukkit start
// Craftbukkit start
public void a(World world, int i, int j, int k, int l) {
if(net.minecraft.server.Block.byId[l].c()) {
if (net.minecraft.server.Block.byId[l].c()) {
CraftWorld craftWorld = ((WorldServer) world).getWorld();
CraftServer server = ((WorldServer) world).getServer();
org.bukkit.block.Block block = craftWorld.getBlockAt(i, j, k);
@@ -62,5 +62,5 @@ public class BlockPumpkin extends Block {
server.getPluginManager().callEvent(eventRedstone);
}
}
//Craftbukkit end
// Craftbukkit end
}

View File

@@ -262,7 +262,7 @@ public class BlockRedstoneWire extends Block {
}
}
public int g(World world, int i, int j, int k, int l) { //Craftbukkit made public
public int g(World world, int i, int j, int k, int l) { // Craftbukkit made public
if (world.getTypeId(i, j, k) != this.id) {
return l;
} else {
@@ -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);
}

View File

@@ -105,8 +105,8 @@ public class BlockSign extends BlockContainer {
super.a(world, i, j, k, l);
//Craftbukkit start
if(net.minecraft.server.Block.byId[l].c()) {
// Craftbukkit start
if (net.minecraft.server.Block.byId[l].c()) {
CraftWorld craftWorld = ((WorldServer) world).getWorld();
CraftServer server = ((WorldServer) world).getServer();
Block block = craftWorld.getBlockAt(i, j, k);
@@ -114,6 +114,6 @@ public class BlockSign extends BlockContainer {
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, power, power);
server.getPluginManager().callEvent(eventRedstone);
}
//Craftbukkit end
// Craftbukkit end
}
}

View File

@@ -109,8 +109,8 @@ public class ChunkProviderServer implements IChunkProvider {
Chunk chunk = (Chunk) this.e.get(i, j); // CraftBukkit
chunk = chunk == null ? (this.g.r ? this.d(i, j) : this.b) : chunk;
if(chunk == this.b) return chunk;
if(i != chunk.j || j != chunk.k) {
if (chunk == this.b) return chunk;
if (i != chunk.j || j != chunk.k) {
MinecraftServer.a.info("Chunk (" + chunk.j + ", " + chunk.k +") stored at (" + i + ", " + j + ")");
MinecraftServer.a.info(chunk.getClass().getName());
Throwable x = new Throwable();

View File

@@ -71,10 +71,10 @@ public class EntityTrackerEntry {
boolean flag = Math.abs(i) >= 8 || Math.abs(j) >= 8 || Math.abs(k) >= 8;
boolean flag1 = Math.abs(l - this.g) >= 8 || Math.abs(i1 - this.h) >= 8;
//CraftBukkit - Create relative movement packet only if distance is greater than zero.
// CraftBukkit - Create relative movement packet only if distance is greater than zero.
int distanceSquared = j1*j1+k1*k1+l1*l1;
flag = (distanceSquared > 0) && flag;
//CraftBukkit stop
// CraftBukkit stop
if (j1 >= -128 && j1 < 128 && k1 >= -128 && k1 < 128 && l1 >= -128 && l1 < 128) {
if (flag && flag1) {

View File

@@ -204,7 +204,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
server.loadPlugins(); // CraftBukkit
}
void f() { //CraftBukkit - private -> default
void f() { // CraftBukkit - private -> default
a.info("Saving chunks");
// CraftBukkit start