mirror of
https://github.com/PaperMC/Paper.git
synced 2024-09-12 06:58:11 +02:00
Don't send requests of every player was found in the global api cache SpigotMC/Spigot@841270ff1e Correctly set the response code for the cached lookups and return the ... SpigotMC/Spigot@f170b7899c Don't try and re-set the global api cache on reload SpigotMC/Spigot@b410a00a66 Use a compile time sneaky throw hack. SpigotMC/Spigot@508462b96b Fix a missed rename in WorldGenGroundBush SpigotMC/Spigot@0614d8fae9
69 lines
2.8 KiB
Diff
69 lines
2.8 KiB
Diff
From fab1432cc005200e3b0310969985bc7da82c6d10 Mon Sep 17 00:00:00 2001
|
|
From: md_5 <md_5@live.com.au>
|
|
Date: Tue, 11 Jun 2013 12:17:37 +1000
|
|
Subject: [PATCH] More Efficient GetCubes
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
|
index c7c33b0..66db74d 100644
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
|
@@ -1139,23 +1139,42 @@ public abstract class World implements IBlockAccess {
|
|
int i1 = MathHelper.floor(axisalignedbb.c);
|
|
int j1 = MathHelper.floor(axisalignedbb.f + 1.0D);
|
|
|
|
- for (int k1 = i; k1 < j; ++k1) {
|
|
- for (int l1 = i1; l1 < j1; ++l1) {
|
|
- if (this.isLoaded(k1, 64, l1)) {
|
|
- for (int i2 = k - 1; i2 < l; ++i2) {
|
|
- Block block;
|
|
-
|
|
- if (k1 >= -30000000 && k1 < 30000000 && l1 >= -30000000 && l1 < 30000000) {
|
|
- block = this.getType(k1, i2, l1);
|
|
- } else {
|
|
- block = Blocks.STONE;
|
|
+ // Spigot start
|
|
+ int ystart = ( ( k - 1 ) < 0 ) ? 0 : ( k - 1 );
|
|
+ for ( int chunkx = ( i >> 4 ); chunkx <= ( ( j - 1 ) >> 4 ); chunkx++ )
|
|
+ {
|
|
+ int cx = chunkx << 4;
|
|
+ for ( int chunkz = ( i1 >> 4 ); chunkz <= ( ( j1 - 1 ) >> 4 ); chunkz++ )
|
|
+ {
|
|
+ if ( !this.isChunkLoaded( chunkx, chunkz ) )
|
|
+ {
|
|
+ continue;
|
|
+ }
|
|
+ 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 );
|
|
+ int zstart = ( i1 < cz ) ? cz : i1;
|
|
+ int zend = ( j1 < ( cz + 16 ) ) ? j1 : ( cz + 16 );
|
|
+ // Loop through blocks within chunk
|
|
+ for ( int x = xstart; x < xend; x++ )
|
|
+ {
|
|
+ for ( int z = zstart; z < zend; z++ )
|
|
+ {
|
|
+ for ( int y = ystart; y < l; y++ )
|
|
+ {
|
|
+ Block block = chunk.getType(x - cx, y, z - cz );
|
|
+ if ( block != null )
|
|
+ {
|
|
+ block.a( this, x, y, z, axisalignedbb, this.L, entity );
|
|
+ }
|
|
}
|
|
-
|
|
- block.a(this, k1, i2, l1, axisalignedbb, this.L, entity);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
+ // Spigot end
|
|
|
|
double d0 = 0.25D;
|
|
List list = this.getEntities(entity, axisalignedbb.grow(d0, d0, d0));
|
|
--
|
|
1.9.1
|
|
|