sisby-folk / inventory-tabs

A minecraft mod that allows swapping to other in-world screens (blocks, entities, etc) via tabs. A fourth-generation rewrite of CakeWhip's InventoryTabs.
https://modrinth.com/mod/inventory-tabs
GNU Lesser General Public License v3.0
6 stars 3 forks source link

Incompatible with container-title-text-based inventory background resource packs #52

Open seylorx1 opened 2 months ago

seylorx1 commented 2 months ago

Applicable to Inventory Tabs 1.3.3

Issue Description

Hello! I was playing earlier using the Faithless resource pack and noticed strange behaviour when hovering over chest tabs, where an image of the chest inventory layout would display.

image

However, vanilla textures display expected behaviour.

image

After digging through the resource pack, I noticed some strange escape sequences in the Faithless lang file that tabs/ChestBlockTab.java references. In Faithless, a custom en.us lang file has overrides for the container.chest and container.chestDouble language entries:

Further, I learned that vanilla resource pack authors are not able to create unique textures for chests and double chests in vanilla contexts as discussed in this minecraftforum thread. It appears, somehow, that Faithless is doing something with the language file to display sprites for containers that otherwise do not support custom textures. Certainly, I struggled to find any information on what the \uE99X escape sequence does, but Faithless seems to use this to override the "Chest" and "Double Chest" text fields at the top of chest inventories to display gui backgrounds. Typically, these lang file entries are only used within gui, as the chest item has a separate lang file entry. This appears to have the unintended consequence of displaying a sprite wherever the container.xxxx lang file translations are used, including within tooltips apparently.

Workaround for 1.3.3

Removing container lang file entries from the resource pack fixes the issue with this mod, but also prevents resource packs like Faithless from displaying their nicely done (yet hacky) container gui backgrounds.

Possible Solutions?

It might be worth seeing how feasible it would be to add an option in inventory_tabs.toml to allow for custom strings or lang files for use exclusively within the mod, bypassing net.minecraft.text.Text.translatable().