Skip to content

scalable lux x dynamic trees bug neoforge 1.21.1 #1229

Description

@4EP3RZ

Reflective blockstate analysis triggers client-only class load on dedicated server (Dynamic Trees DynamicHardnessBlockState)
Environment

Minecraft 1.21.1, NeoForge
ScalableLux version: (fill in — check your mods folder jar filename)
Dedicated server
Dynamic Trees 1.7.2 (dynamictrees-neoforge-1.21.1-1.7.2.jar)
Relevant mods present: C2ME (rewrites-chunk-system), ModernFix, FerriteCore, Sable, Copycats, KubeJS, Moonlight, Galosphere, Expandability

Description

BlockStateBaseMixin.initLightAccessState (scalablelux.mixins.json:common.blockstate) reflectively inspects each BlockState class via Class.getMethod(...) to detect custom lighting behavior. For Dynamic Trees' com.dtteam.dynamictrees.block.BlockWithDynamicHardness$DynamicHardnessBlockState, this reflection walk causes the classloader to resolve a client-only class (net.minecraft.client.resources.model.ModelResourceLocation, and separately net.minecraft.client.color.block.BlockColors) as part of getMethod's method-resolution walk up the class hierarchy.

NeoForge's RuntimeDistCleaner blocks loading those classes on DEDICATED_SERVER and throws RuntimeException: Attempted to load class ... for invalid dist DEDICATED_SERVER. ScalableLux catches this and logs:

[ScalableLux/]: Failed to analyze class "class com.dtteam.dynamictrees.block.BlockWithDynamicHardness$DynamicHardnessBlockState" for dynamic lighting, this will impact performance.

Because DynamicHardnessBlockState instances are created per-block-state and Dynamic Trees generates many of them during worldgen tree placement (Species.placeRootyDirtBlock → JoCode.generate → DynamicTreeFeature), this failure fires repeatedly — once per tree/blockstate — producing heavy log spam during world generation and presumably falling back to non-optimized lighting for these states.
Steps to Reproduce

Install ScalableLux + Dynamic Trees on a NeoForge 1.21.1 dedicated server.
Generate/load a new world with tree worldgen enabled (Dynamic Trees' DynamicTreeFeature running).
Observe repeated ScalableLux "Failed to analyze class ... DynamicHardnessBlockState" errors in the log, each with a RuntimeDistCleaner RuntimeException for ModelResourceLocation / BlockColors.

Expected Behavior

Blockstate reflection analysis should not attempt to resolve client-only classes on a dedicated server, or should fail silently/once per class rather than once per instance/tree.
Log excerpt

[Server thread/ERROR] [ne.ne.fm.co.as.RuntimeDistCleaner/DISTXFORM]: Attempted to load class net/minecraft/client/resources/model/ModelResourceLocation for invalid dist DEDICATED_SERVER
[Server thread/ERROR] [ScalableLux/]: Failed to analyze class "class net.minecraft.world.level.block.state.BlockState" for dynamic lighting, this will impact performance.
java.lang.RuntimeException: Attempted to load class net/minecraft/client/resources/model/ModelResourceLocation for invalid dist DEDICATED_SERVER
at ... net.neoforged.fml.common.asm.RuntimeDistCleaner.processClassWithFlags(RuntimeDistCleaner.java:60)
...
at net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.handler$bcb000$scalablelux$initLightAccessState(BlockBehaviour.java:2004)
at net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.initCache(BlockBehaviour.java:492)
...

[c2me-worker-0/ERROR] [ne.ne.fm.co.as.RuntimeDistCleaner/DISTXFORM]: Attempted to load class net/minecraft/client/color/block/BlockColors for invalid dist DEDICATED_SERVER
[c2me-worker-0/ERROR] [ScalableLux/]: Failed to analyze class "class com.dtteam.dynamictrees.block.BlockWithDynamicHardness$DynamicHardnessBlockState" for dynamic lighting, this will impact performance.
java.lang.RuntimeException: Attempted to load class net/minecraft/client/color/block/BlockColors for invalid dist DEDICATED_SERVER
at ... net.neoforged.fml.common.asm.RuntimeDistCleaner.processClassWithFlags(RuntimeDistCleaner.java:60)
...
at net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.handler$bcb000$scalablelux$initLightAccessState(BlockBehaviour.java:2004)
at net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.initCache(BlockBehaviour.java:492)
...
at com.dtteam.dynamictrees.tree.species.Species.placeRootyDirtBlock(Species.java:1078)
at com.dtteam.dynamictrees.worldgen.JoCode.generate(JoCode.java:171)
at com.dtteam.dynamictrees.tree.species.Species.generate(Species.java:2170)
at com.dtteam.dynamictrees.worldgen.feature.DynamicTreeFeature.genTree(DynamicTreeFeature.java:165)
at com.dtteam.dynamictrees.worldgen.feature.DynamicTreeFeature.generateTree(DynamicTreeFeature.java:119)
at com.dtteam.dynamictrees.worldgen.feature.DynamicTreeFeature.generateTrees(DynamicTreeFeature.java:81)
at com.dtteam.dynamictrees.worldgen.feature.DynamicTreeFeature.place(DynamicTreeFeature.java:68)
...

(repeats once per tree placed during worldgen)
Additional Notes

This does not appear to be a hard crash — server continues generating chunks and progresses normally (observed spawn-area preparation continuing past 30% with the errors still firing). Impact is log spam plus the stated "will impact performance" fallback for affected blockstates.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions