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+ diff --git a/build.gradle b/build.gradle index 86ea1fb..7f85f1c 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_0.0.2' 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' // 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.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 878bf1f..dea19b5 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.18 +mc_version=1.18.2 +forge_version = 41.1.0 +mod_version=HTony_test +forgegradle_version = 5.1.53 diff --git a/src/main/java/net/torocraft/flighthud/FlightHud.java b/src/main/java/net/torocraft/flighthud/FlightHud.java index bc90a5d..8599860 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; @@ -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/java/net/torocraft/flighthud/HudRenderer.java b/src/main/java/net/torocraft/flighthud/HudRenderer.java index e01573e..a2a6374 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,24 @@ public void render(PoseStack m, float partial, Minecraft client) { } try { - m.pushPose(); + if (fps.tps % 6 == 0 ){ + 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); - } - m.popPose(); + for (HudComponent component : components) { + component.render(m, partial, client); + } + m.popPose(); + fps.tps = 2; + }; + fps.tps = ++fps.tps; } catch (Exception e) { e.printStackTrace(); } diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 2d4c878..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=''' @@ -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" 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