3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 11:00:06 +01:00

Multitude of changes to attempt to fix #1199

Dieser Commit ist enthalten in:
Aikar 2018-07-12 16:42:56 -04:00
Ursprung 73b214a515
Commit db4ecc9d9d
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 401ADFC9891FAAFE
12 geänderte Dateien mit 67 neuen und 48 gelöschten Zeilen

Datei anzeigen

@ -1,4 +1,4 @@
From 3fbe4af7bcafee200f8492e070b8ea2d98a00181 Mon Sep 17 00:00:00 2001 From 12051b946e1a2fbe7faba1a7011db4dd05b3e727 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Wed, 4 Jul 2018 02:10:36 -0400 Date: Wed, 4 Jul 2018 02:10:36 -0400
Subject: [PATCH] Store reference to current Chunk for Entity and Block Subject: [PATCH] Store reference to current Chunk for Entity and Block
@ -81,25 +81,30 @@ index 4bbebb25a..68008fe6a 100644
} }
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 3a8902bf1..f7750a05c 100644 index 3a8902bf1..f140d5e28 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1703,6 +1703,19 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -1703,6 +1703,24 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
} }
// Paper start // Paper start
+ private java.lang.ref.WeakReference<Chunk> currentChunk = null; + private java.lang.ref.WeakReference<Chunk> currentChunk = null;
+ public Chunk getCurrentChunk() { + public Chunk getCurrentChunk() {
+ final Chunk chunk = currentChunk != null ? currentChunk.get() : null; + final Chunk chunk = currentChunk != null ? currentChunk.get() : null;
+ final int cx = getChunkX(); + return chunk != null && chunk.isLoaded() ? chunk : null;
+ final int cz = getChunkZ();
+ if (chunk != null && chunk.isLoaded() && chunk.locX == cx && chunk.locZ == cz) {
+ return chunk;
+ }
+ return world.getChunkIfLoaded(cx, cz);
+ } + }
+ public void setCurrentChunk(Chunk chunk) { + public void setCurrentChunk(Chunk chunk) {
+ this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null; + this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null;
+ }
+ public Chunk getCurrentChunkAt(int x, int z) {
+ if (getChunkX() == x && getChunkZ() == z) {
+ return getCurrentChunk();
+ } else {
+ return world.getChunkIfLoaded(x, z);
+ }
+ }
+ public Chunk getChunkAtLocation() {
+ return getCurrentChunkAt((int)Math.floor(locX) >> 4, (int)Math.floor(locZ) >> 4);
+ } + }
public final MinecraftKey entityKey = EntityTypes.getKey(this); public final MinecraftKey entityKey = EntityTypes.getKey(this);
public final String entityKeyString = entityKey != null ? entityKey.toString() : null; public final String entityKeyString = entityKey != null ? entityKey.toString() : null;

Datei anzeigen

@ -1,4 +1,4 @@
From 63c7daaef2f42d527197a8df4878ed44813ad87f Mon Sep 17 00:00:00 2001 From 16ff74ebe1e80730259a60e6803bad44733cb728 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net> From: Byteflux <byte@byteflux.net>
Date: Tue, 1 Mar 2016 14:14:15 -0600 Date: Tue, 1 Mar 2016 14:14:15 -0600
Subject: [PATCH] Drop falling block and tnt entities at the specified height Subject: [PATCH] Drop falling block and tnt entities at the specified height
@ -24,10 +24,10 @@ index 0094d1a87..4da846719 100644
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 9d7fe97ce..c7513622e 100644 index 05aad7dd0..bee8e632a 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1775,6 +1775,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -1780,6 +1780,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
return this.a(new ItemStack(item, i, 0), f); return this.a(new ItemStack(item, i, 0), f);
} }

Datei anzeigen

@ -1,11 +1,11 @@
From 6254651ac3eeee042d9b4f6b1aabca609f242122 Mon Sep 17 00:00:00 2001 From 5ad883e113f3989db0ce7fdb198f9b1990955142 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net> From: Byteflux <byte@byteflux.net>
Date: Tue, 1 Mar 2016 23:45:08 -0600 Date: Tue, 1 Mar 2016 23:45:08 -0600
Subject: [PATCH] Entity Origin API Subject: [PATCH] Entity Origin API
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index c7513622e..72efe282b 100644 index bee8e632a..7f66f7579 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -149,6 +149,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -149,6 +149,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@ -42,7 +42,7 @@ index c7513622e..72efe282b 100644
} catch (Throwable throwable) { } catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT"); CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
@@ -1737,6 +1750,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -1742,6 +1755,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
protected abstract void b(NBTTagCompound nbttagcompound); protected abstract void b(NBTTagCompound nbttagcompound);

Datei anzeigen

@ -1,4 +1,4 @@
From 427ed2e030aab48f93a55b805946fa07fba593ae Mon Sep 17 00:00:00 2001 From bb523c50d224b2ed674f592b66fb3bf6195269dc Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Tue, 8 Mar 2016 23:25:45 -0500 Date: Tue, 8 Mar 2016 23:25:45 -0500
Subject: [PATCH] Disable Scoreboards for non players by default Subject: [PATCH] Disable Scoreboards for non players by default
@ -37,10 +37,10 @@ index ec9a87239..b08274d93 100644
if (scoreboard.addPlayerToTeam(s2, s)) { if (scoreboard.addPlayerToTeam(s2, s)) {
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index a4c5b780c..c620667e0 100644 index 158ee9e37..0e761997c 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2104,6 +2104,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -2109,6 +2109,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@Nullable @Nullable
public ScoreboardTeamBase aY() { public ScoreboardTeamBase aY() {

Datei anzeigen

@ -1,4 +1,4 @@
From 9a662f1a253d481005f4318fd6db8deda65a553b Mon Sep 17 00:00:00 2001 From 615a75652424409cc5f097ea1cb71ce13ec4fb86 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Tue, 22 Mar 2016 00:55:23 -0400 Date: Tue, 22 Mar 2016 00:55:23 -0400
Subject: [PATCH] Don't teleport dead entities Subject: [PATCH] Don't teleport dead entities
@ -7,10 +7,10 @@ Had some issue with this in past, and this is the vanilla logic.
Potentially an old CB change that's no longer needed. Potentially an old CB change that's no longer needed.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 843cb3a61..89ea217b9 100644 index b3eea4337..13035574e 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2380,7 +2380,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -2385,7 +2385,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
} }
public Entity teleportTo(Location exit, boolean portal) { public Entity teleportTo(Location exit, boolean portal) {

Datei anzeigen

@ -1,4 +1,4 @@
From e90027b47608f6153ad3d0321ec2799077d3b0b7 Mon Sep 17 00:00:00 2001 From 6b6bfc5c1d44feb7485d3e330c02983211794352 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com> From: Zach Brown <zach.brown@destroystokyo.com>
Date: Wed, 6 Apr 2016 01:04:23 -0500 Date: Wed, 6 Apr 2016 01:04:23 -0500
Subject: [PATCH] Option to use vanilla per-world scoreboard coloring on names Subject: [PATCH] Option to use vanilla per-world scoreboard coloring on names
@ -19,10 +19,10 @@ index abc1aabdd..6ea608ba9 100644
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 89ea217b9..437ae2fa3 100644 index 13035574e..8f47ffd47 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2103,6 +2103,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -2108,6 +2108,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
return this.getFlag(5); return this.getFlag(5);
} }

Datei anzeigen

@ -1,11 +1,11 @@
From 4b24d8aeee60f407bd9917d39f49188526338a26 Mon Sep 17 00:00:00 2001 From 577bace6c1eef300fd2970de0a10a377afe6e1ac Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com> From: Zach Brown <zach.brown@destroystokyo.com>
Date: Fri, 22 Apr 2016 18:20:05 -0500 Date: Fri, 22 Apr 2016 18:20:05 -0500
Subject: [PATCH] Vehicle Event Cancellation Changes Subject: [PATCH] Vehicle Event Cancellation Changes
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 437ae2fa3..17ec10c26 100644 index 8f47ffd47..41fca4118 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -70,7 +70,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -70,7 +70,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@ -17,7 +17,7 @@ index 437ae2fa3..17ec10c26 100644
public boolean attachedToPlayer; public boolean attachedToPlayer;
public World world; public World world;
public double lastX; public double lastX;
@@ -1985,6 +1985,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -1990,6 +1990,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)"); throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
} else { } else {
// CraftBukkit start // CraftBukkit start
@ -25,7 +25,7 @@ index 437ae2fa3..17ec10c26 100644
CraftEntity craft = (CraftEntity) entity.getBukkitEntity().getVehicle(); CraftEntity craft = (CraftEntity) entity.getBukkitEntity().getVehicle();
Entity orig = craft == null ? null : craft.getHandle(); Entity orig = craft == null ? null : craft.getHandle();
if (getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) { if (getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) {
@@ -2000,7 +2001,13 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -2005,7 +2006,13 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
} }
} }
// CraftBukkit end // CraftBukkit end

Datei anzeigen

@ -1,4 +1,4 @@
From 1975e598adb294c806ff4b0699ba67178cbce3ad Mon Sep 17 00:00:00 2001 From 03dc46a921790b6f0fabdb28969547a4af7e7954 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com> From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sun, 22 May 2016 20:20:55 -0500 Date: Sun, 22 May 2016 20:20:55 -0500
Subject: [PATCH] Optional TNT doesn't move in water Subject: [PATCH] Optional TNT doesn't move in water
@ -32,7 +32,7 @@ index 067cb233e..06acdaaf0 100644
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index e860e9c6a..a52cd0728 100644 index b6b4b581b..e77a3b2ab 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1114,6 +1114,11 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -1114,6 +1114,11 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@ -47,7 +47,7 @@ index e860e9c6a..a52cd0728 100644
if (this.bJ() instanceof EntityBoat) { if (this.bJ() instanceof EntityBoat) {
this.inWater = false; this.inWater = false;
} else if (this.world.a(this.getBoundingBox().grow(0.0D, -0.4000000059604645D, 0.0D).shrink(0.001D), Material.WATER, this)) { } else if (this.world.a(this.getBoundingBox().grow(0.0D, -0.4000000059604645D, 0.0D).shrink(0.001D), Material.WATER, this)) {
@@ -2568,6 +2573,11 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -2573,6 +2578,11 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
} }
public boolean bo() { public boolean bo() {

Datei anzeigen

@ -1,4 +1,4 @@
From 68fbc7785fd609e258aa6084639d6206a3cef286 Mon Sep 17 00:00:00 2001 From 3da653ac5594ecd2407621dc2d303c63816df5a4 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Tue, 27 Dec 2016 22:38:06 -0500 Date: Tue, 27 Dec 2016 22:38:06 -0500
Subject: [PATCH] Activation Range Improvements Subject: [PATCH] Activation Range Improvements
@ -96,7 +96,7 @@ index e5b5e9887..e3781f3a8 100644
} }
} }
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index b79bf70f0..b1536e1c5 100644 index b79bf70f0..33ae73890 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java --- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -20,6 +20,7 @@ import net.minecraft.server.EntityFireball; @@ -20,6 +20,7 @@ import net.minecraft.server.EntityFireball;
@ -140,12 +140,26 @@ index b79bf70f0..b1536e1c5 100644
if ( entity instanceof EntityAnimal ) if ( entity instanceof EntityAnimal )
{ {
EntityAnimal animal = (EntityAnimal) entity; EntityAnimal animal = (EntityAnimal) entity;
@@ -278,7 +290,7 @@ public class ActivationRange @@ -251,7 +263,7 @@ public class ActivationRange
int x = MathHelper.floor( entity.locX ); {
int z = MathHelper.floor( entity.locZ ); // Never safe to skip fireworks or entities not yet added to chunk
// PAIL: inChunk - boolean under datawatchers
- if ( !entity.aa || entity instanceof EntityFireworks ) {
+ if ( !entity.isAddedToChunk() || entity instanceof EntityFireworks ) { // Paper (use obf helper)
return true;
}
@@ -275,10 +287,10 @@ public class ActivationRange
{
isActive = false;
}
- int x = MathHelper.floor( entity.locX );
- int z = MathHelper.floor( entity.locZ );
+ //int x = MathHelper.floor( entity.locX ); // Paper
+ //int z = MathHelper.floor( entity.locZ ); // Paper
// Make sure not on edge of unloaded chunk // Make sure not on edge of unloaded chunk
- Chunk chunk = entity.world.getChunkIfLoaded( x >> 4, z >> 4 ); - Chunk chunk = entity.world.getChunkIfLoaded( x >> 4, z >> 4 );
+ Chunk chunk = entity.getCurrentChunk(); // Paper + Chunk chunk = entity.getChunkAtLocation(); // Paper
if ( isActive && !( chunk != null && chunk.areNeighborsLoaded( 1 ) ) ) if ( isActive && !( chunk != null && chunk.areNeighborsLoaded( 1 ) ) )
{ {
isActive = false; isActive = false;

Datei anzeigen

@ -1,14 +1,14 @@
From 3fa934b4f3d9456a4d9aa78bd013f5d0232dd929 Mon Sep 17 00:00:00 2001 From 06dc5de21c577e7757f5e38cbc88062fb62158c9 Mon Sep 17 00:00:00 2001
From: Alfie Cleveland <alfeh@me.com> From: Alfie Cleveland <alfeh@me.com>
Date: Sun, 8 Jan 2017 04:31:36 +0000 Date: Sun, 8 Jan 2017 04:31:36 +0000
Subject: [PATCH] Don't allow entities to ride themselves - #572 Subject: [PATCH] Don't allow entities to ride themselves - #572
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 64e566d3a..f75d57c30 100644 index e4b45f2c7..8fbef57cc 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1962,6 +1962,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -1967,6 +1967,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
} }
protected void o(Entity entity) { protected void o(Entity entity) {

Datei anzeigen

@ -1,4 +1,4 @@
From 24da81e684f7d7c01c3b5e6053899d60668157c1 Mon Sep 17 00:00:00 2001 From 1fc278e5919f7644bd12ebb0eb81039c27faa37e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sun, 10 Jun 2018 20:04:42 -0400 Date: Sun, 10 Jun 2018 20:04:42 -0400
Subject: [PATCH] Properly remove entities on dimension teleport Subject: [PATCH] Properly remove entities on dimension teleport
@ -22,10 +22,10 @@ requirement, but plugins (such as my own) use this method to
trigger a "reload" of the entity on the client. trigger a "reload" of the entity on the client.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 9f2db9025..a96cdcbc6 100644 index b61927c99..eff84f812 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2430,7 +2430,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -2435,7 +2435,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
} }
// CraftBukkit end */ // CraftBukkit end */

Datei anzeigen

@ -1,4 +1,4 @@
From 2d1fee2dfb5ead97bc5af3ad7b86158993a65fdf Mon Sep 17 00:00:00 2001 From 855c50b43725ac1167d2735d0d0b0b60de73499f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Wed, 4 Jul 2018 03:39:51 -0400 Date: Wed, 4 Jul 2018 03:39:51 -0400
Subject: [PATCH] Avoid Chunk Lookups for Entity/TileEntity Current Chunk Subject: [PATCH] Avoid Chunk Lookups for Entity/TileEntity Current Chunk
@ -22,7 +22,7 @@ index 3e80825f7..4a94fd5a6 100644
this.a(entity, entity.ac); this.a(entity, entity.ac);
} }
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index c0816b9f8..33ac57e6b 100644 index c0816b9f8..52adee880 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -1511,12 +1511,15 @@ public abstract class World implements IBlockAccess { @@ -1511,12 +1511,15 @@ public abstract class World implements IBlockAccess {
@ -37,7 +37,7 @@ index c0816b9f8..33ac57e6b 100644
this.getChunkAt(k, j).b(e); this.getChunkAt(k, j).b(e);
- } - }
+ }*/ + }*/
+ Chunk chunk = e.getCurrentChunk(); + Chunk chunk = e.isAddedToChunk() ? e.getCurrentChunk() : null;
+ if (chunk != null) chunk.removeEntity(e); + if (chunk != null) chunk.removeEntity(e);
} }
@ -56,7 +56,7 @@ index c0816b9f8..33ac57e6b 100644
this.getChunkAt(j, l).b(entity); this.getChunkAt(j, l).b(entity);
- } - }
+ }*/ + }*/
+ Chunk chunk = entity.getCurrentChunk(); + Chunk chunk = entity.isAddedToChunk() ? entity.getCurrentChunk() : null;
+ if (chunk != null) chunk.removeEntity(entity); + if (chunk != null) chunk.removeEntity(entity);
+ // Paper end + // Paper end
@ -86,5 +86,5 @@ index c0816b9f8..33ac57e6b 100644
} }
} }
-- --
2.17.1 2.18.0