diff options
Diffstat (limited to 'src')
18 files changed, 119 insertions, 73 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java index fcba864c..610412ac 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java @@ -26,6 +26,7 @@ import io.github.moulberry.notenoughupdates.miscgui.GuiInvButtonEditor; import io.github.moulberry.notenoughupdates.miscgui.GuiItemRecipe; import io.github.moulberry.notenoughupdates.miscgui.StorageOverlay; import io.github.moulberry.notenoughupdates.miscgui.TradeWindow; +import io.github.moulberry.notenoughupdates.mixins.AccessorGuiContainer; import io.github.moulberry.notenoughupdates.options.NEUConfig; import io.github.moulberry.notenoughupdates.overlays.AuctionSearchOverlay; import io.github.moulberry.notenoughupdates.overlays.OverlayManager; @@ -333,10 +334,10 @@ public class RenderListener { if (event.gui instanceof GuiContainer) { try { - int xSize = ((GuiContainer) event.gui).xSize; - int ySize = ((GuiContainer) event.gui).ySize; - int guiLeft = ((GuiContainer) event.gui).guiLeft; - int guiTop = ((GuiContainer) event.gui).guiTop; + int xSize = ((AccessorGuiContainer) event.gui).getXSize(); + int ySize = ((AccessorGuiContainer) event.gui).getYSize(); + int guiLeft = ((AccessorGuiContainer) event.gui).getGuiLeft(); + int guiTop = ((AccessorGuiContainer) event.gui).getGuiTop(); hoverInv = event.getMouseX() > guiLeft && event.getMouseX() < guiLeft + xSize && event.getMouseY() > guiTop && event.getMouseY() < guiTop + ySize; @@ -458,10 +459,10 @@ public class RenderListener { GlStateManager.translate(0, 0, zOffset); - int xSize = ((GuiContainer) event.gui).xSize; - int ySize = ((GuiContainer) event.gui).ySize; - int guiLeft = ((GuiContainer) event.gui).guiLeft; - int guiTop = ((GuiContainer) event.gui).guiTop; + int xSize = ((AccessorGuiContainer) event.gui).getXSize(); + int ySize = ((AccessorGuiContainer) event.gui).getYSize(); + int guiLeft = ((AccessorGuiContainer) event.gui).getGuiLeft(); + int guiTop = ((AccessorGuiContainer) event.gui).getGuiTop(); if (!NEUApi.disableInventoryButtons) { for (NEUConfig.InventoryButton button : NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons) { @@ -565,10 +566,10 @@ public class RenderListener { if (!doInventoryButtons) return; if (NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() && NotificationHandler.shouldRenderOverlay(event.gui) && event.gui instanceof GuiContainer) { - int xSize = ((GuiContainer) event.gui).xSize; - int ySize = ((GuiContainer) event.gui).ySize; - int guiLeft = ((GuiContainer) event.gui).guiLeft; - int guiTop = ((GuiContainer) event.gui).guiTop; + int xSize = ((AccessorGuiContainer) event.gui).getXSize(); + int ySize = ((AccessorGuiContainer) event.gui).getYSize(); + int guiLeft = ((AccessorGuiContainer) event.gui).getGuiLeft(); + int guiTop = ((AccessorGuiContainer) event.gui).getGuiTop(); if (!NEUApi.disableInventoryButtons) { for (NEUConfig.InventoryButton button : NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons) { @@ -644,9 +645,9 @@ public class RenderListener { if (gui instanceof GuiChest && NotEnoughUpdates.INSTANCE.config.dungeons.profitDisplayLoc != 2) { try { - int xSize = ((GuiContainer) gui).xSize; - int guiLeft = ((GuiContainer) gui).guiLeft; - int guiTop = ((GuiContainer) gui).guiTop; + int xSize = ((AccessorGuiContainer) gui).getXSize(); + int guiLeft = ((AccessorGuiContainer) gui).getGuiLeft(); + int guiTop = ((AccessorGuiContainer) gui).getGuiTop(); GuiChest eventGui = (GuiChest) gui; ContainerChest cc = (ContainerChest) eventGui.inventorySlots; @@ -899,8 +900,7 @@ public class RenderListener { GuiChest eventGui = (GuiChest) guiScreen; ContainerChest cc = (ContainerChest) eventGui.inventorySlots; containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); - if (containerName.contains(" Profile") && BetterContainers.profileViewerStackIndex != -1 && - eventGui.isMouseOverSlot(cc.inventorySlots.get(BetterContainers.profileViewerStackIndex), mouseX, mouseY) && + if (containerName.contains(" Profile") && BetterContainers.profileViewerStackIndex != -1 && ((AccessorGuiContainer)eventGui).doIsMouseOverSlot(cc.inventorySlots.get(BetterContainers.profileViewerStackIndex), mouseX, mouseY) && Mouse.getEventButton() >= 0) { event.setCanceled(true); if (Mouse.getEventButtonState() && eventGui.inventorySlots.inventorySlots.get(22).getStack() != null && @@ -959,10 +959,10 @@ public class RenderListener { if (!doInventoryButtons) return; if (NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() && NotificationHandler.shouldRenderOverlay(event.gui) && Mouse.getEventButton() >= 0 && event.gui instanceof GuiContainer) { - int xSize = ((GuiContainer) event.gui).xSize; - int ySize = ((GuiContainer) event.gui).ySize; - int guiLeft = ((GuiContainer) event.gui).guiLeft; - int guiTop = ((GuiContainer) event.gui).guiTop; + int xSize = ((AccessorGuiContainer) event.gui).getXSize(); + int ySize = ((AccessorGuiContainer) event.gui).getYSize(); + int guiLeft = ((AccessorGuiContainer) event.gui).getGuiLeft(); + int guiTop = ((AccessorGuiContainer) event.gui).getGuiTop(); if (!NEUApi.disableInventoryButtons) { for (NEUConfig.InventoryButton button : NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons) { if (!button.isActive()) continue; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionSortModeWarning.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionSortModeWarning.java index 4b526185..5137c90f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionSortModeWarning.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionSortModeWarning.java @@ -3,6 +3,7 @@ package io.github.moulberry.notenoughupdates.miscfeatures; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils; +import io.github.moulberry.notenoughupdates.mixins.AccessorGuiContainer; import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; @@ -57,8 +58,8 @@ public class AuctionSortModeWarning { String warningText = "\u00a7aSort: " + selectedColour + selectedSort; int warningLength = Minecraft.getMinecraft().fontRendererObj.getStringWidth(warningText); - int centerX = chest.guiLeft + chest.xSize / 2 + 9; - int centerY = chest.guiTop + 26; + int centerX = ((AccessorGuiContainer)chest).getGuiLeft() + ((AccessorGuiContainer)chest).getXSize() / 2 + 9; + int centerY = ((AccessorGuiContainer)chest).getGuiTop() + 26; RenderUtils.drawFloatingRectDark(centerX - warningLength / 2 - 4, centerY - 6, warningLength + 8, 12, false diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java index 743625f5..9292c0d3 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java @@ -5,6 +5,7 @@ import com.google.gson.GsonBuilder; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.config.KeybindHelper; import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; +import io.github.moulberry.notenoughupdates.mixins.AccessorGuiContainer; import io.github.moulberry.notenoughupdates.util.SBInfo; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.ISound; @@ -200,7 +201,7 @@ public class SlotLocking { int mouseX = Mouse.getX() * scaledWidth / Minecraft.getMinecraft().displayWidth; int mouseY = scaledHeight - Mouse.getY() * scaledHeight / Minecraft.getMinecraft().displayHeight - 1; - Slot slot = container.getSlotAtPosition(mouseX, mouseY); + Slot slot = ((AccessorGuiContainer) container).doGetSlotAtPosition(mouseX, mouseY); if (slot != null && slot.getSlotIndex() != 8 && slot.inventory == Minecraft.getMinecraft().thePlayer.inventory) { int slotNum = slot.getSlotIndex(); if (slotNum >= 0 && slotNum <= 39) { @@ -280,7 +281,7 @@ public class SlotLocking { int mouseX = Mouse.getX() * scaledWidth / Minecraft.getMinecraft().displayWidth; int mouseY = scaledHeight - Mouse.getY() * scaledHeight / Minecraft.getMinecraft().displayHeight - 1; - Slot slot = container.getSlotAtPosition(mouseX, mouseY); + Slot slot = ((AccessorGuiContainer) container).doGetSlotAtPosition(mouseX, mouseY); if (slot != null && slot.getSlotIndex() != 8 && slot.inventory == Minecraft.getMinecraft().thePlayer.inventory) { int slotNum = slot.getSlotIndex(); if (slotNum >= 0 && slotNum <= 39) { @@ -378,10 +379,10 @@ public class SlotLocking { if (!(Minecraft.getMinecraft().currentScreen instanceof GuiContainer)) { return; } - GuiContainer container = (GuiContainer) Minecraft.getMinecraft().currentScreen; + AccessorGuiContainer container = (AccessorGuiContainer) Minecraft.getMinecraft().currentScreen; - int x1 = container.guiLeft + pairingSlot.xDisplayPosition + 8; - int y1 = container.guiTop + pairingSlot.yDisplayPosition + 8; + int x1 = container.getGuiLeft() + pairingSlot.xDisplayPosition + 8; + int y1 = container.getGuiTop() + pairingSlot.yDisplayPosition + 8; int x2 = event.mouseX; int y2 = event.mouseY; @@ -514,7 +515,7 @@ public class SlotLocking { return; } - boolean hoverOverSlot = container.isMouseOverSlot(slot, mouseX, mouseY); + boolean hoverOverSlot = ((AccessorGuiContainer) container).doIsMouseOverSlot(slot, mouseX, mouseY); if (hoverOverSlot || slot.getSlotIndex() >= 9) { Minecraft.getMinecraft().getTextureManager().bindTexture(BOUND); @@ -545,8 +546,8 @@ public class SlotLocking { ); } } else if (pairingSlot != null && lockKeyHeld && slot.getSlotIndex() < 8) { - int x1 = container.guiLeft + pairingSlot.xDisplayPosition; - int y1 = container.guiTop + pairingSlot.yDisplayPosition; + int x1 = ((AccessorGuiContainer)container).getGuiLeft() + pairingSlot.xDisplayPosition; + int y1 = ((AccessorGuiContainer)container).getGuiTop() + pairingSlot.yDisplayPosition; if (mouseX <= x1 || mouseX >= x1 + 16 || mouseY <= y1 || mouseY >= y1 + 16) { @@ -634,8 +635,8 @@ public class SlotLocking { int mouseX = Mouse.getX() * scaledWidth / Minecraft.getMinecraft().displayWidth; int mouseY = scaledHeight - Mouse.getY() * scaledHeight / Minecraft.getMinecraft().displayHeight - 1; - int x1 = container.guiLeft + pairingSlot.xDisplayPosition; - int y1 = container.guiTop + pairingSlot.yDisplayPosition; + int x1 = ((AccessorGuiContainer)container).getGuiLeft() + pairingSlot.xDisplayPosition; + int y1 = ((AccessorGuiContainer)container).getGuiTop() + pairingSlot.yDisplayPosition; if (mouseX <= x1 || mouseX >= x1 + 16 || mouseY <= y1 || mouseY >= y1 + 16) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java index 25869452..42340259 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java @@ -9,6 +9,7 @@ import io.github.moulberry.notenoughupdates.core.GuiElementTextField; import io.github.moulberry.notenoughupdates.core.util.lerp.LerpingFloat; import io.github.moulberry.notenoughupdates.core.util.lerp.LerpingInteger; import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking; +import io.github.moulberry.notenoughupdates.mixins.AccessorGuiContainer; import io.github.moulberry.notenoughupdates.options.NEUConfig; import io.github.moulberry.notenoughupdates.util.Constants; import io.github.moulberry.notenoughupdates.util.Utils; @@ -945,7 +946,7 @@ public class GuiCustomEnchant extends Gui { GlStateManager.pushMatrix(); GlStateManager.translate(guiLeft + 102 - 8, guiTop + 191 - (inventoryStartIndex / 9 * 18 + 89), 0); Slot slot = cc.getSlot(inventoryStartIndex + i); - chest.drawSlot(slot); + ((AccessorGuiContainer)chest).doDrawSlot(slot); GlStateManager.popMatrix(); if (mouseX >= itemX && mouseX < itemX + 18 && diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/KatSitterOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/KatSitterOverlay.java index 107d4db2..5a763411 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/KatSitterOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/KatSitterOverlay.java @@ -2,6 +2,7 @@ package io.github.moulberry.notenoughupdates.miscgui; import com.google.gson.JsonObject; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.mixins.AccessorGuiContainer; import io.github.moulberry.notenoughupdates.util.Utils; import io.github.moulberry.notenoughupdates.util.XPInformation; import net.minecraft.client.Minecraft; @@ -61,12 +62,12 @@ public class KatSitterOverlay { int currentWidth = font.getStringWidth(currentText); String upgradedText = "Upgraded pet level: " + upgradedLevel; int upgradedWidth = font.getStringWidth(upgradedText); - int left = gui.guiLeft - 30 - (upgradedLevel == null ? Math.max(upgradedWidth, currentWidth) : currentWidth); + int left = ((AccessorGuiContainer)gui).getGuiLeft() - 30 - (upgradedLevel == null ? Math.max(upgradedWidth, currentWidth) : currentWidth); GlStateManager.disableLighting(); GlStateManager.color(1F, 1F, 1F, 1F); - Utils.drawStringScaled(currentText, font, left, gui.guiTop + 25, false, 0xFFD700, 1F); + Utils.drawStringScaled(currentText, font, left, ((AccessorGuiContainer)gui).getGuiTop() + 25, false, 0xFFD700, 1F); if (upgradedLevel != null) - Utils.drawStringScaled(upgradedText, font, left, gui.guiTop + 45, false, 0xFFD700, 1F); + Utils.drawStringScaled(upgradedText, font, left, ((AccessorGuiContainer)gui).getGuiTop() + 45, false, 0xFFD700, 1F); } public String nextRarity(String currentRarity) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java index ac3ddfb8..cb81589d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java @@ -12,6 +12,7 @@ import io.github.moulberry.notenoughupdates.core.util.lerp.LerpingInteger; import io.github.moulberry.notenoughupdates.miscfeatures.BetterContainers; import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking; import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager; +import io.github.moulberry.notenoughupdates.mixins.AccessorGuiContainer; import io.github.moulberry.notenoughupdates.util.NotificationHandler; import io.github.moulberry.notenoughupdates.util.SpecialColour; import io.github.moulberry.notenoughupdates.util.Utils; @@ -737,7 +738,7 @@ public class StorageOverlay extends GuiElement { if (storageId == currentPage) { Utils.hasEffectOverride = true; GlStateManager.translate(storageX - 7, storageY - 17 - 18, 0); - guiChest.drawSlot(containerChest.getSlot(k + 9)); + ((AccessorGuiContainer)guiChest).doDrawSlot(containerChest.getSlot(k + 9)); GlStateManager.translate(-storageX + 7, -storageY + 17 + 18, 0); Utils.hasEffectOverride = false; } else { @@ -752,7 +753,7 @@ public class StorageOverlay extends GuiElement { } else if (storageId == currentPage) { Utils.hasEffectOverride = true; GlStateManager.translate(storageX - 7, storageY - 17 - 18, 0); - guiChest.drawSlot(containerChest.getSlot(k + 9)); + ((AccessorGuiContainer)guiChest).doDrawSlot(containerChest.getSlot(k + 9)); GlStateManager.translate(-storageX + 7, -storageY + 17 + 18, 0); Utils.hasEffectOverride = false; } else { @@ -1268,7 +1269,7 @@ public class StorageOverlay extends GuiElement { GlStateManager.pushMatrix(); GlStateManager.translate(181 - 8, storageViewSize + 18 - (inventoryStartIndex / 9 * 18 + 31), 0); - guiChest.drawSlot(containerChest.inventorySlots.get(inventoryStartIndex + i)); + ((AccessorGuiContainer)guiChest).doDrawSlot(containerChest.inventorySlots.get(inventoryStartIndex + i)); GlStateManager.popMatrix(); if (!searchBar.getText().isEmpty()) { @@ -1302,7 +1303,7 @@ public class StorageOverlay extends GuiElement { //Utils.drawItemStack(playerItems[i+9], itemX, itemY); GlStateManager.pushMatrix(); GlStateManager.translate(181 - 8, storageViewSize + 18 - (inventoryStartIndex / 9 * 18 + 31), 0); - guiChest.drawSlot(containerChest.inventorySlots.get(inventoryStartIndex + 9 + i)); + ((AccessorGuiContainer)guiChest).doDrawSlot(containerChest.inventorySlots.get(inventoryStartIndex + 9 + i)); GlStateManager.popMatrix(); if (!searchBar.getText().isEmpty()) { @@ -2183,8 +2184,7 @@ public class StorageOverlay extends GuiElement { for (Slot slot : container.inventorySlots.inventorySlots) { if (slot != null && - slot.inventory == Minecraft.getMinecraft().thePlayer.inventory && - container.isMouseOverSlot(slot, mouseX, mouseY)) { + slot.inventory == Minecraft.getMinecraft().thePlayer.inventory && ((AccessorGuiContainer)container).doIsMouseOverSlot(slot, mouseX, mouseY)) { SlotLocking.getInstance().toggleLock(slot.getSlotIndex()); return true; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java index 1c5bc2e3..1f47e6ee 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java @@ -4,6 +4,7 @@ import com.google.gson.JsonObject; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.config.KeybindHelper; import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking; +import io.github.moulberry.notenoughupdates.mixins.AccessorGuiContainer; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; @@ -559,8 +560,7 @@ public class TradeWindow { int y = 104 + 18 * (index / 9); if (index < 9) y = 180; - chest.drawSlot(new Slot(Minecraft.getMinecraft().thePlayer.inventory, index, guiLeft + x, guiTop + y)); - //Utils.drawItemStack(stack, guiLeft+x, guiTop+y); + ((AccessorGuiContainer)chest).doDrawSlot(new Slot(Minecraft.getMinecraft().thePlayer.inventory, index, guiLeft + x, guiTop + y)); int col = 0x80ffffff; if (SlotLocking.getInstance().isSlotIndexLocked(index)) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/AccessorEntityAgeable.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/AccessorEntityAgeable.java index 9228f93d..e41c12eb 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/AccessorEntityAgeable.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/AccessorEntityAgeable.java @@ -1,12 +1,14 @@ package io.github.moulberry.notenoughupdates.mixins; import net.minecraft.entity.EntityAgeable; +import net.minecraft.inventory.Slot; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; +import org.spongepowered.asm.mixin.gen.Invoker; @Mixin(EntityAgeable.class) public interface AccessorEntityAgeable { - @Accessor(value = "growingAge") - void setGrowingAgeDirect(int newValue); + @Accessor(value = "growingAge") + void setGrowingAgeDirect(int newValue); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/AccessorGuiContainer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/AccessorGuiContainer.java new file mode 100644 index 00000000..3966317b --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/AccessorGuiContainer.java @@ -0,0 +1,33 @@ +package io.github.moulberry.notenoughupdates.mixins; + +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.inventory.Slot; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; +import org.spongepowered.asm.mixin.gen.Invoker; + +@Mixin(GuiContainer.class) +public interface AccessorGuiContainer { + + @Invoker("getSlotAtPosition") + Slot doGetSlotAtPosition(int x, int y); + + @Invoker("drawSlot") + void doDrawSlot(Slot slot); + + @Invoker("isMouseOverSlot") + boolean doIsMouseOverSlot(Slot slot, int x, int y); + + @Accessor("guiLeft") + int getGuiLeft(); + + @Accessor("guiTop") + int getGuiTop(); + + @Accessor("xSize") + int getXSize(); + + @Accessor("ySize") + int getYSize(); + +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/AccessorGuiEditSign.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/AccessorGuiEditSign.java new file mode 100644 index 00000000..ea945d5d --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/AccessorGuiEditSign.java @@ -0,0 +1,12 @@ +package io.github.moulberry.notenoughupdates.mixins; + +import net.minecraft.client.gui.inventory.GuiEditSign; +import net.minecraft.tileentity.TileEntitySign; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(GuiEditSign.class) +public interface AccessorGuiEditSign { + @Accessor("tileSign") + TileEntitySign getTileSign(); +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityPlayer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityPlayer.java index e15d18eb..280e964e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityPlayer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityPlayer.java @@ -8,7 +8,7 @@ import net.minecraft.scoreboard.ScorePlayerTeam; import net.minecraft.scoreboard.Scoreboard; import net.minecraft.util.BlockPos; import net.minecraft.world.World; -import org.spongepowered.asm.lib.Opcodes; +import org.objectweb.asm.Opcodes; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityRenderer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityRenderer.java index e98c3330..ab448660 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityRenderer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityRenderer.java @@ -9,7 +9,7 @@ import net.minecraft.client.settings.GameSettings; import net.minecraft.entity.Entity; import net.minecraftforge.client.ForgeHooksClient; import org.lwjgl.util.vector.Vector3f; -import org.spongepowered.asm.lib.Opcodes; +import org.objectweb.asm.Opcodes; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinMinecraft.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinMinecraft.java index b01e9609..8708afd8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinMinecraft.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinMinecraft.java @@ -2,7 +2,7 @@ package io.github.moulberry.notenoughupdates.mixins; import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking; import net.minecraft.client.Minecraft; -import org.spongepowered.asm.lib.Opcodes; +import org.objectweb.asm.Opcodes; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java index 36b37766..f36c0958 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java @@ -5,6 +5,7 @@ import com.google.gson.JsonObject; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.GuiElementTextField; import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper; +import io.github.moulberry.notenoughupdates.mixins.AccessorGuiEditSign; import io.github.moulberry.notenoughupdates.options.NEUConfigEditor; import io.github.moulberry.notenoughupdates.util.Constants; import io.github.moulberry.notenoughupdates.util.SBInfo; @@ -86,7 +87,7 @@ public class AuctionSearchOverlay { if (lastContainer == null) return false; if (!lastContainer.equals("Auctions Browser") && !lastContainer.startsWith("Auctions: ")) return false; - TileEntitySign tes = ((GuiEditSign) Minecraft.getMinecraft().currentScreen).tileSign; + TileEntitySign tes = ((AccessorGuiEditSign) Minecraft.getMinecraft().currentScreen).getTileSign(); if (tes == null) return false; if (tes.getPos().getY() != 0) return false; @@ -289,7 +290,7 @@ public class AuctionSearchOverlay { } } - TileEntitySign tes = ((GuiEditSign) Minecraft.getMinecraft().currentScreen).tileSign; + TileEntitySign tes = ((AccessorGuiEditSign) Minecraft.getMinecraft().currentScreen).getTileSign(); String search = searchString.trim(); if (searchStringExtra != null && !searchStringExtra.isEmpty()) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/RancherBootOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/RancherBootOverlay.java index 94bd53a2..9661812f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/RancherBootOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/RancherBootOverlay.java @@ -2,6 +2,7 @@ package io.github.moulberry.notenoughupdates.overlays; import io.github.moulberry.notenoughupdates.core.GuiElementTextField; import io.github.moulberry.notenoughupdates.core.util.GuiElementSlider; +import io.github.moulberry.notenoughupdates.mixins.AccessorGuiEditSign; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; @@ -31,7 +32,7 @@ public class RancherBootOverlay { if (!(Minecraft.getMinecraft().currentScreen instanceof GuiEditSign)) return false; - TileEntitySign tes = ((GuiEditSign) Minecraft.getMinecraft().currentScreen).tileSign; + TileEntitySign tes = ((AccessorGuiEditSign) Minecraft.getMinecraft().currentScreen).getTileSign(); if (tes == null) return false; if (tes.getPos().getY() != 0) return false; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/recipes/CraftingOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/recipes/CraftingOverlay.java index 9d305e1d..45675945 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/recipes/CraftingOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/recipes/CraftingOverlay.java @@ -1,6 +1,7 @@ package io.github.moulberry.notenoughupdates.recipes; import io.github.moulberry.notenoughupdates.NEUManager; +import io.github.moulberry.notenoughupdates.mixins.AccessorGuiContainer; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -49,10 +50,10 @@ public class CraftingOverlay { ) { forEachSlot(chest, (recipeIngredient, slot) -> { if (Utils.isWithinRect( - mouseX, mouseY, - slot.xDisplayPosition + gui.guiLeft, - slot.yDisplayPosition + gui.guiTop, - 16, 16 + mouseX, mouseY, + slot.xDisplayPosition + ((AccessorGuiContainer) gui).getGuiLeft(), + slot.yDisplayPosition + ((AccessorGuiContainer) gui).getGuiTop(), + 16, 16 )) block.accept(recipeIngredient, slot); }); @@ -80,9 +81,9 @@ public class CraftingOverlay { if (currentRecipe.getCraftText() != null) { FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; fontRenderer.drawStringWithShadow( - currentRecipe.getCraftText(), - Utils.peekGuiScale().getScaledWidth() / 2f - fontRenderer.getStringWidth(currentRecipe.getCraftText()) / 2f, - guiChest.guiTop - 15f, 0x808080 + currentRecipe.getCraftText(), + Utils.peekGuiScale().getScaledWidth() / 2f - fontRenderer.getStringWidth(currentRecipe.getCraftText()) / 2f, + ((AccessorGuiContainer) guiChest).getGuiTop() - 15f, 0x808080 ); } renderTooltip(guiChest, chest); @@ -140,8 +141,8 @@ public class CraftingOverlay { } private void drawItemStack(GuiChest gui, Slot slot, ItemStack item) { - int slotX = slot.xDisplayPosition + gui.guiLeft; - int slotY = slot.yDisplayPosition + gui.guiTop; + int slotX = slot.xDisplayPosition + ((AccessorGuiContainer)gui).getGuiLeft(); + int slotY = slot.yDisplayPosition + ((AccessorGuiContainer)gui).getGuiTop(); Gui.drawRect(slotX, slotY, slotX + 16, slotY + 16, 0x64ff0000); if (item != null) Utils.drawItemStack(item, slotX, slotY); diff --git a/src/main/resources/mixins.notenoughupdates.json b/src/main/resources/mixins.notenoughupdates.json index c6ba98b7..ab2c705e 100644 --- a/src/main/resources/mixins.notenoughupdates.json +++ b/src/main/resources/mixins.notenoughupdates.json @@ -1,6 +1,7 @@ { "package": "io.github.moulberry.notenoughupdates.mixins", "refmap": "mixins.notenoughupdates.refmap.json", + "minVersion": "0.7", "compatibilityLevel": "JAVA_8", "mixins": [ "AccessorEntityAgeable", @@ -46,6 +47,8 @@ "MixinWorldClient" ], "client": [ + "AccessorGuiContainer", + "AccessorGuiEditSign", "AccessorMinecraft" ] } diff --git a/src/main/resources/notenoughupdates_at.cfg b/src/main/resources/notenoughupdates_at.cfg deleted file mode 100644 index c3fb5dbc..00000000 --- a/src/main/resources/notenoughupdates_at.cfg +++ /dev/null @@ -1,11 +0,0 @@ -public net.minecraft.client.gui.inventory.GuiContainer field_146999_f #xSize -public net.minecraft.client.gui.inventory.GuiContainer field_147000_g #ySize -public net.minecraft.client.gui.inventory.GuiContainer field_147003_i #guiLeft -public net.minecraft.client.gui.inventory.GuiContainer field_147009_r #guiTop -public net.minecraft.client.gui.inventory.GuiContainer func_146975_c(II)Lnet/minecraft/inventory/Slot; #guiTop -public net.minecraft.client.gui.inventory.GuiEditSign field_146848_f #tileSign -public net.minecraft.client.gui.inventory.GuiContainer func_146977_a(Lnet/minecraft/inventory/Slot;)V #drawSlot -public net.minecraft.client.gui.inventory.GuiContainer func_146981_a(Lnet/minecraft/inventory/Slot;II)Z #isMouseOverSlot -public net.minecraft.client.renderer.RenderGlobal field_72755_R #renderInfos -public net.minecraft.client.renderer.RenderGlobal$ContainerLocalRenderInformation -public net.minecraft.client.renderer.RenderGlobal$ContainerLocalRenderInformation field_178036_a #renderChunk
\ No newline at end of file |