OpenBagTwo / FoxNap

A survival-, multiplayer- and copyright-friendly mod for adding custom music discs to your world
GNU General Public License v3.0
1 stars 1 forks source link

Create placeholder registry entries for large numbers of tracks #35

Closed OpenBagTwo closed 1 year ago

OpenBagTwo commented 1 year ago

Band-aid solution to resolve #34

It was a fundamental misunderstanding on my part to think that only the logical server kept track of the item registry or that the item registry could be modified after launch (this has broader implications for any planned ModMenu integration). Even looking at several mods which have configs that customize the items registered and have settings adjustable via ModMenu, the item options are never tweakable without a restart.

So given that the number of tracks needs to a value that is:

I went ahead and semi-hard-coded it to an absurdly high number.

This appears to work as intended on 1.19.2, because large parts of the Minecraft logic are implicitly logical-server-side or client-side. Namely, I have verified, with varying n_disc values set on independently on server and client, that:

Outstanding Issues

Of these, only that last item (plus the validation story) I would consider as having any sort of severity, so I may watch some tutorials to see if I can get that figured out for the initial release.

Footnotes

[1] as I mentioned when I originally ran up against this issue, it does seem like the experience is functional if the server has fewer records registered than the client, but the behavior seemed extremely glitchy

[2] with client-side n_discs set to 3 and server-side n_discs set to 5, only records 1-3 show up in the creative inventory ![with client-side n_discs set to 3 and server-side n_discs set to 5, only records 1-3 show up in the creative inventory](https://user-images.githubusercontent.com/66568922/206779456-5596842b-68df-4d79-a43e-f9912d076dae.png)
[3] with client-side n_discs set to 3 and server-side n_discs set to 5, villagers will still offer discs 4 and 5 ![with client-side n_discs set to 3 and server-side n_discs set to 5, villagers will still offer discs 4 and 5](https://user-images.githubusercontent.com/66568922/206779728-99aaf528-861e-443c-88c2-641da71d2a0f.png)
OpenBagTwo commented 1 year ago

First outstanding issue is spun off as #36.