diff options
author | Aikar <[email protected]> | 2019-03-29 02:51:08 -0400 |
---|---|---|
committer | Aikar <[email protected]> | 2019-03-29 03:38:23 -0400 |
commit | f4f4396f0e00366a023ac9ba077f743333fb66ff (patch) | |
tree | 9a1423ae506f13deff72a33720fcbcf7e2102551 /Spigot-Server-Patches | |
parent | 27c32b9344f70bc17d8e910a3c4eb9e9021cb5a0 (diff) | |
download | Paper-f4f4396f0e00366a023ac9ba077f743333fb66ff.tar.gz Paper-f4f4396f0e00366a023ac9ba077f743333fb66ff.zip |
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
Diffstat (limited to 'Spigot-Server-Patches')
-rw-r--r-- | Spigot-Server-Patches/0330-Cache-World-Entity-Type-counts.patch | 29 | ||||
-rw-r--r-- | Spigot-Server-Patches/0373-Add-sun-related-API.patch | 10 |
2 files changed, 30 insertions, 9 deletions
diff --git a/Spigot-Server-Patches/0330-Cache-World-Entity-Type-counts.patch b/Spigot-Server-Patches/0330-Cache-World-Entity-Type-counts.patch index 1e5d5380b0..bf1643f181 100644 --- a/Spigot-Server-Patches/0330-Cache-World-Entity-Type-counts.patch +++ b/Spigot-Server-Patches/0330-Cache-World-Entity-Type-counts.patch @@ -1,4 +1,4 @@ -From 4b037a6ff610d3f9552b7f9e348d02ca470b97da Mon Sep 17 00:00:00 2001 +From d0ac0272da649db7ffd5c1edec1356600a145029 Mon Sep 17 00:00:00 2001 From: Colin Godsey <[email protected]> Date: Wed, 8 Aug 2018 10:10:06 -0600 Subject: [PATCH] Cache World Entity Type counts @@ -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 +1,121 @@ @@ -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 +@@ -259,6 +259,7 @@ 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 @@ -45,7 +45,8 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc @@ -212,6 +224,15 @@ 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 +@@ -2423,7 +2428,7 @@ 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; + } + } -- 2.21.0 diff --git a/Spigot-Server-Patches/0373-Add-sun-related-API.patch b/Spigot-Server-Patches/0373-Add-sun-related-API.patch index 5bde4d4b91..6c9b4abdc0 100644 --- a/Spigot-Server-Patches/0373-Add-sun-related-API.patch +++ b/Spigot-Server-Patches/0373-Add-sun-related-API.patch @@ -1,14 +1,14 @@ -From 9ea7c799dd3324001490189303392b36d4e89f10 Mon Sep 17 00:00:00 2001 +From d8da756f4792ecdda39669d0407a4d76e60cbc21 Mon Sep 17 00:00:00 2001 From: BillyGalbreath <[email protected]> Date: Sun, 7 Oct 2018 00:54:21 -0500 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 -@@ -1287,6 +1287,7 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -1288,6 +1288,7 @@ public abstract class EntityInsentient extends EntityLiving { return flag; } @@ -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 @@ -829,6 +829,7 @@ 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 @@ -538,6 +538,12 @@ public class CraftWorld implements World { |