diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index e09b519e57..40a9f5bc0a 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -175,7 +175,7 @@ public abstract class EntityLiving extends Entity { this.extinguish(); } else { - if (this.getAirTicks() != 300) { + if (this.getAirTicks() != 300) { // CraftBukkit -- only set if needed to work around a datawatcher inefficiency this.setAirTicks(maxAirTicks); } } diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java index bbb64f050b..c32783cf61 100644 --- a/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java @@ -1,6 +1,5 @@ package net.minecraft.server; -import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; @@ -8,7 +7,8 @@ import java.util.List; import java.util.Random; // CraftBukkit -import org.bukkit.craftbukkit.util.LongAbstractHashtable; +import java.util.ArrayList; +import org.bukkit.craftbukkit.util.LongBaseHashtable; import org.bukkit.craftbukkit.util.EntryBase; import org.bukkit.craftbukkit.util.LongHash; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; @@ -47,8 +47,7 @@ public final class SpawnerCreature { return 0; } else { // b.clear(); // CraftBukkit - LongAbstractHashtable chunkCoords; // CraftBukkit - chunkCoords = new LongAbstractHashtable() {}; + LongBaseHashtable chunkCoords = new LongBaseHashtable(); // CraftBukkit int i; int j; @@ -78,7 +77,7 @@ public final class SpawnerCreature { i = 0; ChunkCoordinates chunkcoordinates = world.getSpawn(); - ArrayList entries = chunkCoords.entries(); // CraftBukkit + ArrayList b = chunkCoords.entries(); // CraftBukkit EnumCreatureType[] aenumcreaturetype = EnumCreatureType.values(); j = aenumcreaturetype.length; @@ -86,14 +85,15 @@ public final class SpawnerCreature { for (int j1 = 0; j1 < j; ++j1) { EnumCreatureType enumcreaturetype = aenumcreaturetype[j1]; + if ((!enumcreaturetype.d() || flag1) && (enumcreaturetype.d() || flag) && world.a(enumcreaturetype.a()) <= enumcreaturetype.b() * b.size() / 256) { - if ((!enumcreaturetype.d() || flag1) && (enumcreaturetype.d() || flag) && world.a(enumcreaturetype.a()) <= enumcreaturetype.b() * entries.size() / 256) { - + // CraftBukkit start label108: - for (EntryBase base : entries) { + for (EntryBase base : b) { ChunkEntry entry = (SpawnerCreature.ChunkEntry) base; if (!entry.spawn) { - ChunkPosition chunkposition = a(world, LongHash.msw(entry.getX()) * 16, entry.getZ() * 16); + ChunkPosition chunkposition = a(world, entry.getX() * 16, entry.getZ() * 16); + // CraftBukkit end int k1 = chunkposition.x; int l1 = chunkposition.y; int i2 = chunkposition.z; diff --git a/src/main/java/org/bukkit/craftbukkit/util/LongAbstractHashtable.java b/src/main/java/org/bukkit/craftbukkit/util/LongBaseHashtable.java similarity index 98% rename from src/main/java/org/bukkit/craftbukkit/util/LongAbstractHashtable.java rename to src/main/java/org/bukkit/craftbukkit/util/LongBaseHashtable.java index 2da732cce2..c478f50c97 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/LongAbstractHashtable.java +++ b/src/main/java/org/bukkit/craftbukkit/util/LongBaseHashtable.java @@ -7,7 +7,7 @@ import java.util.ArrayList; import static org.bukkit.craftbukkit.util.Java15Compat.Arrays_copyOf; -public abstract class LongAbstractHashtable extends LongHash { +public class LongBaseHashtable extends LongHash { EntryBase[][][] values = new EntryBase[256][][]; EntryBase cache = null; diff --git a/src/main/java/org/bukkit/craftbukkit/util/LongHashtable.java b/src/main/java/org/bukkit/craftbukkit/util/LongHashtable.java index d3912e497e..154b877bb5 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/LongHashtable.java +++ b/src/main/java/org/bukkit/craftbukkit/util/LongHashtable.java @@ -1,11 +1,10 @@ package org.bukkit.craftbukkit.util; import java.util.ArrayList; -import net.minecraft.server.Chunk; -import net.minecraft.server.MinecraftServer; + import static org.bukkit.craftbukkit.util.Java15Compat.Arrays_copyOf; -public class LongHashtable extends LongAbstractHashtable { +public class LongHashtable extends LongBaseHashtable { public void put(int msw, int lsw, V value) { put(toLong(msw, lsw), value); @@ -20,7 +19,7 @@ public class LongHashtable extends LongAbstractHashtable { } public synchronized V get(long key) { - Entry entry = ((Entry)getEntry(key)); + Entry entry = ((Entry) getEntry(key)); return entry != null ? entry.value : null; } @@ -30,7 +29,7 @@ public class LongHashtable extends LongAbstractHashtable { ArrayList entries = entries(); for(EntryBase entry : entries) { - ret.add(((Entry)entry).value); + ret.add(((Entry) entry).value); } return ret; }