diff options
Diffstat (limited to 'patches/server/0997-Entity-Activation-Range-2.0.patch')
-rw-r--r-- | patches/server/0997-Entity-Activation-Range-2.0.patch | 43 |
1 files changed, 9 insertions, 34 deletions
diff --git a/patches/server/0997-Entity-Activation-Range-2.0.patch b/patches/server/0997-Entity-Activation-Range-2.0.patch index 4710fe8474..f181d771a3 100644 --- a/patches/server/0997-Entity-Activation-Range-2.0.patch +++ b/patches/server/0997-Entity-Activation-Range-2.0.patch @@ -17,62 +17,37 @@ Adds villagers as separate config public net.minecraft.world.entity.Entity isInsidePortal diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 978208f74b6f1d3f859165e951d41013a5f00256..1196eb573317ad01b6df0ae2d38aa17a72da2535 100644 +index a391ace656077cc1df48c07890f4eabd06a75143..fb1d88f7501e9b94249c0262c00ecf12c600ce99 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2,7 +2,6 @@ package net.minecraft.server.level; +@@ -1223,12 +1223,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. - import com.google.common.annotations.VisibleForTesting; - import co.aikar.timings.TimingHistory; // Paper --import co.aikar.timings.Timings; // Paper - import com.google.common.collect.Lists; - import com.mojang.datafixers.DataFixer; - import com.mojang.datafixers.util.Pair; -@@ -1235,17 +1234,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. - ++TimingHistory.entityTicks; // Paper - timings + public void tickNonPassenger(Entity entity) { // Spigot start - co.aikar.timings.Timing timer; // Paper - if (!org.spigotmc.ActivationRange.checkIfActive(entity)) { + /*if (!org.spigotmc.ActivationRange.checkIfActive(entity)) { // Paper - comment out - EAR 2, reimplement below entity.tickCount++; - timer = entity.getType().inactiveTickTimer.startTiming(); try { // Paper - timings entity.inactiveTick(); - } finally { timer.stopTiming(); } // Paper return; - } + }*/ // Paper - comment out EAR 2 // Spigot end - // Paper start- timings -- TimingHistory.activatedEntityTicks++; -- timer = entity.getVehicle() != null ? entity.getType().passengerTickTimer.startTiming() : entity.getType().tickTimer.startTiming(); + final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(entity); -+ timer = isActive ? entity.getType().tickTimer.startTiming() : entity.getType().inactiveTickTimer.startTiming(); // Paper - try { - // Paper end - timings entity.setOldPosAndRot(); -@@ -1256,9 +1255,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. + ProfilerFiller gameprofilerfiller = this.getProfiler(); + +@@ -1237,8 +1238,10 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString(); }); gameprofilerfiller.incrementCounter("tickNonPassenger"); + if (isActive) { // Paper - EAR 2 -+ TimingHistory.activatedEntityTicks++; entity.tick(); entity.postTick(); // CraftBukkit + } else { entity.inactiveTick(); } // Paper - EAR 2 this.getProfiler().pop(); -+ } finally { timer.stopTiming(); } // Paper - timings Iterator iterator = entity.getPassengers().iterator(); - while (iterator.hasNext()) { -@@ -1266,13 +1269,18 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. - - this.tickPassenger(entity, entity1); - } -- } finally { timer.stopTiming(); } // Paper - timings -+ // } finally { timer.stopTiming(); } // Paper - timings - move up - - } - +@@ -1253,6 +1256,11 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. private void tickPassenger(Entity vehicle, Entity passenger) { if (!passenger.isRemoved() && passenger.getVehicle() == vehicle) { if (passenger instanceof Player || this.entityTickList.contains(passenger)) { @@ -84,7 +59,7 @@ index 978208f74b6f1d3f859165e951d41013a5f00256..1196eb573317ad01b6df0ae2d38aa17a passenger.setOldPosAndRot(); ++passenger.tickCount; ProfilerFiller gameprofilerfiller = this.getProfiler(); -@@ -1281,8 +1289,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. +@@ -1261,8 +1269,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. return BuiltInRegistries.ENTITY_TYPE.getKey(passenger.getType()).toString(); }); gameprofilerfiller.incrementCounter("tickPassenger"); @@ -102,7 +77,7 @@ index 978208f74b6f1d3f859165e951d41013a5f00256..1196eb573317ad01b6df0ae2d38aa17a gameprofilerfiller.pop(); Iterator iterator = passenger.getPassengers().iterator(); -@@ -1292,6 +1309,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. +@@ -1272,6 +1289,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. this.tickPassenger(passenger, entity2); } |