Paper/Spigot-Server-Patches/0060-Optimize-getCubes.patch

46 lines
2.0 KiB
Diff
Raw Normal View History

2015-10-17 04:43:03 +02:00
From ad9631fe4ee824d1e2443306f6df0d782aea44cb Mon Sep 17 00:00:00 2001
2015-08-05 00:25:37 +02:00
From: Byteflux <byte@byteflux.net>
Date: Tue, 14 Jul 2015 10:03:45 -0700
Subject: [PATCH] Optimize getCubes()
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
2015-10-17 04:43:03 +02:00
index 64713bd..08041af 100644
2015-08-05 00:25:37 +02:00
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
2015-10-17 04:43:03 +02:00
@@ -1166,11 +1166,12 @@ public abstract class World implements IBlockAccess {
2015-08-05 00:25:37 +02:00
int cx = chunkx << 4;
for ( int chunkz = ( i1 >> 4 ); chunkz <= ( ( j1 - 1 ) >> 4 ); chunkz++ )
{
- if ( !this.isChunkLoaded( chunkx, chunkz, true ) )
+ Chunk chunk = this.getChunkIfLoaded( chunkx, chunkz );
+ if ( chunk == null )
{
// PaperSpigot start
if (entity.loadChunks) {
- ((ChunkProviderServer) entity.world.chunkProvider).getChunkAt(chunkx, chunkz);
+ chunk = ((ChunkProviderServer) entity.world.chunkProvider).getChunkAt(chunkx, chunkz);
} else {
entity.inUnloadedChunk = true; // PaperSpigot - Remove entities in unloaded chunks
continue;
2015-10-17 04:43:03 +02:00
@@ -1178,7 +1179,6 @@ public abstract class World implements IBlockAccess {
2015-08-05 00:25:37 +02:00
// PaperSpigot end
}
int cz = chunkz << 4;
- Chunk chunk = this.getChunkAt( chunkx, chunkz );
// Compute ranges within chunk
int xstart = ( i < cx ) ? cx : i;
int xend = ( j < ( cx + 16 ) ) ? j : ( cx + 16 );
2015-10-17 04:43:03 +02:00
@@ -1225,6 +1225,8 @@ public abstract class World implements IBlockAccess {
2015-08-05 00:25:37 +02:00
}
// Spigot end
+ if (entity instanceof EntityItem) return arraylist; // PaperSpigot - Optimize item movement
+
double d0 = 0.25D;
List list = this.getEntities(entity, axisalignedbb.grow(d0, d0, d0));
--
2015-10-17 04:43:03 +02:00
2.6.1.windows.1
2015-08-05 00:25:37 +02:00