From 5b9d53f1317cb6c16a114eb0274771388b934acf Mon Sep 17 00:00:00 2001 From: enjarai Date: Sun, 21 Jan 2024 22:13:15 +0100 Subject: [PATCH] Oh boy --- build.gradle | 4 +++- common/build.gradle | 2 +- .../mixin/client/roll/DebugHudMixin.java | 2 +- .../doabarrelroll/platform/Services.java | 4 +--- .../resources/assets/do_a_barrel_roll/icon.png | Bin .../assets/do_a_barrel_roll/lang/en_us.yml | 0 .../assets/do_a_barrel_roll/lang/pt_br.yml | 0 .../assets/do_a_barrel_roll/sounds.json | 0 .../sounds/do_a_barrel_roll.ogg | Bin .../textures/gui/barrel_roll_1.png | Bin .../textures/gui/barrel_roll_2.png | Bin .../images/controls/show_momentum_widget.png | Bin .../gui/config/images/hud/show_horizon.png | Bin .../resources/do_a_barrel_roll.mixins.json | 2 +- fabric/build.gradle | 2 +- forge/build.gradle | 4 ++-- forge/gradle.properties | 1 - .../doabarrelroll/DoABarrelRollForge.java | 17 +++++++++++++++++ forge/src/main/resources/META-INF/mods.toml | 2 +- gradle.properties | 2 +- 20 files changed, 29 insertions(+), 13 deletions(-) rename {fabric => common}/src/main/resources/assets/do_a_barrel_roll/icon.png (100%) rename {fabric => common}/src/main/resources/assets/do_a_barrel_roll/lang/en_us.yml (100%) rename {fabric => common}/src/main/resources/assets/do_a_barrel_roll/lang/pt_br.yml (100%) rename {fabric => common}/src/main/resources/assets/do_a_barrel_roll/sounds.json (100%) rename {fabric => common}/src/main/resources/assets/do_a_barrel_roll/sounds/do_a_barrel_roll.ogg (100%) rename {fabric => common}/src/main/resources/assets/do_a_barrel_roll/textures/gui/barrel_roll_1.png (100%) rename {fabric => common}/src/main/resources/assets/do_a_barrel_roll/textures/gui/barrel_roll_2.png (100%) rename {fabric => common}/src/main/resources/assets/do_a_barrel_roll/textures/gui/config/images/controls/show_momentum_widget.png (100%) rename {fabric => common}/src/main/resources/assets/do_a_barrel_roll/textures/gui/config/images/hud/show_horizon.png (100%) diff --git a/build.gradle b/build.gradle index 38af1e4d..d7b9b941 100644 --- a/build.gradle +++ b/build.gradle @@ -3,12 +3,14 @@ plugins { id 'me.fallenbreath.yamlang' version '1.2.1' apply(false) } -version = "${mod_version}+${minecraft_version}"; +version = "${mod_version}+${minecraft_version}" subprojects { apply plugin: 'java' apply plugin: 'me.fallenbreath.yamlang' + version = "${mod_version}+${minecraft_version}" + repositories { // Personal maven for cicada and backup mirrors of some dependencies. maven { url "https://maven.enjarai.dev/mirrors" } diff --git a/common/build.gradle b/common/build.gradle index 0fe48cca..2b0dea02 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -6,7 +6,7 @@ plugins { } base { - archivesName = "${mod_name}-common-${minecraft_version}" + archivesName = "${mod_id}-common" } dependencies { diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/DebugHudMixin.java b/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/DebugHudMixin.java index aa3de541..430ba25a 100644 --- a/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/DebugHudMixin.java +++ b/common/src/main/java/nl/enjarai/doabarrelroll/mixin/client/roll/DebugHudMixin.java @@ -14,7 +14,7 @@ public abstract class DebugHudMixin { @Shadow @Final private MinecraftClient client; - @ModifyArgs( + @ModifyArgs( // TODO froge method = "getLeftText", at = @At( value = "INVOKE", diff --git a/common/src/main/java/nl/enjarai/doabarrelroll/platform/Services.java b/common/src/main/java/nl/enjarai/doabarrelroll/platform/Services.java index e134644e..c4d6836c 100644 --- a/common/src/main/java/nl/enjarai/doabarrelroll/platform/Services.java +++ b/common/src/main/java/nl/enjarai/doabarrelroll/platform/Services.java @@ -19,10 +19,8 @@ public class Services { // Inside the file you should write the fully qualified class name of the implementation to load for the platform. For // example our file on Forge points to ForgePlatformHelper while Fabric points to FabricPlatformHelper. public static T load(Class clazz) { - final T loadedService = ServiceLoader.load(clazz) + return ServiceLoader.load(clazz) .findFirst() .orElseThrow(() -> new NullPointerException("Failed to load service for " + clazz.getName())); - DoABarrelRoll.LOGGER.debug("Loaded {} for service {}", loadedService, clazz); - return loadedService; } } \ No newline at end of file diff --git a/fabric/src/main/resources/assets/do_a_barrel_roll/icon.png b/common/src/main/resources/assets/do_a_barrel_roll/icon.png similarity index 100% rename from fabric/src/main/resources/assets/do_a_barrel_roll/icon.png rename to common/src/main/resources/assets/do_a_barrel_roll/icon.png diff --git a/fabric/src/main/resources/assets/do_a_barrel_roll/lang/en_us.yml b/common/src/main/resources/assets/do_a_barrel_roll/lang/en_us.yml similarity index 100% rename from fabric/src/main/resources/assets/do_a_barrel_roll/lang/en_us.yml rename to common/src/main/resources/assets/do_a_barrel_roll/lang/en_us.yml diff --git a/fabric/src/main/resources/assets/do_a_barrel_roll/lang/pt_br.yml b/common/src/main/resources/assets/do_a_barrel_roll/lang/pt_br.yml similarity index 100% rename from fabric/src/main/resources/assets/do_a_barrel_roll/lang/pt_br.yml rename to common/src/main/resources/assets/do_a_barrel_roll/lang/pt_br.yml diff --git a/fabric/src/main/resources/assets/do_a_barrel_roll/sounds.json b/common/src/main/resources/assets/do_a_barrel_roll/sounds.json similarity index 100% rename from fabric/src/main/resources/assets/do_a_barrel_roll/sounds.json rename to common/src/main/resources/assets/do_a_barrel_roll/sounds.json diff --git a/fabric/src/main/resources/assets/do_a_barrel_roll/sounds/do_a_barrel_roll.ogg b/common/src/main/resources/assets/do_a_barrel_roll/sounds/do_a_barrel_roll.ogg similarity index 100% rename from fabric/src/main/resources/assets/do_a_barrel_roll/sounds/do_a_barrel_roll.ogg rename to common/src/main/resources/assets/do_a_barrel_roll/sounds/do_a_barrel_roll.ogg diff --git a/fabric/src/main/resources/assets/do_a_barrel_roll/textures/gui/barrel_roll_1.png b/common/src/main/resources/assets/do_a_barrel_roll/textures/gui/barrel_roll_1.png similarity index 100% rename from fabric/src/main/resources/assets/do_a_barrel_roll/textures/gui/barrel_roll_1.png rename to common/src/main/resources/assets/do_a_barrel_roll/textures/gui/barrel_roll_1.png diff --git a/fabric/src/main/resources/assets/do_a_barrel_roll/textures/gui/barrel_roll_2.png b/common/src/main/resources/assets/do_a_barrel_roll/textures/gui/barrel_roll_2.png similarity index 100% rename from fabric/src/main/resources/assets/do_a_barrel_roll/textures/gui/barrel_roll_2.png rename to common/src/main/resources/assets/do_a_barrel_roll/textures/gui/barrel_roll_2.png diff --git a/fabric/src/main/resources/assets/do_a_barrel_roll/textures/gui/config/images/controls/show_momentum_widget.png b/common/src/main/resources/assets/do_a_barrel_roll/textures/gui/config/images/controls/show_momentum_widget.png similarity index 100% rename from fabric/src/main/resources/assets/do_a_barrel_roll/textures/gui/config/images/controls/show_momentum_widget.png rename to common/src/main/resources/assets/do_a_barrel_roll/textures/gui/config/images/controls/show_momentum_widget.png diff --git a/fabric/src/main/resources/assets/do_a_barrel_roll/textures/gui/config/images/hud/show_horizon.png b/common/src/main/resources/assets/do_a_barrel_roll/textures/gui/config/images/hud/show_horizon.png similarity index 100% rename from fabric/src/main/resources/assets/do_a_barrel_roll/textures/gui/config/images/hud/show_horizon.png rename to common/src/main/resources/assets/do_a_barrel_roll/textures/gui/config/images/hud/show_horizon.png diff --git a/common/src/main/resources/do_a_barrel_roll.mixins.json b/common/src/main/resources/do_a_barrel_roll.mixins.json index 838b45ce..f71ab498 100644 --- a/common/src/main/resources/do_a_barrel_roll.mixins.json +++ b/common/src/main/resources/do_a_barrel_roll.mixins.json @@ -20,7 +20,7 @@ "client.key.KeyBindingEntryMixin", "client.key.KeyBindingMixin", "client.roll.CameraMixin", - "client.roll.DebugHudMixin", + "client.roll.GameRendererMixin", "client.roll.MouseMixin", "client.roll.PlayerEntityRendererMixin", diff --git a/fabric/build.gradle b/fabric/build.gradle index 34915c68..b6cdbe83 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -5,7 +5,7 @@ plugins { id 'dev.architectury.loom' } base { - archivesName = "${mod_name}-fabric-${minecraft_version}" + archivesName = "${mod_id}-fabric" } dependencies { minecraft "com.mojang:minecraft:${minecraft_version}" diff --git a/forge/build.gradle b/forge/build.gradle index 8eedd8c8..29ff3210 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -6,7 +6,7 @@ plugins { } base { - archivesName = "${mod_name}-forge-${minecraft_version}" + archivesName = "${mod_id}-forge" } loom { @@ -56,7 +56,7 @@ dependencies { compileOnly project(":common") - modImplementation("dev.isxander.yacl:yet-another-config-lib-forge:${project.yacl_version}") + modCompileOnly("dev.isxander.yacl:yet-another-config-lib-forge:${project.yacl_version}") implementation(annotationProcessor("io.github.llamalad7:mixinextras-common:${project.mixin_extras_version}")) implementation(include("io.github.llamalad7:mixinextras-forge:${project.mixin_extras_version}")) diff --git a/forge/gradle.properties b/forge/gradle.properties index 0c22b907..82425854 100644 --- a/forge/gradle.properties +++ b/forge/gradle.properties @@ -1,2 +1 @@ loom.platform=forge -mod_version=${file.jarVersion} \ No newline at end of file diff --git a/forge/src/main/java/nl/enjarai/doabarrelroll/DoABarrelRollForge.java b/forge/src/main/java/nl/enjarai/doabarrelroll/DoABarrelRollForge.java index 4b7b90ce..963e50ab 100644 --- a/forge/src/main/java/nl/enjarai/doabarrelroll/DoABarrelRollForge.java +++ b/forge/src/main/java/nl/enjarai/doabarrelroll/DoABarrelRollForge.java @@ -1,7 +1,24 @@ package nl.enjarai.doabarrelroll; +import net.minecraftforge.client.ConfigScreenHandler; +import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.loading.FMLLoader; +import nl.enjarai.doabarrelroll.config.ModConfigScreen; @Mod(DoABarrelRoll.MODID) public class DoABarrelRollForge { + public DoABarrelRollForge() { + DoABarrelRoll.init(); + if (FMLLoader.getDist().isClient()) { + DoABarrelRollClient.init(); + } + + ModLoadingContext.get().registerExtensionPoint( + ConfigScreenHandler.ConfigScreenFactory.class, + () -> new ConfigScreenHandler.ConfigScreenFactory( + (minecraft, parent) -> ModConfigScreen.create(parent) + ) + ); + } } diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index d03e3a9e..83b199d0 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -24,7 +24,7 @@ displayName = "${mod_name}" #mandatory # A URL for the "homepage" for this mod, displayed in the mod UI #displayURL="${mod_url}" #optional (displayed in the mod UI) # A file name (in the root of the mod JAR) containing a logo for display -logoFile = "multiloader.png" #optional +logoFile = "assets/do_a_barrel_roll/icon.png" #optional # A text field displayed in the mod UI credits = "${mod_credits}" #optional # A text field displayed in the mod UI diff --git a/gradle.properties b/gradle.properties index 917f3692..07e9caf1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.daemon=false # Project mod_version=3.4.0 -group=com.example.examplemod +group=nl.enjarai # Common minecraft_version=1.20.1