aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/dulkirfabric
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/dulkirfabric')
-rw-r--r--src/main/java/com/dulkirfabric/mixin/render/GameMenuScreenMixin.java3
-rw-r--r--src/main/java/com/dulkirfabric/mixin/render/GameRendererMixin.java17
-rw-r--r--src/main/java/com/dulkirfabric/mixin/render/InGameHudMixin.java45
3 files changed, 42 insertions, 23 deletions
diff --git a/src/main/java/com/dulkirfabric/mixin/render/GameMenuScreenMixin.java b/src/main/java/com/dulkirfabric/mixin/render/GameMenuScreenMixin.java
index 6f09e51..86a4ecf 100644
--- a/src/main/java/com/dulkirfabric/mixin/render/GameMenuScreenMixin.java
+++ b/src/main/java/com/dulkirfabric/mixin/render/GameMenuScreenMixin.java
@@ -32,7 +32,8 @@ import java.util.function.Supplier;
@Mixin(GameMenuScreen.class)
public abstract class GameMenuScreenMixin extends ScreenMixin {
- private final Text buttonText = MutableText.of(new LiteralTextContent("Dulkir")).formatted(Formatting.BOLD, Formatting.YELLOW);
+ private final Text buttonText = MutableText.of(new PlainTextContent.Literal("Dulkir"))
+ .formatted(Formatting.BOLD, Formatting.YELLOW);
@Shadow
protected abstract ButtonWidget createButton(Text text, Supplier<Screen> screenSupplier);
diff --git a/src/main/java/com/dulkirfabric/mixin/render/GameRendererMixin.java b/src/main/java/com/dulkirfabric/mixin/render/GameRendererMixin.java
index 78b4dbd..40ac4af 100644
--- a/src/main/java/com/dulkirfabric/mixin/render/GameRendererMixin.java
+++ b/src/main/java/com/dulkirfabric/mixin/render/GameRendererMixin.java
@@ -2,18 +2,15 @@ package com.dulkirfabric.mixin.render;
import com.dulkirfabric.features.InventoryScale;
+import com.llamalad7.mixinextras.sugar.Local;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.GameRenderer;
-import net.minecraft.client.util.Window;
-import net.minecraft.client.util.math.MatrixStack;
-import org.joml.Matrix4f;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
@Mixin(value = GameRenderer.class, priority = 1001)
public class GameRendererMixin {
@@ -37,9 +34,8 @@ public class GameRendererMixin {
opcode = Opcodes.GETFIELD,
target = "Lnet/minecraft/client/MinecraftClient;currentScreen:Lnet/minecraft/client/gui/screen/Screen;",
shift = At.Shift.BEFORE,
- ordinal = 1), locals = LocalCapture.CAPTURE_FAILHARD)
- public void onScreenRenderPre(float tickDelta, long startTime, boolean tick, CallbackInfo ci, int i, int j,
- Window window, Matrix4f matrix4f, MatrixStack matrixStack, DrawContext drawContext) {
+ ordinal = 1))
+ public void onScreenRenderPre(float tickDelta, long startTime, boolean tick, CallbackInfo ci, @Local DrawContext drawContext) {
drawContext.getMatrices().push();
drawContext.getMatrices().scale(InventoryScale.INSTANCE.getScale(), InventoryScale.INSTANCE.getScale(), 1f);
}
@@ -49,10 +45,9 @@ public class GameRendererMixin {
opcode = Opcodes.GETFIELD,
target = "Lnet/minecraft/client/MinecraftClient;currentScreen:Lnet/minecraft/client/gui/screen/Screen;",
shift = At.Shift.AFTER,
- ordinal = 3), locals = LocalCapture.CAPTURE_FAILHARD
+ ordinal = 3)
)
- public void onScreenRenderPost(float tickDelta, long startTime, boolean tick, CallbackInfo ci, int i, int j,
- Window window, Matrix4f matrix4f, MatrixStack matrixStack, DrawContext drawContext) {
- drawContext.getMatrices().pop();
+ public void onScreenRenderPost(float tickDelta, long startTime, boolean tick, CallbackInfo ci, @Local DrawContext drawContext) {
+ drawContext.getMatrices().pop();
}
} \ No newline at end of file
diff --git a/src/main/java/com/dulkirfabric/mixin/render/InGameHudMixin.java b/src/main/java/com/dulkirfabric/mixin/render/InGameHudMixin.java
index 7f90b3b..995b8af 100644
--- a/src/main/java/com/dulkirfabric/mixin/render/InGameHudMixin.java
+++ b/src/main/java/com/dulkirfabric/mixin/render/InGameHudMixin.java
@@ -6,6 +6,7 @@ import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.hud.InGameHud;
+import net.minecraft.text.Text;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@@ -15,21 +16,36 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(InGameHud.class)
public class InGameHudMixin {
- @Inject(method = "renderStatusEffectOverlay", at = @At("HEAD"), cancellable = true)
+ @Inject(
+ method = "renderStatusEffectOverlay",
+ at = @At("HEAD"),
+ cancellable = true
+ )
public void onRenderStatusEffectOverlay(DrawContext context, CallbackInfo ci) {
if (DulkirConfig.ConfigVars.getConfigOptions().getStatusEffectHidden()) {
ci.cancel();
}
}
- @Redirect(method = "renderScoreboardSidebar(Lnet/minecraft/client/gui/DrawContext;Lnet/minecraft/scoreboard/ScoreboardObjective;)V",
- at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawText(Lnet/minecraft/client/font/TextRenderer;Ljava/lang/String;IIIZ)I"))
- public int renderScoreBoardSidebar(DrawContext instance, TextRenderer textRenderer, String text, int x, int y, int color, boolean shadow) {
+ @Redirect(
+ method = "method_55440([Lnet/minecraft/client/gui/hud/InGameHud$SidebarEntry;ILnet/minecraft/client/gui/DrawContext;Lnet/minecraft/text/Text;I)V",
+ at = @At(
+ value = "INVOKE",
+ target = "Lnet/minecraft/client/gui/DrawContext;drawText(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/text/Text;IIIZ)I",
+ ordinal = 2
+ )
+ )
+ public int removeScoreBoardNumbers(DrawContext instance, TextRenderer textRenderer, Text text, int x, int y, int color, boolean shadow) {
return 0;
}
- @ModifyExpressionValue(method = "renderStatusBars(Lnet/minecraft/client/gui/DrawContext;)V",
- at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;getArmor()I"))
+ @ModifyExpressionValue(
+ method = "renderStatusBars(Lnet/minecraft/client/gui/DrawContext;)V",
+ at = @At(
+ value = "INVOKE",
+ target = "Lnet/minecraft/entity/player/PlayerEntity;getArmor()I"
+ )
+ )
public int onGrabArmorAmount(int original) {
if (DulkirConfig.ConfigVars.getConfigOptions().getHideArmorOverlay() && Utils.INSTANCE.isInSkyblock()) {
return 0;
@@ -37,17 +53,24 @@ public class InGameHudMixin {
return original;
}
- @ModifyExpressionValue(method = "renderStatusBars(Lnet/minecraft/client/gui/DrawContext;)V",
- at = @At(value = "INVOKE",
- target = "Lnet/minecraft/client/gui/hud/InGameHud;getHeartCount(Lnet/minecraft/entity/LivingEntity;)I"))
+ @ModifyExpressionValue(
+ method = "renderStatusBars(Lnet/minecraft/client/gui/DrawContext;)V",
+ at = @At(
+ value = "INVOKE",
+ target = "Lnet/minecraft/client/gui/hud/InGameHud;getHeartCount(Lnet/minecraft/entity/LivingEntity;)I"
+ )
+ )
public int onCheckForRiding(int original) {
if (DulkirConfig.ConfigVars.getConfigOptions().getHideHungerOverlay() && Utils.INSTANCE.isInSkyblock())
return 1;
return original;
}
- @Inject(method = "renderHeldItemTooltip",
- at = @At("HEAD"), cancellable = true)
+ @Inject(
+ method = "renderHeldItemTooltip",
+ at = @At("HEAD"),
+ cancellable = true
+ )
public void changeItemDisplay (DrawContext context, CallbackInfo ci) {
if (DulkirConfig.ConfigVars.getConfigOptions().getHideHeldItemTooltip())
ci.cancel();