aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/xmrvizzy/skyblocker/mixin/InGameHudMixin.java
diff options
context:
space:
mode:
authorYasin <LifeIsAParadox@users.noreply.github.com>2023-06-18 08:28:15 +0200
committerGitHub <noreply@github.com>2023-06-18 08:28:15 +0200
commitcafe56cd21b5ebc3cd17b52ee86a81ec469795a5 (patch)
tree7de400f397994ed09fd2c1ea9087cd8003cef60f /src/main/java/me/xmrvizzy/skyblocker/mixin/InGameHudMixin.java
parent826a6d8fd9a38c794eb70b7a71aa969dfddd685c (diff)
parent79711da8090cfba910ce0cdcc61ab3b491478cf3 (diff)
downloadSkyblocker-cafe56cd21b5ebc3cd17b52ee86a81ec469795a5.tar.gz
Skyblocker-cafe56cd21b5ebc3cd17b52ee86a81ec469795a5.tar.bz2
Skyblocker-cafe56cd21b5ebc3cd17b52ee86a81ec469795a5.zip
Merge pull request #150 from AzureAaron/1.20
1.20 Port
Diffstat (limited to 'src/main/java/me/xmrvizzy/skyblocker/mixin/InGameHudMixin.java')
-rw-r--r--src/main/java/me/xmrvizzy/skyblocker/mixin/InGameHudMixin.java32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/main/java/me/xmrvizzy/skyblocker/mixin/InGameHudMixin.java b/src/main/java/me/xmrvizzy/skyblocker/mixin/InGameHudMixin.java
index e17795ab..335737a1 100644
--- a/src/main/java/me/xmrvizzy/skyblocker/mixin/InGameHudMixin.java
+++ b/src/main/java/me/xmrvizzy/skyblocker/mixin/InGameHudMixin.java
@@ -1,6 +1,5 @@
package me.xmrvizzy.skyblocker.mixin;
-import com.mojang.blaze3d.systems.RenderSystem;
import me.xmrvizzy.skyblocker.SkyblockerMod;
import me.xmrvizzy.skyblocker.config.SkyblockerConfig;
import me.xmrvizzy.skyblocker.skyblock.FancyStatusBars;
@@ -10,13 +9,14 @@ import me.xmrvizzy.skyblocker.skyblock.dungeon.DungeonMap;
import me.xmrvizzy.skyblocker.utils.Utils;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
-import net.minecraft.client.gui.DrawableHelper;
+import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.hud.InGameHud;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
+
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
@@ -26,7 +26,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Environment(EnvType.CLIENT)
@Mixin(InGameHud.class)
-public abstract class InGameHudMixin extends DrawableHelper {
+public abstract class InGameHudMixin {
+ //@Shadow
+ //@Final
+ //private static Identifier ICONS = new Identifier("textures/gui/icons.png");
@Unique
private static final Identifier SLOT_LOCK = new Identifier(SkyblockerMod.NAMESPACE, "textures/gui/slot_lock.png");
@Unique
@@ -35,7 +38,7 @@ public abstract class InGameHudMixin extends DrawableHelper {
@Unique
private final FancyStatusBars statusBars = new FancyStatusBars();
@Unique
- private MatrixStack hotbarMatrices;
+ private DrawContext hotbarContext;
@Unique
private int hotbarSlotIndex;
@@ -62,45 +65,44 @@ public abstract class InGameHudMixin extends DrawableHelper {
}
@Inject(method = "renderHotbar", at = @At("HEAD"))
- public void skyblocker$renderHotbar(float f, MatrixStack matrices, CallbackInfo ci) {
+ public void skyblocker$renderHotbar(float f, DrawContext context, CallbackInfo ci) {
if (Utils.isOnSkyblock()) {
- hotbarMatrices = matrices;
+ hotbarContext = context;
hotbarSlotIndex = 0;
}
}
@Inject(method = "renderHotbarItem", at = @At("HEAD"))
- public void skyblocker$renderHotbarItem(MatrixStack matrices, int i, int j, float f, PlayerEntity player, ItemStack stack, int seed, CallbackInfo ci) {
+ public void skyblocker$renderHotbarItem(DrawContext context, int i, int j, float f, PlayerEntity player, ItemStack stack, int seed, CallbackInfo ci) {
if (Utils.isOnSkyblock()) {
if (HotbarSlotLock.isLocked(hotbarSlotIndex)) {
- RenderSystem.setShaderTexture(0, SLOT_LOCK);
- DrawableHelper.drawTexture(hotbarMatrices, i, j, 0, 0, 16, 16);
+ hotbarContext.drawTexture(SLOT_LOCK, i, j, 0, 0, 16, 16);
}
hotbarSlotIndex++;
}
}
@Inject(method = "renderExperienceBar", at = @At("HEAD"), cancellable = true)
- private void skyblocker$renderExperienceBar(MatrixStack matrices, int x, CallbackInfo ci) {
+ private void skyblocker$renderExperienceBar(DrawContext context, int x, CallbackInfo ci) {
if (Utils.isOnSkyblock() && SkyblockerConfig.get().general.bars.enableBars)
ci.cancel();
}
@Inject(method = "renderStatusBars", at = @At("HEAD"), cancellable = true)
- private void skyblocker$renderStatusBars(MatrixStack matrices, CallbackInfo ci) {
+ private void skyblocker$renderStatusBars(DrawContext context, CallbackInfo ci) {
if (!Utils.isOnSkyblock())
return;
- if (statusBars.render(matrices, scaledWidth, scaledHeight))
+ if (statusBars.render(context, scaledWidth, scaledHeight))
ci.cancel();
if (Utils.isInDungeons() && SkyblockerConfig.get().locations.dungeons.enableMap)
- DungeonMap.render(matrices);
+ DungeonMap.render(context.getMatrices());
- RenderSystem.setShaderTexture(0, GUI_ICONS_TEXTURE);
+ //RenderSystem.setShaderTexture(0, ICONS);
}
@Inject(method = "renderMountHealth", at = @At("HEAD"), cancellable = true)
- private void skyblocker$renderMountHealth(MatrixStack matrices, CallbackInfo ci) {
+ private void skyblocker$renderMountHealth(DrawContext context, CallbackInfo ci) {
if (Utils.isOnSkyblock() && SkyblockerConfig.get().general.bars.enableBars)
ci.cancel();
}