|
@@ -4,6 +4,8 @@ import com.mojang.blaze3d.systems.RenderSystem;
|
|
|
import com.umollu.ash.AshCommands;
|
|
|
import net.minecraft.client.MinecraftClient;
|
|
|
import net.minecraft.client.render.GameRenderer;
|
|
|
+import net.minecraft.client.util.Window;
|
|
|
+import net.minecraft.client.util.math.MatrixStack;
|
|
|
import net.minecraft.entity.Entity;
|
|
|
import net.minecraft.util.math.BlockPos;
|
|
|
import net.minecraft.util.math.Direction;
|
|
@@ -11,12 +13,13 @@ 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.callback.CallbackInfo;
|
|
|
+import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
|
|
|
|
|
@Mixin(GameRenderer.class)
|
|
|
public class GameRendererMixin {
|
|
|
|
|
|
- @Inject(at = @At(value = "INVOKE", target = "com/mojang/blaze3d/systems/RenderSystem.defaultAlphaFunc()V"), method = "render")
|
|
|
- public void render(float float_1, long long_1, boolean boolean_1, CallbackInfo info) {
|
|
|
+ @Inject(at = @At(value = "INVOKE", target = "com/mojang/blaze3d/systems/RenderSystem.defaultAlphaFunc()V"), method = "render", locals = LocalCapture.CAPTURE_FAILSOFT)
|
|
|
+ public void render(float float_1, long long_1, boolean boolean_1, CallbackInfo info , int i, int j, Window window, MatrixStack matrixStack) {
|
|
|
|
|
|
MinecraftClient client = MinecraftClient.getInstance();
|
|
|
Entity cameraEntity = client.getCameraEntity();
|
|
@@ -39,13 +42,13 @@ public class GameRendererMixin {
|
|
|
float textPosX = 5;
|
|
|
|
|
|
if (AshCommands.config.align == 1) {
|
|
|
- textPosX = (client.getWindow().getScaledWidth() - client.textRenderer.getStringWidth(ashString)) / 2f - textPosX;
|
|
|
+ textPosX = (client.getWindow().getScaledWidth() - client.textRenderer.getWidth(ashString)) / 2f - textPosX;
|
|
|
}
|
|
|
if (AshCommands.config.align == 2) {
|
|
|
- textPosX = client.getWindow().getScaledWidth() - client.textRenderer.getStringWidth(ashString) - textPosX;
|
|
|
+ textPosX = client.getWindow().getScaledWidth() - client.textRenderer.getWidth(ashString) - textPosX;
|
|
|
}
|
|
|
|
|
|
- client.textRenderer.drawWithShadow(ashString, textPosX, 5, AshCommands.config.hudColor);
|
|
|
+ client.textRenderer.drawWithShadow(matrixStack, ashString, textPosX, 5, AshCommands.config.hudColor);
|
|
|
RenderSystem.popMatrix();
|
|
|
}
|
|
|
}
|