|
@@ -3,10 +3,12 @@ package com.umollu.ash.mixin;
|
|
import com.umollu.ash.AshMod;
|
|
import com.umollu.ash.AshMod;
|
|
import net.minecraft.client.MinecraftClient;
|
|
import net.minecraft.client.MinecraftClient;
|
|
import net.minecraft.client.render.GameRenderer;
|
|
import net.minecraft.client.render.GameRenderer;
|
|
|
|
+import net.minecraft.entity.Entity;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.util.math.BlockPos;
|
|
|
|
|
|
import com.mojang.blaze3d.platform.GlStateManager;
|
|
import com.mojang.blaze3d.platform.GlStateManager;
|
|
|
|
|
|
|
|
+import net.minecraft.util.math.Direction;
|
|
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.Inject;
|
|
import org.spongepowered.asm.mixin.injection.Inject;
|
|
@@ -19,12 +21,35 @@ public class GameRendererMixin {
|
|
public void render(float float_1, long long_1, boolean boolean_1, CallbackInfo info) {
|
|
public void render(float float_1, long long_1, boolean boolean_1, CallbackInfo info) {
|
|
|
|
|
|
MinecraftClient client = MinecraftClient.getInstance();
|
|
MinecraftClient client = MinecraftClient.getInstance();
|
|
|
|
+ Entity cameraEntity = client.getCameraEntity();
|
|
|
|
+
|
|
if(!client.options.debugEnabled && AshMod.config.showHud) {
|
|
if(!client.options.debugEnabled && AshMod.config.showHud) {
|
|
- BlockPos blockPos = new BlockPos(client.getCameraEntity().x, client.getCameraEntity().getBoundingBox().minY, client.getCameraEntity().z);
|
|
|
|
double scaleFactor = client.window.getScaleFactor();
|
|
double scaleFactor = client.window.getScaleFactor();
|
|
GlStateManager.pushMatrix();
|
|
GlStateManager.pushMatrix();
|
|
GlStateManager.scaled(1 * scaleFactor, 1 * scaleFactor, 1 * scaleFactor);
|
|
GlStateManager.scaled(1 * scaleFactor, 1 * scaleFactor, 1 * scaleFactor);
|
|
- client.textRenderer.drawWithShadow(String.format("%d fps %d %d %d", MinecraftClient.getCurrentFps(), blockPos.getX(), blockPos.getY(), blockPos.getZ()), 5, 5, AshMod.config.hudColor);
|
|
|
|
|
|
+ String ashString = "";
|
|
|
|
+ if(AshMod.config.showFps) {
|
|
|
|
+ ashString += String.format("%d fps ", MinecraftClient.getCurrentFps());
|
|
|
|
+ }
|
|
|
|
+ if(AshMod.config.showCoords) {
|
|
|
|
+ BlockPos blockPos = new BlockPos(cameraEntity.x, cameraEntity.getBoundingBox().minY, cameraEntity.z);
|
|
|
|
+ ashString += String.format("%d %d %d ", blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
|
|
|
+ }
|
|
|
|
+ if(AshMod.config.showDirection) {
|
|
|
|
+ Direction direction = cameraEntity.getHorizontalFacing();
|
|
|
|
+ ashString += String.format("%5s ", direction);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ float textPosX = 5;
|
|
|
|
+
|
|
|
|
+ if (AshMod.config.align == 1) {
|
|
|
|
+ textPosX = (client.window.getScaledWidth() - client.textRenderer.getStringWidth(ashString)) / 2f - textPosX;
|
|
|
|
+ }
|
|
|
|
+ if (AshMod.config.align == 2) {
|
|
|
|
+ textPosX = client.window.getScaledWidth() - client.textRenderer.getStringWidth(ashString) - textPosX;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ client.textRenderer.drawWithShadow(ashString, textPosX, 5, AshMod.config.hudColor);
|
|
GlStateManager.popMatrix();
|
|
GlStateManager.popMatrix();
|
|
}
|
|
}
|
|
}
|
|
}
|