Andrew6rant / Thanks--I-fixed-your-Inventory

Customize several aspects of the player inventory. Slot x/y positions, highlight color, player render, etc.
MIT License
2 stars 0 forks source link

Resourcepack & config #1

Open dadoirie opened 10 months ago

dadoirie commented 10 months ago

Really like the mod, but the problem here is that if having a resourcepack depending on the moved slots the user needs to adjust the slots manually Not a issue if it's in a modpack since the configs are shipped aswell, but adding the resourcepack and mod in another configuration/modpack it is. Now my question would be if there could be way that this mod takes a config from a resourcepack (in a predefined folder ofc - maybe root where pack.mcmeta is?) and applies it. Which on the other hand leads to another issue - making the new slots position apply upon a client reload when switching the resource pack would be much more useful when there is a resourcepack config present (lesser confusion for the users)

Just for clarity - I'm using the resource pack options mod and can apply a texture conditionally if a specific mod is installed. That been said I'm planning on combining this with your mod - already using the highlight color feature (but still would be nice if that could be set also with the resource pack)

once disabling the resourcepack just revert back to configs in the configs folder (or if another resource pack which was lower of the disabled one also has a config for this mod then take those)

hope I explained it understandable & reasonable - if not feel free asking

Andrew6rant commented 10 months ago

Technically, it is possible for me to allow resource packs to define slot locations. In fact, I've already done this before, about a year ago: (https://github.com/Andrew6rant/Slot-Helper)

Here is how it looked: (ignore the gold bar renders in the wrong location, I fixed that but never re-recorded a video)

https://github.com/Andrew6rant/Thanks--I-fixed-your-Inventory/assets/57331134/cb1b353a-5d66-442f-a1e3-5856076ea04f

Resource packs could change the location of slots, the shape of slot hitboxes (even to non-square values!), the color of slot hitboxes, and the location of the title text.

There were a number of problems with my method.

Minecraft clients don't really have a clean way to detect what slot is what. There is the slot id, but that is fragile as it changes between inventories (and mods sometime mess with it). My code to detect the slots and if the mouse is hovering over the slots ran every tick (20 times a second) for every slot visible in the inventory. I kept the calculations lightweight, but it is still a lot.

Compare to this mod. This mod is required on both the server and the client, and my code runs only once, when the player slot data is initialized (this is why changing slot locations requires a world reload). Much more performant, but runs the tradeoffs that it needs to be installed on both the server and client, and that it is not very configurable.

dadoirie commented 10 months ago

got an idea: could you make a check if there is a tifyi.json in the root folder of a enabled resourcepack (basically where the pack.mcmeta is)? And if yes on a client reload just overwrite the current configs with this one and when the resourcepack gets disabled then upon client reload revert the changes and use the .minacraft/configs/tifyi.json again (ofc if there ain't other resourcepacks have a tifyi.json in them) but still the player needs to exit the world if the resourcepack got changed ingame and rejoin in order to make the changes happen basically not changing how the slots are being initialized, but still giving resource packs the possibility to change the configs

otherwise on each change of resourcepack (or if using a resourcepack with that Respackopts mod) the TIFYI configs need to be changed manually and also find the correct pixels ... quite a hassle

dadoirie commented 10 months ago

example:

this is just a resourcepack, but with options, and each time changing this one setting the TIFYI configs need also to be changed accordingly - manually - here I just did the left part of player model for the sake of clarity image image

image image