Jikoo / OpenInv

Open anyone's inventory as a chest, real-time!
GNU General Public License v3.0
119 stars 36 forks source link

Improve customizability #215

Closed Jikoo closed 2 months ago

Jikoo commented 2 months ago

Adds configurability to title and placeholders.

Placeholders default to support the legibility pack. As most users probably won't want to edit them, they are not included in the configuration by default, but can be manually added. Copy the following into your config.yml and edit accordingly:

placeholders:
  crafting-output: '{id:"minecraft:crafting_table",components:{"minecraft:custom_model_data":9999,"minecraft:item_name":''{"translate":"container.crafting"}''}}'
  cursor: '{id:"minecraft:white_banner",components:{"minecraft:custom_model_data":9999,"minecraft:banner_patterns":[{color:"gray",pattern:"minecraft:diagonal_up_right"},{color:"white",pattern:"minecraft:stripe_downright"},{color:"gray",pattern:"minecraft:border"}],"minecraft:hide_tooltip":{}}}'
  drop: '{id:"minecraft:dropper",components:{"minecraft:custom_model_data":9999,"minecraft:item_name":''{"translate":"key.drop"}''}}'
  empty-helmet: '{id:"minecraft:leather_helmet",components:{"minecraft:custom_model_data":9999,"minecraft:dyed_color":{rgb:13158600,show_in_tooltip:0b},"minecraft:hide_tooltip":{}}}'
  empty-chestplate: '{id:"minecraft:leather_chestplate",components:{"minecraft:custom_model_data":9999,"minecraft:dyed_color":{rgb:13158600,show_in_tooltip:0b},"minecraft:hide_tooltip":{}}}'
  empty-leggings: '{id:"minecraft:leather_leggings",components:{"minecraft:custom_model_data":9999,"minecraft:dyed_color":{rgb:13158600,show_in_tooltip:0b},"minecraft:hide_tooltip":{}}}'
  empty-boots: '{id:"minecraft:leather_boots",components:{"minecraft:custom_model_data":9999,"minecraft:dyed_color":{rgb:13158600,show_in_tooltip:0b},"minecraft:hide_tooltip":{}}}'
  empty-off-hand: '{id:"minecraft:shield",components:{"minecraft:custom_model_data":9999,"minecraft:banner_patterns":[{color:"black",pattern:"minecraft:half_vertical"},{color:"magenta",pattern:"minecraft:square_top_left"},{color:"magenta",pattern:"minecraft:square_bottom_left"},{color:"black",pattern:"minecraft:square_top_right"},{color:"black",pattern:"minecraft:square_bottom_right"}],"minecraft:base_color":"magenta","minecraft:hide_tooltip":{}}}'
  not-a-slot: '{id:"minecraft:white_stained_glass_pane",components:{"minecraft:custom_model_data":9999,"minecraft:hide_tooltip":{}}}'
  blocked:
    offline: '{id:"minecraft:barrier",components:{"minecraft:item_name":''{"translate":"options.narrator.notavailable","extra":[" - ",{"translate":"gui.socialInteractions.status_offline"}]}''}}'
    creative: '{id:"minecraft:barrier",components:{"minecraft:item_name":''{"translate":"options.narrator.notavailable","extra":[" - ",{"translate":"selectWorld.gameMode.creative"}]}''}}'
    spectator: '{id:"minecraft:barrier",components:{"minecraft:item_name":''{"translate":"options.narrator.notavailable","extra":[" - ",{"translate":"selectWorld.gameMode.spectator"}]}''}}'

The inventory title is more customizable: There is a white prefix using the font openinv:font/inventory to support the usage of bitmap fonts. Depending on whether the inventory is opened by the owner or another player, this will use translation key openinv.container.inventory.self or openinv.container.inventory.other, defaulting to empty. This is followed by the translation key container.inventory. Finally, the translation key openinv.container.inventory.suffix with a default of - %s and a parameter of the inventory owner's name is at the end. If that doesn't offer the customization you need, you can change it yourself via Paper's API.

Still need to include a way for users to download the pack directly. May be exclusive to GitHub releases because I'm lazy, but it might also be nice to upload elsewhere. Alternately, as I imagine the pack will be relatively static, maybe I'll just upload it once when necessary and reuse the link. I will also need to write a wiki page about this.