소스 검색

Merge branch '1.16' into master

Hibiii 4 년 전
부모
커밋
e3510e0126

+ 4 - 4
build.gradle

@@ -19,7 +19,7 @@ repositories {
         url "https://server.bbkr.space/artifactory/libs-release"
     }
 	maven {
-		url "https://maven.fabricmc.net/io/github/prospector/modmenu/"
+		url "http://maven.terraformersmc.com"
 	}
 }
 
@@ -39,7 +39,7 @@ dependencies {
 		exclude module: 'fabric-api'
 	}
 
-	modImplementation "io.github.prospector:modmenu:${project.modmenu_version}"
+	modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}"
 }
 
 processResources {
@@ -79,7 +79,7 @@ publishing {
 	publications {
 		mavenJava(MavenPublication) {
 			// add all the jars that should be included when publishing to maven
-			artifact(jar) {
+			artifact(remapJar) {
 				builtBy remapJar
 			}
 			artifact(sourcesJar) {
@@ -93,4 +93,4 @@ publishing {
 		// uncomment to publish to the local maven
 		// mavenLocal()
 	}
-}
+}

+ 5 - 5
gradle.properties

@@ -2,12 +2,12 @@
 org.gradle.jvmargs=-Xmx1G
 
 # Fabric Properties
-	minecraft_version=1.16.4
-	yarn_mappings=1.16.4+build.6
-	loader_version=0.10.6+build.214
+	minecraft_version=1.16.5
+	yarn_mappings=1.16.5+build.3
+	loader_version=0.11.1
 
 # Mod Properties
-	mod_version = 1.1.11
+	mod_version = 1.1.13
 	maven_group = com.umollu
 	archives_base_name = ash
 
@@ -15,4 +15,4 @@ org.gradle.jvmargs=-Xmx1G
 	fabric_version=0.31.0+1.16
 	autoconfig_version=3.3.1
 	clothconfig_version=4.8.3
-	modmenu_version=1.14.6+build.31
+	modmenu_version=1.14.15

+ 1 - 1
gradle/wrapper/gradle-wrapper.properties

@@ -1,5 +1,5 @@
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists

+ 1 - 2
settings.gradle

@@ -6,6 +6,5 @@ pluginManagement {
             url = 'https://maven.fabricmc.net/'
         }
         gradlePluginPortal()
-        mavenCentral()
     }
-}
+}

+ 21 - 1
src/main/java/com/umollu/ash/AshCommands.java

@@ -87,5 +87,25 @@ public class AshCommands {
                         AshMod.configManager.save();
                         return 1;
                     })));
+
+        commandDispatcher.register(ClientCommandManager.literal("valignash")
+            .then(ClientCommandManager.literal("top")
+                    .executes(context -> {
+                        config.verticalAlign = 0;
+                        AshMod.configManager.save();
+                        return 1;
+                    }))
+            .then(ClientCommandManager.literal("middle")
+                    .executes(context -> {
+                        config.verticalAlign = 1;
+                        AshMod.configManager.save();
+                        return 1;
+                    }))
+            .then(ClientCommandManager.literal("bottom")
+                    .executes(context -> {
+                        config.verticalAlign = 2;
+                        AshMod.configManager.save();
+                        return 1;
+                    })));
     }
-}
+}

+ 51 - 2
src/main/java/com/umollu/ash/AshMod.java

@@ -8,6 +8,10 @@ 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.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
+import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
+import net.minecraft.client.options.KeyBinding;
+import net.minecraft.client.util.InputUtil;
 import net.minecraft.text.TranslatableText;
 
 import java.util.Collections;
@@ -21,9 +25,17 @@ public class AshMod implements ClientModInitializer {
     public void onInitializeClient() {
         configManager = (ConfigManager) AutoConfig.register(AshConfig.class, GsonConfigSerializer::new);
 
+        KeyBinding toggleAsh = KeyBindingHelper.registerKeyBinding(new KeyBinding("key.umollu_ash.toggleAsh", InputUtil.Type.KEYSYM, InputUtil.UNKNOWN_KEY.getCode(), "key.categories.misc"));
+
+        ClientTickEvents.END_CLIENT_TICK.register(client -> {
+            while (toggleAsh.wasPressed()) {
+                AshCommands.config.showHud = !AshCommands.config.showHud;
+                configManager.save();
+            }
+        });
+
         GuiRegistry registry = AutoConfig.getGuiRegistry(AshConfig.class);
         registry.registerPredicateProvider((i13n, field, config, defaults, guiProvider) -> {
-
             ConfigEntryBuilder ENTRY_BUILDER = ConfigEntryBuilder.create();
 
             String[] ints = new String[3];
@@ -46,7 +58,31 @@ public class AshMod implements ClientModInitializer {
         }, (field) -> {
             return field.getName().equals("align");
         });
-        
+
+        registry.registerPredicateProvider((i13n, field, config, defaults, guiProvider) -> {
+            ConfigEntryBuilder ENTRY_BUILDER = ConfigEntryBuilder.create();
+
+            String[] ints = new String[3];
+
+            ints[0] = "Top";
+            ints[1] = "Middle";
+            ints[2] = "Bottom";
+
+            return Collections.singletonList(ENTRY_BUILDER.startSelector(new TranslatableText(i13n), ints, verticalAlignToString((Integer) Utils.getUnsafely(field, config, (Object)null))).setDefaultValue(() -> {
+                return verticalAlignToString(Utils.getUnsafely(field, defaults));
+            }).setSaveConsumer((newValue) -> {
+                int intValue = 0;
+                if(newValue.equals("Middle"))
+                    intValue = 1;
+                else if(newValue.equals("Bottom"))
+                    intValue = 2;
+
+                Utils.setUnsafely(field, config, intValue);
+            }).build());
+        }, (field) -> {
+            return field.getName().equals("verticalAlign");
+        });
+      
         AshCommands.registerCommands();
     }
 
@@ -62,4 +98,17 @@ public class AshMod implements ClientModInitializer {
                 return "";
         }
     }
+
+    private String verticalAlignToString(int verticalAlign) {
+        switch (verticalAlign) {
+            case 0:
+                return "Top";
+            case 1:
+                return "Middle";
+            case 2:
+                return "Bottom";
+            default:
+                return "";
+        }
+    }
 }

+ 3 - 1
src/main/java/com/umollu/ash/config/AshConfig.java

@@ -19,4 +19,6 @@ public class AshConfig implements ConfigData {
     public boolean showDirection = true;
 
     public int align = 0;
-}
+
+    public int verticalAlign = 0;
+}

+ 1 - 8
src/main/java/com/umollu/ash/config/AshMenuIntegration.java

@@ -1,19 +1,12 @@
 package com.umollu.ash.config;
 
-import com.umollu.ash.AshMod;
 import io.github.prospector.modmenu.api.ConfigScreenFactory;
 import io.github.prospector.modmenu.api.ModMenuApi;
 import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
 
 public class AshMenuIntegration implements ModMenuApi {
-
-    @Override
-    public String getModId() {
-        return AshMod.MOD_ID;
-    }
-
     @Override
     public ConfigScreenFactory<?> getModConfigScreenFactory() {
         return parent -> AutoConfig.getConfigScreen(AshConfig.class, parent).get();
     }
-}
+}

+ 13 - 5
src/main/java/com/umollu/ash/mixin/InGameHudMixin.java

@@ -1,6 +1,5 @@
 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;
@@ -22,7 +21,7 @@ public class InGameHudMixin {
         Entity cameraEntity = client.getCameraEntity();
 
         if(!client.options.debugEnabled && AshCommands.config.showHud) {
-            RenderSystem.pushMatrix();
+            matrixStack.push();
             String ashString = "";
             if(AshCommands.config.showFps) {
                 ashString += String.format("%d fps ", ((MinecraftClientMixin) MinecraftClient.getInstance()).getCurrentFps());
@@ -45,8 +44,17 @@ public class InGameHudMixin {
                 textPosX = client.getWindow().getScaledWidth() - client.textRenderer.getWidth(ashString) - textPosX;
             }
 
-            client.textRenderer.drawWithShadow(matrixStack, ashString, textPosX, 5, AshCommands.config.hudColor);
-            RenderSystem.popMatrix();
+            float textPosY = 5;
+
+            if (AshCommands.config.verticalAlign == 1) {
+                textPosY = (client.getWindow().getScaledHeight() - client.textRenderer.fontHeight) / 2f - textPosY;
+            }
+            if (AshCommands.config.verticalAlign == 2) {
+                textPosY = client.getWindow().getScaledHeight() - client.textRenderer.fontHeight - textPosY;
+            }
+
+            client.textRenderer.drawWithShadow(matrixStack, ashString, textPosX, textPosY, AshCommands.config.hudColor);
+            matrixStack.pop();
         }
     }
-}
+}

+ 3 - 1
src/main/resources/assets/umollu_ash/lang/en_us.json

@@ -5,5 +5,7 @@
   "text.autoconfig.umollu_ash.option.showFps" : "Show FPS",
   "text.autoconfig.umollu_ash.option.showCoords" : "Show coordinates",
   "text.autoconfig.umollu_ash.option.showDirection" : "Show direction",
-  "text.autoconfig.umollu_ash.option.align" : "HUD screen alignment"
+  "text.autoconfig.umollu_ash.option.align" : "HUD screen horizontal alignment",
+  "text.autoconfig.umollu_ash.option.verticalAlign" : "HUD screen vertical alignment",
+  "key.umollu_ash.toggleAsh" : "Toggle ASH HUD"
 }

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

@@ -28,6 +28,8 @@
     "umollu_ash.mixins.json"
   ],
   "depends": {
-    "fabric": ">=0.31.0"
+    "fabricloader": ">=0.7.4",
+    "fabric": ">=0.31.0",
+    "minecraft": "1.16.x"
   }
-}
+}