ZsoltMolnarrr / Rogues

Rogues and Warriors (RPG Series)
Other
1 stars 6 forks source link

Effect weirdness on servers, even after changing config #10

Closed Partonetrain closed 2 months ago

Partonetrain commented 3 months ago

I've brought this up in the Discord a few times, but have been reluctant to make an issue because I struggle to describe the problem.

Even after changing both my client and server's tweaks.json to contain "effects_raw_id_start": 7000, (there is far less than 7000 effects in my pack, obviously) there are visual issues when the client players on the server. Although all of the effects in my personal modpack work as intended, the effects that are shown in the inventory are not always correct. The easiest example is that, after eating a Farmer's Delight food that gives Comfort on a sever (with identical pack configuration), my inventory shows the Shattered effect. It's difficult to debug because no such problem exists in singleplayer. There is some kind of desync in the way the server communicates effects to the client.

Partonetrain commented 2 months ago

After some debugging, I discovered that servers do not seem to respect rawID settings. I wrote some code to dump effect resourcelocations and rawIDs on server start [mojmap]:

ServerLifecycleEvents.SERVER_STARTING.register(server -> {
                List<MobEffect> mes = BuiltInRegistries.MOB_EFFECT.stream().toList();
                for(MobEffect me : mes){
                    Rpgattr.LOGGER.info("[RPGAttr debug]" + BuiltInRegistries.MOB_EFFECT.getKey(me).toString() + " " + BuiltInRegistries.MOB_EFFECT.getId(me));
                }

            });

produces as expected on client, but on server, even with config effects_raw_id_start: 700, produces the following:

[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:speed 1
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:slowness 2
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:haste 3
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:mining_fatigue 4
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:strength 5
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:instant_health 6
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:instant_damage 7
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:jump_boost 8
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:nausea 9
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:regeneration 10
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:resistance 11
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:fire_resistance 12
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:water_breathing 13
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:invisibility 14
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:blindness 15
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:night_vision 16
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:hunger 17
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:weakness 18
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:poison 19
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:wither 20
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:health_boost 21
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:absorption 22
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:saturation 23
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:glowing 24
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:levitation 25
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:luck 26
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:unluck 27
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:slow_falling 28
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:conduit_power 29
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:dolphins_grace 30
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:bad_omen 31
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:hero_of_the_village 32
[21:07:15] [Server thread/INFO]: [RPGAttr debug]minecraft:darkness 33
[21:07:15] [Server thread/INFO]: [RPGAttr debug]rogues:slice_and_dice 752
[21:07:15] [Server thread/INFO]: [RPGAttr debug]rogues:shock 747
[21:07:15] [Server thread/INFO]: [RPGAttr debug]rogues:shadow_step 750
[21:07:15] [Server thread/INFO]: [RPGAttr debug]rogues:stealth 745
[21:07:15] [Server thread/INFO]: [RPGAttr debug]rogues:shatter 753
[21:07:15] [Server thread/INFO]: [RPGAttr debug]rogues:demoralize 749
[21:07:15] [Server thread/INFO]: [RPGAttr debug]rogues:charge 751
[21:07:15] [Server thread/INFO]: [RPGAttr debug]spell_power:critical_damage 730
[21:07:15] [Server thread/INFO]: [RPGAttr debug]spell_power:critical_chance 731
[21:07:15] [Server thread/INFO]: [RPGAttr debug]spell_power:haste 732
[21:07:15] [Server thread/INFO]: [RPGAttr debug]spell_power:healing 733
[21:07:15] [Server thread/INFO]: [RPGAttr debug]spell_power:lightning 734
[21:07:15] [Server thread/INFO]: [RPGAttr debug]spell_power:soul 735

Notice that the IDs are not incremental past rogues:slice_and_dice, and more importantly rogues IDs don't start at 700. Edit: being non-incremental seems to be irrelevant, it happens on both dev and prod server. I'm still not sure what the nature of the issue is, but there is some problem with the way Rogues registers effects, and none of the other RPG series mods seem to have it?

ZsoltMolnarrr commented 2 months ago

I am unsure why you are experiencing issues, both public servers I ran had no such problems.

Partonetrain commented 2 months ago

Were they ran as dedicated servers or run through e4mc? I could only see the problem on the dedicated server software.

ZsoltMolnarrr commented 2 months ago

We had one using E4MC, one Azure.

Partonetrain commented 2 months ago

This seems to be a result of adding Rogues after the server world was generated.

ZsoltMolnarrr commented 2 months ago

I don’t understand how, could you elaborate?

Partonetrain commented 2 months ago

Basically, as I understand it, the world saves a mapping of block, entity, effect, and other registries to rawIDs. This mapping is sent to clients when they join the server. Since Rogues uses set IDs, the client gets confused if the world's mapping doesn't match up. Essentially this problem only exists if you add to the modpack after the server has generated this mapping. I am able to resolve the issue by simply resetting the world for the server. If there was a way to "flush" the registry-rawID mapping then that would be ideal, but I plan on resetting my server anyway.