Procházet zdrojové kódy

Fixed ASH not showing above vignette;

umollu před 4 roky
rodič
revize
a796949372

+ 1 - 1
build.gradle

@@ -1,5 +1,5 @@
 plugins {
-	id 'fabric-loom' version '0.4-SNAPSHOT'
+	id 'fabric-loom' version '0.5-SNAPSHOT'
 	id 'maven-publish'
 }
 

+ 7 - 8
gradle.properties

@@ -2,19 +2,18 @@
 org.gradle.jvmargs=-Xmx1G
 
 # Fabric Properties
-	# check these on https://fabricmc.net/use
-	minecraft_version=1.16.3
-	yarn_mappings=1.16.3+build.12
-	loader_version=0.9.3+build.207
+	minecraft_version=1.16.4
+	yarn_mappings=1.16.4+build.6
+	loader_version=0.10.6+build.214
 
 # Mod Properties
-	mod_version = 1.1.10
+	mod_version = 1.1.11
 	maven_group = com.umollu
 	archives_base_name = ash
 
 # Dependencies
-	fabric_version=0.21.0+build.407-1.16
+	fabric_version=0.25.4+1.16
 	clientcommands_version=1.0.1+1.16-rc1
-	autoconfig_version=3.2.2
-	clothconfig_version=4.8.1
+	autoconfig_version=3.3.1
+	clothconfig_version=4.8.3
 	modmenu_version=1.14.6+build.31

+ 0 - 1
src/main/java/com/umollu/ash/AshMod.java

@@ -8,7 +8,6 @@ import me.sargunvohra.mcmods.autoconfig1u.serializer.GsonConfigSerializer;
 import me.sargunvohra.mcmods.autoconfig1u.util.Utils;
 import me.shedaniel.clothconfig2.api.ConfigEntryBuilder;
 import net.fabricmc.api.ClientModInitializer;
-import net.minecraft.text.LiteralText;
 import net.minecraft.text.TranslatableText;
 
 import java.util.Collections;

+ 0 - 55
src/main/java/com/umollu/ash/mixin/GameRendererMixin.java

@@ -1,55 +0,0 @@
-package com.umollu.ash.mixin;
-
-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;
-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", 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();
-
-		if(!client.options.debugEnabled && AshCommands.config.showHud) {
-			RenderSystem.pushMatrix();
-			String ashString = "";
-			if(AshCommands.config.showFps) {
-				ashString += String.format("%d fps ", ((MinecraftClientMixin) MinecraftClient.getInstance()).getCurrentFps());
-			}
-			if(AshCommands.config.showCoords && !client.hasReducedDebugInfo()) {
-				BlockPos blockPos = new BlockPos(cameraEntity.getX(), cameraEntity.getBoundingBox().getMin(Direction.Axis.Y), cameraEntity.getZ());
-				ashString += String.format("%d %d %d ", blockPos.getX(), blockPos.getY(), blockPos.getZ());
-			}
-			if(AshCommands.config.showDirection) {
-				Direction direction = cameraEntity.getHorizontalFacing();
-				ashString += String.format("%5s ", direction);
-			}
-
-			float textPosX = 5;
-
-			if (AshCommands.config.align == 1) {
-				textPosX = (client.getWindow().getScaledWidth() - client.textRenderer.getWidth(ashString)) / 2f - textPosX;
-			}
-			if (AshCommands.config.align == 2) {
-				textPosX = client.getWindow().getScaledWidth() - client.textRenderer.getWidth(ashString) - textPosX;
-			}
-
-			client.textRenderer.drawWithShadow(matrixStack, ashString, textPosX, 5, AshCommands.config.hudColor);
-			RenderSystem.popMatrix();
-		}
-	}
-}

+ 52 - 0
src/main/java/com/umollu/ash/mixin/InGameHudMixin.java

@@ -0,0 +1,52 @@
+package com.umollu.ash.mixin;
+
+import com.mojang.blaze3d.systems.RenderSystem;
+import com.umollu.ash.AshCommands;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.gui.hud.InGameHud;
+import net.minecraft.client.util.math.MatrixStack;
+import net.minecraft.entity.Entity;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.Direction;
+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;
+
+@Mixin(InGameHud.class)
+public class InGameHudMixin {
+
+    @Inject(at = @At("TAIL"), method = "render")
+    public void render(MatrixStack matrixStack, float tickDelta, CallbackInfo info) {
+        MinecraftClient client = MinecraftClient.getInstance();
+        Entity cameraEntity = client.getCameraEntity();
+
+        if(!client.options.debugEnabled && AshCommands.config.showHud) {
+            RenderSystem.pushMatrix();
+            String ashString = "";
+            if(AshCommands.config.showFps) {
+                ashString += String.format("%d fps ", ((MinecraftClientMixin) MinecraftClient.getInstance()).getCurrentFps());
+            }
+            if(AshCommands.config.showCoords && !client.hasReducedDebugInfo()) {
+                BlockPos blockPos = new BlockPos(cameraEntity.getX(), cameraEntity.getBoundingBox().getMin(Direction.Axis.Y), cameraEntity.getZ());
+                ashString += String.format("%d %d %d ", blockPos.getX(), blockPos.getY(), blockPos.getZ());
+            }
+            if(AshCommands.config.showDirection) {
+                Direction direction = cameraEntity.getHorizontalFacing();
+                ashString += String.format("%5s ", direction);
+            }
+
+            float textPosX = 5;
+
+            if (AshCommands.config.align == 1) {
+                textPosX = (client.getWindow().getScaledWidth() - client.textRenderer.getWidth(ashString)) / 2f - textPosX;
+            }
+            if (AshCommands.config.align == 2) {
+                textPosX = client.getWindow().getScaledWidth() - client.textRenderer.getWidth(ashString) - textPosX;
+            }
+
+            client.textRenderer.drawWithShadow(matrixStack, ashString, textPosX, 5, AshCommands.config.hudColor);
+            RenderSystem.popMatrix();
+        }
+    }
+}

+ 15 - 5
src/main/resources/fabric.mod.json

@@ -1,9 +1,19 @@
 {
   "schemaVersion": 1,
   "id": "umollu_ash",
+  "version": "${version}",
   "name": "ASH - Another Simple HUD",
   "description": "ASH - Another Simple HUD with FPS count and coordinates.",
-  "version": "${version}",
+  "authors": [
+    "umollu"
+  ],
+  "contact": {
+    "homepage": "https://umollu.com/",
+    "sources": "https://github.com/umollu/ash",
+    "issues": "https://github.com/umollu/ash/issues"
+  },
+  "license": "MIT",
+  "icon": "assets/umollu_ash/icon.png",
   "environment": "*",
   "entrypoints": {
     "client": [
@@ -14,11 +24,11 @@
     ],
     "cotton-client-commands": ["com.umollu.ash.AshCommands"]
   },
+  "mixins": [
+    "umollu_ash.mixins.json"
+  ],
   "depends": {
     "fabric": "*",
     "cotton-client-commands": "^1.0.0"
-  },
-  "mixins": [
-    "umollu_ash.mixins.json"
-  ]
+  }
 }

+ 3 - 3
src/main/resources/umollu_ash.mixins.json

@@ -1,13 +1,13 @@
 {
   "required": true,
+  "minVersion": "0.8",
   "package": "com.umollu.ash.mixin",
   "compatibilityLevel": "JAVA_8",
-  "minVersion": "0.7.11",
   "client": [
-    "GameRendererMixin",
+    "InGameHudMixin",
     "MinecraftClientMixin"
   ],
   "injectors": {
     "defaultRequire": 1
   }
-}
+}