diff --git a/gale-server/minecraft-patches/sources/net/minecraft/server/level/ServerLevel.java.patch b/gale-server/minecraft-patches/sources/net/minecraft/server/level/ServerLevel.java.patch index 0bbe62a9..9848f7f4 100644 --- a/gale-server/minecraft-patches/sources/net/minecraft/server/level/ServerLevel.java.patch +++ b/gale-server/minecraft-patches/sources/net/minecraft/server/level/ServerLevel.java.patch @@ -95,9 +95,12 @@ entity.totalEntityAge++; // Paper - age-like counter for all entities profiler.push(entity.typeHolder()::getRegisteredName); profiler.incrementCounter("tickNonPassenger"); -@@ -1423,7 +_,7 @@ +@@ -1421,9 +_,9 @@ + private void tickPassenger(final Entity vehicle, final Entity entity, final boolean isActive) { // Paper - EAR 2 + if (entity.isRemoved() || entity.getVehicle() != vehicle) { entity.stopRiding(); - } else if (entity instanceof Player || this.entityTickList.contains(entity)) { +- } else if (entity instanceof Player || this.entityTickList.contains(entity)) { ++ } else if (entity instanceof Player || entity.gale$eventDriven_isInTickList) { // Gale - Event-driven - Entity.isInTickList entity.setOldPosAndRot(); - entity.tickCount++; + entity.setTickCount(entity.tickCount + 1); // Gale - Event-driven - Cat.canRemoveWhenFarAway, Ocelot.canRemoveWhenFarAway diff --git a/gale-server/minecraft-patches/sources/net/minecraft/world/entity/Entity.java.patch b/gale-server/minecraft-patches/sources/net/minecraft/world/entity/Entity.java.patch index c098fe20..47c280d8 100644 --- a/gale-server/minecraft-patches/sources/net/minecraft/world/entity/Entity.java.patch +++ b/gale-server/minecraft-patches/sources/net/minecraft/world/entity/Entity.java.patch @@ -194,7 +194,7 @@ // CraftBukkit start - block invalid bounding boxes double minX = bb.minX, minY = bb.minY, -@@ -4718,13 +_,35 @@ +@@ -4718,13 +_,43 @@ } public int countPlayerPassengers() { @@ -231,6 +231,14 @@ + return this.gale$eventDriven_playerPassengerCount == 0; + } + // Gale end - Event-driven - Entity.playerPassengerCount ++ ++ // Gale start - Event-driven - Entity.isInTickList ++ public boolean gale$eventDriven_isInTickList; ++ ++ public void gale$eventDriven_isInTickList_set(boolean newValue) { ++ this.gale$eventDriven_isInTickList = newValue; ++ } ++ // Gale end - Event-driven - Entity.isInTickList public Entity getRootVehicle() { Entity result = this; diff --git a/gale-server/minecraft-patches/sources/net/minecraft/world/entity/Mob.java.patch b/gale-server/minecraft-patches/sources/net/minecraft/world/entity/Mob.java.patch index 8480bc13..4e9aea6c 100644 --- a/gale-server/minecraft-patches/sources/net/minecraft/world/entity/Mob.java.patch +++ b/gale-server/minecraft-patches/sources/net/minecraft/world/entity/Mob.java.patch @@ -55,7 +55,7 @@ return toEquip; } else { return ItemStack.EMPTY; -@@ -780,38 +_,187 @@ +@@ -780,38 +_,198 @@ return true; } @@ -206,7 +206,7 @@ + } + + private byte gale$eventDriven_checkDespawnPlayerTrackingMode_compute() { -+ if (this.gale$eventDriven_mustDespawnBecauseOfPeacefulDifficulty || this.gale$eventDriven_isPersistent || this.level().gale$eventDriven_affectsSpawningSelectorPlayerCount == 0) { ++ if (!this.gale$eventDriven_isInTickList || this.gale$eventDriven_mustDespawnBecauseOfPeacefulDifficulty || this.gale$eventDriven_isPersistent || this.level().gale$eventDriven_affectsSpawningSelectorPlayerCount == 0) { + return 0; + } else if (!this.gale$canRemoveWhenFarAway()) { + return 1; @@ -214,6 +214,15 @@ + return 2; + } + } ++ ++ @Override ++ public void gale$eventDriven_isInTickList_set(boolean newValue) { ++ boolean oldValue = this.gale$eventDriven_isInTickList; ++ if (oldValue != newValue) { ++ super.gale$eventDriven_isInTickList_set(newValue); ++ this.gale$eventDriven_checkDespawnPlayerTrackingMode_update(); ++ } ++ } + // Gale end - Optimize Mob.checkDespawn + @Override diff --git a/gale-server/minecraft-patches/sources/net/minecraft/world/level/entity/EntityTickList.java.patch b/gale-server/minecraft-patches/sources/net/minecraft/world/level/entity/EntityTickList.java.patch new file mode 100644 index 00000000..cebb5043 --- /dev/null +++ b/gale-server/minecraft-patches/sources/net/minecraft/world/level/entity/EntityTickList.java.patch @@ -0,0 +1,16 @@ +--- a/net/minecraft/world/level/entity/EntityTickList.java ++++ b/net/minecraft/world/level/entity/EntityTickList.java +@@ -18,11 +_,13 @@ + public void add(final Entity entity) { + this.ensureActiveIsNotIterated(); + this.entities.add(entity); // Paper - rewrite chunk system ++ entity.gale$eventDriven_isInTickList_set(true); // Gale - Event-driven - Entity.isInTickList + } + + public void remove(final Entity entity) { + this.ensureActiveIsNotIterated(); + this.entities.remove(entity); // Paper - rewrite chunk system ++ entity.gale$eventDriven_isInTickList_set(false); // Gale - Event-driven - Entity.isInTickList + } + + public boolean contains(final Entity entity) {