ModernFix

ModernFix

72M Downloads

ModernFix Breaks KubeJS NetworkEvents data

KostromDan opened this issue ยท 6 comments

commented

This is due to the fact that this mod replaces some network classes with its own and as a result, probably some kind of conflict, the event.data becomes empty.
Breaked events:
/client_scripts/ | NetworkEvents.fromServer
/server_scripts/ | NetworkEvents.fromClient
event.data is alvays empty with modern fix.

commented

Latest release includes the fix, thanks again for the report.

commented

What Minecraft version? I assume you're using Forge.

commented

What Minecraft version? I assume you're using Forge.

modernfix-mc1.19.2-forge-3.6.0.jar

commented

What Minecraft version? I assume you're using Forge.

scripts for testing:
client:

NetworkEvents.fromServer('test', event => {
    event.player.tell(`fromServer ${event.data}`)
    event.player.sendData('test', {'test':'test'})
})

server

NetworkEvents.fromClient('test', event => {
    event.player.tell(`fromClient ${event.data}`)
})
BlockEvents.rightClicked(event => {
    if (event.hand == 'main_hand') {
        event.player.sendData('test', {'test': 'test'})
    }
})
commented

Tested on fabric, the problem is also relevant there.

commented

Thanks, I appreciate the example scripts as I couldn't find any documentation on how to use these events. ๐Ÿ˜†

I was able to track down and fix the underlying issue. The fix will be in the next release. For now disabling mixin.perf.nbt_memory_usage will work around it, or you can use the unreleased version via the link in the README.


Technical explanation for the issue: KubeJS has an OrderedCompoundTag class, which uses an internal constructor of CompoundTag to control the backing map that gets used. ModernFix's NBT memory usage optimization didn't take this into account which caused KubeJS' map to be completely empty. Thus, no data. :)

The next version of ModernFix uses a different injection strategy in CompoundTag that will be compatible with mods that provide custom backing maps.