Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update forge-1.18.2 #26

Open
wants to merge 8 commits into
base: forge-1.17.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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+
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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.

Expand Down Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -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
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
4 changes: 2 additions & 2 deletions src/main/java/net/torocraft/flighthud/FlightHud.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
30 changes: 18 additions & 12 deletions src/main/java/net/torocraft/flighthud/HudRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <here>
#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
Expand All @@ -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='''
Expand All @@ -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"
4 changes: 4 additions & 0 deletions src/main/resources/assets/flighthud/lang/zh_cn.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"key.flighthud.toggleDisplayMode": "切换HUD模式",
"category.flighthud.toggleDisplayMode": "Flight HUD"
}