Chumbanotz / MutantBeasts

The popular Mutant Creatures mod in modern Minecraft
https://www.curseforge.com/minecraft/mc-mods/mutant-beasts
GNU Affero General Public License v3.0
13 stars 14 forks source link

Hulk Hammer / onLivingUpdateEvent doesn't work with a dedicated server. #2

Closed Vaelzan closed 4 years ago

Vaelzan commented 4 years ago

onLivingUpdateEvent (Hulk Hammer on-use event) doesn't work with a dedicated server. It causes the player using the Hulk Hammer to immediately disconnect and they then can't reconnect until the server is restarted.

https://github.com/Chumbanotz/MutantBeasts/blob/0468d063bcd9e9fc22586f2a1b8f43e2ac702e74/src/main/java/chumbanotz/mutantbeasts/EventHandler.java#L136 is the problem line, because it's using the Minecraft class, which is client-side only, and should not be used on a dedicated server.

To me, it seems that the entire method seems like it is doing some overly complicated things when it really doesn't need to be, but it's too late at night for me to unravel it all and try to see if there's a reason you're nesting several loops there iterating over worlds and players. Why not just use event.player, event.player.getUniqueID(), and event.player.world instead of iterating over so many things?

Chumbanotz commented 4 years ago

I had copied it exactly from the original, and I haven't had a chance yet to clean it up.