summaryrefslogtreecommitdiffstats
path: root/nms-patches/World.patch
diff options
context:
space:
mode:
authorThinkofdeath <thinkofdeath@spigotmc.org>2015-03-08 00:44:47 +0000
committerThinkofdeath <thinkofdeath@spigotmc.org>2015-03-08 00:44:47 +0000
commit21f6ee1f627245705a9741d1665dffef833ad232 (patch)
tree3e0bcb7926fe7b90d7a78ec7fd2be2599505c5b2 /nms-patches/World.patch
parent1e56438ac05041e43b374a9fd38461716d4ac1fc (diff)
downloadcraftbukkit-21f6ee1f627245705a9741d1665dffef833ad232.tar
craftbukkit-21f6ee1f627245705a9741d1665dffef833ad232.tar.gz
craftbukkit-21f6ee1f627245705a9741d1665dffef833ad232.tar.lz
craftbukkit-21f6ee1f627245705a9741d1665dffef833ad232.tar.xz
craftbukkit-21f6ee1f627245705a9741d1665dffef833ad232.zip
SPIGOT-644: Attempt to fix a long standing issue by limiting the range of getEntities
Diffstat (limited to 'nms-patches/World.patch')
-rw-r--r--nms-patches/World.patch36
1 files changed, 25 insertions, 11 deletions
diff --git a/nms-patches/World.patch b/nms-patches/World.patch
index 9cc00ba8..aab5c2dc 100644
--- a/nms-patches/World.patch
+++ b/nms-patches/World.patch
@@ -1,5 +1,5 @@
---- /home/matt/mc-dev-private//net/minecraft/server/World.java 2015-02-26 22:40:23.215608133 +0000
-+++ src/main/java/net/minecraft/server/World.java 2015-02-26 22:40:23.219608133 +0000
+--- /home/matt/mc-dev-private//net/minecraft/server/World.java 2015-03-08 00:44:40.231645140 +0000
++++ src/main/java/net/minecraft/server/World.java 2015-03-08 00:44:40.239645140 +0000
@@ -13,6 +13,22 @@
import java.util.UUID;
import java.util.concurrent.Callable;
@@ -496,7 +496,21 @@
return false;
} else {
int i = 0;
-@@ -2042,7 +2295,7 @@
+@@ -2024,6 +2277,13 @@
+ int k = MathHelper.floor((axisalignedbb.c - 2.0D) / 16.0D);
+ int l = MathHelper.floor((axisalignedbb.f + 2.0D) / 16.0D);
+
++ // CraftBukkit start - filter out large ranges
++ if (j - i > 10 || l - k > 10) {
++ getServer().getLogger().log(java.util.logging.Level.WARNING, "Filtered out large getEntities call {0},{1} {2},{3}", new Object[]{i, j, k, j});
++ return arraylist;
++ }
++ // CraftBukkit end
++
+ for (int i1 = i; i1 <= j; ++i1) {
+ for (int j1 = k; j1 <= l; ++j1) {
+ if (this.isChunkLoaded(i1, j1, true)) {
+@@ -2042,7 +2302,7 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -505,7 +519,7 @@
arraylist.add(entity);
}
}
-@@ -2057,7 +2310,7 @@
+@@ -2057,7 +2317,7 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -514,7 +528,7 @@
arraylist.add(entity);
}
}
-@@ -2105,7 +2358,7 @@
+@@ -2105,7 +2365,7 @@
}
}
@@ -523,7 +537,7 @@
}
public Entity a(int i) {
-@@ -2125,8 +2378,17 @@
+@@ -2125,8 +2385,17 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -543,7 +557,7 @@
++i;
}
}
-@@ -2135,12 +2397,18 @@
+@@ -2135,12 +2404,18 @@
}
public void b(Collection<Entity> collection) {
@@ -563,7 +577,7 @@
this.a(entity);
}
-@@ -2154,7 +2422,13 @@
+@@ -2154,7 +2429,13 @@
Block block1 = this.getType(blockposition).getBlock();
AxisAlignedBB axisalignedbb = flag ? null : block.a(this, blockposition, block.getBlockData());
@@ -578,7 +592,7 @@
}
public int F() {
-@@ -2253,6 +2527,11 @@
+@@ -2253,6 +2534,11 @@
for (int i = 0; i < this.players.size(); ++i) {
EntityHuman entityhuman1 = (EntityHuman) this.players.get(i);
@@ -590,7 +604,7 @@
if (IEntitySelector.d.apply(entityhuman1)) {
double d5 = entityhuman1.e(d0, d1, d2);
-@@ -2369,6 +2648,16 @@
+@@ -2369,6 +2655,16 @@
public void everyoneSleeping() {}
@@ -607,7 +621,7 @@
public float h(float f) {
return (this.q + (this.r - this.q) * f) * this.j(f);
}
-@@ -2592,6 +2881,6 @@
+@@ -2592,6 +2888,6 @@
int l = j * 16 + 8 - blockposition.getZ();
short short0 = 128;