diff --git a/README.md b/README.md index 716b946..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,6 +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.16.1 -- Fabric Mod Loader -- Fabric API Mod +- Minecraft 1.19+ +- Forge 40.1.93+ diff --git a/build.gradle b/build.gradle index 86ea1fb..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.17.1-forge-1' -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) - -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.17.1' - - // 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.17.1-37.0.34' - - // 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/gradle.properties b/gradle.properties index 878bf1f..c838b16 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,12 @@ # 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 +org.gradle.parallel=true + +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/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/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 bc90a5d..59295ce 100644 --- a/src/main/java/net/torocraft/flighthud/FlightHud.java +++ b/src/main/java/net/torocraft/flighthud/FlightHud.java @@ -1,17 +1,23 @@ package net.torocraft.flighthud; import net.minecraft.client.KeyMapping; -import net.minecraftforge.client.event.InputEvent.KeyInputEvent; +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.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.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 +25,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 +46,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); @@ -46,7 +57,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(); @@ -54,14 +65,24 @@ private void setup(final FMLCommonSetupEvent event) { setupCommand(); } - private void onKeyInput(KeyInputEvent 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() { - ClientRegistry.registerKeyBinding(keyBinding); + //RegisterKeyMappingsEvent.register(keyBinding); + //RegisterKeyMappingsEvent registerKeyMappingsEvent = options; + testsetup(new RegisterKeyMappingsEvent(options)); + //RegisterKeyMappingsEvent(options); + + //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 6392d68..eec5664 100644 --- a/src/main/java/net/torocraft/flighthud/HudComponent.java +++ b/src/main/java/net/torocraft/flighthud/HudComponent.java @@ -138,8 +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(); - BufferUploader.end(bufferBuilder); + //bufferBuilder.end(); + + //BufferUploader.end(bufferBuilder); + BufferUploader.drawWithShader(bufferBuilder.end()); + RenderSystem.enableTexture(); RenderSystem.disableBlend(); } diff --git a/src/main/java/net/torocraft/flighthud/HudRenderer.java b/src/main/java/net/torocraft/flighthud/HudRenderer.java index e01573e..b7567fc 100644 --- a/src/main/java/net/torocraft/flighthud/HudRenderer.java +++ b/src/main/java/net/torocraft/flighthud/HudRenderer.java @@ -9,15 +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; -public class HudRenderer extends HudComponent { +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), @@ -50,20 +58,33 @@ public void render(PoseStack m, float partial, Minecraft client) { } try { - m.pushPose(); - if (HudComponent.CONFIG.scale != 1d) { - float scale = 1 / (float) HudComponent.CONFIG.scale; - m.scale(scale, scale, scale); + try{ + frames = config.refreshing_rate; + } catch (Exception e2){ + e2.printStackTrace(); + frames = 8; } + if (allframes % frames == 0 ){ + m.pushPose(); - computer.update(client, partial); - dim.update(client); + if (HudComponent.CONFIG.scale != 1d) { + float scale = 1 / (float) HudComponent.CONFIG.scale; + m.scale(scale, scale, scale); + } - for (HudComponent component : components) { - component.render(m, partial, client); + computer.update(client, partial); + dim.update(client); + + for (HudComponent component : components) { + component.render(m, partial, client); + } + m.popPose(); + } + allframes = ++allframes; + if (allframes == 100){ + allframes = 0; } - m.popPose(); } 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(); diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 2d4c878..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" @@ -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=''' @@ -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 @@ -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.19,1.19.2]" ordering="NONE" side="BOTH" 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