RubixDev / Inventorio

Inventorio - an inventory enhancement mod for Minecraft (Fabric / (Neo)Forge)
https://modrinth.com/mod/inventorio
57 stars 20 forks source link

Can you update to 1.20.2 #275

Closed offbeat-stuff closed 4 months ago

offbeat-stuff commented 9 months ago

I updated the mod to 1.20.2 using this diff

diff --git a/common/src/main/kotlin/me/lizardofoz/inventorio/client/ui/InventorioScreen.kt b/common/src/main/kotlin/me/lizardofoz/inventorio/client/ui/InventorioScreen.kt
index 1851473..53adf2f 100644
--- a/common/src/main/kotlin/me/lizardofoz/inventorio/client/ui/InventorioScreen.kt
+++ b/common/src/main/kotlin/me/lizardofoz/inventorio/client/ui/InventorioScreen.kt
@@ -16,6 +16,7 @@ import net.fabricmc.api.Environment
 import net.minecraft.client.MinecraftClient
 import net.minecraft.client.gui.DrawContext
 import net.minecraft.client.gui.Drawable
+import net.minecraft.client.gui.screen.ButtonTextures
 import net.minecraft.client.gui.screen.Screen
 import net.minecraft.client.gui.screen.ingame.AbstractInventoryScreen
 import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen
@@ -34,33 +35,29 @@ import java.util.function.Consumer

 @Environment(EnvType.CLIENT)
 class InventorioScreen(handler: InventorioScreenHandler, inventory: PlayerInventory)
-    : AbstractInventoryScreen<InventorioScreenHandler?>(handler, inventory, Text.translatable("container.crafting")), RecipeBookProvider
-{
+    : AbstractInventoryScreen<InventorioScreenHandler?>(handler, inventory, Text.translatable("container.crafting")), RecipeBookProvider {
     private var mouseX = 0f
     private var mouseY = 0f
     private val recipeBook = RecipeBookWidget()
-    private var recipeButton : TexturedButtonWidget? = null
-    private var toggleButton : TexturedButtonWidget? = null
-    private var lockedCraftButton : TexturedButtonWidget? = null
+    private var recipeButton: TexturedButtonWidget? = null
+    private var toggleButton: TexturedButtonWidget? = null
+    private var lockedCraftButton: TexturedButtonWidget? = null
     private var open = false
     private var narrow = false
     private var mouseDown = false

     private val inventoryAddon = inventory.player.inventoryAddon!!

-    init
-    {
+    init {
         titleX = INVENTORY_TITLE_X + CRAFTING_GRID_OFFSET_X
     }

     //===================================================
     //Heavily modified or new methods
     //===================================================
-    override fun init()
-    {
+    override fun init() {
         val client = this.client!!
-        if (client.interactionManager!!.hasCreativeInventory())
-        {
+        if (client.interactionManager!!.hasCreativeInventory()) {
             client.setScreen(CreativeInventoryScreen(client.player, client.player!!.networkHandler.enabledFeatures, client.options.operatorItemsTab.value))
             return
         }
@@ -73,10 +70,9 @@ class InventorioScreen(handler: InventorioScreenHandler, inventory: PlayerInvent
         toggleButton = addToggleButton(this)
         lockedCraftButton = addLockedCraftButton(this)
         recipeButton = addDrawableChild(TexturedButtonWidget(
-            x + GUI_RECIPE_WIDGET_BUTTON.x, y + GUI_RECIPE_WIDGET_BUTTON.y,
-            GUI_RECIPE_WIDGET_BUTTON.width, GUI_RECIPE_WIDGET_BUTTON.height,
-            0, 0,
-            19, RECIPE_BUTTON_TEXTURE)
+                x + GUI_RECIPE_WIDGET_BUTTON.x, y + GUI_RECIPE_WIDGET_BUTTON.y,
+                GUI_RECIPE_WIDGET_BUTTON.width, GUI_RECIPE_WIDGET_BUTTON.height,
+                ButtonTextures(RECIPE_BUTTON_TEXTURE, RECIPE_BUTTON_TEXTURE))
         { buttonWidget: ButtonWidget ->
             recipeBook.toggleOpen()
             x = findLeftEdge(recipeBook, width, backgroundWidth - 19 - 19 * ((inventoryAddon.toolBelt.size - 1) / ToolBeltSlot.getColumnCapacity(inventoryAddon.getDeepPocketsRowCount())))
@@ -89,32 +85,27 @@ class InventorioScreen(handler: InventorioScreenHandler, inventory: PlayerInvent
         client.player?.inventorioScreenHandler?.updateDeepPocketsCapacity()

         initConsumers.forEach {
-            try
-            {
+            try {
                 it.value.accept(this)
-            }
-            catch (e: Throwable)
-            {
+            } catch (e: Throwable) {
                 logger.error("Inventory Screen Init Consumer '${it.key}' has failed: ", e)
             }
         }
     }

-    fun onRefresh()
-    {
+    fun onRefresh() {
         backgroundWidth = GUI_INVENTORY_TOP.width + ((inventoryAddon.toolBelt.size - 1) / ToolBeltSlot.getColumnCapacity(inventoryAddon.getDeepPocketsRowCount())) * 20
         backgroundHeight = INVENTORY_HEIGHT + inventoryAddon.getDeepPocketsRowCount() * SLOT_UI_SIZE
     }

-    override fun drawBackground(drawContext: DrawContext, delta: Float, mouseX: Int, mouseY: Int)
-    {
-        if (PlayerSettings.aggressiveButtonRemoval.boolValue)
-        {
+    override fun drawBackground(drawContext: DrawContext, delta: Float, mouseX: Int, mouseY: Int) {
+        if (PlayerSettings.aggressiveButtonRemoval.boolValue) {
             for (child in children().filter {
                 it is Drawable
                         && it != recipeButton
                         && it != toggleButton
-                        && it != lockedCraftButton })
+                        && it != lockedCraftButton
+            })
                 remove(child)
         }
         toggleButton?.x = x + backgroundWidth + GUI_TOGGLE_BUTTON_OFFSET.x
@@ -133,43 +124,42 @@ class InventorioScreen(handler: InventorioScreenHandler, inventory: PlayerInvent

         //Top Part
         drawContext.drawTexture(texture,
-            x + GUI_INVENTORY_TOP.x, y + GUI_INVENTORY_TOP.y,
-            CANVAS_INVENTORY_TOP.x, CANVAS_INVENTORY_TOP.y,
-            GUI_INVENTORY_TOP.width, GUI_INVENTORY_TOP.height,
-            CANVAS_INVENTORY_TEXTURE_SIZE.x, CANVAS_INVENTORY_TEXTURE_SIZE.y)
+                x + GUI_INVENTORY_TOP.x, y + GUI_INVENTORY_TOP.y,
+                CANVAS_INVENTORY_TOP.x, CANVAS_INVENTORY_TOP.y,
+                GUI_INVENTORY_TOP.width, GUI_INVENTORY_TOP.height,
+                CANVAS_INVENTORY_TEXTURE_SIZE.x, CANVAS_INVENTORY_TEXTURE_SIZE.y)

         //Main Rows
         val guiMainRect = GUI_INVENTORY_MAIN(deepPocketsRowCount)
         drawContext.drawTexture(texture,
-            x + guiMainRect.x, y + guiMainRect.y,
-            CANVAS_INVENTORY_MAIN.x, CANVAS_INVENTORY_MAIN.y,
-            guiMainRect.width, guiMainRect.height,
-            CANVAS_INVENTORY_TEXTURE_SIZE.x, CANVAS_INVENTORY_TEXTURE_SIZE.y)
+                x + guiMainRect.x, y + guiMainRect.y,
+                CANVAS_INVENTORY_MAIN.x, CANVAS_INVENTORY_MAIN.y,
+                guiMainRect.width, guiMainRect.height,
+                CANVAS_INVENTORY_TEXTURE_SIZE.x, CANVAS_INVENTORY_TEXTURE_SIZE.y)

         //Deep Pockets Rows
-        if (inventoryAddon.getAvailableUtilityBeltSize() == UTILITY_BELT_FULL_SIZE)
-        {
+        if (inventoryAddon.getAvailableUtilityBeltSize() == UTILITY_BELT_FULL_SIZE) {
             val guiDeepPocketsRect = GUI_INVENTORY_DEEP_POCKETS(deepPocketsRowCount)
             drawContext.drawTexture(texture,
-                x + guiDeepPocketsRect.x, y + guiDeepPocketsRect.y,
-                CANVAS_INVENTORY_DEEP_POCKETS.x, CANVAS_INVENTORY_DEEP_POCKETS.y,
-                guiDeepPocketsRect.width, guiDeepPocketsRect.height,
-                CANVAS_INVENTORY_TEXTURE_SIZE.x, CANVAS_INVENTORY_TEXTURE_SIZE.y)
+                    x + guiDeepPocketsRect.x, y + guiDeepPocketsRect.y,
+                    CANVAS_INVENTORY_DEEP_POCKETS.x, CANVAS_INVENTORY_DEEP_POCKETS.y,
+                    guiDeepPocketsRect.width, guiDeepPocketsRect.height,
+                    CANVAS_INVENTORY_TEXTURE_SIZE.x, CANVAS_INVENTORY_TEXTURE_SIZE.y)

             drawContext.drawTexture(texture,
-                x + GUI_UTILITY_BELT_COLUMN_2.x, y + GUI_UTILITY_BELT_COLUMN_2.y,
-                CANVAS_UTILITY_BELT_COLUMN_2.x, CANVAS_UTILITY_BELT_COLUMN_2.y,
-                GUI_UTILITY_BELT_COLUMN_2.width, GUI_UTILITY_BELT_COLUMN_2.height,
-                CANVAS_INVENTORY_TEXTURE_SIZE.x, CANVAS_INVENTORY_TEXTURE_SIZE.y)
+                    x + GUI_UTILITY_BELT_COLUMN_2.x, y + GUI_UTILITY_BELT_COLUMN_2.y,
+                    CANVAS_UTILITY_BELT_COLUMN_2.x, CANVAS_UTILITY_BELT_COLUMN_2.y,
+                    GUI_UTILITY_BELT_COLUMN_2.width, GUI_UTILITY_BELT_COLUMN_2.height,
+                    CANVAS_INVENTORY_TEXTURE_SIZE.x, CANVAS_INVENTORY_TEXTURE_SIZE.y)
         }

         //Utility Belt Selection Frame
         drawContext.drawTexture(texture,
-            x + GUI_UTILITY_BELT_FRAME_ORIGIN.x + (inventoryAddon.selectedUtility / UTILITY_BELT_SMALL_SIZE) * SLOT_UI_SIZE,
-            y + GUI_UTILITY_BELT_FRAME_ORIGIN.y + (inventoryAddon.selectedUtility % UTILITY_BELT_SMALL_SIZE) * SLOT_UI_SIZE,
-            CANVAS_UTILITY_BELT_FRAME.x.toFloat(), CANVAS_UTILITY_BELT_FRAME.y.toFloat(),
-            CANVAS_UTILITY_BELT_FRAME.width, CANVAS_UTILITY_BELT_FRAME.height,
-            CANVAS_INVENTORY_TEXTURE_SIZE.x, CANVAS_INVENTORY_TEXTURE_SIZE.y)
+                x + GUI_UTILITY_BELT_FRAME_ORIGIN.x + (inventoryAddon.selectedUtility / UTILITY_BELT_SMALL_SIZE) * SLOT_UI_SIZE,
+                y + GUI_UTILITY_BELT_FRAME_ORIGIN.y + (inventoryAddon.selectedUtility % UTILITY_BELT_SMALL_SIZE) * SLOT_UI_SIZE,
+                CANVAS_UTILITY_BELT_FRAME.x.toFloat(), CANVAS_UTILITY_BELT_FRAME.y.toFloat(),
+                CANVAS_UTILITY_BELT_FRAME.width, CANVAS_UTILITY_BELT_FRAME.height,
+                CANVAS_INVENTORY_TEXTURE_SIZE.x, CANVAS_INVENTORY_TEXTURE_SIZE.y)

         //Tool Belt

@@ -177,37 +167,35 @@ class InventorioScreen(handler: InventorioScreenHandler, inventory: PlayerInvent
         val size = inventoryAddon.toolBelt.size
         for (column in 0 until (size - 1) / ToolBeltSlot.getColumnCapacity(deepPocketsRowCount))
             drawContext.drawTexture(texture,
-                x + GUI_TOOL_BELT_UI_EXTENSION.x + column * 20, y + GUI_TOOL_BELT_UI_EXTENSION.y,
-                CANVAS_TOOL_BELT_UI_EXTENSION.x.toFloat(), CANVAS_TOOL_BELT_UI_EXTENSION.y.toFloat(),
-                CANVAS_TOOL_BELT_UI_EXTENSION.width, CANVAS_TOOL_BELT_UI_EXTENSION.height,
-                CANVAS_INVENTORY_TEXTURE_SIZE.x, CANVAS_INVENTORY_TEXTURE_SIZE.y)
+                    x + GUI_TOOL_BELT_UI_EXTENSION.x + column * 20, y + GUI_TOOL_BELT_UI_EXTENSION.y,
+                    CANVAS_TOOL_BELT_UI_EXTENSION.x.toFloat(), CANVAS_TOOL_BELT_UI_EXTENSION.y.toFloat(),
+                    CANVAS_TOOL_BELT_UI_EXTENSION.width, CANVAS_TOOL_BELT_UI_EXTENSION.height,
+                    CANVAS_INVENTORY_TEXTURE_SIZE.x, CANVAS_INVENTORY_TEXTURE_SIZE.y)

         //Draw a slot background per each tool belt slot
         for (index in inventoryAddon.toolBelt.indices)
             drawContext.drawTexture(texture,
-                x + ToolBeltSlot.getGuiPosition(deepPocketsRowCount, index, size).x, y + ToolBeltSlot.getGuiPosition(deepPocketsRowCount, index, size).y,
-                CANVAS_TOOL_BELT.x, CANVAS_TOOL_BELT.y,
-                SLOT_UI_SIZE, SLOT_UI_SIZE,
-                CANVAS_INVENTORY_TEXTURE_SIZE.x, CANVAS_INVENTORY_TEXTURE_SIZE.y)
+                    x + ToolBeltSlot.getGuiPosition(deepPocketsRowCount, index, size).x, y + ToolBeltSlot.getGuiPosition(deepPocketsRowCount, index, size).y,
+                    CANVAS_TOOL_BELT.x, CANVAS_TOOL_BELT.y,
+                    SLOT_UI_SIZE, SLOT_UI_SIZE,
+                    CANVAS_INVENTORY_TEXTURE_SIZE.x, CANVAS_INVENTORY_TEXTURE_SIZE.y)

         //Draw empty slot icons
         for ((index, stack) in inventoryAddon.toolBelt.withIndex())
-            if (stack.isEmpty)
-            {
+            if (stack.isEmpty) {
                 drawContext.drawTexture(PlayerInventoryAddon.toolBeltTemplates[index].emptyIcon,
-                    x + ToolBeltSlot.getSlotPosition(deepPocketsRowCount, index, size).x,
-                    y + ToolBeltSlot.getSlotPosition(deepPocketsRowCount, index, size).y,
-                    0f, 0f, 16, 16, 16, 16
+                        x + ToolBeltSlot.getSlotPosition(deepPocketsRowCount, index, size).x,
+                        y + ToolBeltSlot.getSlotPosition(deepPocketsRowCount, index, size).y,
+                        0f, 0f, 16, 16, 16, 16
                 )
             }

-        InventoryScreen.drawEntity(drawContext, x + 51, y + 75, 30, (x + 51).toFloat() - this.mouseX, (y + 75 - 50).toFloat() - this.mouseY, client!!.player)
+        InventoryScreen.drawEntity(drawContext, x + 51, y + 75, 30, 30, 30, 30.0f, (x + 51).toFloat() - this.mouseX, (y + 75 - 50).toFloat() - this.mouseY, client!!.player)
     }

     //Yes, it's a vanilla method replicated here. 1.17 and 1.17.1 mapping differ and I don't want to have different versions of a mod
     //todo this is a 1.18 branch!
-    private fun findLeftEdge(widget: RecipeBookWidget, width: Int, parentWidth: Int): Int
-    {
+    private fun findLeftEdge(widget: RecipeBookWidget, width: Int, parentWidth: Int): Int {
         return if (widget.isOpen && !narrow)
             177 + (width - parentWidth - 200) / 2
         else
@@ -217,21 +205,16 @@ class InventorioScreen(handler: InventorioScreenHandler, inventory: PlayerInvent
     //===================================================
     //Unmodified methods lifted from InventoryScreen
     //===================================================
-    override fun drawForeground(drawContext: DrawContext, mouseX: Int, mouseY: Int)
-    {
+    override fun drawForeground(drawContext: DrawContext, mouseX: Int, mouseY: Int) {
         drawContext.drawText(textRenderer, title, titleX, titleY, 4210752, false)
     }

-    override fun render(drawContext: DrawContext, mouseX: Int, mouseY: Int, delta: Float)
-    {
-        this.renderBackground(drawContext)
-        if (recipeBook.isOpen && narrow)
-        {
+    override fun render(drawContext: DrawContext, mouseX: Int, mouseY: Int, delta: Float) {
+        this.renderBackground(drawContext, mouseX, mouseY, delta)
+        if (recipeBook.isOpen && narrow) {
             drawBackground(drawContext, delta, mouseX, mouseY)
             recipeBook.render(drawContext, mouseX, mouseY, delta)
-        }
-        else
-        {
+        } else {
             recipeBook.render(drawContext, mouseX, mouseY, delta)
             super.render(drawContext, mouseX, mouseY, delta)
             recipeBook.drawGhostSlots(drawContext, x, y, false, delta)
@@ -242,51 +225,43 @@ class InventorioScreen(handler: InventorioScreenHandler, inventory: PlayerInvent
         this.mouseY = mouseY.toFloat()
     }

-    override fun isPointWithinBounds(xPosition: Int, yPosition: Int, width: Int, height: Int, pointX: Double, pointY: Double): Boolean
-    {
+    override fun isPointWithinBounds(xPosition: Int, yPosition: Int, width: Int, height: Int, pointX: Double, pointY: Double): Boolean {
         return (!narrow || !recipeBook.isOpen) && super.isPointWithinBounds(xPosition, yPosition, width, height, pointX, pointY)
     }

-    override fun mouseClicked(mouseX: Double, mouseY: Double, button: Int): Boolean
-    {
+    override fun mouseClicked(mouseX: Double, mouseY: Double, button: Int): Boolean {
         if (!recipeBook.mouseClicked(mouseX, mouseY, button))
             return if (narrow && recipeBook.isOpen) false else super.mouseClicked(mouseX, mouseY, button)
         focused = recipeBook
         return true
     }

-    override fun mouseReleased(mouseX: Double, mouseY: Double, button: Int): Boolean
-    {
+    override fun mouseReleased(mouseX: Double, mouseY: Double, button: Int): Boolean {
         if (!mouseDown)
             return super.mouseReleased(mouseX, mouseY, button)
         mouseDown = false
         return true
     }

-    override fun isClickOutsideBounds(mouseX: Double, mouseY: Double, left: Int, top: Int, button: Int): Boolean
-    {
+    override fun isClickOutsideBounds(mouseX: Double, mouseY: Double, left: Int, top: Int, button: Int): Boolean {
         val bl = mouseX < left.toDouble() || mouseY < top.toDouble() || mouseX >= (left + backgroundWidth).toDouble() || mouseY >= (top + backgroundHeight).toDouble()
         return recipeBook.isClickOutsideBounds(mouseX, mouseY, x, y, backgroundWidth, backgroundHeight, button) && bl
     }

-    override fun onMouseClick(slot: Slot?, invSlot: Int, clickData: Int, actionType: SlotActionType)
-    {
+    override fun onMouseClick(slot: Slot?, invSlot: Int, clickData: Int, actionType: SlotActionType) {
         super.onMouseClick(slot, invSlot, clickData, actionType)
         recipeBook.slotClicked(slot)
     }

-    override fun refreshRecipeBook()
-    {
+    override fun refreshRecipeBook() {
         recipeBook.refresh()
     }

-    override fun getRecipeBookWidget(): RecipeBookWidget
-    {
+    override fun getRecipeBookWidget(): RecipeBookWidget {
         return recipeBook
     }

-    override fun handledScreenTick()
-    {
+    override fun handledScreenTick() {
         val client = client!!
         if (client.interactionManager!!.hasCreativeInventory() && client.player != null)
             client.setScreen(CreativeInventoryScreen(client.player, client.player!!.networkHandler.enabledFeatures, client.options.operatorItemsTab.value))
@@ -297,37 +272,33 @@ class InventorioScreen(handler: InventorioScreenHandler, inventory: PlayerInvent
     //===================================================
     //Companion Object
     //===================================================
-    companion object
-    {
+    companion object {
         private val RECIPE_BUTTON_TEXTURE = Identifier("textures/gui/recipe_button.png")
         private val BACKGROUND_TEXTURE = Identifier("inventorio", "textures/gui/player_inventory.png")
         private val BACKGROUND_TEXTURE_DARK = Identifier("inventorio", "textures/gui/player_inventory_dark.png")

         private val initConsumers = mutableMapOf<Identifier, Consumer<InventorioScreen>>()

-        @JvmField var shouldOpenVanillaInventory = false
+        @JvmField
+        var shouldOpenVanillaInventory = false

         @JvmStatic
-        fun registerInitConsumer(customIdentifier: Identifier, uiConsumer: Consumer<InventorioScreen>)
-        {
+        fun registerInitConsumer(customIdentifier: Identifier, uiConsumer: Consumer<InventorioScreen>) {
             if (initConsumers.containsKey(customIdentifier))
                 throw IllegalStateException("The Identifier '$customIdentifier' has already been taken")
             initConsumers[customIdentifier] = uiConsumer
         }

         @JvmStatic
-        fun addToggleButton(screen: Screen): TexturedButtonWidget?
-        {
+        fun addToggleButton(screen: Screen): TexturedButtonWidget? {
             if (!PlayerSettings.toggleButton.boolValue)
                 return null
             val canvas = if (screen is InventorioScreen) CANVAS_TOGGLE_BUTTON_ON else CANVAS_TOGGLE_BUTTON_OFF
             val screenAccessor = screen as HandledScreenAccessor
             val button = TexturedButtonWidget(
-                screenAccessor.x + screen.backgroundWidth + GUI_TOGGLE_BUTTON_OFFSET.x, screenAccessor.y + GUI_TOGGLE_BUTTON_OFFSET.y,
-                GUI_TOGGLE_BUTTON_OFFSET.width, GUI_TOGGLE_BUTTON_OFFSET.height,
-                canvas.x, canvas.y,
-                CANVAS_TOGGLE_BUTTON_HOVER_SHIFT,
-                if (PlayerSettings.darkTheme.boolValue) BACKGROUND_TEXTURE_DARK else BACKGROUND_TEXTURE)
+                    screenAccessor.x + screen.backgroundWidth + GUI_TOGGLE_BUTTON_OFFSET.x, screenAccessor.y + GUI_TOGGLE_BUTTON_OFFSET.y,
+                    GUI_TOGGLE_BUTTON_OFFSET.width, GUI_TOGGLE_BUTTON_OFFSET.height,
+                    if (PlayerSettings.darkTheme.boolValue) ButtonTextures(BACKGROUND_TEXTURE_DARK, BACKGROUND_TEXTURE_DARK) else ButtonTextures(BACKGROUND_TEXTURE, BACKGROUND_TEXTURE))
             {
                 val client = MinecraftClient.getInstance() ?: return@TexturedButtonWidget
                 shouldOpenVanillaInventory = client.currentScreen is InventorioScreen
@@ -344,17 +315,14 @@ class InventorioScreen(handler: InventorioScreenHandler, inventory: PlayerInvent
         }

         @JvmStatic
-        fun addLockedCraftButton(screen: Screen): TexturedButtonWidget?
-        {
+        fun addLockedCraftButton(screen: Screen): TexturedButtonWidget? {
             if (GlobalSettings.allow2x2CraftingGrid.boolValue)
                 return null
             val screenAccessor = screen as HandledScreenAccessor
             val button = TexturedButtonWidget(
-                screenAccessor.x + GUI_LOCKED_CRAFTING_POS.x, screenAccessor.y + GUI_LOCKED_CRAFTING_POS.y,
-                GUI_LOCKED_CRAFTING_POS.width, GUI_LOCKED_CRAFTING_POS.height,
-                CANVAS_LOCKED_CRAFT_BUTTON.x, CANVAS_LOCKED_CRAFT_BUTTON.y,
-                GUI_LOCKED_CRAFTING_POS.height,
-                if (PlayerSettings.darkTheme.boolValue) BACKGROUND_TEXTURE_DARK else BACKGROUND_TEXTURE)
+                    screenAccessor.x + GUI_LOCKED_CRAFTING_POS.x, screenAccessor.y + GUI_LOCKED_CRAFTING_POS.y,
+                    GUI_LOCKED_CRAFTING_POS.width, GUI_LOCKED_CRAFTING_POS.height,
+                    if (PlayerSettings.darkTheme.boolValue) ButtonTextures(BACKGROUND_TEXTURE_DARK, BACKGROUND_TEXTURE_DARK) else ButtonTextures(BACKGROUND_TEXTURE, BACKGROUND_TEXTURE))
             {
                 val client = MinecraftClient.getInstance() ?: return@TexturedButtonWidget
                 client.currentScreen?.close()
diff --git a/common/src/main/kotlin/me/lizardofoz/inventorio/enchantment/DeepPocketsBookRecipe.kt b/common/src/main/kotlin/me/lizardofoz/inventorio/enchantment/DeepPocketsBookRecipe.kt
index 0a471c6..0b656cf 100644
--- a/common/src/main/kotlin/me/lizardofoz/inventorio/enchantment/DeepPocketsBookRecipe.kt
+++ b/common/src/main/kotlin/me/lizardofoz/inventorio/enchantment/DeepPocketsBookRecipe.kt
@@ -16,17 +16,14 @@ import net.minecraft.util.Identifier
 import net.minecraft.util.collection.DefaultedList
 import net.minecraft.world.World

-class DeepPocketsBookRecipe(identifier: Identifier, category: CraftingRecipeCategory) : SpecialCraftingRecipe(identifier, category)
-{
-    override fun matches(craftingInventory: RecipeInputInventory, world: World): Boolean
-    {
+class DeepPocketsBookRecipe(identifier: Identifier, category: CraftingRecipeCategory) : SpecialCraftingRecipe(category) {
+    override fun matches(craftingInventory: RecipeInputInventory, world: World): Boolean {
         if (!GlobalSettings.deepPocketsBookCraft.boolValue)
             return false
         var shells = 0
         var books = 0

-        for (i in 0 until craftingInventory.size())
-        {
+        for (i in 0 until craftingInventory.size()) {
             val itemStack = craftingInventory.getStack(i)
             if (SHULKER_SHELL.test(itemStack))
                 shells++
@@ -36,35 +33,29 @@ class DeepPocketsBookRecipe(identifier: Identifier, category: CraftingRecipeCate
         return shells == 2 && books == 1
     }

-    override fun craft(inventory: RecipeInputInventory, registryManager: DynamicRegistryManager): ItemStack
-    {
+    override fun craft(inventory: RecipeInputInventory, registryManager: DynamicRegistryManager): ItemStack {
         val bookItem = ItemStack(Items.ENCHANTED_BOOK, 1)
         EnchantedBookItem.addEnchantment(bookItem, EnchantmentLevelEntry(DeepPocketsEnchantment, 1))
         return bookItem
     }

-    override fun fits(width: Int, height: Int): Boolean
-    {
+    override fun fits(width: Int, height: Int): Boolean {
         return width >= 2 && height >= 2
     }

-    override fun getSerializer(): RecipeSerializer<*>
-    {
+    override fun getSerializer(): RecipeSerializer<*> {
         return SERIALIZER
     }

-    override fun isIgnoredInRecipeBook(): Boolean
-    {
+    override fun isIgnoredInRecipeBook(): Boolean {
         return !GlobalSettings.deepPocketsBookCraft.boolValue
     }

-    override fun getIngredients(): DefaultedList<Ingredient>
-    {
+    override fun getIngredients(): DefaultedList<Ingredient> {
         return DefaultedList.copyOf(SHULKER_SHELL, SHULKER_SHELL, BOOKS, SHULKER_SHELL)
     }

-    override fun getOutput(registryManager: DynamicRegistryManager): ItemStack
-    {
+    fun getOutput(registryManager: DynamicRegistryManager): ItemStack {
         if (!GlobalSettings.deepPocketsBookCraft.boolValue)
             ItemStack.EMPTY
         val bookItem = ItemStack(Items.ENCHANTED_BOOK, 1)
@@ -72,8 +63,7 @@ class DeepPocketsBookRecipe(identifier: Identifier, category: CraftingRecipeCate
         return bookItem
     }

-    companion object
-    {
+    companion object {
         private val SHULKER_SHELL = Ingredient.ofItems(Items.SHULKER_SHELL)
         private val BOOKS = Ingredient.ofItems(Items.BOOK, Items.WRITABLE_BOOK)

diff --git a/common/src/main/kotlin/me/lizardofoz/inventorio/player/InventorioScreenHandler.kt b/common/src/main/kotlin/me/lizardofoz/inventorio/player/InventorioScreenHandler.kt
index ea90b1f..3f81ca2 100644
--- a/common/src/main/kotlin/me/lizardofoz/inventorio/player/InventorioScreenHandler.kt
+++ b/common/src/main/kotlin/me/lizardofoz/inventorio/player/InventorioScreenHandler.kt
@@ -25,6 +25,7 @@ import net.minecraft.inventory.CraftingResultInventory
 import net.minecraft.inventory.Inventory
 import net.minecraft.item.ItemStack
 import net.minecraft.recipe.Recipe
+import net.minecraft.recipe.RecipeEntry
 import net.minecraft.recipe.RecipeMatcher
 import net.minecraft.recipe.book.RecipeBookCategory
 import net.minecraft.screen.AbstractRecipeScreenHandler
@@ -360,7 +361,14 @@ class InventorioScreenHandler(syncId: Int, val inventory: PlayerInventory)
         craftingInput.clear()
     }

-    override fun matches(recipe: Recipe<in CraftingInventory?>): Boolean
+    override fun matches(recipe: RecipeEntry<out Recipe<CraftingInventory?>>?): Boolean {
+        if (recipe != null) {
+            return recipe.value.matches(craftingInput,inventory.player.world)
+        }
+        return false
+    }
+
+    fun matches(recipe: Recipe<in CraftingInventory?>): Boolean
     {
         return recipe.matches(craftingInput, inventory.player.world)
     }
diff --git a/fabric/src/main/kotlin/me/lizardofoz/inventorio/InventorioFabric.kt b/fabric/src/main/kotlin/me/lizardofoz/inventorio/InventorioFabric.kt
index 7229fce..3c50ade 100644
--- a/fabric/src/main/kotlin/me/lizardofoz/inventorio/InventorioFabric.kt
+++ b/fabric/src/main/kotlin/me/lizardofoz/inventorio/InventorioFabric.kt
@@ -34,7 +34,7 @@ open class InventorioFabric : ModInitializer
         DeepPocketsBookRecipe.SERIALIZER = Registry.register(
             Registries.RECIPE_SERIALIZER,
             Identifier("inventorio", "deep_pockets_book"),
-            SpecialRecipeSerializer { identifier, category -> DeepPocketsBookRecipe(identifier, category) })
+            SpecialRecipeSerializer { category -> DeepPocketsBookRecipe(Identifier("inventorio", "deep_pockets_book"), category) })

         initToolBelt()

diff --git a/gradle.properties b/gradle.properties
index 419b3eb..205727e 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -6,20 +6,20 @@ mod_authors=["LizardOfOz"]
 mod_description=My vision of the Inventory Update. Includes Deep Pockets Enchantment, Tool Belt, Utility Belt and more.
 github=https://github.com/Lizard-Of-Oz/Inventorio

-minecraft_version=1.20.1
-archive_version=1.20
+minecraft_version=1.20.2
+archive_version=1.20.2
 mod_version=1.9.2
 kotlin_version=1.6.0

-fabric_loader_version=0.14.21
-fabric_api_version=0.84.0+1.20.1
-yarn_mappings=1.20.1+build.9
+fabric_loader_version=0.14.22
+fabric_api_version=0.89.2+1.20.2
+yarn_mappings=1.20.2+build.1
 fabric_kotlin_version=1.9.6+kotlin.1.8.22

-forge_version=47.0.35
-forge_kotlin_version=4.3.0
+forge_version=48.0.13
+forge_kotlin_version=4.4.0

-cloth_config_version=11.0.99
-modmenu_version=7.1.0
+cloth_config_version=12.0.109
+modmenu_version=8.0.0
offbeat-stuff commented 9 months ago

Though I dont really know how the code works

offbeat-stuff commented 9 months ago

Also mixin errors, SO I hope you can bring forward the 1.20.2 version

RubixDev commented 4 months ago

A Fabric version for 1.20.2 was already released over a month ago, and just now I also released a version for NeoForge