From 09d3a014d759237ed95bbbaab2fb5d7bb817ac27 Mon Sep 17 00:00:00 2001 From: HTony03 Date: Sun, 30 Apr 2023 15:41:28 +0800 Subject: [PATCH 01/12] 1.18.2 yeaaaah --- build.gradle | 8 ++++---- gradle.properties | 16 +++++++++++++++- .../java/net/torocraft/flighthud/FlightHud.java | 2 +- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 86ea1fb..fb26860 100644 --- a/build.gradle +++ b/build.gradle @@ -13,12 +13,12 @@ apply plugin: 'net.minecraftforge.gradle' apply plugin: 'eclipse' apply plugin: 'maven-publish' -version = '1.17.1-forge-1' +version = '1.18.2_htony_test' group = 'net.torocraft' // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = 'flighthud' // Mojang ships Java 16 to end users in 1.17+ instead of Java 8 in 1.16 or lower, so your mod should target Java 16. -java.toolchain.languageVersion = JavaLanguageVersion.of(16) +java.toolchain.languageVersion = JavaLanguageVersion.of(17) println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) minecraft { @@ -33,7 +33,7 @@ minecraft { // // Use non-default mappings at your own risk. They may not always work. // Simply re-run your setup task after changing the mappings to update your workspace. - mappings channel: 'official', version: '1.17.1' + mappings channel: 'official', version: '1.18.2' // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default. @@ -128,7 +128,7 @@ dependencies { // Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed // that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied. // The userdev artifact is a special name and will get all sorts of transformations applied to it. - minecraft 'net.minecraftforge:forge:1.17.1-37.0.34' + minecraft 'net.minecraftforge:forge:1.18.2-40.1.93' // Real mod deobf dependency examples - these get remapped to your current mappings // compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency diff --git a/gradle.properties b/gradle.properties index 878bf1f..f3b3b43 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,18 @@ # Sets default memory used for gradle commands. Can be overridden by user or command line properties. # This is required to provide enough memory for the Minecraft decompilation process. org.gradle.jvmargs=-Xmx3G -org.gradle.daemon=false \ No newline at end of file +org.gradle.daemon=true +org.gradle.configureondemand=true + +artifact_minecraft_version = 1.18.2 +mc_version=1.18.2 +forge_version = 40.1.93 +mod_version=HTony_test +forgegradle_version = 5.1.53 +mixingradle_version = 0.7-SNAPSHOT +mixin_version = 0.8.5 +jei_minecraft_version = 1.18.2 +jei_version = 9.7.0.209 +registrate_version = MC1.18.2-1.1.3 +curios_minecraft_version = 1.18.2 +curios_version = 5.0.7.0 \ No newline at end of file diff --git a/src/main/java/net/torocraft/flighthud/FlightHud.java b/src/main/java/net/torocraft/flighthud/FlightHud.java index bc90a5d..21a3525 100644 --- a/src/main/java/net/torocraft/flighthud/FlightHud.java +++ b/src/main/java/net/torocraft/flighthud/FlightHud.java @@ -6,7 +6,7 @@ import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.fmlclient.registry.ClientRegistry; +import net.minecraftforge.client.ClientRegistry; import net.torocraft.flighthud.config.HudConfig; import net.torocraft.flighthud.config.SettingsConfig; import net.torocraft.flighthud.config.loader.ConfigLoader; From 3c8e5bcef80123eb5696f90373641897d81a5264 Mon Sep 17 00:00:00 2001 From: HTony03 Date: Sun, 30 Apr 2023 16:38:38 +0800 Subject: [PATCH 02/12] 6fps --- .../net/torocraft/flighthud/HudRenderer.java | 42 ++++++++++++++----- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/src/main/java/net/torocraft/flighthud/HudRenderer.java b/src/main/java/net/torocraft/flighthud/HudRenderer.java index e01573e..56d2f94 100644 --- a/src/main/java/net/torocraft/flighthud/HudRenderer.java +++ b/src/main/java/net/torocraft/flighthud/HudRenderer.java @@ -11,8 +11,10 @@ import net.torocraft.flighthud.components.SpeedIndicator; import net.torocraft.flighthud.config.SettingsConfig.DisplayMode; +class fps { + public static int tps = 1; +} public class HudRenderer extends HudComponent { - private final Dimensions dim = new Dimensions(); private final FlightComputer computer = new FlightComputer(); private static final String FULL = DisplayMode.FULL.toString(); @@ -50,20 +52,38 @@ public void render(PoseStack m, float partial, Minecraft client) { } try { - m.pushPose(); + if (fps.tps == 1){ + m.pushPose(); - if (HudComponent.CONFIG.scale != 1d) { - float scale = 1 / (float) HudComponent.CONFIG.scale; - m.scale(scale, scale, scale); - } + if (HudComponent.CONFIG.scale != 1d) { + float scale = 1 / (float) HudComponent.CONFIG.scale; + m.scale(scale, scale, scale); + } - computer.update(client, partial); - dim.update(client); + computer.update(client, partial); + dim.update(client); - for (HudComponent component : components) { - component.render(m, partial, client); + for (HudComponent component : components) { + component.render(m, partial, client); + } + m.popPose(); + fps.tps = 2; } - m.popPose(); + if (fps.tps == 2){ + fps.tps = 3; + } + if (fps.tps == 3){ + fps.tps = 4; + } + if (fps.tps == 4){ + fps.tps = 5; + } + if (fps.tps == 5){ + fps.tps = 6; + } + if (fps.tps == 6){ + fps.tps = 1; + } } catch (Exception e) { e.printStackTrace(); } From 43d067068debe38e32a1bd530af5ab1fb3381151 Mon Sep 17 00:00:00 2001 From: HTony03 Date: Sun, 30 Apr 2023 17:12:07 +0800 Subject: [PATCH 03/12] 6fps --- src/main/java/net/torocraft/flighthud/HudRenderer.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/torocraft/flighthud/HudRenderer.java b/src/main/java/net/torocraft/flighthud/HudRenderer.java index 56d2f94..359249c 100644 --- a/src/main/java/net/torocraft/flighthud/HudRenderer.java +++ b/src/main/java/net/torocraft/flighthud/HudRenderer.java @@ -69,19 +69,19 @@ public void render(PoseStack m, float partial, Minecraft client) { m.popPose(); fps.tps = 2; } - if (fps.tps == 2){ + else if (fps.tps == 2){ fps.tps = 3; } - if (fps.tps == 3){ + else if (fps.tps == 3){ fps.tps = 4; } - if (fps.tps == 4){ + else if (fps.tps == 4){ fps.tps = 5; } - if (fps.tps == 5){ + else if (fps.tps == 5){ fps.tps = 6; } - if (fps.tps == 6){ + else if (fps.tps == 6){ fps.tps = 1; } } catch (Exception e) { From 1c7d2050888488caad805402901ea0547d51578d Mon Sep 17 00:00:00 2001 From: HTony03 Date: Sun, 30 Apr 2023 17:21:43 +0800 Subject: [PATCH 04/12] readme --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 716b946..82c0681 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,5 @@ __Flight HUD__ is a client side Fabric Minecraft Mod that adds a flight style HU ![HUD Components](images/hud-diagram.png?raw=true "HUD Components") ## Requirements -- Minecraft 1.16.1 -- Fabric Mod Loader -- Fabric API Mod +- Minecraft 1.18.1/1.18.2 +- Forge 40.1.93+ From d7b95c028102e9e6e26567318cc6d5d9d125a658 Mon Sep 17 00:00:00 2001 From: HTony03 Date: Tue, 2 May 2023 16:14:17 +0800 Subject: [PATCH 05/12] =?UTF-8?q?=E5=A4=A7=E6=AE=B5=E6=94=B9=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../net/torocraft/flighthud/HudRenderer.java | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/src/main/java/net/torocraft/flighthud/HudRenderer.java b/src/main/java/net/torocraft/flighthud/HudRenderer.java index 359249c..a2a6374 100644 --- a/src/main/java/net/torocraft/flighthud/HudRenderer.java +++ b/src/main/java/net/torocraft/flighthud/HudRenderer.java @@ -52,7 +52,7 @@ public void render(PoseStack m, float partial, Minecraft client) { } try { - if (fps.tps == 1){ + if (fps.tps % 6 == 0 ){ m.pushPose(); if (HudComponent.CONFIG.scale != 1d) { @@ -68,22 +68,8 @@ public void render(PoseStack m, float partial, Minecraft client) { } m.popPose(); fps.tps = 2; - } - else if (fps.tps == 2){ - fps.tps = 3; - } - else if (fps.tps == 3){ - fps.tps = 4; - } - else if (fps.tps == 4){ - fps.tps = 5; - } - else if (fps.tps == 5){ - fps.tps = 6; - } - else if (fps.tps == 6){ - fps.tps = 1; - } + }; + fps.tps = ++fps.tps; } catch (Exception e) { e.printStackTrace(); } From 4d176871c6945b25cdebb8366956756b46ff15ca Mon Sep 17 00:00:00 2001 From: HTony03 Date: Fri, 12 May 2023 20:51:24 +0800 Subject: [PATCH 06/12] toml --- src/main/resources/META-INF/mods.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 2d4c878..8b7e4ce 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -62,6 +62,6 @@ Displays a flight styled hud while flying with elytra. [[dependencies.flighthud]] modId="minecraft" mandatory=true - versionRange="[1.17.1]" + versionRange="[1.18,1.18.2]" ordering="NONE" side="BOTH" From 3e07c80a0a6549a43d467acf0e1a481b993c4eb9 Mon Sep 17 00:00:00 2001 From: HTony03 Date: Fri, 12 May 2023 21:23:41 +0800 Subject: [PATCH 07/12] toml2 --- src/main/resources/META-INF/mods.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 8b7e4ce..20c3acd 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -24,13 +24,13 @@ modId="flighthud" #mandatory version="${file.jarVersion}" #mandatory # A display name for the mod -displayName="FlightHUD" #mandatory +displayName="FlightHUD reloaded" #mandatory # A URL to query for updates for this mod. See the JSON update specification #updateJSONURL="http://myurl.me/" #optional # A URL for the "homepage" for this mod, displayed in the mod UI -displayURL="https://www.curseforge.com/minecraft/mc-mods/flighthud" #optional +displayURL="https://www.mcmod.cn/class/10172.html" #optional # A file name (in the root of the mod JAR) containing a logo for display #logoFile="flighthud.png" #optional @@ -39,7 +39,7 @@ displayURL="https://www.curseforge.com/minecraft/mc-mods/flighthud" #optional #credits="Thanks for this example mod goes to Java" #optional # A text field displayed in the mod UI -authors="frodare" #optional +authors="frodare,HTony03" #optional # The description text for the mod (multi line!) (#mandatory) description=''' From 20491f13a91e56a23be30dfe701d872bebcfa4ff Mon Sep 17 00:00:00 2001 From: HTony03 Date: Fri, 26 May 2023 22:12:31 +0800 Subject: [PATCH 08/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9B=9E1.18=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0zh=5Fcn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 6 +++--- gradle.properties | 12 +++--------- src/main/java/net/torocraft/flighthud/FlightHud.java | 2 +- src/main/resources/assets/flighthud/lang/zh_cn.json | 4 ++++ 4 files changed, 11 insertions(+), 13 deletions(-) create mode 100644 src/main/resources/assets/flighthud/lang/zh_cn.json diff --git a/build.gradle b/build.gradle index fb26860..7f85f1c 100644 --- a/build.gradle +++ b/build.gradle @@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle' apply plugin: 'eclipse' apply plugin: 'maven-publish' -version = '1.18.2_htony_test' +version = '1.18_0.0.2' group = 'net.torocraft' // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = 'flighthud' @@ -33,7 +33,7 @@ minecraft { // // Use non-default mappings at your own risk. They may not always work. // Simply re-run your setup task after changing the mappings to update your workspace. - mappings channel: 'official', version: '1.18.2' + mappings channel: 'official', version: '1.18' // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default. @@ -128,7 +128,7 @@ dependencies { // Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed // that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied. // The userdev artifact is a special name and will get all sorts of transformations applied to it. - minecraft 'net.minecraftforge:forge:1.18.2-40.1.93' + minecraft 'net.minecraftforge:forge:1.18.2-40.2.0' // Real mod deobf dependency examples - these get remapped to your current mappings // compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency diff --git a/gradle.properties b/gradle.properties index f3b3b43..dea19b5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,16 +3,10 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=true org.gradle.configureondemand=true +org.gradle.parallel=true -artifact_minecraft_version = 1.18.2 +artifact_minecraft_version = 1.18 mc_version=1.18.2 -forge_version = 40.1.93 +forge_version = 41.1.0 mod_version=HTony_test forgegradle_version = 5.1.53 -mixingradle_version = 0.7-SNAPSHOT -mixin_version = 0.8.5 -jei_minecraft_version = 1.18.2 -jei_version = 9.7.0.209 -registrate_version = MC1.18.2-1.1.3 -curios_minecraft_version = 1.18.2 -curios_version = 5.0.7.0 \ No newline at end of file diff --git a/src/main/java/net/torocraft/flighthud/FlightHud.java b/src/main/java/net/torocraft/flighthud/FlightHud.java index 21a3525..8599860 100644 --- a/src/main/java/net/torocraft/flighthud/FlightHud.java +++ b/src/main/java/net/torocraft/flighthud/FlightHud.java @@ -46,7 +46,7 @@ public FlightHud() { } private void setup(final FMLCommonSetupEvent event) { - keyBinding = new KeyMapping("key.flighthud.toggleDisplayModed", GLFW.GLFW_KEY_GRAVE_ACCENT, "category.flighthud.toggleDisplayMode"); + keyBinding = new KeyMapping("key.flighthud.toggleDisplayMode", GLFW.GLFW_KEY_GRAVE_ACCENT, "category.flighthud.toggleDisplayMode"); CONFIG_LOADER_SETTINGS.load(); CONFIG_LOADER_FULL.load(); CONFIG_LOADER_MIN.load(); diff --git a/src/main/resources/assets/flighthud/lang/zh_cn.json b/src/main/resources/assets/flighthud/lang/zh_cn.json new file mode 100644 index 0000000..6b35b82 --- /dev/null +++ b/src/main/resources/assets/flighthud/lang/zh_cn.json @@ -0,0 +1,4 @@ +{ + "key.flighthud.toggleDisplayMode": "切换HUD模式", + "category.flighthud.toggleDisplayMode": "Flight HUD" +} \ No newline at end of file From 2de4a70c0c850ef8bae641be7bde72016fcd2113 Mon Sep 17 00:00:00 2001 From: HTony03 Date: Tue, 18 Jul 2023 22:42:24 +0800 Subject: [PATCH 09/12] =?UTF-8?q?1192=E7=A7=BB=E6=A4=8D=EF=BC=88=E5=8F=AF?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=EF=BC=8C2bug=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 6 +++--- gradle.properties | 6 +++--- .../java/net/torocraft/flighthud/ClientEventHandler.java | 6 +++--- src/main/java/net/torocraft/flighthud/Dimensions.java | 4 ++-- src/main/java/net/torocraft/flighthud/FlightHud.java | 8 ++++---- src/main/java/net/torocraft/flighthud/HudComponent.java | 3 ++- src/main/resources/META-INF/mods.toml | 2 +- 7 files changed, 18 insertions(+), 17 deletions(-) diff --git a/build.gradle b/build.gradle index 7f85f1c..06a7997 100644 --- a/build.gradle +++ b/build.gradle @@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle' apply plugin: 'eclipse' apply plugin: 'maven-publish' -version = '1.18_0.0.2' +version = '1.19_test' group = 'net.torocraft' // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = 'flighthud' @@ -33,7 +33,7 @@ minecraft { // // Use non-default mappings at your own risk. They may not always work. // Simply re-run your setup task after changing the mappings to update your workspace. - mappings channel: 'official', version: '1.18' + mappings channel: 'official', version: '1.19' // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default. @@ -128,7 +128,7 @@ dependencies { // Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed // that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied. // The userdev artifact is a special name and will get all sorts of transformations applied to it. - minecraft 'net.minecraftforge:forge:1.18.2-40.2.0' + minecraft 'net.minecraftforge:forge:1.19.2-43.1.10' // Real mod deobf dependency examples - these get remapped to your current mappings // compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency diff --git a/gradle.properties b/gradle.properties index dea19b5..c838b16 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,8 +5,8 @@ org.gradle.daemon=true org.gradle.configureondemand=true org.gradle.parallel=true -artifact_minecraft_version = 1.18 -mc_version=1.18.2 -forge_version = 41.1.0 +artifact_minecraft_version = 1.19 +mc_version=1.19.2 +forge_version = 43.1.10 mod_version=HTony_test forgegradle_version = 5.1.53 diff --git a/src/main/java/net/torocraft/flighthud/ClientEventHandler.java b/src/main/java/net/torocraft/flighthud/ClientEventHandler.java index b95d687..0392a22 100644 --- a/src/main/java/net/torocraft/flighthud/ClientEventHandler.java +++ b/src/main/java/net/torocraft/flighthud/ClientEventHandler.java @@ -2,7 +2,7 @@ import net.minecraft.client.Minecraft; import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.client.event.RenderGameOverlayEvent; +import net.minecraftforge.client.event.RenderGuiOverlayEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; @@ -12,7 +12,7 @@ public class ClientEventHandler { private static final HudRenderer hud = new HudRenderer(); @SubscribeEvent - public static void onRenderGui(RenderGameOverlayEvent.Post event) { - hud.render(event.getMatrixStack(), event.getPartialTicks(), Minecraft.getInstance()); + public static void onRenderGui(RenderGuiOverlayEvent.Post event) { + hud.render(event.getPoseStack(), event.getPartialTick(), Minecraft.getInstance()); } } diff --git a/src/main/java/net/torocraft/flighthud/Dimensions.java b/src/main/java/net/torocraft/flighthud/Dimensions.java index 8f7b582..923b4a4 100644 --- a/src/main/java/net/torocraft/flighthud/Dimensions.java +++ b/src/main/java/net/torocraft/flighthud/Dimensions.java @@ -30,8 +30,8 @@ public void update(Minecraft client) { hScreen = hScreen * c.scale; wScreen = wScreen * c.scale; } - - degreesPerPixel = (float) (hScreen / client.options.fov); + float fov = client.options.fov().get().floatValue(); + degreesPerPixel = (float) (hScreen / fov); xMid = wScreen / 2; yMid = hScreen / 2; diff --git a/src/main/java/net/torocraft/flighthud/FlightHud.java b/src/main/java/net/torocraft/flighthud/FlightHud.java index 8599860..3b3c5f9 100644 --- a/src/main/java/net/torocraft/flighthud/FlightHud.java +++ b/src/main/java/net/torocraft/flighthud/FlightHud.java @@ -1,12 +1,12 @@ package net.torocraft.flighthud; import net.minecraft.client.KeyMapping; -import net.minecraftforge.client.event.InputEvent.KeyInputEvent; +import net.minecraftforge.client.event.InputEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.client.ClientRegistry; +import net.minecraftforge.client.event.RegisterKeyMappingsEvent; import net.torocraft.flighthud.config.HudConfig; import net.torocraft.flighthud.config.SettingsConfig; import net.torocraft.flighthud.config.loader.ConfigLoader; @@ -54,14 +54,14 @@ private void setup(final FMLCommonSetupEvent event) { setupCommand(); } - private void onKeyInput(KeyInputEvent event) { + private void onKeyInput(InputEvent.Key event) { if (keyBinding.consumeClick()) { CONFIG_SETTINGS.toggleDisplayMode(); } } private static void setupKeycCode() { - ClientRegistry.registerKeyBinding(keyBinding); + //register(keyBinding); } private static void setupCommand() { diff --git a/src/main/java/net/torocraft/flighthud/HudComponent.java b/src/main/java/net/torocraft/flighthud/HudComponent.java index 6392d68..4f56888 100644 --- a/src/main/java/net/torocraft/flighthud/HudComponent.java +++ b/src/main/java/net/torocraft/flighthud/HudComponent.java @@ -139,7 +139,8 @@ private static void fill(Matrix4f matrix, float x1, float y1, float x2, float y2 bufferBuilder.vertex(matrix, x2, y1, 0.0F).color(r, g, b, alpha).endVertex(); bufferBuilder.vertex(matrix, x1, y1, 0.0F).color(r, g, b, alpha).endVertex(); bufferBuilder.end(); - BufferUploader.end(bufferBuilder); + //BufferUploader.end(bufferBuilder); + //BufferUploader.end() RenderSystem.enableTexture(); RenderSystem.disableBlend(); } diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 20c3acd..e3e29cc 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -62,6 +62,6 @@ Displays a flight styled hud while flying with elytra. [[dependencies.flighthud]] modId="minecraft" mandatory=true - versionRange="[1.18,1.18.2]" + versionRange="[1.19,1.19.2]" ordering="NONE" side="BOTH" From 8a20902bf4215e2abb2abadb1d5572250451ce0b Mon Sep 17 00:00:00 2001 From: HTony03 Date: Sat, 16 Sep 2023 00:24:54 +0800 Subject: [PATCH 10/12] =?UTF-8?q?=E8=84=91=E5=AD=90=E4=B8=80=E7=83=AD=20?= =?UTF-8?q?=E4=BF=AE=E4=B8=AAbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../net/torocraft/flighthud/FlightHud.java | 39 +++++++++++++++++-- .../net/torocraft/flighthud/HudComponent.java | 2 +- src/main/resources/META-INF/mods.toml | 4 +- 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/torocraft/flighthud/FlightHud.java b/src/main/java/net/torocraft/flighthud/FlightHud.java index 3b3c5f9..ca91c4c 100644 --- a/src/main/java/net/torocraft/flighthud/FlightHud.java +++ b/src/main/java/net/torocraft/flighthud/FlightHud.java @@ -3,15 +3,23 @@ import net.minecraft.client.KeyMapping; import net.minecraftforge.client.event.InputEvent; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraft.client.Minecraft; +import net.minecraft.client.Options; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +//import net.minecraftforge.client.ClientRegistry; +import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.client.event.RegisterKeyMappingsEvent; import net.torocraft.flighthud.config.HudConfig; import net.torocraft.flighthud.config.SettingsConfig; import net.torocraft.flighthud.config.loader.ConfigLoader; import org.lwjgl.glfw.GLFW; + + + @Mod(FlightHud.MODID) public class FlightHud { public static final String MODID = "flighthud"; @@ -19,7 +27,9 @@ public class FlightHud { public static SettingsConfig CONFIG_SETTINGS = new SettingsConfig(); public static HudConfig CONFIG_MIN = new HudConfig(); public static HudConfig CONFIG_FULL = new HudConfig(); - + + public static IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); + public static ConfigLoader CONFIG_LOADER_SETTINGS = new ConfigLoader<>( new SettingsConfig(), FlightHud.MODID + ".settings.json", @@ -38,6 +48,9 @@ public class FlightHud { config -> FlightHud.CONFIG_MIN = config); private static KeyMapping keyBinding; + static Options options = Minecraft.getInstance().options; + + public FlightHud() { FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); @@ -54,14 +67,34 @@ private void setup(final FMLCommonSetupEvent event) { setupCommand(); } - private void onKeyInput(InputEvent.Key event) { + private void onKeyInput(InputEvent event) { if (keyBinding.consumeClick()) { CONFIG_SETTINGS.toggleDisplayMode(); } } + + //@SubscribeEvent + private static void testsetup(RegisterKeyMappingsEvent event){ + event.register(keyBinding); + } private static void setupKeycCode() { - //register(keyBinding); + //RegisterKeyMappingsEvent.register(keyBinding); + //RegisterKeyMappingsEvent registerKeyMappingsEvent = options; + testsetup(new RegisterKeyMappingsEvent(options)); + //RegisterKeyMappingsEvent(options); + + + + + + + //key.keybind = new KeyMapping(key.description, key.key, Create.NAME); + //if (!key.modifiable) + // continue; + //MinecraftForge.EVENT_BUS.register(keyBinding); + //MinecraftForge.EVENT_BUS.register(keyBinding); + //lightHud.register(keyBinding); } private static void setupCommand() { diff --git a/src/main/java/net/torocraft/flighthud/HudComponent.java b/src/main/java/net/torocraft/flighthud/HudComponent.java index 4f56888..6415048 100644 --- a/src/main/java/net/torocraft/flighthud/HudComponent.java +++ b/src/main/java/net/torocraft/flighthud/HudComponent.java @@ -140,7 +140,7 @@ private static void fill(Matrix4f matrix, float x1, float y1, float x2, float y2 bufferBuilder.vertex(matrix, x1, y1, 0.0F).color(r, g, b, alpha).endVertex(); bufferBuilder.end(); //BufferUploader.end(bufferBuilder); - //BufferUploader.end() + BufferUploader.reset(); RenderSystem.enableTexture(); RenderSystem.disableBlend(); } diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index e3e29cc..9b7296a 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -7,7 +7,7 @@ modLoader="javafml" #mandatory # A version range to match for said mod loader - for regular FML @Mod it will be the forge version -loaderVersion="[32,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. +loaderVersion="[41,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. license="GPL3" @@ -52,7 +52,7 @@ Displays a flight styled hud while flying with elytra. # Does this dependency have to exist - if not, ordering below must be specified mandatory=true #mandatory # The version range of the dependency - versionRange="[32,)" #mandatory + versionRange="[41,)" #mandatory # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory ordering="NONE" # Side this dependency is applied on - BOTH, CLIENT or SERVER From 5ce0b47dff1f5f0cffe5ed16d5ad06f0e8c2d3e8 Mon Sep 17 00:00:00 2001 From: HTony03 Date: Sat, 16 Sep 2023 01:46:29 +0800 Subject: [PATCH 11/12] =?UTF-8?q?=E4=BF=AE=E5=AE=8Cbug=E5=95=A6=20?= =?UTF-8?q?=E8=B5=A2=E8=B5=A2=E8=B5=A2=E8=B5=A2=E8=B5=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/net/torocraft/flighthud/FlightHud.java | 5 ----- src/main/java/net/torocraft/flighthud/HudComponent.java | 6 ++++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/torocraft/flighthud/FlightHud.java b/src/main/java/net/torocraft/flighthud/FlightHud.java index ca91c4c..6331124 100644 --- a/src/main/java/net/torocraft/flighthud/FlightHud.java +++ b/src/main/java/net/torocraft/flighthud/FlightHud.java @@ -84,11 +84,6 @@ private static void setupKeycCode() { testsetup(new RegisterKeyMappingsEvent(options)); //RegisterKeyMappingsEvent(options); - - - - - //key.keybind = new KeyMapping(key.description, key.key, Create.NAME); //if (!key.modifiable) // continue; diff --git a/src/main/java/net/torocraft/flighthud/HudComponent.java b/src/main/java/net/torocraft/flighthud/HudComponent.java index 6415048..eec5664 100644 --- a/src/main/java/net/torocraft/flighthud/HudComponent.java +++ b/src/main/java/net/torocraft/flighthud/HudComponent.java @@ -138,9 +138,11 @@ private static void fill(Matrix4f matrix, float x1, float y1, float x2, float y2 bufferBuilder.vertex(matrix, x2, y2, 0.0F).color(r, g, b, alpha).endVertex(); bufferBuilder.vertex(matrix, x2, y1, 0.0F).color(r, g, b, alpha).endVertex(); bufferBuilder.vertex(matrix, x1, y1, 0.0F).color(r, g, b, alpha).endVertex(); - bufferBuilder.end(); + //bufferBuilder.end(); + //BufferUploader.end(bufferBuilder); - BufferUploader.reset(); + BufferUploader.drawWithShader(bufferBuilder.end()); + RenderSystem.enableTexture(); RenderSystem.disableBlend(); } From 248b2a31e94635e7f0aa32c5c7df3e4372944e23 Mon Sep 17 00:00:00 2001 From: HTony03 Date: Sun, 17 Sep 2023 12:15:16 +0800 Subject: [PATCH 12/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9readme=20=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=A4=9A=E4=BD=99import=20=E6=B7=BB=E5=8A=A0=E8=AF=BB?= =?UTF-8?q?=E5=8F=96config=E8=B0=83=E6=95=B4=E5=88=B7=E6=96=B0=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +- build.gradle | 408 ++++++++++-------- settings.gradle | 10 + .../net/torocraft/flighthud/FlightHud.java | 13 +- .../net/torocraft/flighthud/HudRenderer.java | 29 +- .../torocraft/flighthud/config/HudConfig.java | 2 + 6 files changed, 270 insertions(+), 196 deletions(-) create mode 100644 settings.gradle diff --git a/README.md b/README.md index 82c0681..7b3c8a3 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ __Flight HUD__ is a client side Fabric Minecraft Mod that adds a flight style HUD like one you would see in a flight simulator. +This is an unofficial branch of Forge FlightHUD. + ![HUD Screenshot](images/hud2020-07-07.png?raw=true "HUD Screenshot") ## Features @@ -26,5 +28,5 @@ __Flight HUD__ is a client side Fabric Minecraft Mod that adds a flight style HU ![HUD Components](images/hud-diagram.png?raw=true "HUD Components") ## Requirements -- Minecraft 1.18.1/1.18.2 +- Minecraft 1.19+ - Forge 40.1.93+ diff --git a/build.gradle b/build.gradle index 06a7997..054146e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,178 +1,230 @@ -buildscript { - repositories { - // These repositories are only for Gradle plugins, put any other repositories in the repository block further below - maven { url = 'https://maven.minecraftforge.net' } - mavenCentral() - } - dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true - } -} -apply plugin: 'net.minecraftforge.gradle' -// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. -apply plugin: 'eclipse' -apply plugin: 'maven-publish' - -version = '1.19_test' -group = 'net.torocraft' // http://maven.apache.org/guides/mini/guide-naming-conventions.html -archivesBaseName = 'flighthud' - -// Mojang ships Java 16 to end users in 1.17+ instead of Java 8 in 1.16 or lower, so your mod should target Java 16. -java.toolchain.languageVersion = JavaLanguageVersion.of(17) - -println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) -minecraft { - // The mappings can be changed at any time and must be in the following format. - // Channel: Version: - // snapshot YYYYMMDD Snapshot are built nightly. - // stable # Stables are built at the discretion of the MCP team. - // official MCVersion Official field/method names from Mojang mapping files - // - // You must be aware of the Mojang license when using the 'official' mappings. - // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md - // - // Use non-default mappings at your own risk. They may not always work. - // Simply re-run your setup task after changing the mappings to update your workspace. - mappings channel: 'official', version: '1.19' - - // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default. - - // Default run configurations. - // These can be tweaked, removed, or duplicated as needed. - runs { - client { - workingDirectory project.file('run') - - // Recommended logging data for a userdev environment - // The markers can be added/remove as needed separated by commas. - // "SCAN": For mods scan. - // "REGISTRIES": For firing of registry events. - // "REGISTRYDUMP": For getting the contents of all registries. - property 'forge.logging.markers', 'REGISTRIES' - - // Recommended logging level for the console - // You can set various levels here. - // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels - property 'forge.logging.console.level', 'debug' - - mods { - examplemod { - source sourceSets.main - } - } - } - - server { - workingDirectory project.file('run') - - // Recommended logging data for a userdev environment - // The markers can be added/remove as needed separated by commas. - // "SCAN": For mods scan. - // "REGISTRIES": For firing of registry events. - // "REGISTRYDUMP": For getting the contents of all registries. - property 'forge.logging.markers', 'REGISTRIES' - - // Recommended logging level for the console - // You can set various levels here. - // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels - property 'forge.logging.console.level', 'debug' - - mods { - examplemod { - source sourceSets.main - } - } - } - - data { - workingDirectory project.file('run') - - // Recommended logging data for a userdev environment - // The markers can be added/remove as needed separated by commas. - // "SCAN": For mods scan. - // "REGISTRIES": For firing of registry events. - // "REGISTRYDUMP": For getting the contents of all registries. - property 'forge.logging.markers', 'REGISTRIES' - - // Recommended logging level for the console - // You can set various levels here. - // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels - property 'forge.logging.console.level', 'debug' - - // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. - args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') - - mods { - examplemod { - source sourceSets.main - } - } - } - } -} - -// Include resources generated by data generators. -sourceSets.main.resources { srcDir 'src/generated/resources' } - -repositories { - // Put repositories for dependencies here - // ForgeGradle automatically adds the Forge maven and Maven Central for you - - // If you have mod jar dependencies in ./libs, you can declare them as a repository like so: - // flatDir { - // dir 'libs' - // } -} - -dependencies { - // Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed - // that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied. - // The userdev artifact is a special name and will get all sorts of transformations applied to it. - minecraft 'net.minecraftforge:forge:1.19.2-43.1.10' - - // Real mod deobf dependency examples - these get remapped to your current mappings - // compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency - // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency - // implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency - - // Examples using mod jars from ./libs - // implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}") - - // For more info... - // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html - // http://www.gradle.org/docs/current/userguide/dependency_management.html -} - -// Example for how to get properties into the manifest for reading at runtime. -jar { - manifest { - attributes([ - "Specification-Title" : "examplemod", - "Specification-Vendor" : "examplemodsareus", - "Specification-Version" : "1", // We are version 1 of ourselves - "Implementation-Title" : project.name, - "Implementation-Version" : project.jar.archiveVersion, - "Implementation-Vendor" : "examplemodsareus", - "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") - ]) - } -} - -// Example configuration to allow publishing using the maven-publish plugin -// This is the preferred method to reobfuscate your jar file -jar.finalizedBy('reobfJar') -// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing -// publish.dependsOn('reobfJar') - -publishing { - publications { - mavenJava(MavenPublication) { - artifact jar - } - } - repositories { - maven { - url "file://${project.projectDir}/mcmodsrepo" - } - } -} +buildscript { + repositories { + // These repositories are only for Gradle plugins, put any other repositories in the repository block further below + maven { url = 'https://maven.minecraftforge.net' } + maven { url = 'https://maven.parchmentmc.org' } + mavenCentral() + } + dependencies { + classpath 'org.parchmentmc:librarian:1.+' + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true + } +} + +// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. +plugins { + id 'eclipse' + id 'maven-publish' +} +apply plugin: 'net.minecraftforge.gradle' +apply plugin: 'org.parchmentmc.librarian.forgegradle' +//apply plugin: 'org.parchmentmc.librarian.forgegradle' + +version = '1.19_1.0.1' +group = 'net.torocraft.flighthud' // http://maven.apache.org/guides/mini/guide-naming-conventions.html +archivesBaseName = 'flighthud' + +// Mojang ships Java 16 to end users in 1.17+ instead of Java 8 in 1.16 or lower, so your mod should target Java 16. +java.toolchain.languageVersion = JavaLanguageVersion.of(17) + +println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) +minecraft { + // The mappings can be changed at any time and must be in the following format. + // Channel: Version: + // snapshot YYYYMMDD Snapshot are built nightly. + // stable # Stables are built at the discretion of the MCP team. + // official MCVersion Official field/method names from Mojang mapping files + // + // You must be aware of the Mojang license when using the 'official' mappings. + // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md + // + // Use non-default mappings at your own risk. They may not always work. + // Simply re-run your setup task after changing the mappings to update your workspace. + mappings channel: 'official', version: '1.19' + + accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default. + + // Default run configurations. + // These can be tweaked, removed, or duplicated as needed. + runs { + client { + workingDirectory project.file('run') + + // Recommended logging data for a userdev environment + // The markers can be added/remove as needed separated by commas. + // "SCAN": For mods scan. + // "REGISTRIES": For firing of registry events. + // "REGISTRYDUMP": For getting the contents of all registries. + property 'forge.logging.markers', 'REGISTRIES' + + // Recommended logging level for the console + // You can set various levels here. + // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels + property 'forge.logging.console.level', 'debug' + property 'forge.enabledGameTestNamespaces', 'flighthud' + + mods { + flighthud { + source sourceSets.main + } + } + } + + server { + workingDirectory project.file('run') + + // Recommended logging data for a userdev environment + // The markers can be added/remove as needed separated by commas. + // "SCAN": For mods scan. + // "REGISTRIES": For firing of registry events. + // "REGISTRYDUMP": For getting the contents of all registries. + property 'forge.logging.markers', 'REGISTRIES' + + // Recommended logging level for the console + // You can set various levels here. + // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels + property 'forge.logging.console.level', 'debug' + property 'forge.enabledGameTestNamespaces', 'flighthud' + + mods { + flighthud { + source sourceSets.main + } + } + } + // This run config launches GameTestServer and runs all registered gametests, then exits. + // By default, the server will crash when no gametests are provided. + // The gametest system is also enabled by default for other run configs under the /test command. + gameTestServer { + workingDirectory project.file('run') + + // Recommended logging data for a userdev environment + // The markers can be added/remove as needed separated by commas. + // "SCAN": For mods scan. + // "REGISTRIES": For firing of registry events. + // "REGISTRYDUMP": For getting the contents of all registries. + property 'forge.logging.markers', 'REGISTRIES' + + // Recommended logging level for the console + // You can set various levels here. + // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels + property 'forge.logging.console.level', 'debug' + + // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. + property 'forge.enabledGameTestNamespaces', 'flighthud' + + property 'mixin.env.remapRefMap', 'true' + property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg" + mods { + flighthud { + source sourceSets.main + } + } + } + + data { + workingDirectory project.file('run') + + // Recommended logging data for a userdev environment + // The markers can be added/remove as needed separated by commas. + // "SCAN": For mods scan. + // "REGISTRIES": For firing of registry events. + // "REGISTRYDUMP": For getting the contents of all registries. + property 'forge.logging.markers', 'REGISTRIES' + + // Recommended logging level for the console + // You can set various levels here. + // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels + property 'forge.logging.console.level', 'debug' + + // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. + args '--mod', 'flighthud', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') + + mods { + flighthud { + source sourceSets.main + } + } + } + } +} + +// Include resources generated by data generators. +sourceSets.main.resources { srcDir 'src/generated/resources' } + +repositories { + // Put repositories for dependencies here + // ForgeGradle automatically adds the Forge maven and Maven Central for you + + // If you have mod jar dependencies in ./libs, you can declare them as a repository like so: + // flatDir { + // dir 'libs' + // } + + //maven { + // name = 'tterrag maven' + // url = 'https://maven.tterrag.com/' + //} + //maven { + // // location of a maven mirror for JEI files, as a fallback + // name = "ModMaven" + // url = "https://modmaven.dev" + //} + //maven { + // url = "https://maven.theillusivec4.top/" + //} + +} + +dependencies { + // Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed + // that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied. + // The userdev artifact is a special name and will get all sorts of transformations applied to it. + minecraft 'net.minecraftforge:forge:1.19.2-43.1.10' + + // Real mod deobf dependency examples - these get remapped to your current mappings + // compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency + // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency + // implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency + + // Examples using mod jars from ./libs + // implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}") + + // For more info... + // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html + // http://www.gradle.org/docs/current/userguide/dependency_management.html +} + +// Example for how to get properties into the manifest for reading at runtime. +jar { + manifest { + attributes([ + "Specification-Title" : "flighthud", + "Specification-Vendor" : "examplemodsareus", + "Specification-Version" : "1", // We are version 1 of ourselves + "Implementation-Title" : project.name, + "Implementation-Version" : project.jar.archiveVersion, + "Implementation-Vendor" : "examplemodsareus", + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") + ]) + } +} + +// Example configuration to allow publishing using the maven-publish plugin +// This is the preferred method to reobfuscate your jar file +jar.finalizedBy('reobfJar') +// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing +// publish.dependsOn('reobfJar') + +publishing { + publications { + mavenJava(MavenPublication) { + artifact jar + } + } + repositories { + maven { + url "file://${project.projectDir}/mcmodsrepo" + } + } +} diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..093e907 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,10 @@ +/* + * This file was generated by the Gradle 'init' task. + * + * The settings file is used to specify which projects to include in your build. + * + * Detailed information about configuring a multi-project build in Gradle can be found + * in the user manual at https://docs.gradle.org/7.4/userguide/multi_project_builds.html + */ + +rootProject.name = 'FlightHUD' diff --git a/src/main/java/net/torocraft/flighthud/FlightHud.java b/src/main/java/net/torocraft/flighthud/FlightHud.java index 6331124..59295ce 100644 --- a/src/main/java/net/torocraft/flighthud/FlightHud.java +++ b/src/main/java/net/torocraft/flighthud/FlightHud.java @@ -1,17 +1,15 @@ package net.torocraft.flighthud; import net.minecraft.client.KeyMapping; +import net.minecraft.client.Minecraft; +import net.minecraft.client.Options; import net.minecraftforge.client.event.InputEvent; +import net.minecraftforge.client.event.RegisterKeyMappingsEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraft.client.Minecraft; -import net.minecraft.client.Options; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -//import net.minecraftforge.client.ClientRegistry; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.client.event.RegisterKeyMappingsEvent; import net.torocraft.flighthud.config.HudConfig; import net.torocraft.flighthud.config.SettingsConfig; import net.torocraft.flighthud.config.loader.ConfigLoader; @@ -84,11 +82,6 @@ private static void setupKeycCode() { testsetup(new RegisterKeyMappingsEvent(options)); //RegisterKeyMappingsEvent(options); - //key.keybind = new KeyMapping(key.description, key.key, Create.NAME); - //if (!key.modifiable) - // continue; - //MinecraftForge.EVENT_BUS.register(keyBinding); - //MinecraftForge.EVENT_BUS.register(keyBinding); //lightHud.register(keyBinding); } diff --git a/src/main/java/net/torocraft/flighthud/HudRenderer.java b/src/main/java/net/torocraft/flighthud/HudRenderer.java index a2a6374..b7567fc 100644 --- a/src/main/java/net/torocraft/flighthud/HudRenderer.java +++ b/src/main/java/net/torocraft/flighthud/HudRenderer.java @@ -9,17 +9,23 @@ import net.torocraft.flighthud.components.LocationIndicator; import net.torocraft.flighthud.components.PitchIndicator; import net.torocraft.flighthud.components.SpeedIndicator; +import net.torocraft.flighthud.config.HudConfig; import net.torocraft.flighthud.config.SettingsConfig.DisplayMode; -class fps { - public static int tps = 1; -} + public class HudRenderer extends HudComponent { private final Dimensions dim = new Dimensions(); private final FlightComputer computer = new FlightComputer(); private static final String FULL = DisplayMode.FULL.toString(); private static final String MIN = DisplayMode.MIN.toString(); + + HudConfig config = HudComponent.CONFIG; + + int frames; + public int allframes = 0; + + private final HudComponent[] components = new HudComponent[] {new FlightPathIndicator(computer, dim), new LocationIndicator(dim), new HeadingIndicator(computer, dim), new SpeedIndicator(computer, dim), @@ -52,7 +58,14 @@ public void render(PoseStack m, float partial, Minecraft client) { } try { - if (fps.tps % 6 == 0 ){ + + try{ + frames = config.refreshing_rate; + } catch (Exception e2){ + e2.printStackTrace(); + frames = 8; + } + if (allframes % frames == 0 ){ m.pushPose(); if (HudComponent.CONFIG.scale != 1d) { @@ -67,9 +80,11 @@ public void render(PoseStack m, float partial, Minecraft client) { component.render(m, partial, client); } m.popPose(); - fps.tps = 2; - }; - fps.tps = ++fps.tps; + } + allframes = ++allframes; + if (allframes == 100){ + allframes = 0; + } } catch (Exception e) { e.printStackTrace(); } diff --git a/src/main/java/net/torocraft/flighthud/config/HudConfig.java b/src/main/java/net/torocraft/flighthud/config/HudConfig.java index f831005..459d41d 100644 --- a/src/main/java/net/torocraft/flighthud/config/HudConfig.java +++ b/src/main/java/net/torocraft/flighthud/config/HudConfig.java @@ -48,6 +48,8 @@ public class HudConfig implements IConfig { public boolean heading_showReadout = true; public boolean heading_showOrdinals = true; + public int refreshing_rate = 6; + @Override public void update() { updateThickness();