Support for Inventory Management
ModProg opened this issue ยท 3 comments
Its author claims it should be possible to do so from here (Roundaround/mc-fabric-inventory-management#2).
If I find time, I'll maybe look into this myself.
Hi! It should be pretty easy to integrate (famous last words)!
Unfortunately I'm pretty busy today so I won't be able to come up with more details yet but I poked around the source code and saw it was extending ScreenHandler with a SimpleInventory backing it, which means you should be able to utilize the registration methods in InventoryButtonsManager to do it by registering BackpackScreenHandler.class:
https://github.com/Roundaround/mc-fabric-inventory-management/blob/1.18.2/src/main/java/me/roundaround/inventorymanagement/client/InventoryButtonsManager.java#L79
https://github.com/Roundaround/mc-fabric-inventory-management/blob/1.18.2/src/main/java/me/roundaround/inventorymanagement/client/InventoryButtonsManager.java#L83
Okay I found myself a bit more time to play around with it and I think it works!
You'll need to add my Maven repo:
maven {
name = 'Roundaround Maven'
url = "https://maven.rnda.dev/releases"
}
and then add Inventory Management as a compile only dependency:
modCompileOnly "me.roundaround:inventorymanagement:1.0.2+1.18.2"
From there, you can integrate similarly to how the Trinket integration is set up. Create a compat class to make sure none of the Inventory Management classes are loaded directly in the main Inmis loader class, and use Fabric loader's API to check if Inventory Management is loaded:
if (FabricLoader.getInstance().isModLoaded("inventorymanagement")) {
InventoryManagementCompat.registerScreenHandler();
}
Then within your compat class, simply call the appropriate registration methods to setup the backpack screens for integration:
public static void registerScreenHandler() {
InventoryButtonsManager.INSTANCE.registerSimpleInventorySortableHandler(BackpackScreenHandler.class);
InventoryButtonsManager.INSTANCE.registerSimpleInventoryTransferableHandler(BackpackScreenHandler.class);
}