diff options
author | Kevin <92656833+kevinthegreat1@users.noreply.github.com> | 2024-04-28 14:46:28 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-28 14:46:28 -0400 |
commit | 75547cb59396252f8e5bde41181b9f27c655ccf2 (patch) | |
tree | 9e24bb51bed5c65758c6b762a05c2ea9bb761ff1 /src/main/java/de/hysky/skyblocker/skyblock/item/SkyblockCraftingTableScreenHandler.java | |
parent | 115078d8ce5584fa1bae256d4a44696c6ac79b44 (diff) | |
parent | 76d03afae9e757510fae0ae5ac701c26d19f6327 (diff) | |
download | Skyblocker-75547cb59396252f8e5bde41181b9f27c655ccf2.tar.gz Skyblocker-75547cb59396252f8e5bde41181b9f27c655ccf2.tar.bz2 Skyblocker-75547cb59396252f8e5bde41181b9f27c655ccf2.zip |
Merge pull request #675 from viciscat/fixes-and-things
Fixes and things
Diffstat (limited to 'src/main/java/de/hysky/skyblocker/skyblock/item/SkyblockCraftingTableScreenHandler.java')
-rw-r--r-- | src/main/java/de/hysky/skyblocker/skyblock/item/SkyblockCraftingTableScreenHandler.java | 35 |
1 files changed, 27 insertions, 8 deletions
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 { |