Merge branch 'master' into pre/1.13

* master:
  Don't process despawn if entity is in a chunk scheduled for unload
  Fix Squids corrupting the entire servers entity randomness....
  Fix placement of chunk tracking - Fixes #1199
This commit is contained in:
Aikar 2018-07-19 01:46:11 -04:00
commit dc1b407c7d
No known key found for this signature in database
GPG key ID: 401ADFC9891FAAFE
4 changed files with 108 additions and 0 deletions

View file

@ -0,0 +1,22 @@
From ae198e0c01788ecbf9eee5d0602ddd9393f41b7c Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 19 Jul 2018 01:05:00 -0400
Subject: [PATCH] Don't change the Entity Random seed for squids
diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java
index 58a902831..2d8cfb012 100644
--- a/src/main/java/net/minecraft/server/EntitySquid.java
+++ b/src/main/java/net/minecraft/server/EntitySquid.java
@@ -22,7 +22,7 @@ public class EntitySquid extends EntityWaterAnimal {
public EntitySquid(World world) {
super(world);
this.setSize(0.8F, 0.8F);
- this.random.setSeed((long) (1 + this.getId()));
+ //this.random.setSeed((long) (1 + this.getId())); // Paper
this.bB = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
}
--
2.18.0

View file

@ -0,0 +1,35 @@
From 5bcdb8659896fe78904ecdd15d38ea2a483204d0 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 19 Jul 2018 01:08:05 -0400
Subject: [PATCH] Re-add vanilla entity warnings for duplicates
These are a critical sign that somethin went wrong, and you've lost some data....
We should kind of know about these things you know.
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 9fe5c4406..dd78a87b2 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1159,7 +1159,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
private boolean j(Entity entity) {
if (entity.dead) {
- // WorldServer.a.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.a(entity)); // CraftBukkit
+ WorldServer.a.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.a(entity)); // CraftBukkit // Paper
return false;
} else {
UUID uuid = entity.getUniqueID();
@@ -1171,7 +1171,8 @@ public class WorldServer extends World implements IAsyncTaskHandler {
this.f.remove(entity1);
} else {
if (!(entity instanceof EntityHuman)) {
- // WorldServer.a.warn("Keeping entity {} that already exists with UUID {}", EntityTypes.a(entity1), uuid.toString()); // CraftBukkit
+ WorldServer.a.error("Keeping entity {} that already exists with UUID {} - " + entity1, EntityTypes.a(entity1), uuid.toString()); // CraftBukkit // Paper
+ WorldServer.a.error("Deleting duplicate entity {}", entity); // Paper
return false;
}
--
2.18.0

View file

@ -0,0 +1,22 @@
From 9b99af87d227e67cfc13b271b7b1b9d6dc37e45c Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 19 Jul 2018 01:13:28 -0400
Subject: [PATCH] add uuid to Entity.toString()
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index d03e7c24f..fe1ccba8d 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2348,7 +2348,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
}
public String toString() {
- return String.format("%s[\'%s\'/%d, l=\'%s\', x=%.2f, y=%.2f, z=%.2f]", new Object[] { this.getClass().getSimpleName(), this.getName(), Integer.valueOf(this.id), this.world == null ? "~NULL~" : this.world.getWorldData().getName(), Double.valueOf(this.locX), Double.valueOf(this.locY), Double.valueOf(this.locZ)});
+ return String.format("%s[\'%s\'/%d, uuid=\'%s\', l=\'%s\', x=%.2f, y=%.2f, z=%.2f]", new Object[] { this.getClass().getSimpleName(), this.getName(), Integer.valueOf(this.id), this.uniqueID.toString(), this.world == null ? "~NULL~" : this.world.getWorldData().getName(), Double.valueOf(this.locX), Double.valueOf(this.locY), Double.valueOf(this.locZ)}); // Paper - add UUID
}
public boolean isInvulnerable(DamageSource damagesource) {
--
2.18.0

View file

@ -0,0 +1,29 @@
From 4b0d74a924803d09ea2ba1e95f38afc4de96d86f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 19 Jul 2018 01:23:00 -0400
Subject: [PATCH] Don't process despawn if entity is in a chunk scheduled for
unload
This won't happen anyways if the user has
"skip ticking for entities in chunks scheduled for unload" turned on,
but if they don't, protect from this instant killing the entity to
keep it vanilla in behavior
a player may teleport away, and trigger instant despawn
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 89e878365..d6a1933ad 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -628,6 +628,8 @@ public abstract class EntityInsentient extends EntityLiving {
if (this.persistent) {
this.ticksFarFromPlayer = 0;
} else {
+ Chunk currentChunk = getChunkAtLocation(); // Paper
+ if (currentChunk != null && (currentChunk.isUnloading() || currentChunk.scheduledForUnload != null)) return; // Paper
EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D);
if (entityhuman != null && entityhuman.affectsSpawning) { // Paper - Affects Spawning API
--
2.18.0