Urgent.News

What's breaking now, across thousands of outlets.

Tech

I Fixed a Minecraft Mod by Patching a Java .class File

I was playing DawnCraft when I ran into a strangely specific bug. The Spellbound Book worked perfectly in singleplayer. On my dedicated server, it didn't. The weird part was that the book still applied its Misconduction effect. It was only the actual attacks that stopped working. That was annoying enough that I stopped trying to fix it from inside the game and opened the mod's JAR instead. The…

A dedicated server player discovered a bug with the Spellbound Book mod in the DawnCraft game. The issue only affected the attack functionality, not the spell application. The player investigated by opening the mod's JAR file instead of making configuration changes. The source code revealed that the attack handlers were registered to a Forge event bus limited to the client side.

On a dedicated server, this event registration was missing, causing the attack handlers to not function. The player edited the compiled Java class file to remove the CLIENT side restriction from the event bus annotation. After repackaging the modified class back into the JAR, the server-side attacks worked again. The solution was a simple modification to the class metadata, avoiding the need to rebuild the entire mod or make server configuration changes.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Saturday 19 September →