From 60d060a3ff4c3fffbd9f3b781a1883976835f507 Mon Sep 17 00:00:00 2001 From: Algent Date: Thu, 3 Sep 2026 15:19:59 +0200 Subject: [PATCH] refactor: document the light hook and unify the mixin cache access Explain why remPart_do keeps the reference's otherwise unused getLightValue() call, so it is not mistaken for dead code. Read the mixin cache through the same map reference that registration writes, instead of the companion accessor. getMixinInfo is defined as that map's get and the map is what registerScalaTrait already receives, so this is an identity substitution; the public accessor is unchanged. --- src/main/scala/codechicken/multipart/TileMultipart.java | 1 + .../codechicken/multipart/asm/ScalaTraitRegistration.java | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/scala/codechicken/multipart/TileMultipart.java b/src/main/scala/codechicken/multipart/TileMultipart.java index 0f9eac8..2657656 100644 --- a/src/main/scala/codechicken/multipart/TileMultipart.java +++ b/src/main/scala/codechicken/multipart/TileMultipart.java @@ -434,6 +434,7 @@ public class TileMultipart extends TileEntity implements IChunkLoadTile { throw new IllegalArgumentException("Tried to remove a non-existant part"); } + // The reference read an unused removedLightValue here; the virtual call is observable, so keep it. part.getLightValue(); part.preRemove(); List current = mutablePartsSnapshot(); diff --git a/src/main/scala/codechicken/multipart/asm/ScalaTraitRegistration.java b/src/main/scala/codechicken/multipart/asm/ScalaTraitRegistration.java index 60e9230..905d553 100644 --- a/src/main/scala/codechicken/multipart/asm/ScalaTraitRegistration.java +++ b/src/main/scala/codechicken/multipart/asm/ScalaTraitRegistration.java @@ -63,7 +63,8 @@ final class ScalaTraitRegistration { static MixinInfo registerScalaTrait(final ClassNode node, Map mixins, Function1 signature, Function1 classSymbol) { - Option cached = ASMMixinCompiler$.MODULE$.getMixinInfo(node.name); + // Read and write the same map reference; getMixinInfo is that map's get, and one source keeps them in step. + Option cached = mixins.get(node.name); if (cached instanceof Some) return cached.get(); if (cached != (Object) None$.MODULE$) throw new MatchError(cached);