Inventorio
Inventorio copied to clipboard
[Forge 1.18.1] Incompatibillity with tetra
i cant have in sword slos sword, ect...
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...
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.
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:
- 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.
- 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 😅