|
@@ -3,6 +3,8 @@ package me.lortseam.uglyscoreboardfix.mixin;
|
|
import me.lortseam.uglyscoreboardfix.UglyScoreboardFix;
|
|
import me.lortseam.uglyscoreboardfix.UglyScoreboardFix;
|
|
import net.minecraft.client.font.TextRenderer;
|
|
import net.minecraft.client.font.TextRenderer;
|
|
import net.minecraft.client.gui.hud.InGameHud;
|
|
import net.minecraft.client.gui.hud.InGameHud;
|
|
|
|
+import net.minecraft.client.util.math.MatrixStack;
|
|
|
|
+import net.minecraft.scoreboard.ScoreboardObjective;
|
|
import org.spongepowered.asm.mixin.Mixin;
|
|
import org.spongepowered.asm.mixin.Mixin;
|
|
import org.spongepowered.asm.mixin.injection.At;
|
|
import org.spongepowered.asm.mixin.injection.At;
|
|
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
|
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
|
@@ -12,18 +14,18 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
|
public abstract class MixinInGameHud {
|
|
public abstract class MixinInGameHud {
|
|
|
|
|
|
@ModifyVariable(method = "renderScoreboardSidebar", at = @At(value = "STORE"))
|
|
@ModifyVariable(method = "renderScoreboardSidebar", at = @At(value = "STORE"))
|
|
- private String uglyscoreboardfix$modifyScore(String score) {
|
|
|
|
- return UglyScoreboardFix.getInstance().isEnabled() ? "" : score;
|
|
|
|
|
|
+ private String uglyscoreboardfix$modifyScore(String score, MatrixStack matrices, ScoreboardObjective objective) {
|
|
|
|
+ return UglyScoreboardFix.getInstance().shouldHideScores(objective) ? "" : score;
|
|
}
|
|
}
|
|
|
|
|
|
@ModifyVariable(method = "renderScoreboardSidebar", at = @At(value = "STORE"), ordinal = 2)
|
|
@ModifyVariable(method = "renderScoreboardSidebar", at = @At(value = "STORE"), ordinal = 2)
|
|
- private int uglyscoreboardfix$modifySeperatorWidth(int seperatorWidth) {
|
|
|
|
- return UglyScoreboardFix.getInstance().isEnabled() ? 0 : seperatorWidth;
|
|
|
|
|
|
+ private int uglyscoreboardfix$modifySeperatorWidth(int seperatorWidth, MatrixStack matrices, ScoreboardObjective objective) {
|
|
|
|
+ return UglyScoreboardFix.getInstance().shouldHideScores(objective) ? 0 : seperatorWidth;
|
|
}
|
|
}
|
|
|
|
|
|
@Redirect(method = "renderScoreboardSidebar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/TextRenderer;getWidth(Ljava/lang/String;)I", ordinal = 1))
|
|
@Redirect(method = "renderScoreboardSidebar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/TextRenderer;getWidth(Ljava/lang/String;)I", ordinal = 1))
|
|
- private int uglyscoreboardfix$modifyScoreWidth(TextRenderer textRenderer, String score) {
|
|
|
|
- return UglyScoreboardFix.getInstance().isEnabled() ? 0 : textRenderer.getWidth(score);
|
|
|
|
|
|
+ private int uglyscoreboardfix$modifyScoreWidth(TextRenderer textRenderer, String score, MatrixStack matrices, ScoreboardObjective objective) {
|
|
|
|
+ return UglyScoreboardFix.getInstance().shouldHideScores(objective) ? 0 : textRenderer.getWidth(score);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|