Updated to 1.21

Removed support for Forge
Added support for NeoForge

Added a new location for Visual Speed Type (WIP) slight bug

Made Cloth Config an optional dependency (as of version 6.2)
This commit is contained in:
2024-07-09 08:40:43 +02:00
parent 965a3ea62d
commit 481993b2e2
22 changed files with 174 additions and 107 deletions

3
.gitignore vendored
View File

@@ -114,6 +114,9 @@ gradle-app.setting
# Common working directory # Common working directory
run/ run/
neoforge/run/
fabric/run/
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar !gradle-wrapper.jar

View File

@@ -1,6 +1,6 @@
plugins { plugins {
id "architectury-plugin" version "3.4-SNAPSHOT" id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.1-SNAPSHOT" apply false id "dev.architectury.loom" version "1.6-SNAPSHOT" apply false
} }
architectury { architectury {
@@ -32,17 +32,22 @@ allprojects {
version = rootProject.mod_version version = rootProject.mod_version
group = rootProject.maven_group group = rootProject.maven_group
dependencies {
implementation ("net.kyori:adventure-text-minimessage:4.17.0")
}
repositories { repositories {
// Add repositories to retrieve artifacts from in here. // Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because // You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically. // Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html // See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories. // for more information about repositories.
mavenCentral();
} }
tasks.withType(JavaCompile) { tasks.withType(JavaCompile) {
options.encoding = "UTF-8" options.encoding = "UTF-8"
options.release = 17 options.release = 21
} }
java { java {

View File

@@ -9,7 +9,7 @@ dependencies {
} }
architectury { architectury {
common() common("fabric", "neoforge")
} }
publishing { publishing {

View File

@@ -5,15 +5,19 @@ import dev.architectury.event.events.client.ClientGuiEvent;
import dev.architectury.event.events.client.ClientTickEvent; import dev.architectury.event.events.client.ClientTickEvent;
import dev.architectury.platform.Platform; import dev.architectury.platform.Platform;
import dev.architectury.registry.client.keymappings.KeyMappingRegistry; import dev.architectury.registry.client.keymappings.KeyMappingRegistry;
import net.minecraft.ChatFormatting;
import net.minecraft.client.DeltaTracker;
import net.minecraft.client.KeyMapping; import net.minecraft.client.KeyMapping;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.network.chat.ClickEvent;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.animal.Pig; import net.minecraft.world.entity.animal.Pig;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.vehicle.Boat; import net.minecraft.world.entity.vehicle.Boat;
import net.minecraft.world.entity.vehicle.Minecart; import net.minecraft.world.entity.vehicle.Minecart;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraft.network.chat.Component;
import java.awt.*; import java.awt.*;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
@@ -43,13 +47,41 @@ public class Client {
public static BufferedImage img = null; public static BufferedImage img = null;
public static void init(){ public static void init(){
Platform.getMod(MOD_ID).registerConfigurationScreen(parent -> ConfigMenu.getConfig(parent).build()); final boolean isClothLoaded = false;//Platform.isModLoaded("cloth_config") || Platform.isModLoaded("cloth-config");
if(isClothLoaded) {
Platform.getMod(MOD_ID).registerConfigurationScreen(parent -> ConfigMenu.getConfig(parent).build());
}
else
{
LOGGER.warn("Missing Cloth Config API, In game config menu will not be available");
}
KeyMappingRegistry.register(CONFIG_KEY); KeyMappingRegistry.register(CONFIG_KEY);
ClientTickEvent.CLIENT_POST.register(minecraft -> { ClientTickEvent.CLIENT_POST.register(minecraft -> {
if(CONFIG_KEY.consumeClick()){ if(CONFIG_KEY.consumeClick()){
Minecraft.getInstance().setScreen(ConfigMenu.getConfig(Minecraft.getInstance().screen).build()); if(isClothLoaded) {
Minecraft.getInstance().setScreen(ConfigMenu.getConfig(Minecraft.getInstance().screen).build());
}
else if(Minecraft.getInstance().player != null)
{
Minecraft.getInstance().player.sendSystemMessage(
Component
.translatable("speedometer.error.missing_cloth")
.withColor(new Color(190, 0, 0).getRGB())
.append(" ")
.append(Component
.literal("Open Config")
.withStyle(ChatFormatting.UNDERLINE)
.withStyle((style) -> style.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, Config.getConfigPath())))
));
LOGGER.warn(Component.translatable("speedometer.error.missing_cloth").getString());
}
else
{
LOGGER.warn(Component.translatable("speedometer.error.missing_cloth").getString());
}
} }
}); });
@@ -73,7 +105,7 @@ public class Client {
LOGGER.info("Finished loading speedometer"); LOGGER.info("Finished loading speedometer");
} }
private static void render(GuiGraphics graphics, float tick) { private static void render(GuiGraphics graphics, DeltaTracker deltaTracker) {
if(Minecraft.getInstance().player == null) return; if(Minecraft.getInstance().player == null) return;
Entity entity = Minecraft.getInstance().player.getRootVehicle(); Entity entity = Minecraft.getInstance().player.getRootVehicle();
@@ -129,10 +161,19 @@ public class Client {
case MPH -> speedTypeSpeed; case MPH -> speedTypeSpeed;
case KNOT -> Math.pow(speedTypeSpeed,1.05); case KNOT -> Math.pow(speedTypeSpeed,1.05);
}/100; }/100;
double i = (v *(316-45))+45; double i = (v *(316-45))+45;
String speedString = format + " " + SpeedTypes.getName(speedType).getString();
int width = switch ((Config.getVisualSpeedometer() && !speedometerVisualDisplayFailed) ? 1 : 0){
case 1 -> Config.getImageSize();
case 0 -> Minecraft.getInstance().font.width(speedString);
default -> 0;
};
int yPos = getPos(graphics, Config.getYPosition(), 1); int yPos = getPos(graphics, width, Config.getYPosition(), 1);
int xPos = getPos(graphics, Config.getXPosition(), 0); int xPos = getPos(graphics, width, Config.getXPosition(), 0);
int lineHeight = Minecraft.getInstance().font.lineHeight; int lineHeight = Minecraft.getInstance().font.lineHeight;
@@ -147,13 +188,9 @@ public class Client {
g2d.setColor(new Color(138, 0, 0)); g2d.setColor(new Color(138, 0, 0));
g2d.setFont(new Font(g2d.getFont().getName(), Font.PLAIN, 15)); g2d.setFont(new Font(g2d.getFont().getName(), Font.PLAIN, 15));
if(Config.getShowVisualSpeedType()) {
g2d.drawString(SpeedTypes.getName(speedType).getString(), img.getWidth() / 2 - 27, img.getHeight() / 2 + 25);
}
if(Config.getShowSpeedType()){ if(Config.getShowSpeedType()){
String speedString = SpeedTypes.getName(speedType).getString(); speedString = SpeedTypes.getName(speedType).getString();
int width = Minecraft.getInstance().font.width(speedString); drawString(graphics, xPos - width, yPos - Config.getImageSize() - lineHeight - 1, speedString, Config.getColor().getRGB());
drawString(graphics, xPos - width, yPos - Config.getImageSize() - lineHeight - 1, speedString, Config.getColor().getColor());
} }
BufferedImage img = ImageHandler.scale(Client.img, Config.getImageSize(), Config.getImageSize()); BufferedImage img = ImageHandler.scale(Client.img, Config.getImageSize(), Config.getImageSize());
@@ -199,14 +236,12 @@ public class Client {
// i -> x // i -> x
// j -> y // j -> y
// k -> color RGB int // k -> color RGB int
String speedString = format + " " + SpeedTypes.getName(speedType).getString();
int width = Minecraft.getInstance().font.width(speedString);
graphics.drawString( graphics.drawString(
Minecraft.getInstance().font, Minecraft.getInstance().font,
speedString, speedString,
xPos - width, xPos - width,
yPos - lineHeight, yPos - lineHeight,
Config.getColor().getColor() Config.getColor().getRGB()
); );
} }
@@ -228,7 +263,7 @@ public class Client {
"Velocity total average: " + speed + "\n" + "Velocity total average: " + speed + "\n" +
"Velocity total in " + speedType.name() + ": " + speedTypeSpeed + "\n" + "Velocity total in " + speedType.name() + ": " + speedTypeSpeed + "\n" +
"Percentage point of visual speedometer: " + v + "\n" + "Percentage point of visual speedometer: " + v + "\n" +
"Degree end point: " + (i+45) +"\n" + "Degree end point: " + i +"\n" +
(Config.getVisualSpeedometer()?"Visual Size: ":"Textual display") + Config.getImageSize(); (Config.getVisualSpeedometer()?"Visual Size: ":"Textual display") + Config.getImageSize();
Color color = new Color(255, 255, 255); Color color = new Color(255, 255, 255);
@@ -251,7 +286,7 @@ public class Client {
); );
} }
private static int getPos(GuiGraphics event, String input, int type) { private static int getPos(GuiGraphics event, int width, String input, int type) {
ArrayList<String> passerPose = new ArrayList<>(); ArrayList<String> passerPose = new ArrayList<>();
final char[] s = input.toCharArray(); final char[] s = input.toCharArray();
try{ try{
@@ -262,6 +297,9 @@ public class Client {
}else if(s[i] == 'h' || s[i] == 'w'){ }else if(s[i] == 'h' || s[i] == 'w'){
if(type == 0) passerPose.add(String.valueOf(event.guiWidth() / 2)); if(type == 0) passerPose.add(String.valueOf(event.guiWidth() / 2));
else if(type == 1) passerPose.add(String.valueOf(event.guiHeight() / 2)); else if(type == 1) passerPose.add(String.valueOf(event.guiHeight() / 2));
}else if(s[i] == 'S' || s[i] == 's'){
if(type == 0) passerPose.add(String.valueOf(width));
else if(type == 1) passerPose.add(String.valueOf(width));
}else if(s[i] == '+'){ }else if(s[i] == '+'){
passerPose.add("+"); passerPose.add("+");
}else if(s[i] == '-'){ }else if(s[i] == '-'){
@@ -272,8 +310,14 @@ public class Client {
passerPose.add("/"); passerPose.add("/");
}else if(Character.isDigit(s[i])){ }else if(Character.isDigit(s[i])){
try{ try{
Integer.parseInt(passerPose.get(i-1)); if(i-1 > 0) {
passerPose.add(i-1,passerPose.get(i-1)+s[i]); Integer.parseInt(passerPose.get(i - 1));
passerPose.add(i - 1, passerPose.get(i - 1) + s[i]);
}
else
{
passerPose.add(Character.toString(s[i]));
}
}catch (NumberFormatException e){ }catch (NumberFormatException e){
passerPose.add(Character.toString(s[i])); passerPose.add(Character.toString(s[i]));
} }

View File

@@ -3,9 +3,9 @@ package me.zacharias.speedometer;
import dev.architectury.platform.Platform; import dev.architectury.platform.Platform;
import org.json.JSONObject; import org.json.JSONObject;
import java.awt.*;
import java.io.*; import java.io.*;
import me.shedaniel.math.Color;
import static me.zacharias.speedometer.Speedometer.MOD_ID; import static me.zacharias.speedometer.Speedometer.MOD_ID;
@@ -13,10 +13,12 @@ public class Config {
private static JSONObject config; private static JSONObject config;
public static final float configVersion = 3f; public static final float configVersion = 3f;
private static int counter = 0; private static int counter = 0;
private static String configPath;
public static void initialize(){ public static void initialize(){
if(config != null) throw new RuntimeException("Already Initialized"); if(config != null) throw new RuntimeException("Already Initialized");
File configFile = new File(Platform.getConfigFolder().toString()+"/"+MOD_ID+"/config.json"); configPath = Platform.getConfigFolder().toString()+"/"+MOD_ID+"/config.json";
File configFile = new File(configPath);
if(!configFile.exists()){ if(!configFile.exists()){
try { try {
configFile.getParentFile().mkdir(); configFile.getParentFile().mkdir();
@@ -107,7 +109,7 @@ public class Config {
} }
public static void save(){ public static void save(){
File config = new File(Platform.getConfigFolder().toString()+"/"+MOD_ID+"/config.json"); File config = new File(configPath);
if(!config.exists()){ if(!config.exists()){
try { try {
config.getParentFile().mkdir(); config.getParentFile().mkdir();
@@ -146,13 +148,13 @@ public class Config {
public static Color getColor(){ public static Color getColor(){
if(config.has("color")){ if(config.has("color")){
JSONObject color = config.getJSONObject("color"); JSONObject color = config.getJSONObject("color");
return Color.ofRGB( return new Color(
color.getInt("r"), color.getInt("r"),
color.getInt("g"), color.getInt("g"),
color.getInt("b") color.getInt("b")
); );
}else{ }else{
return Color.ofRGB(16, 146, 158); return new Color(16, 146, 158);
} }
} }
@@ -203,14 +205,6 @@ public class Config {
} }
} }
public static boolean getShowVisualSpeedType() {
if(config.has("showVisualSpeedType")){
return config.getBoolean("showVisualSpeedType");
}else{
return false;
}
}
public static boolean getShowSpeedType(){ public static boolean getShowSpeedType(){
if(config.has("getShowSpeedType")){ if(config.has("getShowSpeedType")){
return config.getBoolean("showSpeedType"); return config.getBoolean("showSpeedType");
@@ -219,11 +213,11 @@ public class Config {
} }
} }
public static void setColor(Color color){ public static void setColor(int r, int g, int b){
config.put("color", new JSONObject() config.put("color", new JSONObject()
.put("r", color.getRed()) .put("r", r)
.put("g", color.getGreen()) .put("g", g)
.put("b", color.getBlue()) .put("b", b)
); );
} }
@@ -255,11 +249,12 @@ public class Config {
config.put("imageSize", imageSize); config.put("imageSize", imageSize);
} }
public static void setShowVisualSpeedType(boolean showVisualSpeedType){
config.put("showVisualSpeedType", showVisualSpeedType);
}
public static void setShowSpeedType(boolean showSpeedType){ public static void setShowSpeedType(boolean showSpeedType){
config.put("showSpeedType", showSpeedType); config.put("showSpeedType", showSpeedType);
} }
public static String getConfigPath()
{
return configPath;
}
} }

View File

@@ -25,8 +25,10 @@ public class ConfigMenu {
.build() .build()
); );
category.addEntry(entryBuilder.startColorField(Component.translatable("speedometer.config.color"), me.zacharias.speedometer.Config.getColor()) category.addEntry(entryBuilder.startColorField(Component.translatable("speedometer.config.color"), me.zacharias.speedometer.Config.getColor().getRGB())
.setSaveConsumer2(me.zacharias.speedometer.Config::setColor) .setSaveConsumer2(color -> {
me.zacharias.speedometer.Config.setColor(color.getRed(), color.getGreen(), color.getBlue());
})
.build() .build()
); );
@@ -58,7 +60,8 @@ public class ConfigMenu {
}) })
.setTooltip( .setTooltip(
Component.translatable("speedometer.config.tooltip.xPosition.line1"), Component.translatable("speedometer.config.tooltip.xPosition.line1"),
Component.translatable("speedometer.config.tooltip.xPosition.line2") Component.translatable("speedometer.config.tooltip.xPosition.line2"),
Component.translatable("speedometer.config.tooltip.xPosition.line3")
) )
.build() .build()
); );
@@ -75,7 +78,8 @@ public class ConfigMenu {
}) })
.setTooltip( .setTooltip(
Component.translatable("speedometer.config.tooltip.yPosition.line1"), Component.translatable("speedometer.config.tooltip.yPosition.line1"),
Component.translatable("speedometer.config.tooltip.yPosition.line2") Component.translatable("speedometer.config.tooltip.yPosition.line2"),
Component.translatable("speedometer.config.tooltip.yPosition.line3")
) )
.build() .build()
); );
@@ -97,14 +101,6 @@ public class ConfigMenu {
.build() .build()
); );
category.addEntry(entryBuilder.startBooleanToggle(Component.translatable("speedometer.config.showVisualSpeedType"), Config.getShowVisualSpeedType())
.setSaveConsumer(Config::setShowVisualSpeedType)
.setYesNoTextSupplier(showVisualSpeedType -> Component.translatable("speedometer."+(showVisualSpeedType?"show":"hide")).withStyle(ChatFormatting.DARK_RED))
.setTooltip(Component.translatable("speedometer.config.tooltip.showVisualSpeedType.line1"),
Component.translatable("speedometer.config.tooltip.showVisualSpeedType.line2"))
.build()
);
category.addEntry(entryBuilder.startBooleanToggle(Component.translatable("speedometer.config.debug"),Config.isDebug()) category.addEntry(entryBuilder.startBooleanToggle(Component.translatable("speedometer.config.debug"),Config.isDebug())

View File

@@ -60,5 +60,7 @@
"speedometer.config.tooltip.showSpeedType.line1": "This setting shows the speed type above the visual meter which is better then within the visual meter", "speedometer.config.tooltip.showSpeedType.line1": "This setting shows the speed type above the visual meter which is better then within the visual meter",
"speedometer.invalid": "Invalid String" "speedometer.invalid": "Invalid String",
"speedometer.error.missing_cloth": "Missing Cloth Config API for Config Screen"
} }

View File

@@ -18,6 +18,7 @@ configurations {
repositories { repositories {
maven { url "https://maven.shedaniel.me/" } maven { url "https://maven.shedaniel.me/" }
maven { url "https://maven.terraformersmc.com/releases/" } maven { url "https://maven.terraformersmc.com/releases/" }
maven { url "https://maven.nucleoid.xyz/" }
} }
dependencies { dependencies {
@@ -26,8 +27,9 @@ dependencies {
// Remove the next line if you don't want to depend on the API // Remove the next line if you don't want to depend on the API
modApi "dev.architectury:architectury-fabric:${rootProject.architectury_version}" modApi "dev.architectury:architectury-fabric:${rootProject.architectury_version}"
modApi "me.shedaniel.cloth:cloth-config-fabric:11.1.106" modApi "me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_config_version}"
modApi "com.terraformersmc:modmenu:7.1.0" modApi "com.terraformersmc:modmenu:11.0.0"
modApi "eu.pb4:placeholder-api:2.4.0-pre.2+1.21"
common(project(path: ":common", configuration: "namedElements")) { transitive false } common(project(path: ":common", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false } shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }

View File

@@ -2,6 +2,13 @@ package me.zacharias.speedometer.fabric;
import me.zacharias.speedometer.Speedometer; import me.zacharias.speedometer.Speedometer;
import net.fabricmc.api.ModInitializer; import net.fabricmc.api.ModInitializer;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.Component;
import java.awt.*;
public class SpeedometerFabric implements ModInitializer { public class SpeedometerFabric implements ModInitializer {
@Override @Override

View File

@@ -5,7 +5,7 @@
"name": "speedometer", "name": "speedometer",
"description": "just displaying your speed", "description": "just displaying your speed",
"authors": ["Allen"], "authors": ["Zacharias"],
"contact": { "contact": {
"sources": "https://github.com/zaze06/Speedometer", "sources": "https://github.com/zaze06/Speedometer",
"issues": "https://github.com/zaze06/Speedometer/issues" "issues": "https://github.com/zaze06/Speedometer/issues"
@@ -19,9 +19,8 @@
"main": ["me.zacharias.speedometer.fabric.SpeedometerFabric"] "main": ["me.zacharias.speedometer.fabric.SpeedometerFabric"]
}, },
"depends": { "depends": {
"fabricloader": ">=0.14.21", "fabricloader": ">=0.15.11",
"minecraft": ">=1.20", "minecraft": ">=1.21",
"cloth-config": ">=11.1.106", "architectury": ">=13.0.1"
"architectury": ">=9.1.10"
} }
} }

View File

@@ -1 +0,0 @@
loom.platform=forge

View File

@@ -1,15 +0,0 @@
package me.zacharias.speedometer.forge;
import dev.architectury.platform.forge.EventBuses;
import me.zacharias.speedometer.Speedometer;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
@Mod(Speedometer.MOD_ID)
public class SpeedometerForge {
public SpeedometerForge() {
// Submit our event bus to let architectury register our content on the right time
EventBuses.registerModEventBus(Speedometer.MOD_ID, FMLJavaModLoadingContext.get().getModEventBus());
Speedometer.init();
}
}

View File

@@ -1,14 +1,16 @@
org.gradle.jvmargs=-Xmx8G org.gradle.jvmargs=-Xmx8G
minecraft_version=1.20.1 minecraft_version=1.21
archives_base_name=speedometer archives_base_name=speedometer
mod_version=5.1 mod_version=6.0.1
maven_group=me.zacharias maven_group=me.zacharias
architectury_version=9.1.10 architectury_version=13.0.1
fabric_loader_version=0.14.21 fabric_loader_version=0.15.11
fabric_api_version=0.84.0+1.20.1 fabric_api_version=0.100.3+1.21
forge_version=1.20.1-47.0.19 neoforge_version = 21.0.21-beta
cloth_config_version = 15.0.127

View File

@@ -1,6 +1,6 @@
#Fri Jun 21 10:45:53 CEST 2024
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@@ -1,12 +1,16 @@
plugins { plugins {
id "com.github.johnrengelman.shadow" version "7.1.2" id "com.github.johnrengelman.shadow" version "8.1.1"
} }
architectury { architectury {
platformSetupLoomIde() platformSetupLoomIde()
forge() neoForge()
} }
repositories{ repositories{
maven {
name = 'NeoForged'
url = 'https://maven.neoforged.net/releases'
}
maven { url "https://maven.shedaniel.me/" } maven { url "https://maven.shedaniel.me/" }
} }
@@ -15,24 +19,24 @@ configurations {
shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this.
compileClasspath.extendsFrom common compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common runtimeClasspath.extendsFrom common
developmentForge.extendsFrom common developmentNeoForge.extendsFrom common
} }
dependencies { dependencies {
forge "net.minecraftforge:forge:${rootProject.forge_version}" neoForge "net.neoforged:neoforge:$rootProject.neoforge_version"
// Remove the next line if you don't want to depend on the API // Remove the next line if you don't want to depend on the API
modApi "dev.architectury:architectury-forge:${rootProject.architectury_version}" modImplementation "dev.architectury:architectury-neoforge:$rootProject.architectury_version"
modApi "me.shedaniel.cloth:cloth-config-forge:11.1.106" modImplementation "me.shedaniel.cloth:cloth-config-neoforge:$rootProject.cloth_config_version"
common(project(path: ":common", configuration: "namedElements")) { transitive false } common(project(path: ":common", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive = false } shadowCommon(project(path: ":common", configuration: "transformProductionNeoForge")) { transitive = false }
} }
processResources { processResources {
inputs.property "version", project.version inputs.property "version", project.version
filesMatching("META-INF/mods.toml") { filesMatching("META-INF/neoforge.mods.toml") {
expand "version": project.version expand "version": project.version
} }
} }

View File

@@ -0,0 +1 @@
loom.platform=neoforge

View File

@@ -0,0 +1,12 @@
package me.zacharias.speedometer.forge;
import me.zacharias.speedometer.Speedometer;
import net.neoforged.fml.common.Mod;
@Mod(Speedometer.MOD_ID)
public class SpeedometerNeoForge {
public SpeedometerNeoForge() {
// Submit our event bus to let architectury register our content on the right time
Speedometer.init();
}
}

View File

@@ -1,4 +1,4 @@
# This is an example mods.toml file. It contains the data relating to the loading mods. # This is an example neoforge.mods.toml file. It contains the data relating to the loading mods.
# There are several mandatory fields (#mandatory), and many more that are optional (#optional). # There are several mandatory fields (#mandatory), and many more that are optional (#optional).
# The overall format is standard TOML format, v0.5.0. # The overall format is standard TOML format, v0.5.0.
# Note that there are a couple of TOML lists in this file. # Note that there are a couple of TOML lists in this file.
@@ -6,7 +6,7 @@
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml # The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader="javafml" #mandatory modLoader="javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version # A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion="[46,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. loaderVersion="[2,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties. # The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here. # Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
license="All Rights Reserved" license="All Rights Reserved"
@@ -31,7 +31,7 @@ logoFile="icon.png" #optional
# A text field displayed in the mod UI # A text field displayed in the mod UI
#credits="Thanks for this example mod goes to Java" #optional #credits="Thanks for this example mod goes to Java" #optional
# A text field displayed in the mod UI # A text field displayed in the mod UI
authors="Allen" #optional authors="Zacharias" #optional
# Display Test controls the display for your mod in the server connection screen # Display Test controls the display for your mod in the server connection screen
# MATCH_VERSION means that your mod will cause a red X if the versions on client and server differ. This is the default behaviour and should be what you choose if you have server and client elements to your mod. # MATCH_VERSION means that your mod will cause a red X if the versions on client and server differ. This is the default behaviour and should be what you choose if you have server and client elements to your mod.
# IGNORE_SERVER_VERSION means that your mod will not cause a red X if it's present on the server but not on the client. This is what you should use if you're a server only mod. # IGNORE_SERVER_VERSION means that your mod will not cause a red X if it's present on the server but not on the client. This is what you should use if you're a server only mod.
@@ -47,32 +47,32 @@ just displaying your speed
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. # A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
[[dependencies.speedometer]] #optional [[dependencies.speedometer]] #optional
# the modid of the dependency # the modid of the dependency
modId="forge" #mandatory modId="neoforge" #mandatory
# Does this dependency have to exist - if not, ordering below must be specified # Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory mandatory=true #mandatory
# The version range of the dependency # The version range of the dependency
versionRange="[46,)" #mandatory versionRange="[2,)" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
ordering="NONE" ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER # Side this dependency is applied on - BOTH, CLIENT or SERVER
side="BOTH" side="CLIENT"
# Here's another dependency # Here's another dependency
[[dependencies.speedometer]] [[dependencies.speedometer]]
modId="minecraft" modId="minecraft"
mandatory=true mandatory=true
# This version range declares a minimum of the current minecraft version up to but not including the next major version # This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange="[1.20,1.21)" versionRange="[1.21,1.22)"
ordering="NONE" ordering="NONE"
side="BOTH" side="BOTH"
[[dependencies.speedometer]] [[dependencies.speedometer]]
modId="architectury" modId="architectury"
mandatory=true mandatory=true
versionRange="[9.1.10,)" versionRange="[13.0.1,)"
ordering="NONE" ordering="NONE"
side="CLIENT" side="CLIENT"
[[dependencies.speedometer]] [[dependencies.speedometer]]
modId="cloth_config" modId="cloth_config"
mandatory=true mandatory=false
versionRange="[11.1.106,)" versionRange="[15.0.127,)"
ordering="NONE" ordering="NONE"
side="CLIENT" side="CLIENT"

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -0,0 +1,11 @@
{
"homepage": "https://modrinth.com/mod/speedometer/versions",
"1.21": {
"6.0": "Lost support for Forge and gain NeoForge support",
"6.0.1": "Small bug fix in Parser"
},
"promos": {
"1.21-latest": "6.0.1",
"1.21-recommended": "6.0.1",
}
}

View File

@@ -9,4 +9,4 @@ pluginManagement {
include("common") include("common")
include("fabric") include("fabric")
include("forge") include("neoforge")