Fix for entity spawning and some code cleanup
Dieser Commit ist enthalten in:
Ursprung
bc8f02788f
Commit
e4a839cbbc
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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<EntryBase> entries = chunkCoords.entries(); // CraftBukkit
|
||||
ArrayList<EntryBase> 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;
|
||||
|
@ -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;
|
@ -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<V> extends LongAbstractHashtable {
|
||||
public class LongHashtable<V> extends LongBaseHashtable {
|
||||
|
||||
public void put(int msw, int lsw, V value) {
|
||||
put(toLong(msw, lsw), value);
|
||||
@ -20,7 +19,7 @@ public class LongHashtable<V> 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<V> extends LongAbstractHashtable {
|
||||
ArrayList<EntryBase> entries = entries();
|
||||
|
||||
for(EntryBase entry : entries) {
|
||||
ret.add(((Entry)entry).value);
|
||||
ret.add(((Entry) entry).value);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren