C2ME-fabric icon indicating copy to clipboard operation
C2ME-fabric copied to clipboard

BackSlot incompatibility

Open Mirsario opened this issue 3 years ago • 1 comments
trafficstars

Describe the bug No idea which side will have to fix this, but loading the mod together with BackSlot and using the latter's features results in the world crashing thanks to CheckedThreadLocalRandom and a call of Random.nextFloat().

The relevant code of BackSlot doesn't seem to be doing anything special: https://github.com/Globox1997/BackSlot/blob/1.19/src/main/java/net/backslot/network/SwitchPacket.java?ts=4#L168

Could thread locks (or whatever they're called in Java) be added for random instead of throwing exceptions when it's accessed from the "wrong" thread? Might be slow of course.

To Reproduce

  1. Load MC with C2ME, BackSlot, (Quilted)Fabric API, Cloth Config
  2. Grab some sword and press BackSlot's hotkey (G by default) a bunch of times to put the sword on and from your back.
  3. The world crashes. Takes around 3 presses for me.

Expected behavior No crashes, duh.

Screenshots image

Runtime info:

  • OS: Windows 10, x86_64
  • Minecraft version: 1.19.2, Quilt Loader 0.17.3
  • Mod version: 0.2.0+alpha.8.37 devbuild for 1.19.2

Crash reports / logs

Other mods

Checklist

  • [x] I am using the official version of the mod.
  • [x] I tried the latest development version but the issue persists.
  • [x] I searched for similar open issues and could not find an existing bug report on this.

Mirsario avatar Sep 09 '22 22:09 Mirsario

Using world random on another thread is absolutely wrong and causes weird crashes in vanilla: java.lang.IllegalStateException: Accessing LegacyRandomSource from multiple threads. This should be fixed on their side.

ishland avatar Sep 10 '22 00:09 ishland

Resolved now. Thanks, @Mephodio! I tried to resolve this myself at first, but that one maven repo going down was a problem. Reached out to its owners weeks ago, but nothing got fixed after promises.

Mirsario avatar Sep 28 '22 14:09 Mirsario