Inventorio icon indicating copy to clipboard operation
Inventorio copied to clipboard

[Forge 1.18.1] Incompatibillity with tetra

Open kiwisekcz opened this issue 2 years ago • 3 comments

i cant have in sword slos sword, ect...

kiwisekcz avatar Jan 08 '22 22:01 kiwisekcz

Hey there friend, is there any chance of this issue being addressed anytime soon in the future? It's unfortunately dampening the experience of my modpack's players, and it's pushing me to remove either Tetra or Inventorio...

nekomaster1000 avatar Oct 02 '22 14:10 nekomaster1000

It was supposed to be fixed back then, with Inventorio allowing anything marked as a sword/pickaxe/axe etc into corresponding slots.

If a tool from a certain mod doesn't fit into a slot, then it's likely that the creator of that mod ignored the appropriate tags. Therefore, changes have to be made on their end.

Lizard-Of-Oz avatar Oct 02 '22 14:10 Lizard-Of-Oz

Contributing (perhaps negatively) to this discussion, as I'm unfamiliar with Forge's / Minecraft's APIs, I implemented a messy solution for Tetra Compatibility for my personal gameplay,

Under InventorioAPI.java I added the following condition to the sword tool section

.addAllowingCondition((itemStack, addon) -> {
                        // Check if the item is from Tetra mod
                        // matches Modular[A-Za-z]*Item regex
                        return itemStack.getItem().getClass().getSimpleName().matches("Modular[A-Za-z]*Item");
                    })

And under PlayerInventoryExtraStuff.kt

// under prePlayerAttack
val className = getActualMainHandItem().item.javaClass.simpleName
        if (className.matches(Regex("Modular[A-Za-z]+Item")))
            return
        
 // under getMostPreferredTool
 val className = getActualMainHandItem().item.javaClass.simpleName
        if (className.matches(Regex("Modular[A-Za-z]+Item")))
            return getActualMainHandItem()

This modification allows the mods to work together fairly seamlessly, but it's a poor implementation for two reasons:

  1. It uses the classnames (ew); which while unlikely to change, isn't a clean solution. Could conflict with other mods, though unlikely to be an issue.
  2. It allows any modular item to be used in the sword slot; for my tastes, this is not really a problem, as Tetra has weapons other than swords that I might be interested in using (Hammers, Warforged Tools, etc.)

If you have a recommendation @Lizard-Of-Oz for how I can approach this in a more appropriate fashion, I'd be willing to file a PR.

I found that it was easier to modify Inventorio to support Tetra than the other way around, due to how Tetra is set up 😅

TotalTechGeek avatar Feb 19 '24 18:02 TotalTechGeek