Skip to content

Commit

Permalink
Fixed XP Bars
Browse files Browse the repository at this point in the history
Also shrank the texture :l
  • Loading branch information
MystWraith committed Dec 14, 2023
1 parent ec9af45 commit 4251661
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 31 deletions.
41 changes: 10 additions & 31 deletions src/main/java/tech/showierdata/pickaxe/mixin/InGameHudMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,26 +57,7 @@ private void renderHotbarIcons(DrawContext context, int x, int y, float f, Playe
Pickaxe.getInstance().renderHotbarIcons(context, x, y, stack);
}

/**
*
* UV is calculated as:
* (k / i, l / j)
*
* @param context Drawing context
*
* @param i Width of texture?
* @param j Height of texture?
* @param k Primary/starting u (of UVs)
* @param l Primary/starting v (of UVs)
*
* @param x location on screen
* @param y location on screen
* @param z location on screen
*
* @param width Width of render
* @param height Height of render
*/
/*@Redirect(method = "renderExperienceBar",
@Redirect(method = "renderExperienceBar",
slice = @Slice(
from = @At(
value = "INVOKE",
Expand All @@ -87,14 +68,12 @@ private void renderHotbarIcons(DrawContext context, int x, int y, float f, Playe
target = "net/minecraft/client/gui/DrawContext.drawGuiTexture (Lnet/minecraft/util/Identifier;IIIIIIII)V"
),
allow = 1)
void swapIcons(DrawContext context, Identifier ICONS, int i, int j, int k, int l, int x, int y, int z, int width, DrawContext unknownContext, int height) {
/*if (!Pickaxe.getInstance().isInPickaxe()) {
context.drawGuiTexture(ICONS, i, j, k, l, x, y, z, width, height);
void swapIcons(DrawContext context, Identifier ICONS, int i, int j, int k, int l, int x, int y, int width, int height) {
if (!Pickaxe.getInstance().isInPickaxe()) {
context.drawGuiTexture(ICONS, i, j, k, l, x, y, width, height);
return;
}
//renderNewExperienceBar(context, k, l, x, y, z, width, height);
context.drawGuiTexture(ICONS, i, j, k, l, x, y, z, width, height);
unknownContext.drawGuiTexture(ICONS, i, j, k, l, x, y, z, width, height);
renderNewExperienceBar(context, x, y, width, false);
}

@Redirect(method = "renderExperienceBar",
Expand All @@ -113,11 +92,11 @@ void swapIcons(DrawContext context, Identifier ICONS, int x, int y, int width, i
context.drawGuiTexture(ICONS, x, y, width, height);
return;
}
//renderNewExperienceBar(context, 0, 0, x, y, 0, width, height);
context.drawGuiTexture(ICONS, x, y, width, height);
}*/
renderNewExperienceBar(context, x, y, width, true);
}

void renderNewExperienceBar(DrawContext context, int u, int v, int x, int y, int z, int width, int height) {
void renderNewExperienceBar(DrawContext context, int x, int y, int width, boolean isBG) {
int v = (isBG)? 0 : 5;
switch (Options.getInstance().XPBarType) {
case Depth:
v += 20;
Expand All @@ -130,7 +109,7 @@ void renderNewExperienceBar(DrawContext context, int u, int v, int x, int y, int
v += 10;
break;
}
context.drawGuiTexture(COLORS, 256, 256, u, v, x, y, z, width, height);
context.drawTexture(COLORS, x, y, 0, v, width, 5, 182, 50);
}

@ModifyConstant(method = "renderExperienceBar", constant = @Constant(intValue = 8453920))
Expand Down
Binary file modified src/main/resources/assets/pickaxe/textures/gui/colors.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4251661

Please sign in to comment.