Merge branch 'master' into pre/1.13

This commit is contained in:
Zach Brown 2018-07-31 16:44:46 -05:00
commit db81205dd7
No known key found for this signature in database
GPG Key ID: CC9DA35FC5450B76
2 changed files with 21 additions and 13 deletions

View File

@ -1,4 +1,4 @@
From 711c9c234823b69b6c3833b270619973c47a3f21 Mon Sep 17 00:00:00 2001
From 121f02ef0dd8b89d16f5abef8e779bb658f98c10 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 28 Jul 2018 12:18:27 -0400
Subject: [PATCH] Ignore Dead Entities in entityList iteration
@ -35,10 +35,18 @@ index 785c31089..6b0ca4eb9 100644
public float length;
public float J;
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index f8458a2b4..ece187129 100644
index f8458a2b4..60a2729ad 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1141,6 +1141,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -1076,6 +1076,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
}
entity.valid = true; // CraftBukkit
+ entity.shouldBeRemoved = false; // Paper - shouldn't be removed after being re-added
new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid
}
@@ -1141,6 +1142,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
if (entity.inChunk && this.isChunkLoaded(i, j, true)) {
this.getChunkAt(i, j).b(entity);
}
@ -46,7 +54,7 @@ index f8458a2b4..ece187129 100644
if (!guardEntityList) { // Spigot - It will get removed after the tick if we are ticking // Paper - always remove from current chunk above
// CraftBukkit start - Decrement loop variable field if we've already ticked this entity
@@ -2348,6 +2349,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -2348,6 +2350,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@ -54,7 +62,7 @@ index f8458a2b4..ece187129 100644
if (oclass.isAssignableFrom(entity.getClass()) && predicate.test((T) entity)) {
arraylist.add(entity);
@@ -2434,6 +2436,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -2434,6 +2437,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();

View File

@ -1,11 +1,11 @@
From ca8a816fa3bfdbceda39eb992b4e29cca55bea8d Mon Sep 17 00:00:00 2001
From c9e6dd33ed8c202f81aaddcfe777e9e7bfcaba3b Mon Sep 17 00:00:00 2001
From: willies952002 <admin@domnian.com>
Date: Mon, 30 Jul 2018 02:42:49 -0400
Subject: [PATCH] World EntityHuman Lookup Optimizations
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index ece187129..b76135cb0 100644
index 60a2729ad..c2b9d60f8 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -79,6 +79,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@ -25,7 +25,7 @@ index ece187129..b76135cb0 100644
this.everyoneSleeping();
}
@@ -1101,6 +1104,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -1102,6 +1105,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
entity.die();
if (entity instanceof EntityHuman) {
this.players.remove(entity);
@ -33,7 +33,7 @@ index ece187129..b76135cb0 100644
// Spigot start
for ( Object o : worldMaps.d )
{
@@ -1131,6 +1135,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -1132,6 +1136,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
entity.die();
if (entity instanceof EntityHuman) {
this.players.remove(entity);
@ -41,7 +41,7 @@ index ece187129..b76135cb0 100644
this.everyoneSleeping();
}
@@ -2659,6 +2664,8 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -2660,6 +2665,8 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@Nullable
public EntityHuman a(String s) {
@ -50,7 +50,7 @@ index ece187129..b76135cb0 100644
for (int i = 0; i < this.players.size(); ++i) {
EntityHuman entityhuman = (EntityHuman) this.players.get(i);
@@ -2668,10 +2675,15 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -2669,10 +2676,15 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
}
return null;
@ -66,7 +66,7 @@ index ece187129..b76135cb0 100644
for (int i = 0; i < this.players.size(); ++i) {
EntityHuman entityhuman = (EntityHuman) this.players.get(i);
@@ -2681,6 +2693,10 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -2682,6 +2694,10 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
}
return null;
@ -78,5 +78,5 @@ index ece187129..b76135cb0 100644
public void checkSession() throws ExceptionWorldConflict {
--
2.18.0
2.17.1