13
0
geforkt von Mirrors/Paper

Restore vanilla behavior of mob counts for persistent mobs

Now decounts entities that got name tagged or persistent state changed.

Removes a bad CB check that ignored some persistent mobs persistence state.

Vanilla code explicitly only cares 'is this mob persistent?' and if
it is, it is not counted. CB should not of been checking its type state.

Fixes #1922
Dieser Commit ist enthalten in:
Aikar 2019-03-29 02:51:08 -04:00
Ursprung fbe06222c4
Commit b306372426
2 geänderte Dateien mit 27 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add sun related API
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index ee5078370..3059682a4 100644
index 693973e97..d1e70931e 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving {
@ -17,7 +17,7 @@ index ee5078370..3059682a4 100644
if (this.world.L() && !this.world.isClientSide) {
float f = this.az();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index e88e265bf..d9006a2d6 100644
index bde8ad29b..0f34b4163 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@ -29,7 +29,7 @@ index e88e265bf..d9006a2d6 100644
return this.G < 4;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index b5a87cfaf..e33135ada 100644
index eacecccfd..7c0a53053 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -0,0 +0,0 @@ public class CraftWorld implements World {

Datei anzeigen

@ -7,7 +7,7 @@ Optimizes mob spawning by keeping a count of entities by type
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldEntityList.java b/src/main/java/com/destroystokyo/paper/PaperWorldEntityList.java
new file mode 100644
index 000000000..a10a5bc13
index 000000000..d3e6c9e74
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldEntityList.java
@@ -0,0 +0,0 @@
@ -107,7 +107,7 @@ index 000000000..a10a5bc13
+
+ if (entity instanceof EntityInsentient) {
+ EntityInsentient entityinsentient = (EntityInsentient) entity;
+ if (amt > 0 && entityinsentient.isTypeNotPersistent() && entityinsentient.isPersistent()) {
+ if (amt > 0 && entityinsentient.isPersistent()) {
+ return;
+ }
+ }
@ -144,6 +144,18 @@ index 2d2edbd33..47d3609c3 100644
public float width;
public float length;
public float J;
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index ee5078370..693973e97 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving {
public void tick() {
super.tick();
+ if (hasBeenCounted == this.isPersistent()) this.world.entityList.updateEntityCount(this, hasBeenCounted ? -1 : 1); // Paper - adjust count if persistence state changes
if (!this.world.isClientSide) {
this.dl();
if (this.ticksLived % 5 == 0) {
diff --git a/src/main/java/net/minecraft/server/EnumCreatureType.java b/src/main/java/net/minecraft/server/EnumCreatureType.java
index 79e52f7ba..42f6a6a93 100644
--- a/src/main/java/net/minecraft/server/EnumCreatureType.java
@ -171,7 +183,7 @@ index e62616552..bfbe4d3e3 100644
if (l1 <= k) {
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index bd8d9ef48..c25c82bf1 100644
index bd8d9ef48..80bf95028 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@ -212,4 +224,13 @@ index bd8d9ef48..c25c82bf1 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
@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
// CraftBukkit start - Split out persistent check, don't apply it to special persistent mobs
if (entity instanceof EntityInsentient) {
EntityInsentient entityinsentient = (EntityInsentient) entity;
- if (entityinsentient.isTypeNotPersistent() && entityinsentient.isPersistent()) {
+ if (/*entityinsentient.isTypeNotPersistent() && */ entityinsentient.isPersistent()) { // Paper - while this code is inused, remove isTypeNotPersistent() as vanilla does not check that. Patch this method incase anything reflects into it.
continue;
}
}
--