From b8cc86208310513232e27d543ec9b6c153ab1421 Mon Sep 17 00:00:00 2001 From: Travis Watkins Date: Fri, 24 Aug 2012 19:51:51 -0500 Subject: [PATCH] Update to 1.3.2 --- pom.xml | 6 +-- src/main/java/net/minecraft/server/Chunk.java | 2 +- .../net/minecraft/server/DedicatedServer.java | 21 ++++----- .../net/minecraft/server/EntityEnderman.java | 2 +- .../minecraft/server/EntityExperienceOrb.java | 15 +++++-- .../net/minecraft/server/EntityHuman.java | 4 +- .../net/minecraft/server/EntityPlayer.java | 2 +- .../net/minecraft/server/EntitySkeleton.java | 2 +- .../net/minecraft/server/EntityZombie.java | 2 +- .../net/minecraft/server/MinecraftServer.java | 11 ++--- .../minecraft/server/NetServerHandler.java | 13 +++--- .../server/Packet56MapChunkBulk.java | 4 -- .../net/minecraft/server/PlayerManager.java | 2 +- .../ServerConfigurationManagerAbstract.java | 8 +--- .../net/minecraft/server/VillageSiege.java | 2 +- src/main/java/net/minecraft/server/World.java | 10 ++--- .../net/minecraft/server/WorldGenBigTree.java | 31 +++++++++---- .../net/minecraft/server/WorldServer.java | 45 ++++++++++++------- 18 files changed, 103 insertions(+), 79 deletions(-) diff --git a/pom.xml b/pom.xml index 62f6aad89e..84bb24fc7f 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.bukkit craftbukkit jar - 1.3.1-R2.1-SNAPSHOT + 1.3.2-R0.1-SNAPSHOT CraftBukkit http://www.bukkit.org @@ -51,14 +51,14 @@ org.bukkit bukkit - 1.3.1-R2.1-SNAPSHOT + 1.3.2-R0.1-SNAPSHOT jar compile org.bukkit minecraft-server - 1.3.1 + 1.3.2 jar compile diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java index fb9bf2054f..a82773b491 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -255,7 +255,7 @@ public class Chunk { } if (i1 != l) { - this.world.g(i, k, i1, l); + this.world.g(i + this.x * 16, k + this.z * 16, i1, l); this.heightMap[k << 4 | i] = i1; int j1 = this.x * 16 + i; int k1 = this.z * 16 + k; diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java index 66a517ffe9..92b4c949bc 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -47,7 +47,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer System.setErr(new PrintStream(new LoggerOutputStream(log, Level.SEVERE), true)); // CraftBukkit end - log.info("Starting minecraft server version 1.3.1"); + log.info("Starting minecraft server version 1.3.2"); if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) { log.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); } @@ -189,7 +189,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer protected void a(CrashReport crashreport) { while (this.isRunning()) { - this.ah(); + this.ai(); try { Thread.sleep(10L); @@ -200,8 +200,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer } public CrashReport b(CrashReport crashreport) { + crashreport = super.b(crashreport); crashreport.a("Type", (Callable) (new CrashReportType(this))); - return super.b(crashreport); + return crashreport; } protected void o() { @@ -210,7 +211,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer public void q() { super.q(); - this.ah(); + this.ai(); } public boolean getAllowNether() { @@ -222,8 +223,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer } public void a(MojangStatisticsGenerator mojangstatisticsgenerator) { - mojangstatisticsgenerator.a("whitelist_enabled", Boolean.valueOf(this.ai().getHasWhitelist())); - mojangstatisticsgenerator.a("whitelist_count", Integer.valueOf(this.ai().getWhitelisted().size())); + mojangstatisticsgenerator.a("whitelist_enabled", Boolean.valueOf(this.aj().getHasWhitelist())); + mojangstatisticsgenerator.a("whitelist_count", Integer.valueOf(this.aj().getWhitelisted().size())); super.a(mojangstatisticsgenerator); } @@ -235,7 +236,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer this.l.add(new ServerCommand(s, icommandlistener)); } - public void ah() { + public void ai() { while (!this.l.isEmpty()) { ServerCommand servercommand = (ServerCommand) this.l.remove(0); @@ -254,7 +255,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer return true; } - public ServerConfigurationManager ai() { + public ServerConfigurationManager aj() { return (ServerConfigurationManager) super.getServerConfigurationManager(); } @@ -288,7 +289,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer return file1 != null ? file1.getAbsolutePath() : "No settings file"; } - public void aj() { + public void ak() { ServerGUI.a(this); this.s = true; } @@ -302,6 +303,6 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer } public ServerConfigurationManagerAbstract getServerConfigurationManager() { - return this.ai(); + return this.aj(); } } diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java index 48e9c1bdf1..3e6c800421 100644 --- a/src/main/java/net/minecraft/server/EntityEnderman.java +++ b/src/main/java/net/minecraft/server/EntityEnderman.java @@ -132,7 +132,7 @@ public class EntityEnderman extends EntityMonster { this.world.a("portal", this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length - 0.25D, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, (this.random.nextDouble() - 0.5D) * 2.0D, -this.random.nextDouble(), (this.random.nextDouble() - 0.5D) * 2.0D); } - if (this.world.r() && !this.world.isStatic) { + if (this.world.s() && !this.world.isStatic) { float f = this.c(1.0F); if (f > 0.5F && this.world.j(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) { diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java index c6d8ecd77f..c1e1feafcf 100644 --- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java +++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java @@ -12,6 +12,8 @@ public class EntityExperienceOrb extends Entity { public int c; private int d = 5; public int value; // CraftBukkit - private -> public + private EntityHuman targetPlayer; + private int targetTime; public EntityExperienceOrb(World world, double d0, double d1, double d2, int i) { super(world); @@ -56,11 +58,18 @@ public class EntityExperienceOrb extends Entity { this.i(this.locX, (this.boundingBox.b + this.boundingBox.e) / 2.0D, this.locZ); double d0 = 8.0D; - EntityHuman entityhuman = this.world.findNearbyPlayer(this, d0); - if (entityhuman != null) { + if (this.targetTime < this.a - 20 + this.id % 100) { + if (this.targetPlayer == null || this.targetPlayer.e(this) > d0 * d0) { + this.targetPlayer = this.world.findNearbyPlayer(this, d0); + } + + this.targetTime = this.a; + } + + if (this.targetPlayer != null) { // CraftBukkit start - EntityTargetEvent event = CraftEventFactory.callEntityTargetEvent(this, entityhuman, EntityTargetEvent.TargetReason.CLOSEST_PLAYER); + EntityTargetEvent event = CraftEventFactory.callEntityTargetEvent(this, targetPlayer, EntityTargetEvent.TargetReason.CLOSEST_PLAYER); Entity target = event.getTarget() == null ? null : ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle(); if (!event.isCancelled() && target != null) { diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java index 0b02f5b7f0..a269b00908 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -144,7 +144,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen if (!this.world.isStatic) { if (!this.l()) { this.a(true, true, false); - } else if (this.world.r()) { + } else if (this.world.s()) { this.a(false, true, true); } } @@ -855,7 +855,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen return EnumBedResult.NOT_POSSIBLE_HERE; } - if (this.world.r()) { + if (this.world.s()) { return EnumBedResult.NOT_POSSIBLE_NOW; } diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java index b8696b58c8..9fe2d0b963 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -721,7 +721,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } public boolean b(String s) { - return "seed".equals(s) && !this.server.S() ? true : this.server.getServerConfigurationManager().isOp(this.name); + return "seed".equals(s) && !this.server.S() ? true : (!"tell".equals(s) && !"help".equals(s) && !"me".equals(s) ? this.server.getServerConfigurationManager().isOp(this.name) : true); } public String r() { diff --git a/src/main/java/net/minecraft/server/EntitySkeleton.java b/src/main/java/net/minecraft/server/EntitySkeleton.java index d96458af1c..6cfe0539d2 100644 --- a/src/main/java/net/minecraft/server/EntitySkeleton.java +++ b/src/main/java/net/minecraft/server/EntitySkeleton.java @@ -46,7 +46,7 @@ public class EntitySkeleton extends EntityMonster { } public void d() { - if (this.world.r() && !this.world.isStatic) { + if (this.world.s() && !this.world.isStatic) { float f = this.c(1.0F); if (f > 0.5F && this.world.j(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) { diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java index ef5ad29da4..400f3b1c35 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -37,7 +37,7 @@ public class EntityZombie extends EntityMonster { } public void d() { - if (this.world.r() && !this.world.isStatic) { + if (this.world.s() && !this.world.isStatic) { float f = this.c(1.0F); if (f > 0.5F && this.world.j(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 21545ca938..6529ff8015 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -304,7 +304,7 @@ public abstract class MinecraftServer implements Runnable, IMojangStatistics, IC if (worldserver != null) { if (!flag) { - log.info("Saving chunks for level \'" + worldserver.getWorldData().getName() + "\'/" + worldserver.worldProvider); + log.info("Saving chunks for level \'" + worldserver.getWorldData().getName() + "\'/" + worldserver.worldProvider.getName()); worldserver.save(true, (IProgressUpdate) null); // Perform a full save } else { worldserver.save(false, (IProgressUpdate) null); // Queue chunk saving @@ -561,10 +561,7 @@ public abstract class MinecraftServer implements Runnable, IMojangStatistics, IC while (true) { if (!worldserver.updateLights()) { // this.methodProfiler.b(); // CraftBukkit - not in production code - if (true || !worldserver.players.isEmpty()) { // CraftBukkit - this prevents entity cleanup, other issue on servers with no players - worldserver.tickEntities(); - } - + worldserver.tickEntities(); // this.methodProfiler.a("tracker"); // CraftBukkit - not in production code worldserver.getTracker().updatePlayers(); // this.methodProfiler.b(); // CraftBukkit - not in production code @@ -691,7 +688,7 @@ public abstract class MinecraftServer implements Runnable, IMojangStatistics, IC } if (flag) { - dedicatedserver.aj(); + dedicatedserver.ak(); } */ @@ -744,7 +741,7 @@ public abstract class MinecraftServer implements Runnable, IMojangStatistics, IC } public String getVersion() { - return "1.3.1"; + return "1.3.2"; } public int x() { diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index dbd1a5dede..6087692cef 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -126,6 +126,9 @@ public class NetServerHandler extends NetHandler { // this.minecraftServer.methodProfiler.c("playerTick"); // CraftBukkit - not in production code if (!this.h && !this.player.viewingCredits) { this.player.g(); + if (this.player.vehicle == null) { + this.player.setPositionRotation(this.y, this.z, this.q, this.player.yaw, this.player.pitch); + } } // this.minecraftServer.methodProfiler.b(); // CraftBukkit - not in production code @@ -266,13 +269,11 @@ public class NetServerHandler extends NetHandler { } if (packet10flying.hasPos && packet10flying.y == -999.0D && packet10flying.stance == -999.0D) { - // CraftBukkit start - if (Math.abs(packet10flying.x) > 1 || Math.abs(packet10flying.z) > 1) { + if (Math.abs(packet10flying.x) > 1.0D || Math.abs(packet10flying.z) > 1.0D) { System.err.println(player.getName() + " was caught trying to crash the server with an invalid position."); player.kickPlayer("Nope!"); return; } - // CraftBukkit end d5 = packet10flying.x; d4 = packet10flying.z; @@ -875,6 +876,7 @@ public class NetServerHandler extends NetHandler { } try { + logger.info(event.getPlayer().getName() + " issued server command: " + event.getMessage()); // CraftBukkit if (this.server.dispatchCommand(event.getPlayer(), event.getMessage().substring(1))) { return; } @@ -886,10 +888,7 @@ public class NetServerHandler extends NetHandler { // CraftBukkit end /* CraftBukkit start - No longer needed as we have already handled it in server.dispatchServerCommand above. - if (this.minecraftServer.getServerConfigurationManager().isOp(this.player.name) || "/seed".equals(s)) { - logger.info(this.player.name + " issued server command: " + s); - this.minecraftServer.getCommandHandler().a(this.player, s); - } + this.minecraftServer.getCommandHandler().a(this.player, s); // CraftBukkit end */ } diff --git a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java index ae8a0f68de..014bdac1f5 100644 --- a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java +++ b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java @@ -142,8 +142,4 @@ public class Packet56MapChunkBulk extends Packet { public int d() { return this.c.length; } - - public boolean a_() { - return true; - } } diff --git a/src/main/java/net/minecraft/server/PlayerManager.java b/src/main/java/net/minecraft/server/PlayerManager.java index c824e67c26..51e5ac514c 100644 --- a/src/main/java/net/minecraft/server/PlayerManager.java +++ b/src/main/java/net/minecraft/server/PlayerManager.java @@ -229,7 +229,7 @@ public class PlayerManager { public boolean a(EntityPlayer entityplayer, int i, int j) { PlayerInstance playerinstance = this.a(i, j, false); - return playerinstance == null ? false : PlayerInstance.b(playerinstance).contains(entityplayer); + return playerinstance == null ? false : PlayerInstance.b(playerinstance).contains(entityplayer) && !entityplayer.chunkCoordIntPairQueue.contains(PlayerInstance.a(playerinstance)); } public static int getFurthestViewableBlock(int i) { diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManagerAbstract.java b/src/main/java/net/minecraft/server/ServerConfigurationManagerAbstract.java index 0939c93eb8..7111bab41a 100644 --- a/src/main/java/net/minecraft/server/ServerConfigurationManagerAbstract.java +++ b/src/main/java/net/minecraft/server/ServerConfigurationManagerAbstract.java @@ -499,12 +499,8 @@ public abstract class ServerConfigurationManagerAbstract { } public void sendAll(Packet packet) { - Iterator iterator = this.players.iterator(); - - while (iterator.hasNext()) { - EntityPlayer entityplayer = (EntityPlayer) iterator.next(); - - entityplayer.netServerHandler.sendPacket(packet); + for (int i = 0; i < this.players.size(); ++i) { + ((EntityPlayer) this.players.get(i)).netServerHandler.sendPacket(packet); } } diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java index ebe13e6806..5d137dbc4c 100644 --- a/src/main/java/net/minecraft/server/VillageSiege.java +++ b/src/main/java/net/minecraft/server/VillageSiege.java @@ -28,7 +28,7 @@ public class VillageSiege { return; } } else { - if (this.world.r()) { + if (this.world.s()) { this.c = 0; return; } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index e3f8ed0acd..d9874412c7 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -134,7 +134,7 @@ public abstract class World implements IBlockAccess { } this.worldProvider.a(this); - this.chunkProvider = this.h(); + this.chunkProvider = this.i(); if (!this.worldData.isInitialized()) { this.a(worldsettings); this.worldData.d(true); @@ -146,7 +146,7 @@ public abstract class World implements IBlockAccess { this.getServer().addWorld(this.world); // CraftBukkit } - protected abstract IChunkProvider h(); + protected abstract IChunkProvider i(); protected void a(WorldSettings worldsettings) { this.worldData.d(true); @@ -586,7 +586,7 @@ public abstract class World implements IBlockAccess { return this.worldProvider.f[this.getLightLevel(i, j, k)]; } - public boolean r() { + public boolean s() { return this.k < 4; } @@ -1704,7 +1704,7 @@ public abstract class World implements IBlockAccess { } public void doTick() { - this.l(); + this.m(); } private void a() { @@ -1716,7 +1716,7 @@ public abstract class World implements IBlockAccess { } } - protected void l() { + protected void m() { if (!this.worldProvider.e) { if (this.r > 0) { --this.r; diff --git a/src/main/java/net/minecraft/server/WorldGenBigTree.java b/src/main/java/net/minecraft/server/WorldGenBigTree.java index f5117f1848..5ec2c44842 100644 --- a/src/main/java/net/minecraft/server/WorldGenBigTree.java +++ b/src/main/java/net/minecraft/server/WorldGenBigTree.java @@ -118,7 +118,7 @@ public class WorldGenBigTree extends WorldGenerator implements BlockSapling.Tree aint1[b2] = aint[b2] + k1; int l1 = this.world.getTypeId(aint1[0], aint1[1], aint1[2]); - if (l1 != 0 && l1 != 18) { + if (l1 != 0 && l1 != Block.LEAVES.id) { ++k1; } else { this.setTypeAndData(this.world, aint1[0], aint1[1], aint1[2], l, 0); @@ -160,7 +160,7 @@ public class WorldGenBigTree extends WorldGenerator implements BlockSapling.Tree for (int i1 = j + this.n; l < i1; ++l) { float f = this.b(l - j); - this.a(i, l, k, f, (byte) 1, 18); + this.a(i, l, k, f, (byte) 1, Block.LEAVES.id); } } @@ -197,7 +197,20 @@ public class WorldGenBigTree extends WorldGenerator implements BlockSapling.Tree aint3[b1] = MathHelper.floor((double) (aint[b1] + j) + 0.5D); aint3[b2] = MathHelper.floor((double) aint[b2] + (double) j * d0 + 0.5D); aint3[b3] = MathHelper.floor((double) aint[b3] + (double) j * d1 + 0.5D); - this.setTypeAndData(this.world, aint3[0], aint3[1], aint3[2], i, 0); + byte b5 = 0; + int l = Math.abs(aint3[0] - aint[0]); + int i1 = Math.abs(aint3[2] - aint[2]); + int j1 = Math.max(l, i1); + + if (j1 > 0) { + if (l == j1) { + b5 = 4; + } else if (i1 == j1) { + b5 = 8; + } + } + + this.setTypeAndData(this.world, aint3[0], aint3[1], aint3[2], i, b5); } } } @@ -226,17 +239,17 @@ public class WorldGenBigTree extends WorldGenerator implements BlockSapling.Tree int[] aint = new int[] { i, j, l}; int[] aint1 = new int[] { i, k, l}; - this.a(aint, aint1, 17); + this.a(aint, aint1, Block.LOG.id); if (this.l == 2) { ++aint[0]; ++aint1[0]; - this.a(aint, aint1, 17); + this.a(aint, aint1, Block.LOG.id); ++aint[2]; ++aint1[2]; - this.a(aint, aint1, 17); + this.a(aint, aint1, Block.LOG.id); aint[0] += -1; aint1[0] += -1; - this.a(aint, aint1, 17); + this.a(aint, aint1, Block.LOG.id); } } @@ -252,7 +265,7 @@ public class WorldGenBigTree extends WorldGenerator implements BlockSapling.Tree int k = aint[1] - this.d[1]; if (this.c(k)) { - this.a(aint, aint2, 17); + this.a(aint, aint2, (byte) Block.LOG.id); } } } @@ -296,7 +309,7 @@ public class WorldGenBigTree extends WorldGenerator implements BlockSapling.Tree aint3[b3] = MathHelper.floor((double) aint[b3] + (double) i * d1); int k = this.world.getTypeId(aint3[0], aint3[1], aint3[2]); - if ((k != 0 && k != 18) || aint3[1] >= 256) { // CraftBukkit - fix trees wrapping around + if ((k != 0 && k != Block.LEAVES.id) || aint3[1] >= 256) { // CraftBukkit - fix trees wrapping around break; } } diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java index bb69a2dbd4..340fe9007c 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -30,9 +30,10 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate public boolean weirdIsOpCache = false; public boolean savingDisabled; private boolean P; - private NoteDataList[] Q = new NoteDataList[] { new NoteDataList((EmptyClass2) null), new NoteDataList((EmptyClass2) null)}; - private int R = 0; - private static final StructurePieceTreasure[] S = new StructurePieceTreasure[] { new StructurePieceTreasure(Item.STICK.id, 0, 1, 3, 10), new StructurePieceTreasure(Block.WOOD.id, 0, 1, 3, 10), new StructurePieceTreasure(Block.LOG.id, 0, 1, 3, 10), new StructurePieceTreasure(Item.STONE_AXE.id, 0, 1, 1, 3), new StructurePieceTreasure(Item.WOOD_AXE.id, 0, 1, 1, 5), new StructurePieceTreasure(Item.STONE_PICKAXE.id, 0, 1, 1, 3), new StructurePieceTreasure(Item.WOOD_PICKAXE.id, 0, 1, 1, 5), new StructurePieceTreasure(Item.APPLE.id, 0, 2, 3, 5), new StructurePieceTreasure(Item.BREAD.id, 0, 2, 3, 3)}; + private int emptyTime = 0; + private NoteDataList[] R = new NoteDataList[] { new NoteDataList((EmptyClass2) null), new NoteDataList((EmptyClass2) null)}; + private int S = 0; + private static final StructurePieceTreasure[] T = new StructurePieceTreasure[] { new StructurePieceTreasure(Item.STICK.id, 0, 1, 3, 10), new StructurePieceTreasure(Block.WOOD.id, 0, 1, 3, 10), new StructurePieceTreasure(Block.LOG.id, 0, 1, 3, 10), new StructurePieceTreasure(Item.STONE_AXE.id, 0, 1, 1, 3), new StructurePieceTreasure(Item.WOOD_AXE.id, 0, 1, 1, 5), new StructurePieceTreasure(Item.STONE_PICKAXE.id, 0, 1, 1, 3), new StructurePieceTreasure(Item.WOOD_PICKAXE.id, 0, 1, 1, 5), new StructurePieceTreasure(Item.APPLE.id, 0, 2, 3, 5), new StructurePieceTreasure(Item.BREAD.id, 0, 2, 3, 3)}; private IntHashMap entitiesById; // CraftBukkit start @@ -415,6 +416,18 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate } } + public void tickEntities() { + if (false && this.players.isEmpty()) { // CraftBukkit - this prevents entity cleanup, other issues on servers with no players + if (this.emptyTime++ >= 60) { + return; + } + } else { + this.emptyTime = 0; + } + + super.tickEntities(); + } + public boolean a(boolean flag) { int i = this.O.size(); @@ -503,7 +516,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate super.entityJoinedWorld(entity, flag); } - protected IChunkProvider h() { + protected IChunkProvider i() { IChunkLoader ichunkloader = this.dataManager.createChunkLoader(this.worldProvider); // CraftBukkit start @@ -621,13 +634,13 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate this.worldData.setSpawn(i, j, k); this.isLoading = false; if (worldsettings.c()) { - this.i(); + this.j(); } } } - protected void i() { - WorldGenBonusChest worldgenbonuschest = new WorldGenBonusChest(S, 10); + protected void j() { + WorldGenBonusChest worldgenbonuschest = new WorldGenBonusChest(T, 10); for (int i = 0; i < 10; ++i) { int j = this.worldData.c() + this.random.nextInt(6) - this.random.nextInt(6); @@ -756,13 +769,13 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate public void playNote(int i, int j, int k, int l, int i1, int j1) { NoteBlockData noteblockdata = new NoteBlockData(i, j, k, l, i1, j1); - Iterator iterator = this.Q[this.R].iterator(); + Iterator iterator = this.R[this.S].iterator(); NoteBlockData noteblockdata1; do { if (!iterator.hasNext()) { - this.Q[this.R].add(noteblockdata); + this.R[this.S].add(noteblockdata); return; } @@ -772,11 +785,11 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate } private void Q() { - while (!this.Q[this.R].isEmpty()) { - int i = this.R; + while (!this.R[this.S].isEmpty()) { + int i = this.S; - this.R ^= 1; - Iterator iterator = this.Q[i].iterator(); + this.S ^= 1; + Iterator iterator = this.R[i].iterator(); while (iterator.hasNext()) { NoteBlockData noteblockdata = (NoteBlockData) iterator.next(); @@ -787,7 +800,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate } } - this.Q[i].clear(); + this.R[i].clear(); } } @@ -806,10 +819,10 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate this.dataManager.a(); } - protected void l() { + protected void m() { boolean flag = this.J(); - super.l(); + super.m(); if (flag != this.J()) { // CraftBukkit start - only sending weather packets to those affected for (int i = 0; i < this.players.size(); ++i) {