mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-01 04:32:11 -07:00
Update PaperSpigot to Minecraft 1.8
This commit is contained in:
@@ -10,20 +10,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
public Scoreboard scoreboard = new Scoreboard(); // CraftBukkit - protected -> public
|
||||
public boolean isStatic;
|
||||
// CraftBukkit start - public, longhashset
|
||||
public Scoreboard scoreboard = new Scoreboard();
|
||||
public final boolean isStatic;
|
||||
// CraftBukkit - longhashset
|
||||
- protected LongHashSet chunkTickList = new LongHashSet();
|
||||
+ // protected LongHashSet chunkTickList = new LongHashSet(); // Spigot
|
||||
private int K;
|
||||
public boolean allowMonsters;
|
||||
public boolean allowAnimals;
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
private boolean M;
|
||||
int[] I;
|
||||
|
||||
public long ticksPerMonsterSpawns;
|
||||
public boolean populating;
|
||||
private int tickPosition;
|
||||
+
|
||||
+ // Spigot start
|
||||
+ protected final net.minecraft.util.gnu.trove.map.hash.TLongShortHashMap chunkTickList;
|
||||
+ protected final gnu.trove.map.hash.TLongShortHashMap chunkTickList;
|
||||
+ protected float growthOdds = 100;
|
||||
+ protected float modifiedOdds = 100;
|
||||
+ private final byte chunkTickRadius;
|
||||
@@ -31,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ public static long chunkToKey(int x, int z)
|
||||
+ {
|
||||
+ long k = ( ( ( (long) x ) & 0xFFFF0000L ) << 16 ) | ( ( ( (long) x ) & 0x0000FFFFL ) << 0 );
|
||||
+ k |= ( ( ( (long) z ) & 0xFFFF0000L ) << 32 ) | ( ( ( (long) z ) & 0x0000FFFFL ) << 16 );
|
||||
+ k |= ( ( ( (long) z ) & 0xFFFF0000L ) << 32 ) | ( ( ( (long) z ) & 0x0000FFFFL ) << 16 );
|
||||
+ return k;
|
||||
+ }
|
||||
+
|
||||
@@ -46,16 +47,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ // Spigot end
|
||||
+
|
||||
public BiomeBase getBiome(int i, int j) {
|
||||
if (this.isLoaded(i, 0, j)) {
|
||||
Chunk chunk = this.getChunkAtWorldCoords(i, j);
|
||||
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
|
||||
|
||||
public CraftWorld getWorld() {
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
|
||||
this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit
|
||||
// CraftBukkit end
|
||||
+ // Spigot start
|
||||
+ this.chunkTickRadius = (byte) ( ( this.getServer().getViewDistance() < 7 ) ? this.getServer().getViewDistance() : 7 );
|
||||
+ this.chunkTickList = new net.minecraft.util.gnu.trove.map.hash.TLongShortHashMap( spigotConfig.chunksPerTick * 5, 0.7f, Long.MIN_VALUE, Short.MIN_VALUE );
|
||||
+ this.chunkTickList = new gnu.trove.map.hash.TLongShortHashMap( spigotConfig.chunksPerTick * 5, 0.7f, Long.MIN_VALUE, Short.MIN_VALUE );
|
||||
+ this.chunkTickList.setAutoCompactionFactor( 0 );
|
||||
+ // Spigot end
|
||||
|
||||
@@ -84,15 +85,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
entityhuman = (EntityHuman) this.players.get(i);
|
||||
j = MathHelper.floor(entityhuman.locX / 16.0D);
|
||||
k = MathHelper.floor(entityhuman.locZ / 16.0D);
|
||||
l = this.p();
|
||||
l = this.q();
|
||||
|
||||
- for (int i1 = -l; i1 <= l; ++i1) {
|
||||
- for (int j1 = -l; j1 <= l; ++j1) {
|
||||
- this.chunkTickList.add(org.bukkit.craftbukkit.util.LongHash.toLong(i1 + j, j1 + k)); // CraftBukkit
|
||||
- this.chunkTickList.add(org.bukkit.craftbukkit.util.LongHash.toLong(i1 + j, j1 + k));
|
||||
+ // Spigot start - Always update the chunk the player is on
|
||||
+ long key = chunkToKey( j, k );
|
||||
+ int existingPlayers = Math.max( 0, chunkTickList.get( key ) ); // filter out -1
|
||||
+ chunkTickList.put(key, (short) (existingPlayers + 1));
|
||||
+ chunkTickList.put( key, (short) ( existingPlayers + 1 ) );
|
||||
+
|
||||
+ // Check and see if we update the chunks surrounding the player this tick
|
||||
+ for ( int chunk = 0; chunk < chunksPerPlayer; chunk++ )
|
||||
@@ -100,7 +101,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ int dx = ( random.nextBoolean() ? 1 : -1 ) * random.nextInt( randRange );
|
||||
+ int dz = ( random.nextBoolean() ? 1 : -1 ) * random.nextInt( randRange );
|
||||
+ long hash = chunkToKey( dx + j, dz + k );
|
||||
+ if ( !chunkTickList.contains( hash ) && this.isChunkLoaded( dx + j, dz + k ) )
|
||||
+ if ( !chunkTickList.contains( hash ) && this.chunkProvider.isChunkLoaded(dx + j, dz + k ) )
|
||||
+ {
|
||||
+ chunkTickList.put( hash, (short) -1 ); // no players
|
||||
}
|
||||
@@ -113,41 +114,53 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
// CraftBukkit start
|
||||
// Iterator iterator = this.chunkTickList.iterator();
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
||||
protected void h() {
|
||||
super.h();
|
||||
if (this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) {
|
||||
- Iterator iterator = this.chunkTickList.iterator();
|
||||
+ // Spigot start
|
||||
+ gnu.trove.iterator.TLongShortIterator iterator = this.chunkTickList.iterator();
|
||||
|
||||
- for (long chunkCoord : this.chunkTickList.popAll()) {
|
||||
+ // Spigot start
|
||||
+ for (net.minecraft.util.gnu.trove.iterator.TLongShortIterator iter = chunkTickList.iterator(); iter.hasNext();) {
|
||||
+ iter.advance();
|
||||
+ long chunkCoord = iter.key();
|
||||
+ int chunkX = World.keyToX(chunkCoord);
|
||||
+ int chunkZ = World.keyToZ(chunkCoord);
|
||||
+ // If unloaded, or in procedd of being unloaded, drop it
|
||||
+ if ( ( !this.isChunkLoaded( chunkX, chunkZ ) ) || ( this.chunkProviderServer.unloadQueue.contains( chunkX, chunkZ ) ) )
|
||||
while (iterator.hasNext()) {
|
||||
- ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next();
|
||||
+ iterator.advance();
|
||||
+ long chunkCoord = iterator.key();
|
||||
|
||||
- this.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z).b(false);
|
||||
+ this.getChunkAt(World.keyToX( chunkCoord ), World.keyToZ( chunkCoord )).b(false);
|
||||
+ // Spigot end
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
||||
// ChunkCoordIntPair chunkcoordintpair1 = (ChunkCoordIntPair) iterator1.next();
|
||||
// int k = chunkcoordintpair1.x * 16;
|
||||
// int l = chunkcoordintpair1.z * 16;
|
||||
- for (long chunkCoord : chunkTickList.popAll()) {
|
||||
- int chunkX = LongHash.msw(chunkCoord);
|
||||
- int chunkZ = LongHash.lsw(chunkCoord);
|
||||
+ // Spigot start
|
||||
+ for (gnu.trove.iterator.TLongShortIterator iter = chunkTickList.iterator(); iter.hasNext(); )
|
||||
+ {
|
||||
+ iter.remove();
|
||||
+ continue;
|
||||
+ }
|
||||
+ // Spigot end
|
||||
// ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next();
|
||||
- int chunkX = LongHash.msw(chunkCoord);
|
||||
- int chunkZ = LongHash.lsw(chunkCoord);
|
||||
int k = chunkX * 16;
|
||||
int l = chunkZ * 16;
|
||||
+ iter.advance();
|
||||
+ long chunkCoord = iter.key();
|
||||
+ int chunkX = World.keyToX( chunkCoord );
|
||||
+ int chunkZ = World.keyToZ( chunkCoord );
|
||||
+ // If unloaded, or in procedd of being unloaded, drop it
|
||||
+ if ( ( !this.chunkProvider.isChunkLoaded( chunkX, chunkZ ) ) || ( this.chunkProviderServer.unloadQueue.contains( chunkX, chunkZ ) ) )
|
||||
+ {
|
||||
+ iter.remove();
|
||||
+ continue;
|
||||
+ }
|
||||
+ // Spigot end
|
||||
+ // ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next();
|
||||
int k = chunkX * 16;
|
||||
int l = chunkZ * 16;
|
||||
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
|
||||
if (block.isTicking()) {
|
||||
++i;
|
||||
+ this.growthOdds = (iter.value() < 1) ? this.modifiedOdds : 100; // Spigot - grow fast if no players are in this chunk (value = player count)
|
||||
block.a(this, k2 + k, i3 + chunksection.getYPosition(), l2 + l, this.random);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
|
||||
this.methodProfiler.b();
|
||||
}
|
||||
+ // Spigot Start
|
||||
+ if ( spigotConfig.clearChunksOnTick )
|
||||
@@ -157,7 +170,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Spigot End
|
||||
}
|
||||
|
||||
public boolean a(int i, int j, int k, Block block) {
|
||||
protected BlockPosition a(BlockPosition blockposition) {
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
|
Reference in New Issue
Block a user