AHilyard / LegendaryTooltips

A mod for Minecraft that adds fancy tooltips for rare items as well as tooltip customization options.
Other
26 stars 14 forks source link

18.2 Question: advance defintions/selectors #58

Open Shibva opened 1 year ago

Shibva commented 1 year ago

Is there a way for me to include 2 statements into one definition to further refine the specific thing you want to apply it to?

Example: Minecraft:dirt and ^ima tooltip (only applies to dirt that has this specific tooltip)

AHilyard commented 1 year ago

The ability to combine multiple selectors was added in version 1.4.0 of Legendary Tooltips (or more precisely, in version 1.1.0 of Iceberg, which is the library that provides item selector functionality). Unfortunately this version has not been released for 1.18.2. For now, you may need to try some other method of getting the borders to match as you want, perhaps NBT tags if that's possible for your use case.

AHilyard commented 1 year ago

Here is the selector documentation if it's helpful: https://github.com/AHilyard/Iceberg/wiki/Item-Selectors-Documentation

Shibva commented 1 year ago

I was trying that, but the big problem is with priority;

But more so I'm trying to use an NBT tag that does not exist

For example; if the item does not have durability

AHilyard commented 1 year ago

Could you give me the specific item so I can see if there are other alternatives that would work?

Shibva commented 1 year ago

Well, part of what I was trying to do was to replace the common white border rarity with something a little bit darker by default.

Pretty much given up on that adventure, though I'm still working on applying some more stuff

since you're here, I guess it's all right if I can ask you this:

If you're making a resource pack for this stuff, what is the total maximum amount of different frames you're gonna have? The original file looks like it can fit 16 but could go farther than that if you expand the file size?

AHilyard commented 1 year ago

If you are making a resource pack, you can have unlimited custom frames. Each image can only have up to 16 frames, but you can define frames from any number of images. Here's the frame definition format: https://github.com/AHilyard/LegendaryTooltips/blob/1.19.3/src/main/resources/assets/legendarytooltips/frame_definitions.json

Shibva commented 1 year ago

Neat, but that only partially answers what I was asking.

I guess I should've been a bit more specific instead of custom frames

AHilyard commented 1 year ago

Sorry, I must've misunderstood. Are you asking if I am making a resource pack?

Shibva commented 1 year ago

No, I'm making one

I was just wondering if there was a way that I could add more than 16 custom frames in one resource

AHilyard commented 1 year ago

Yes, you can. One resource pack can have as many images as you want with any names (frames1.png, frames2.png, for example), and each one of those images can have up to 16 frames. Then, in your frame_definitions.json file, you can just specify which image each frame comes from.

Shibva commented 1 year ago

and how do I do that? specify which file to use when referencing more than one frame?

Edit: sorry that came off rude; Im interested to have learned this just now

AHilyard commented 1 year ago

No worries, if you look at the frame_definitions.json file I linked above, there are comments that explain how it works. There is an optional "image" property where you can put the name of your image. If you don't put it, it will use legendary tooltip's default frame image (legendarytooltips:textures/gui/tooltip_borders.png).

Shibva commented 1 year ago

ill check this out; glad that this is 18.2

thanks man

AHilyard commented 1 year ago

You're welcome, let me know if you run into any issues with it. 🙂

Shibva commented 1 year ago

ya know, I have 2 ideas. a border color selector option that will tell it to automatically render it as the color of the rareity (seems redundant till you consider that colored names created by things like commands also influence it)

and maybe an internal shine control to "force off" the shine effect if you have it enabled on borders that you don't wish to have that gleam to it (way it is currently its all or nothing)

Shibva commented 1 year ago

so how does the priority work overall with in-game config and resource packs? I see that it is applied by what comes first but how does it define what comes first?

AHilyard commented 1 year ago

For your first suggestion, you could set up borders to do that manually but an automatic option is a good idea, I'll consider it.
As for priorities, there are two different systems to consider. First, in a resource pack you can optionally define priority for each frame, but if you don't then the frames will just be checked based on the order they are defined in the frame_definitions.json file. The second priority system to be aware of is defined in the legendary tooltips config file, where you can define the order that the built-in 16 frames are checked. You can also define in the config file if configuration file-defined frames come before or after resource pack-defined ones. Hopefully that's not too confusing...

Shibva commented 1 year ago

also does the file have to be a specific pixel size/ratio?

Shibva commented 1 year ago

what im currently doing is reimplimenting some textures however one frame has a resolution of 128x128 while the original files use in the resource pack you made is a 64x16

so would I be able to use this file if I modify the file want to use to use a 256x1024 size instead?

AHilyard commented 1 year ago

The mod is expecting a size of either 64x64 or 128x128, but regardless of what size the image is, the frames have to be 64x16 pixels.

Shibva commented 1 year ago

thanks for clarifiying

Shibva commented 1 year ago

If I could make a recomendation as well; maybe have an option that goes with file select to specify if you wish to have it work on a 128x32 option

Shibva commented 1 year ago

thanks again for all the help

Shibva commented 1 year ago

hey uh;

Do you happen to have a example template or a "wireframe" map to help align the borders of the textures?

AHilyard commented 1 year ago

frame_template This is the template I used when making Eclectic Trove.