Skip to content

[BUG] ClassCastException: RenderConfiguration cannot be cast to GanderCompositeRenderType #650

@derneder

Description

@derneder

I am not using performance mods.

  • Confirm

Description

When entering a Compact Machines room, the game crashes with a ClassCastException. The issue occurs when Gander Rendering (bundled with Compact Machines 7.0.78) attempts to cast a RenderConfiguration object from supermartijn642-corelib to GanderCompositeRenderType during block entity rendering.

Mod Version

7.0.78

Forge Version

NeoForge 21.1.216

Link to Crash Log

No response

Screenshot (if available)

Environment

  • Minecraft Version: 1.21.1
  • Mod Loader: NeoForge 21.1.216
  • Compact Machines Version: 7.0.78
  • supermartijn642-corelib Version: 1.1.18b
  • GeckoLib Version: 4.8.3
  • OS: Windows 11
  • GPU: NVIDIA GeForce RTX 2060 SUPER
  • Java: 21.0.9-LTS

Expected Behavior

The Compact Machines room should open and render all block entities without crashing.

Actual Behavior

The game crashes immediately when the room attempts to render, with the following error:

java.lang.ClassCastException: 
class com.supermartijn642.core.render.RenderConfiguration 
cannot be cast to 
class dev.compactmods.gander.render.rendertypes.GanderCompositeRenderType

Error Location

The crash occurs in:

  • dev.compactmods.gander.render.rendertypes.GanderCompositeRenderType.of() (rendering-0.2.31.jar:12)
  • dev.compactmods.gander.render.rendertypes.RenderTypeStore.redirectedBlockRenderType() (rendering-0.2.31.jar:44)
  • dev.compactmods.gander.render.toolkit.RedirectingBufferSource.endBatch() (rendering-0.2.31.jar:40)

Call Stack

at dev.compactmods.gander.render.rendertypes.GanderCompositeRenderType.of()
at dev.compactmods.gander.render.rendertypes.RenderTypeStore.redirectedBlockRenderType()
at dev.compactmods.gander.render.toolkit.RedirectingBufferSource.endBatch()
at dev.compactmods.machines.client.room.MachineRoomScreen.render()

Root Cause Analysis

The GanderCompositeRenderType.of() method expects to receive a GanderCompositeRenderType object for rendering block entities. However, when supermartijn642-corelib is present, the type cast receives a RenderConfiguration object instead, which is incompatible with the expected type.

This happens during the rendering pipeline when:

  1. GeckoLib (4.8.3) initiates entity animations
  2. Gander's RedirectingBufferSource intercepts the render buffer
  3. GanderCompositeRenderType.of() attempts to cast the buffer configuration
  4. Type mismatch causes immediate ClassCastException

Affected Scenarios

  • Opening any Compact Machines room
  • Rendering animated block entities inside rooms (e.g., OritechFuelGenerator)
  • The crash occurs consistently on every room entry attempt

Related Mods

  • Compact Machines: 7.0.78
  • Gander Rendering (embedded): 0.2.31
  • Gander UI (embedded): 0.2.31
  • supermartijn642-corelib: 1.1.18b
  • GeckoLib 4: 4.8.3

Possible Solutions

  1. Update Gander Rendering (0.2.31) to be compatible with supermartijn642-corelib 1.1.18b type interfaces
  2. Add defensive type checking in GanderCompositeRenderType.of() to handle RenderConfiguration gracefully
  3. Implement type casting safety with fallback rendering methods
  4. Update supermartijn642-corelib to align with Gander's rendering interface

Additional Context

  • The crash only occurs when entering Compact Machines rooms
  • It does not affect other rendering in the game
  • The crash is reproducible 100% of the time
  • No error workaround currently available
  • Affected modpack: StoneBlock 4 with 389 mods

Files for Review

See attached crash logs:

How to reproduce

  1. Create or load a Compact Machines room
  2. Attempt to enter the room interface by clicking on the machine room screen
  3. Game crashes during initial block entity rendering phase

Metadata

Metadata

Assignees

No one assigned

    Labels

    21.1Relates to CM7 for MC 21.1triageunverifiedIssue needs to be verified beyond initial report, or due to an old version.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions