TerrariaMod

TerrariaMod

35.9k Downloads

Large majority of the mod doesn't work in multiplayer

quat1024 opened this issue · 1 comments

commented

All of this: https://github.com/Ryorama/Terrariamod/blob/1.18-fabric/src/main/java/com/ryorama/terrariamod/TerrariaModClient.java#L162-L228 is only ever initialized on the client. WorldDataT is also only initialized on the client.

There's no two ways about it - this is simply wrong.

For example, calling MinecraftClient.getInstance().player.setHealth will update the appearance of the health bar on the client's screen, but will not actually increase the health of the player. The next time the player receives regeneration or takes damage, the health bar on the client's screen will reset to the real health value again. This method of giving the player regeneration simply does not work.

WorldDataT is presumably used to hold a bunch of important state information, but it never gets loaded on the server, so all of that never gets loaded.

I recommend reviewing some documentation on the difference between the client and the server; see here or here. The takeaway is that the client is a special-case of the server and not the other way around - write your mod for multiplayer first. Have a look at some other mods, which carefully separate the client and server's concerns. MinecraftClient should only ever be touched when doing rendering. As a rule of thumb, if you are accessing MinecraftClient.getInstance().player (for reasons other than like, getting which way the player is looking so you can do some rendering), you are almost certainly doing something incorrect.

commented

Hey! I've looked over the issues you’ve opened and I wanted to say that some of them I have been planning to fix for a while now. For the music causing the mod to be so large, I was planning on packing the music and possibly some other assets as a resource pack and automatically downloading and applying it at runtime so it could be separate from the mod itself. Also thanks for letting me know about the server related issues. Server related things are always a pain for me to work with so a lot of the things you mentioned I never knew that they were causing problems, so I'll try to start fixing that after doing some more research on the topic.