OptiGUI icon indicating copy to clipboard operation
OptiGUI copied to clipboard

[Feature Request] Some more OptiGUI Selectors

Open JuceInUse opened this issue 3 years ago • 4 comments

While I know that this mod is meant to emulate Optifine GUI properties, it would also be nice if it could extend it in a similar vein to how ETF not only replaces random entity features but adds new ones to the game. For example, it would be awesome if the player inventory could have a texture based on health and hunger or something to that effect

JuceInUse avatar Oct 12 '22 12:10 JuceInUse

I haven't thought about more features than OptiFine supports or should support (which were added in OptiGUI v1.1.0). For the next release I only plan to fix bugs when I have some time. I haven't needed any new features, feel free to explain any new feature in detail so I know what to add if I decide to.

opekope2 avatar Oct 12 '22 16:10 opekope2

Oh! I actually have some ideas that you could use for custom GUI features. Here, I have some of them outlined:

Health [I.E. Health=15, Health=50%, Health=5%..10%, smth like that]

This is a little self-explanatory. Basically, you can make the inventory GUI change depending on player health. Maybe, for example, you could have a stone brick GUI that slowly cracks when you lose HP

Level [I.E. Level=20, Level=20.., Level=10..20]

This would work more in a range. Basically, you could make it so that different GUIs changed based on what level your player was at. For example, maybe you’d make it so that when you reach level 30 enchanting tables have a GUI to indicate that you can do level 30 enchants

Hunger [I.E. Hunger=0, Hunger=30%, Hunger=10%..50%]

Like the others, this would be based on player information. The hunger parameter could make it so that you could change a GUI based on how hungry you were. If you wanted it to trigger for one bar of hunger, for example, Hunger=2 would be what you used. Maybe it could also work with saturation? I dunno. An example of this could be a zombie-themed GUI that slowly became more red the less hunger you had, and saturation could play in by it having golden edges that became less gold the less saturation you had

Effects [I.E. Effects=minecraft:hunger, Effects={minecraft:strength,minecraft:blindness}, etc.]

This would be triggered based on the potion effects the player had. This could be useful for something like maybe having the player GUI change color depending on your active effects. Ideally, it would be compatible with modded potion effects if that implementation was easy enough, but even just vanilla effects would be dope

JuceInUse avatar Oct 12 '22 18:10 JuceInUse

The codebase has reached the point, when adding these features is easy and non-hacky. I'll look into them in a future version.

opekope2 avatar May 17 '23 16:05 opekope2

Love to see it! Good luck with doing any of this, and I'm loving seeing where this mod is going

JuceInUse avatar May 17 '23 17:05 JuceInUse

It would be really good to have more selector options, is it possible to apply texture according to the ID value of the block?

  • for example, I have a mod and I want to change the GUI of the block that matches the mod:id like minecraft:crafting_table

I prepared textures for various crafting tables but I realized that I couldn't change them with name.wildcard, because they are not entities.

crafting_table.ini
[crafting_table]
name.wildcard.ignore_case=Oak Crafting Table
replacement=oak_crafting_table.png

[crafting_table #2]
name.wildcard.ignore_case=Spruce Crafting Table
replacement=spruce_crafting_table.png

[crafting_table #3]
name.wildcard.ignore_case=Birch Crafting Table
replacement=birch_crafting_table.png

...

instead of opening a new issue I thought I'd write it here...

hhhhh-ckr avatar Jan 08 '25 05:01 hhhhh-ckr

OptiGUI 3 will use NBT instead of selectors, and will support most other mods out-of-the-box. The first alpha will be released this January, soon after merging #126.

opekope2 avatar Jan 08 '25 11:01 opekope2

The first alpha builds of OptiGUI 3 are finally here for 1.20 and 1.21!

OptiGUI 3 uses NBT instead of selectors, which is way more compatible with other mods out-of-the-box.

Here's an example for health, level, hunger, effects in Minecraft 1.21 (adjustments may be necessary). Check out the docs for more info.

{
  "containers": ["mod:id"],
  "textures": {
    "mod:textures/gui/path/to/texture.png": "example:path/to/changed/texture.png"
  },
  "match": {
    "@player": {
      "@Health": 15,
      "@XpLevel": {
        ">=": 10,
        "<=": 20
      },
      "@foodLevel": 0,
      "@active_effects": {
        "#any": {
          "@id": "minecraft:hunger"
        }
      }
    }
  }
}

Percentages are not supported as of now.

opekope2 avatar Jan 11 '25 17:01 opekope2