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.
This commit is contained in:
Algent committed 2026-09-03 15:19:59 +02:00
1 parent 21535e50eb
commit 60d060a3ff
2 files changed
+3 -1

No files matched your search

@@ -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<TMultiPart> current = mutablePartsSnapshot();
@@ -63,7 +63,8 @@ final class ScalaTraitRegistration {
static MixinInfo registerScalaTrait(final ClassNode node, Map<String, MixinInfo> mixins,
Function1<ClassInfo, ScalaSignature> signature, Function1<ClassInfo, Object> classSymbol) {
Option<MixinInfo> 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<MixinInfo> cached = mixins.get(node.name);
if (cached instanceof Some) return cached.get();
if (cached != (Object) None$.MODULE$) throw new MatchError(cached);