ModernFix Breaks KubeJS NetworkEvents data
KostromDan opened this issue ยท 6 comments
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.
What Minecraft version? I assume you're using Forge.
modernfix-mc1.19.2-forge-3.6.0.jar
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'})
}
})
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.