From 718eba960649c793c4b90822e61a194f569fa269 Mon Sep 17 00:00:00 2001 From: viciscat <51047087+viciscat@users.noreply.github.com> Date: Sat, 27 Apr 2024 22:17:43 +0200 Subject: possible fix for crafting in mirrorverse --- .../item/SkyblockCraftingTableScreenHandler.java | 35 +++++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) (limited to 'src/main/java/de/hysky/skyblocker/skyblock/item/SkyblockCraftingTableScreenHandler.java') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/item/SkyblockCraftingTableScreenHandler.java b/src/main/java/de/hysky/skyblocker/skyblock/item/SkyblockCraftingTableScreenHandler.java index 04974ade..c3704d8c 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/item/SkyblockCraftingTableScreenHandler.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/item/SkyblockCraftingTableScreenHandler.java @@ -1,5 +1,6 @@ package de.hysky.skyblocker.skyblock.item; +import de.hysky.skyblocker.utils.Utils; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.Inventory; import net.minecraft.screen.GenericContainerScreenHandler; @@ -16,11 +17,22 @@ public class SkyblockCraftingTableScreenHandler extends GenericContainerScreenHa 28, 29, 30, 34 }; + private static final int[] riftNormalSlots = new int[]{ + 11, 12, 13, + 20, 21, 22, 24, + 29, 30, 31 + }; + + public final boolean mirrorverse; + public SkyblockCraftingTableScreenHandler(ScreenHandlerType type, int syncId, PlayerInventory playerInventory, Inventory inventory, int rows) { super(type, syncId, playerInventory, inventory, rows); + mirrorverse = Utils.getIslandArea().toLowerCase().contains("mirrorverse"); + int[] activeSlots = mirrorverse ? riftNormalSlots: normalSlots; + for (int i = 0; i < rows * 9; i++) { Slot originalSlot = slots.get(i); - if (Arrays.binarySearch(normalSlots, i) >= 0) { + if (Arrays.binarySearch(activeSlots, i) >= 0) { int[] coords = getCoords(i); Slot slot = new Slot(originalSlot.inventory, originalSlot.getIndex(), coords[0], coords[1]); slot.id = i; @@ -45,14 +57,21 @@ public class SkyblockCraftingTableScreenHandler extends GenericContainerScreenHa } private int[] getCoords(int slot) { - if (slot == 23) return new int[]{124, 35}; - if (slot == 16 || slot == 25 || slot == 34) { - int y = (slot / 9 - 1) * 18 + 8; - return new int[]{174, y}; + if (mirrorverse) { + if (slot == 24) return new int[]{124, 35}; + int gridX = slot % 9 - 2; + int gridY = slot / 9 - 1; + return new int[]{30 + gridX * 18, 17 + gridY * 18}; + } else { + if (slot == 23) return new int[]{124, 35}; + if (slot == 16 || slot == 25 || slot == 34) { + int y = (slot / 9 - 1) * 18 + 8; + return new int[]{174, y}; + } + int gridX = slot % 9 - 1; + int gridY = slot / 9 - 1; + return new int[]{30 + gridX * 18, 17 + gridY * 18}; } - int gridX = slot % 9 - 1; - int gridY = slot / 9 - 1; - return new int[]{30 + gridX * 18, 17 + gridY * 18}; } public static class DisabledSlot extends Slot { -- cgit