umollu пре 6 година
родитељ
комит
52aca1620e

+ 3 - 3
gradle.properties

@@ -4,14 +4,14 @@ org.gradle.jvmargs=-Xmx1G
 # Fabric Properties
 	# check these on https://fabricmc.net/use
 	minecraft_version=19w09a
-	yarn_mappings=19w09a.2
+	yarn_mappings=19w09a.5
 	loader_version=0.3.7.109
 
 # Mod Properties
-	mod_version = 1.0.0
+	mod_version = 1.1.0
 	maven_group = com.umollu
 	archives_base_name = ash
 
 # Dependencies
 	# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric
-	fabric_version=0.2.3.108
+	fabric_version=0.2.3.109

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

@@ -0,0 +1,26 @@
+package com.umollu.ash;
+
+import net.fabricmc.api.ModInitializer;
+import net.fabricmc.fabric.api.registry.CommandRegistry;
+import net.minecraft.server.command.ServerCommandManager;
+import net.minecraft.server.network.ServerPlayerEntity;
+import net.minecraft.text.Style;
+import net.minecraft.text.TextFormat;
+import net.minecraft.text.TranslatableTextComponent;
+
+public class AshMod implements ModInitializer {
+
+    public static final String MOD_ID = "umollu_ash";
+    public static boolean showHUD = true;
+
+    @Override
+    public void onInitialize() {
+        CommandRegistry.INSTANCE.register(false, serverCommandSourceCommandDispatcher -> serverCommandSourceCommandDispatcher.register(
+                ServerCommandManager.literal("toggleash")
+                        .executes(context -> {
+                            showHUD = !showHUD;
+                            return 1;
+                        })
+        ));
+    }
+}

+ 2 - 1
src/main/java/com/umollu/ash/mixin/GameRendererMixin.java

@@ -1,5 +1,6 @@
 package com.umollu.ash.mixin;
 
+import com.umollu.ash.AshMod;
 import net.minecraft.client.MinecraftClient;
 import net.minecraft.client.render.GameRenderer;
 import net.minecraft.util.math.BlockPos;
@@ -18,7 +19,7 @@ public class GameRendererMixin {
 	public void render(float float_1, long long_1, boolean boolean_1, CallbackInfo info) {
 
 		MinecraftClient client = MinecraftClient.getInstance();
-		if(!client.options.debugEnabled) {
+		if(!client.options.debugEnabled && AshMod.showHUD) {
 			BlockPos blockPos = new BlockPos(client.getCameraEntity().x, client.getCameraEntity().getBoundingBox().minY, client.getCameraEntity().z);
 			double scaleFactor = client.window.getScaleFactor();
 			GlStateManager.pushMatrix();

+ 4 - 2
src/main/resources/fabric.mod.json

@@ -3,8 +3,10 @@
   "name": "ASH - Another Simple HUD",
   "description": "ASH - Another Simple HUD with FPS count and coordinates.",
   "version": "${version}",
-  "side": "client",
-  "initializers": [],
+  "side": "universal",
+  "initializers": [
+    "com.umollu.ash.AshMod"
+  ],
   "requires": {
     "fabric": "*"
   },