diff options
24 files changed, 201 insertions, 149 deletions
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 2381ceb8..327c4e17 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,2 +1,3 @@ /src/main/java/io/github/moulberry/notenoughupdates/recipes/* @romangraef /src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java @romangraef +/*gradle* @romangraef diff --git a/build.gradle.kts b/build.gradle.kts index b9374fc0..4414146f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,24 +1,24 @@ -import net.minecraftforge.gradle.user.ReobfMappingType import java.io.ByteArrayOutputStream plugins { java - id("net.minecraftforge.gradle.forge") version "6f5327738df" - id("com.github.johnrengelman.shadow") version "6.1.0" - id("org.spongepowered.mixin") version "d75e32e" + id("gg.essential.loom") version "0.10.0.+" + id("dev.architectury.architectury-pack200") version "0.1.3" + id("com.github.johnrengelman.shadow") version "7.1.2" } + +// Build metadata + group = "io.github.moulberry" val baseVersion = "2.1" val buildExtra = mutableListOf<String>() val buildVersion = properties["BUILD_VERSION"] as? String -if (buildVersion != null) - buildExtra.add(buildVersion) +if (buildVersion != null) buildExtra.add(buildVersion) val githubCi = properties["GITHUB_ACTIONS"] as? String -if (githubCi == "true") - buildExtra.add("ci") +if (githubCi == "true") buildExtra.add("ci") val stdout = ByteArrayOutputStream() val execResult = exec { @@ -43,53 +43,58 @@ if (gitDiffStdout.toByteArray().isNotEmpty()) { version = baseVersion + (if (buildExtra.isEmpty()) "" else buildExtra.joinToString(prefix = "+", separator = ".")) -// Toolchains: - -java { - // Forge Gradle currently prevents using the toolchain: toolchain.languageVersion.set(JavaLanguageVersion.of(8)) - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 -} - -minecraft { - version = "1.8.9-11.15.1.2318-1.8.9" - runDir = "run" - mappings = "stable_22" - makeObfSourceJar = false - clientJvmArgs.addAll( - listOf( - "-Dmixin.debug=true", - "-Dasmhelper.verbose=true" - ) - ) - clientRunArgs.addAll( - listOf( - "--tweakClass org.spongepowered.asm.launch.MixinTweaker", - "--mixin mixins.notenoughupdates.json" - ) - ) +// Minecraft configuration: +loom { + launchConfigs { + "client" { + property("mixin.debug", "true") + property("asmhelper.verbose", "true") + arg("--tweakClass", "org.spongepowered.asm.launch.MixinTweaker") + arg("--mixin", "mixins.notenoughupdates.json") + } + } + runConfigs { + "server" { + isIdeConfigGenerated = false + } + } + forge { + pack200Provider.set(dev.architectury.pack200.java.Pack200Adapter()) + mixinConfig("mixins.notenoughupdates.json") + } + mixin { + defaultRefmapName.set("mixins.notenoughupdates.refmap.json") + } } -mixin { - add(sourceSets.main.get(), "mixins.notenoughupdates.refmap.json") -} // Dependencies: - repositories { - mavenCentral() - maven("https://repo.spongepowered.org/maven/") + mavenCentral() + mavenLocal() + maven("https://repo.spongepowered.org/maven/") + maven("https://jitpack.io") } dependencies { - implementation("org.spongepowered:mixin:0.7.11-SNAPSHOT") - annotationProcessor("org.spongepowered:mixin:0.7.11-SNAPSHOT") - implementation("com.fasterxml.jackson.core:jackson-core:2.13.1") - implementation("info.bliki.wiki:bliki-core:3.1.0") + minecraft("com.mojang:minecraft:1.8.9") + mappings("de.oceanlabs.mcp:mcp_stable:22-1.8.9") + forge("net.minecraftforge:forge:1.8.9-11.15.1.2318-1.8.9") + + implementation("org.spongepowered:mixin:0.7.11-SNAPSHOT") + annotationProcessor("org.spongepowered:mixin:0.8.4-SNAPSHOT") + implementation("com.fasterxml.jackson.core:jackson-core:2.13.1") + implementation("info.bliki.wiki:bliki-core:3.1.0") testImplementation("org.junit.jupiter:junit-jupiter:5.8.2") + // modImplementation("io.github.notenoughupdates:MoulConfig:0.0.1") } + +java { + toolchain.languageVersion.set(JavaLanguageVersion.of(8)) +} + // Tasks: tasks.withType(JavaCompile::class) { @@ -97,7 +102,7 @@ tasks.withType(JavaCompile::class) { } tasks.named<Test>("test") { - useJUnitPlatform() + useJUnitPlatform() } tasks.withType(Jar::class) { @@ -108,18 +113,21 @@ tasks.withType(Jar::class) { this["MixinConfigs"] = "mixins.notenoughupdates.json" this["FMLCorePluginContainsFMLMod"] = "true" this["ForceLoadAsMod"] = "true" - this["FMLAT"] = "notenoughupdates_at.cfg" } } -tasks.shadowJar { +val remapJar by tasks.named<net.fabricmc.loom.task.RemapJarTask>("remapJar") { archiveClassifier.set("dep") + from(tasks.shadowJar) +} + +tasks.shadowJar { + archiveClassifier.set("dep-dev") exclude( - "module-info.class", - "LICENSE.txt" + "module-info.class", "LICENSE.txt" ) dependencies { - include(dependency("org.spongepowered:mixin:0.7.11-SNAPSHOT")) + include(dependency("org.spongepowered:mixin:0.8.5")) include(dependency("commons-io:commons-io")) include(dependency("org.apache.commons:commons-lang3")) @@ -137,23 +145,14 @@ tasks.shadowJar { relocate("org.slf4j") } -tasks.build.get().dependsOn(tasks.shadowJar) - -reobf { - create("shadowJar") { - mappingType = ReobfMappingType.SEARGE - } -} +tasks.assemble.get().dependsOn(remapJar) tasks.processResources { - from(sourceSets.main.get().resources.srcDirs) filesMatching("mcmod.info") { expand( - "version" to project.version, - "mcversion" to minecraft.version + "version" to project.version, "mcversion" to "1.8.9" ) } - rename("(.+_at.cfg)".toPattern(), "META-INF/$1") } sourceSets.main { diff --git a/gradle.properties b/gradle.properties index bf86fb71..87c0a7c6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1,2 @@ -org.gradle.jvmargs=-Xmx2G
\ No newline at end of file +org.gradle.jvmargs=-Xmx2G +loom.platform=forge diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c1ff7937..eed1d25a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip diff --git a/settings.gradle.kts b/settings.gradle.kts index 44138312..4df48664 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,17 +1,21 @@ pluginManagement { repositories { - mavenCentral() - gradlePluginPortal() - maven(url = "https://jitpack.io/") - maven(url = "https://maven.minecraftforge.net/") - maven(url = "https://repo.spongepowered.org/maven/") - } - resolutionStrategy { - eachPlugin { - when (requested.id.id) { - "net.minecraftforge.gradle.forge" -> useModule("com.github.asbyth:ForgeGradle:${requested.version}") - "org.spongepowered.mixin" -> useModule("com.github.LxGaming:MixinGradle:${requested.version}") - } - } - } + mavenCentral() + gradlePluginPortal() + maven("https://oss.sonatype.org/content/repositories/snapshots") + maven("https://maven.architectury.dev/") + maven("https://maven.fabricmc.net") + maven(url = "https://jitpack.io/") + maven(url = "https://maven.minecraftforge.net/") + maven(url = "https://repo.spongepowered.org/maven/") + maven(url = "https://repo.sk1er.club/repository/maven-releases/") + maven(url = "https://maven.architectury.dev/") + } + resolutionStrategy { + eachPlugin { + when (requested.id.id) { + "gg.essential.loom" -> useModule("gg.essential:architectury-loom:${requested.version}") + } + } + } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index cac89e77..0b2a6ecc 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -180,6 +180,7 @@ public class NotEnoughUpdates { @EventHandler public void preinit(FMLPreInitializationEvent event) { INSTANCE = this; + //SomeRandomTest.fun(); neuDir = new File(event.getModConfigurationDirectory(), "notenoughupdates"); neuDir.mkdirs(); 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.notenough |
