From ed78ec1b4f2da22054b258e56439c1e6d1765577 Mon Sep 17 00:00:00 2001 From: 2No2Name <2No2Name@web.de> Date: Fri, 17 Jan 2025 19:24:18 +0100 Subject: [PATCH] Update a few TODOs --- build.gradle.kts | 1 - .../mods/lithium/common/ai/pathing/PathNodeCache.java | 2 +- .../mods/lithium/common/block/BlockListeningSection.java | 2 -- .../lithium/common/entity/LithiumEntityCollisions.java | 3 ++- .../tracking/block/SectionedBlockChangeTracker.java | 2 +- .../lithium/common/world/chunk/ChunkStatusTracker.java | 2 +- .../mods/lithium/mixin/block/hopper/package-info.java | 2 +- .../util/block_tracking/LevelChunkSectionMixin.java | 9 --------- 8 files changed, 6 insertions(+), 17 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 9629ee09c..b1eaae2a0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,7 +15,6 @@ val FABRIC_LOADER_VERSION by extra { "0.16.4" } val FABRIC_API_VERSION by extra { "0.103.0+1.21.1" } // This value can be set to null to disable Parchment. -// TODO: Add Parchment val PARCHMENT_VERSION by extra { null } // https://semver.org/ diff --git a/common/src/main/java/net/caffeinemc/mods/lithium/common/ai/pathing/PathNodeCache.java b/common/src/main/java/net/caffeinemc/mods/lithium/common/ai/pathing/PathNodeCache.java index 6cd312d1c..22e12f1ae 100644 --- a/common/src/main/java/net/caffeinemc/mods/lithium/common/ai/pathing/PathNodeCache.java +++ b/common/src/main/java/net/caffeinemc/mods/lithium/common/ai/pathing/PathNodeCache.java @@ -75,7 +75,7 @@ public static PathType getNodeTypeFromNeighbors(PathfindingContext context, int // section is empty or contains any dangerous blocks within the palette. If not, we can assume any checks // against this chunk section will always fail, allowing us to fast-exit. if (section == null || PathNodeCache.isSectionSafeAsNeighbor(section)) { - return fallback; //TODO side effects of vanilla's path node caching + return fallback; //TODO side effects of vanilla's path node caching (PathTypeCache maybe has broken invalidation for barely loaded chunks) } } diff --git a/common/src/main/java/net/caffeinemc/mods/lithium/common/block/BlockListeningSection.java b/common/src/main/java/net/caffeinemc/mods/lithium/common/block/BlockListeningSection.java index 40f4c6bbc..b3bf5f3b5 100644 --- a/common/src/main/java/net/caffeinemc/mods/lithium/common/block/BlockListeningSection.java +++ b/common/src/main/java/net/caffeinemc/mods/lithium/common/block/BlockListeningSection.java @@ -1,7 +1,6 @@ package net.caffeinemc.mods.lithium.common.block; import net.caffeinemc.mods.lithium.common.tracking.block.SectionedBlockChangeTracker; -import net.minecraft.core.SectionPos; import net.minecraft.world.level.Level; public interface BlockListeningSection { @@ -10,5 +9,4 @@ public interface BlockListeningSection { void lithium$removeFromCallback(ListeningBlockStatePredicate blockGroup, SectionedBlockChangeTracker tracker); - void lithium$invalidateListeningSection(SectionPos sectionPos); } diff --git a/common/src/main/java/net/caffeinemc/mods/lithium/common/entity/LithiumEntityCollisions.java b/common/src/main/java/net/caffeinemc/mods/lithium/common/entity/LithiumEntityCollisions.java index 1e09892bf..9398f9b15 100644 --- a/common/src/main/java/net/caffeinemc/mods/lithium/common/entity/LithiumEntityCollisions.java +++ b/common/src/main/java/net/caffeinemc/mods/lithium/common/entity/LithiumEntityCollisions.java @@ -212,7 +212,8 @@ public static VoxelShape getWorldBorderCollision(CollisionGetter collisionView, //Technically, the supporting block that vanilla calculates and caches is not always the one // that cancels the downwards motion, but usually it is, and this is only for a quick, additional test. //TODO: This may lead to the movement attempt not creating any chunk load tickets. - // Entities and pistons **probably** create these tickets elsewhere anyways. + // Entities and pistons **probably** create these tickets elsewhere anyways. This probably also applies + // to usages of ChunkAwareBlockCollisionSweeper and others VoxelShape voxelShape = supportingBlockCollisionShapeProvider.lithium$getCollisionShapeBelow(); if (voxelShape != null) { return voxelShape; diff --git a/common/src/main/java/net/caffeinemc/mods/lithium/common/tracking/block/SectionedBlockChangeTracker.java b/common/src/main/java/net/caffeinemc/mods/lithium/common/tracking/block/SectionedBlockChangeTracker.java index 84b6de5e8..865ca7ad7 100644 --- a/common/src/main/java/net/caffeinemc/mods/lithium/common/tracking/block/SectionedBlockChangeTracker.java +++ b/common/src/main/java/net/caffeinemc/mods/lithium/common/tracking/block/SectionedBlockChangeTracker.java @@ -23,7 +23,7 @@ public class SectionedBlockChangeTracker { private long maxChangeTime; private int timesRegistered; - //Some sections may not exist / be unloaded. We have to be aware of those. //TODO Invalidation when sections / chunks unload (but the entity does not (?), not sure whether this is possible) -> might be possible with entities riding lazy loaded vehicles and pushed to different chunks + //Some sections may not exist / be unloaded. We have to be aware of those. boolean isListeningToAll = false; private ArrayList sectionsNotListeningTo = null; private ArrayList sectionsUnsubscribed = null; diff --git a/common/src/main/java/net/caffeinemc/mods/lithium/common/world/chunk/ChunkStatusTracker.java b/common/src/main/java/net/caffeinemc/mods/lithium/common/world/chunk/ChunkStatusTracker.java index f48068825..e296b1f2c 100644 --- a/common/src/main/java/net/caffeinemc/mods/lithium/common/world/chunk/ChunkStatusTracker.java +++ b/common/src/main/java/net/caffeinemc/mods/lithium/common/world/chunk/ChunkStatusTracker.java @@ -50,7 +50,7 @@ public static void onChunkAccessible(ServerLevel serverLevel, LevelChunk levelCh throw new IllegalStateException("ChunkStatusTracker.onChunkAccessible called on wrong thread!"); } - for (int i = 0; i < LOAD_CALLBACKS.size(); i++) { //TODO confirm this is only called on the server thread... + for (int i = 0; i < LOAD_CALLBACKS.size(); i++) { LOAD_CALLBACKS.get(i).accept(serverLevel, levelChunk); } } diff --git a/common/src/main/java/net/caffeinemc/mods/lithium/mixin/block/hopper/package-info.java b/common/src/main/java/net/caffeinemc/mods/lithium/mixin/block/hopper/package-info.java index 60c8294d0..78b19fbc8 100644 --- a/common/src/main/java/net/caffeinemc/mods/lithium/mixin/block/hopper/package-info.java +++ b/common/src/main/java/net/caffeinemc/mods/lithium/mixin/block/hopper/package-info.java @@ -4,7 +4,7 @@ * and modification counter comparisons make sure that no outdated cached information is used while avoiding quadratic * runtime. *

- * TODO: This section can be expended to include a lot more details. The README.md in this package includes a detailed description. + * TODO: This section can be expended to include a lot more details. The README.md in this package includes a detailed description. Needs updating as some stuff doesn't work on neoforge (inventory entity tracking) */ @MixinConfigOption( description = "Reduces hopper lag using caching, notification systems and BlockEntity sleeping", diff --git a/common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/block_tracking/LevelChunkSectionMixin.java b/common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/block_tracking/LevelChunkSectionMixin.java index 51b9ccc66..c20cdab0c 100644 --- a/common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/block_tracking/LevelChunkSectionMixin.java +++ b/common/src/main/java/net/caffeinemc/mods/lithium/mixin/util/block_tracking/LevelChunkSectionMixin.java @@ -3,7 +3,6 @@ import net.caffeinemc.mods.lithium.common.block.*; import net.caffeinemc.mods.lithium.common.tracking.block.ChunkSectionChangeCallback; import net.caffeinemc.mods.lithium.common.tracking.block.SectionedBlockChangeTracker; -import net.minecraft.core.SectionPos; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; @@ -162,12 +161,4 @@ private void updateFlagCounters(int x, int y, int z, BlockState newState, boolea } } - @Override - @Unique - public void lithium$invalidateListeningSection(SectionPos sectionPos) { - if (this.listeningMask != 0) { - this.changeListener.onChunkSectionInvalidated(sectionPos); - this.listeningMask = 0; - } - } }