Estecka / mc-Variants-CIT

A specialized CIT logic for enchanted books
https://modrinth.com/mod/variants-cit
GNU Affero General Public License v3.0
3 stars 0 forks source link

Support for tool with multiple enchantments? #9

Open Jaydee8652 opened 2 weeks ago

Jaydee8652 commented 2 weeks ago

Does this have support for creating tool variants based on enchantments? I assume you could do it with the custom modules but I don't feel like I understand it well enough to even know if what I'm trying to do can be done. Thanks.

Estecka commented 2 weeks ago

Not currently, but that sounds interesting.

How would it behave on a tool with multiple enchantments ? I suppose you'll want one specific enchantment to take priority over the other, and that the enchantments with mutual exclusivity will usually come on top.

Jaydee8652 commented 2 weeks ago

I mean depending on how specific you’d end up wanting to be, you’d only really need to look for mutually exclusives. Fortune and Silk on tools, Channelling and Riptide on Tridents etc, you can just assume knowing something has mending and unbreaking isn’t something you need to know visually. It would get harder with swords because you’d probably want to distinguish both the damage type and Fire Aspect though.

It used to be doable with resewn and I think there are a few packs that do it with Optifine, I was just wondering because this isn’t a direct port wether it was something that has already been figured out.

Jaydee8652 commented 2 weeks ago

For now I decided to just use custom names for a similar effect that the player has to trigger manually.

However I've come across another issue, the custom textures aren't held by the handle in F5. As far as I understand the items in vanilla are tagged somehow as tools and the new variants textures haven't been, is there a way to do that? Thanks

2024-09-04_14 05 47

Estecka commented 2 weeks ago

Do you have a link to one of those older packs ? Having something concrete to play around with while coding will help a lot.

Variants based on a single enchantment should be easy enough to do soon. Since we now have custom enchantments, I won't be hard-coding a list of enchantments to ignore or look for. But it seems feasable to algorithmically pick the most relevants enchantment based on various criterions.

Variance based on a secondary enchantment will definitely take longer. One way I can foresee this becoming possible would be to have a second module that only applies to items with fire aspect, and then provides the variant based on the other enchantment. For that I'd first need to give modules the ability to have restrictions other than the item type.

However I've come across another issue, the custom textures aren't held by the handle in F5. As far as I understand the items in vanilla are tagged somehow as tools and the new variants textures haven't been, is there a way to do that?

The vanilla models for tools use item/handlheld *item/handheld instead of item/generated as a parent; that's probably what you're missing.

Jaydee8652 commented 2 weeks ago

There's quite a few of them,

Visual Enchantments has a system to display a combination of enchants but I think it was done either manually or procedurally before hand. https://www.curseforge.com/minecraft/texture-packs/visual-enchantments/screenshots

The ones by milesdemillas are where I stole the testing texture from, according to their page it only reads the first two enchantments and does it based on those, so to define what texture you want you need to make the item in an anvil in a certain order. https://www.curseforge.com/members/milesdemillas/projects

Jaydee8652 commented 2 weeks ago

The vanilla models for tools use item/handlheld instead of item/generated as a parent; that's probably what you're missing.

That mostly worked but the textures are now missing, I assume I have to put them somewhere else? 2024-09-04_14 51 56

Also, I can't get the trident to do anything, I assume this is because it has a 3D model and so works differently. I don't actually want to change the model itself, just the item.

Estecka commented 1 week ago

Typo, it was handheld, not handlheld.

Not sure about the trident. I think its model has a some hardcoded logic in vanilla, but I don't know how that interacts with the mod; might be that the mod's logic is bypassed completely.

Jaydee8652 commented 1 week ago

2024-09-04_19 45 49 Its working in game! Thanks so much for the help. I still can't crack tridents though, the JSON file for the icon is identical to everything else in vanilla.

Estecka commented 1 week ago

Nothing you can do for now. The trident (and spyglass) have special code that runs after the mod and overrides its changes.

Estecka commented 1 week ago

Had a look at those texture packs... and yeah, they are a completely different kind of beast. These feel like they deserve a CIT system of their own.

It should still be technically possible to achieve with the help of multiple modules, like I suggested in the beginning. That just won't be the most optimal way to do it.