aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorMy-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com>2021-08-07 12:13:42 -0400
committerMy-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com>2021-08-07 12:16:20 -0400
commit6b28758c4c75e35935aa7074c38643dd6d64eaa1 (patch)
treec926d17d124aff6da4577e2b04ddc2837d199b57 /src/main
parent8cf79a135b1330c759d3357add84a0a6accf7c50 (diff)
downloadSkytilsMod-6b28758c4c75e35935aa7074c38643dd6d64eaa1.tar.gz
SkytilsMod-6b28758c4c75e35935aa7074c38643dd6d64eaa1.tar.bz2
SkytilsMod-6b28758c4c75e35935aa7074c38643dd6d64eaa1.zip
Fix Rarity not showing on NEU Auction Overlay
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/skytils/skytilsmod/mixins/neu/MixinCustomAH.java38
-rw-r--r--src/main/java/skytils/skytilsmod/mixins/renderer/MixinRenderItem.java2
-rw-r--r--src/main/kotlin/skytils/skytilsmod/utils/NEUCompatibility.kt1
-rw-r--r--src/main/kotlin/skytils/skytilsmod/utils/RenderUtil.kt19
-rw-r--r--src/main/resources/mixins.skytils.json1
5 files changed, 54 insertions, 7 deletions
diff --git a/src/main/java/skytils/skytilsmod/mixins/neu/MixinCustomAH.java b/src/main/java/skytils/skytilsmod/mixins/neu/MixinCustomAH.java
new file mode 100644
index 00000000..36830fb9
--- /dev/null
+++ b/src/main/java/skytils/skytilsmod/mixins/neu/MixinCustomAH.java
@@ -0,0 +1,38 @@
+/*
+ * Skytils - Hypixel Skyblock Quality of Life Mod
+ * Copyright (C) 2021 Skytils
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package skytils.skytilsmod.mixins.neu;
+
+import net.minecraft.client.gui.Gui;
+import org.spongepowered.asm.mixin.Dynamic;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Pseudo;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+import skytils.skytilsmod.utils.NEUCompatibility;
+
+@Pseudo
+@Mixin(targets = "io.github.moulberry.notenoughupdates.auction.CustomAH")
+public class MixinCustomAH extends Gui {
+ @Dynamic
+ @Inject(method = "isRenderOverAuctionView", at = @At("RETURN"), remap = false)
+ private void updateCustomAHState(CallbackInfoReturnable<Boolean> cir) {
+ NEUCompatibility.INSTANCE.setCustomAHActive(cir.getReturnValue());
+ }
+}
diff --git a/src/main/java/skytils/skytilsmod/mixins/renderer/MixinRenderItem.java b/src/main/java/skytils/skytilsmod/mixins/renderer/MixinRenderItem.java
index 8b845fd6..5e6aada8 100644
--- a/src/main/java/skytils/skytilsmod/mixins/renderer/MixinRenderItem.java
+++ b/src/main/java/skytils/skytilsmod/mixins/renderer/MixinRenderItem.java
@@ -60,7 +60,7 @@ public abstract class MixinRenderItem {
if (Utils.inSkyblock && Skytils.config.showItemRarity) {
if (mc.currentScreen != null) {
String name = mc.currentScreen.getClass().getName();
- if (NEUCompatibility.INSTANCE.isStorageMenuActive() || NEUCompatibility.INSTANCE.isTradeWindowActive() || name.equals("io.github.moulberry.notenoughupdates.auction.CustomAHGui")) {
+ if (NEUCompatibility.INSTANCE.isStorageMenuActive() || NEUCompatibility.INSTANCE.isTradeWindowActive() || NEUCompatibility.INSTANCE.isCustomAHActive()) {
RenderUtil.renderRarity(stack, x, y);
}
}
diff --git a/src/main/kotlin/skytils/skytilsmod/utils/NEUCompatibility.kt b/src/main/kotlin/skytils/skytilsmod/utils/NEUCompatibility.kt
index 8bca2814..17053d36 100644
--- a/src/main/kotlin/skytils/skytilsmod/utils/NEUCompatibility.kt
+++ b/src/main/kotlin/skytils/skytilsmod/utils/NEUCompatibility.kt
@@ -24,6 +24,7 @@ import java.lang.invoke.MethodHandles
import java.lang.invoke.MethodType
object NEUCompatibility {
+ var isCustomAHActive = false
var isStorageMenuActive = false
var isTradeWindowActive = false
diff --git a/src/main/kotlin/skytils/skytilsmod/utils/RenderUtil.kt b/src/main/kotlin/skytils/skytilsmod/utils/RenderUtil.kt
index b2a2d3d5..d3d97f3e 100644
--- a/src/main/kotlin/skytils/skytilsmod/utils/RenderUtil.kt
+++ b/src/main/kotlin/skytils/skytilsmod/utils/RenderUtil.kt
@@ -30,6 +30,7 @@ import net.minecraft.inventory.Slot
import net.minecraft.item.ItemStack
import net.minecraft.util.*
import org.lwjgl.opengl.GL11
+import org.lwjgl.opengl.GLContext
import skytils.skytilsmod.Skytils
import skytils.skytilsmod.Skytils.Companion.mc
import skytils.skytilsmod.mixins.accessors.AccessorMinecraft
@@ -484,10 +485,16 @@ object RenderUtil {
private fun renderRarity(xPos: Int, yPos: Int, rarity: ItemRarity?) {
if (rarity != null) {
val alpha = Skytils.config.itemRarityOpacity
- GlStateManager.disableLighting()
- GlStateManager.disableDepth()
+
+ // save the states
+ val lightingEnabled = GL11.glIsEnabled(GL11.GL_LIGHTING)
+ val depthEnabled = GL11.glIsEnabled(GL11.GL_DEPTH_TEST)
+ val alphaEnabled = GL11.glIsEnabled(GL11.GL_ALPHA_TEST)
+
+ if (lightingEnabled) GlStateManager.disableLighting()
+ if (depthEnabled) GlStateManager.disableDepth()
GlStateManager.enableBlend()
- GlStateManager.enableAlpha()
+ if (!alphaEnabled) GlStateManager.enableAlpha()
Minecraft.getMinecraft().textureManager.bindTexture(RARITY)
GlStateManager.color(
rarity.color.red / 255.0f,
@@ -499,9 +506,9 @@ object RenderUtil {
GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_BLEND)
Gui.drawModalRectWithCustomSizedTexture(xPos, yPos, 0f, 0f, 16, 16, 16f, 16f)
GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE)
- GlStateManager.enableLighting()
- GlStateManager.enableDepth()
- GlStateManager.disableAlpha()
+ if (lightingEnabled) GlStateManager.enableLighting()
+ if (depthEnabled) GlStateManager.enableDepth()
+ if (!alphaEnabled) GlStateManager.disableAlpha()
}
}
diff --git a/src/main/resources/mixins.skytils.json b/src/main/resources/mixins.skytils.json
index 665c29d8..efb5c1c5 100644
--- a/src/main/resources/mixins.skytils.json
+++ b/src/main/resources/mixins.skytils.json
@@ -58,6 +58,7 @@
],
"verbose": true,
"client": [
+ "neu.MixinCustomAH",
"renderer.MixinRendererLivingEntity"
]
} \ No newline at end of file