MrTJP / ProjectRed

Redstone Engineering
MIT License
474 stars 185 forks source link

[1.18.2] Incompatible with Waterlogged Redstone #1798

Closed border999 closed 12 months ago

border999 commented 1 year ago

Describe the bug Upon attempting to create a new world Waterlogged throws an issue citing being unable to cast to a class related to ProjectRed Core. Causing the world generation to halt and forcing me to force close Minecraft.

To Reproduce Steps to reproduce the behavior:

  1. Attempt to create a world with Waterlogged Redstone and ProjectRed Core both in your modlist.
  2. Wait till it locks up.

Expected behavior World generation completing without issue.

Logs Required for crash. Crash report did not appear in .minecraft folder even after log shows the report was generated. Debug.log: https://gist.github.com/border999/875eb9b5c6b0af02c6ff17b2b0c0c9c5 Latest.log: https://gist.github.com/border999/04a85c302fb6d7573b1257f4d4a63c8e Versions

MrTJP commented 1 year ago

Unfortunately those logs don't contain the crash details. I'll need them to investigate this

MrTJP commented 12 months ago

Looks like Waterlogged Redstone replaces the original Redstone block with its own class. Crash comes from ProjectRed side, which tries to cast Blocks.REDSTONE:

Encountered an unexpected exception
java.lang.ClassCastException: class com.the_millman.waterlogged_redstone.common.blocks.RedStoneWireBlock cannot be cast to class net.minecraft.world.level.block.RedStoneWireBlock (com.the_millman.waterlogged_redstone.common.blocks.RedStoneWireBlock is in module wlrs@1.13.1-1.18.2 of loader 'TRANSFORMER' @43aeb5e0; net.minecraft.world.level.block.RedStoneWireBlock is in module minecraft@1.18.2 of loader 'TRANSFORMER' @43aeb5e0)
    at TRANSFORMER/projectred_core@4.16.0-beta-48/mrtjp.projectred.core.RedstonePropagator.setDustProvidesPower(RedstonePropagator.java:59)
    at TRANSFORMER/projectred_core@4.16.0-beta-48/mrtjp.projectred.core.RedstonePropagator.resetPowerFlags(RedstonePropagator.java:66)
    at TRANSFORMER/projectred_transmission@4.16.0-beta-48/mrtjp.projectred.transmission.ProjectRedTransmission.onServerStartEvent(ProjectRedTransmission.java:80)
    at MC-BOOTSTRAP/eventbus@5.0.3/net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:247)
    at MC-BOOTSTRAP/eventbus@5.0.3/net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:239)
    at MC-BOOTSTRAP/eventbus@5.0.3/net.minecraftforge.eventbus.EventBus.post(EventBus.java:302)
    at MC-BOOTSTRAP/eventbus@5.0.3/net.minecraftforge.eventbus.EventBus.post(EventBus.java:283)
    at TRANSFORMER/forge@40.2.4/net.minecraftforge.server.ServerLifecycleHooks.handleServerAboutToStart(ServerLifecycleHooks.java:86)
    at TRANSFORMER/minecraft@1.18.2/net.minecraft.client.server.IntegratedServer.m_7038_(IntegratedServer.java:63)
    at TRANSFORMER/minecraft@1.18.2/net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:661)
    at TRANSFORMER/minecraft@1.18.2/net.minecraft.server.MinecraftServer.m_177918_(MinecraftServer.java:261)
    at java.base/java.lang.Thread.run(Thread.java:833)

Checking if this can be done some other way

MrTJP commented 12 months ago

Confirmed that Waterlogged Redstone is creating a brand new subclass of Block and basically copying the vanilla RedStoneWireBlock source before making modifications. While I can use reflection to get at the shouldSignal field and change it, I don't see any reason why RedStoneWireBlock can't be subclassed directly.

You can point the mod author of WLRS to this issue. This won't be fixed on ProjectRed side (unless a concrete reason for not subclassing RedStoneWireBlock can be given).