Skip to content

Commit

Permalink
Improved item hover effect on containers.
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoxkk0 committed Feb 23, 2025
1 parent 05e7352 commit e4b83d0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public static float renderGlyph(TextureManager textureManager, CustomGlyphs cust

GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_DEPTH_TEST);

float realX = posX + (customGlyphs.getHorizontalPadding() * -1);
float realY = posY + (customGlyphs.getVerticalPadding() * -1);
Expand All @@ -29,6 +30,7 @@ public static float renderGlyph(TextureManager textureManager, CustomGlyphs cust
} else
drawGlyph(realX, realY, customGlyphs.getWidth(), customGlyphs.getHeight());

GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopAttrib();
GL11.glPopMatrix();
Expand Down Expand Up @@ -86,7 +88,7 @@ private static void drawGlyphContains(float x, float y, CustomGlyphs customGlyph
}

private static void add(Tessellator tessellator, float x, float y, float textureX, float textureY) {
tessellator.addVertexWithUV(x, y, 0F, textureX, textureY);
tessellator.addVertexWithUV(x, y, 50F, textureX, textureY);
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.github.cruciblemc.necrotempus.modules.mixin.mixins.minecraft;

import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.inventory.GuiContainer;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
Expand All @@ -8,10 +9,11 @@
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(GuiContainer.class)
public class GuiContainerMixin {
public class GuiContainerMixin extends Gui {

@Shadow
protected int guiLeft;
Expand All @@ -36,6 +38,15 @@ public void drawScreen(CallbackInfo callbackInfo) {

}

@Redirect(method = "Lnet/minecraft/client/gui/inventory/GuiContainer;drawScreen(IIF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/inventory/GuiContainer;drawGradientRect(IIIIII)V"))
public void drawScreen2(GuiContainer container, int left, int top, int right, int bottom, int startColor, int endColor) {
GL11.glEnable(GL11.GL_DEPTH_TEST);
zLevel = 150;
drawGradientRect(left, top, right, bottom, startColor, endColor);
zLevel = 0F;
GL11.glDisable(GL11.GL_DEPTH_TEST);
}

@Unique
public void crucibleTimeMachine$titleRenderHook() {
}
Expand Down

0 comments on commit e4b83d0

Please sign in to comment.