mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-27 19:09:22 +00:00
* prevents async entity tracker update equipment * fix seenBy updated check * skip submit empty * fix invertedVisibilityEntities data race * strict thread check * set max-threads to 1 by default * use fixed thread count * increase thread priority * Revert "use fixed thread count" This reverts commit6746bc25a8. * Revert "set max-threads to 1 by default" This reverts commit5295b6d3e1. * update entity tracker * cleanup * [ci skip] fix phrasing * cleanup * cleanup * support Citizens * optimize update if chunk player no change * configurable threads * configurable no blocking * fix pos y and z * optimize no blocking * cleanup * cleanup * add handle during waitUntilNextTick * fix entity disappear * cleanup * disable nonblocking by default * [ci skip] add entity slice * impl fork-join * fix async locator diff * optimize queue * inline iterator * [ci skip] Update patch header * cleanup * improve compatibility * add license header * optimize spin wait * remove queue-size option * dynamic adjust subtasks --------- Co-authored-by: Taiyou06 <kaandindar21@gmail.com> Co-authored-by: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
53 lines
3.2 KiB
Diff
53 lines
3.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: hayanesuru <hayanesuru@outlook.jp>
|
|
Date: Fri, 4 Jul 2025 03:22:38 +0900
|
|
Subject: [PATCH] optimize mob despawn
|
|
|
|
|
|
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
|
index 97408ce24313ff26347ff434ab6460e9971c3598..af190cb959478cde3fa9011df85032dbab60ce56 100644
|
|
--- a/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/net/minecraft/server/level/ServerLevel.java
|
|
@@ -797,6 +797,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
|
}
|
|
|
|
io.papermc.paper.entity.activation.ActivationRange.activateEntities(this); // Paper - EAR
|
|
+
|
|
+ if (org.dreeam.leaf.config.modules.opt.OptimizeDespawn.enabled) despawnMap.prepare(this); // Leaf - optimize despawn
|
|
this.entityTickList
|
|
.forEach(
|
|
entity -> {
|
|
@@ -832,6 +834,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
|
}
|
|
}
|
|
);
|
|
+ if (org.dreeam.leaf.config.modules.opt.OptimizeDespawn.enabled) despawnMap.reset(); // Leaf - optimize despawn
|
|
this.tickBlockEntities();
|
|
}
|
|
// Paper - rewrite chunk system
|
|
@@ -945,6 +948,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
|
|
|
private int currentIceAndSnowTick = 0; protected void resetIceAndSnowTick() { this.currentIceAndSnowTick = this.simpleRandom.nextInt(16); } // Gale - Airplane - optimize random calls in chunk ticking
|
|
|
|
+ public final org.dreeam.leaf.world.DespawnMap despawnMap = new org.dreeam.leaf.world.DespawnMap(); // Leaf - optimize despawn
|
|
public void tickChunk(LevelChunk chunk, int randomTickSpeed) {
|
|
final net.minecraft.world.level.levelgen.BitRandomSource simpleRandom = this.simpleRandom; // Paper - optimise random ticking // Leaf - Faster random generator - upcasting
|
|
ChunkPos pos = chunk.getPos();
|
|
diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java
|
|
index 867353500482247bbec79f407246902c79a3d14a..173ec6919cef2aa90c40d3bf33d927a2db7b4922 100644
|
|
--- a/net/minecraft/world/entity/Mob.java
|
|
+++ b/net/minecraft/world/entity/Mob.java
|
|
@@ -722,6 +722,12 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
|
if (this.level().getDifficulty() == Difficulty.PEACEFUL && this.shouldDespawnInPeaceful()) {
|
|
this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
|
} else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) {
|
|
+ // Leaf start - optimize despawn
|
|
+ if (org.dreeam.leaf.config.modules.opt.OptimizeDespawn.enabled) {
|
|
+ ((ServerLevel) level()).despawnMap.checkDespawn(this);
|
|
+ return;
|
|
+ }
|
|
+ // Leaf end - optimize despawn
|
|
Entity nearestPlayer = this.level().findNearbyPlayer(this, -1.0, EntitySelector.PLAYER_AFFECTS_SPAWNING); // Paper - Affects Spawning API
|
|
if (nearestPlayer != null) {
|
|
// Paper start - Configurable despawn distances
|