diff options
author | viciscat <51047087+viciscat@users.noreply.github.com> | 2024-04-27 22:17:43 +0200 |
---|---|---|
committer | viciscat <51047087+viciscat@users.noreply.github.com> | 2024-04-27 22:18:18 +0200 |
commit | 718eba960649c793c4b90822e61a194f569fa269 (patch) | |
tree | ad95722f6edc087c98e26894e45a142afed4fe09 /src/main/java/de | |
parent | 69476a65e6831c0d857877e7d95519c1334239ec (diff) | |
download | Skyblocker-718eba960649c793c4b90822e61a194f569fa269.tar.gz Skyblocker-718eba960649c793c4b90822e61a194f569fa269.tar.bz2 Skyblocker-718eba960649c793c4b90822e61a194f569fa269.zip |
possible fix for crafting in mirrorverse
Diffstat (limited to 'src/main/java/de')
-rw-r--r-- | src/main/java/de/hysky/skyblocker/skyblock/item/SkyblockCraftingTableScreen.java | 15 | ||||
-rw-r--r-- | src/main/java/de/hysky/skyblocker/skyblock/item/SkyblockCraftingTableScreenHandler.java | 35 |
2 files changed, 36 insertions, 14 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/item/SkyblockCraftingTableScreen.java b/src/main/java/de/hysky/skyblocker/skyblock/item/SkyblockCraftingTableScreen.java index ad4f8b30..a09b260a 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/item/SkyblockCraftingTableScreen.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/item/SkyblockCraftingTableScreen.java @@ -23,6 +23,7 @@ import net.minecraft.screen.AbstractRecipeScreenHandler; import net.minecraft.screen.ScreenHandlerType; import net.minecraft.screen.slot.Slot; import net.minecraft.screen.slot.SlotActionType; +import net.minecraft.text.OrderedText; import net.minecraft.text.Text; import net.minecraft.util.Identifier; @@ -56,11 +57,13 @@ public class SkyblockCraftingTableScreen extends HandledScreen<SkyblockCraftingT button.setPosition(this.x + 5, this.height / 2 - 49); if (moreCraftsButton != null) moreCraftsButton.setPosition(this.x + 174, this.y + 62); })); - moreCraftsButton = new TexturedButtonWidget(this.x + 174, y + 62, 16, 16, MORE_CRAFTS_TEXTURES, - button -> this.onMouseClick(handler.slots.get(26), handler.slots.get(26).id, 0, SlotActionType.PICKUP)); - moreCraftsButton.setTooltipDelay(Duration.ofMillis(250L)); - moreCraftsButton.setTooltip(Tooltip.of(Text.literal("More Crafts"))); - this.addDrawableChild(moreCraftsButton); + if (!handler.mirrorverse) { + moreCraftsButton = new TexturedButtonWidget(this.x + 174, y + 62, 16, 16, MORE_CRAFTS_TEXTURES, + button -> this.onMouseClick(handler.slots.get(26), handler.slots.get(26).id, 0, SlotActionType.PICKUP)); + moreCraftsButton.setTooltipDelay(Duration.ofMillis(250L)); + moreCraftsButton.setTooltip(Tooltip.of(Text.literal("More Crafts"))); + this.addDrawableChild(moreCraftsButton); + } assert (client != null ? client.player : null) != null; client.player.currentScreenHandler = handler; // recipe book replaces it with the Dummy one fucking DUMBASS this.addSelectableChild(this.recipeBook); @@ -103,7 +106,7 @@ public class SkyblockCraftingTableScreen extends HandledScreen<SkyblockCraftingT int i = this.x; int j = (this.height - this.backgroundHeight) / 2; context.drawTexture(TEXTURE, i, j, 0, 0, this.backgroundWidth, this.backgroundHeight); - context.drawGuiTexture(QUICK_CRAFT, i + 173, j, 0, 25, 84); + if (!handler.mirrorverse) context.drawGuiTexture(QUICK_CRAFT, i + 173, j, 0, 25, 84); } @Override 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 { |