|
| 1 | +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| 2 | +From: MidnightTale < [email protected]> |
| 3 | +Date: Fri, 25 Jul 2025 05:12:34 +0700 |
| 4 | +Subject: [PATCH] Fix Raytracing tracker memory leak |
| 5 | + |
| 6 | + |
| 7 | +diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java |
| 8 | +index 4480b491250f08350f479c27d17d51fe62bc60f6..39496807d1e6301eb52084414753ebd4e64d1971 100644 |
| 9 | +--- a/net/minecraft/world/entity/player/Player.java |
| 10 | ++++ b/net/minecraft/world/entity/player/Player.java |
| 11 | +@@ -232,22 +232,6 @@ public abstract class Player extends LivingEntity { |
| 12 | + // CraftBukkit end |
| 13 | + // Luminol start - Raytracing entity tracker // atDeprecated - Raytracing entity tracker |
| 14 | + public dev.tr7zw.entityculling.CullTask cullTask; |
| 15 | +- { |
| 16 | +- if (!fun.mntale.atdeprecated.config.AtCoreConfig.RAY_TRACKING_ENTITY_TRACKER_CONFIG.enabled) { |
| 17 | +- this.cullTask = null; |
| 18 | +- }else { |
| 19 | +- final com.logisticscraft.occlusionculling.OcclusionCullingInstance culling = new com.logisticscraft.occlusionculling.OcclusionCullingInstance( |
| 20 | +- fun.mntale.atdeprecated.config.AtCoreConfig.RAY_TRACKING_ENTITY_TRACKER_CONFIG.tracingDistance, |
| 21 | +- new dev.tr7zw.entityculling.DefaultChunkDataProvider(this.level()) |
| 22 | +- ); |
| 23 | +- |
| 24 | +- this.cullTask = new dev.tr7zw.entityculling.CullTask( |
| 25 | +- culling, this, |
| 26 | +- fun.mntale.atdeprecated.config.AtCoreConfig.RAY_TRACKING_ENTITY_TRACKER_CONFIG.hitboxLimit, |
| 27 | +- fun.mntale.atdeprecated.config.AtCoreConfig.RAY_TRACKING_ENTITY_TRACKER_CONFIG.checkIntervalMs |
| 28 | +- ); |
| 29 | +- } |
| 30 | +- } |
| 31 | + // Luminol end // atDeprecated - Raytracing entity tracker |
| 32 | + |
| 33 | + public Player(Level level, GameProfile gameProfile) { |
| 34 | +@@ -309,22 +293,27 @@ public abstract class Player extends LivingEntity { |
| 35 | + public void tick() { |
| 36 | + // Luminol start - Ray tracing entity tracker // atDeprecated - Ray tracing entity tracker |
| 37 | + if (!fun.mntale.atdeprecated.config.AtCoreConfig.RAY_TRACKING_ENTITY_TRACKER_CONFIG.enabled) { |
| 38 | +- if (this.cullTask != null) this.cullTask.signalStop(); |
| 39 | +- this.cullTask = null; |
| 40 | +- }else { |
| 41 | +- final com.logisticscraft.occlusionculling.OcclusionCullingInstance culling = new com.logisticscraft.occlusionculling.OcclusionCullingInstance( |
| 42 | ++ if (this.cullTask != null) { |
| 43 | ++ this.cullTask.signalStop(); |
| 44 | ++ this.cullTask = null; |
| 45 | ++ } |
| 46 | ++ } else { |
| 47 | ++ if (this.cullTask == null) { |
| 48 | ++ final com.logisticscraft.occlusionculling.OcclusionCullingInstance culling = new com.logisticscraft.occlusionculling.OcclusionCullingInstance( |
| 49 | + fun.mntale.atdeprecated.config.AtCoreConfig.RAY_TRACKING_ENTITY_TRACKER_CONFIG.tracingDistance, |
| 50 | + new dev.tr7zw.entityculling.DefaultChunkDataProvider(this.level()) |
| 51 | +- ); |
| 52 | +- |
| 53 | +- this.cullTask = new dev.tr7zw.entityculling.CullTask( |
| 54 | ++ ); |
| 55 | ++ this.cullTask = new dev.tr7zw.entityculling.CullTask( |
| 56 | + culling, this, |
| 57 | + fun.mntale.atdeprecated.config.AtCoreConfig.RAY_TRACKING_ENTITY_TRACKER_CONFIG.hitboxLimit, |
| 58 | + fun.mntale.atdeprecated.config.AtCoreConfig.RAY_TRACKING_ENTITY_TRACKER_CONFIG.checkIntervalMs |
| 59 | +- ); |
| 60 | ++ ); |
| 61 | ++ this.cullTask.setup(); |
| 62 | ++ } |
| 63 | ++ } |
| 64 | ++ if (this.cullTask != null) { |
| 65 | ++ this.cullTask.requestCullSignal(); |
| 66 | + } |
| 67 | +- if (this.cullTask != null) this.cullTask.setup(); |
| 68 | +- if (this.cullTask != null) this.cullTask.requestCullSignal(); // Luminol - Ray tracing entity tracker // atDeprecated - Ray tracing entity tracker |
| 69 | + // Luminol end // atDeprecated - Ray tracing entity tracker |
| 70 | + |
| 71 | + this.noPhysics = this.isSpectator(); |
| 72 | +@@ -1484,6 +1473,9 @@ public abstract class Player extends LivingEntity { |
| 73 | + // Folia start - region threading |
| 74 | + @Override |
| 75 | + protected void preRemove(RemovalReason reason) { |
| 76 | ++ if (this.cullTask != null) { |
| 77 | ++ this.cullTask.signalStop(); |
| 78 | ++ } |
| 79 | + super.preRemove(reason); |
| 80 | + this.fishing = null; |
| 81 | + } |
0 commit comments