From 4e381c64dfd2985e282e5d0ab521b7a1565800d2 Mon Sep 17 00:00:00 2001 From: Gate Guardian Date: Sat, 7 Sep 2024 01:08:45 +0800 Subject: [PATCH 1/2] update monolib --- build.gradle | 2 +- ...dependencies.gradle => dependencies.gradle | 8 +- settings.gradle | 20 ++--- .../example/examplemod/ExampleGTAddon.java | 20 +++-- .../com/example/examplemod/ExampleMod.java | 82 +++---------------- .../examplemod/ExampleModBootstrap.java | 13 +++ .../example/examplemod/ExampleModCommon.java | 19 +++++ .../example/examplemod/ExampleModServer.java | 9 ++ .../examplemod/client/ClientProxy.java | 15 ---- .../examplemod/client/ExampleModClient.java | 13 +++ .../examplemod/common/CommonProxy.java | 18 ---- .../config/ExampleConfigHolder.java | 4 +- .../examplemod/data/ExampleLangHandler.java | 2 +- 13 files changed, 96 insertions(+), 129 deletions(-) rename gradle/scripts/dependencies.gradle => dependencies.gradle (89%) create mode 100644 src/main/java/com/example/examplemod/ExampleModBootstrap.java create mode 100644 src/main/java/com/example/examplemod/ExampleModCommon.java create mode 100644 src/main/java/com/example/examplemod/ExampleModServer.java delete mode 100644 src/main/java/com/example/examplemod/client/ClientProxy.java create mode 100644 src/main/java/com/example/examplemod/client/ExampleModClient.java delete mode 100644 src/main/java/com/example/examplemod/common/CommonProxy.java diff --git a/build.gradle b/build.gradle index 7f3579d..8c54eb5 100644 --- a/build.gradle +++ b/build.gradle @@ -33,7 +33,7 @@ version = "${mod_version}" + (buildNumber != null ? "-build.${System.getenv("GIT apply from: "$rootDir/gradle/scripts/architectury_loom.gradle" apply from: "$rootDir/gradle/scripts/capabilities.gradle" apply from: "$rootDir/gradle/scripts/repositories.gradle" -apply from: "$rootDir/gradle/scripts/dependencies.gradle" +apply from: "$rootDir/dependencies.gradle" apply from: "$rootDir/gradle/scripts/resources.gradle" apply from: "$rootDir/gradle/scripts/jars.gradle" apply from: "$rootDir/gradle/scripts/publishing.gradle" diff --git a/gradle/scripts/dependencies.gradle b/dependencies.gradle similarity index 89% rename from gradle/scripts/dependencies.gradle rename to dependencies.gradle index f271965..017ee28 100644 --- a/gradle/scripts/dependencies.gradle +++ b/dependencies.gradle @@ -21,7 +21,7 @@ dependencies { // Mixin Extras implementation(annotationProcessor("io.github.llamalad7:mixinextras-common:${this.forge.versions.mixinextras.get()}")) - api(include("io.github.llamalad7:mixinextras-forge:${this.forge.versions.mixinextras.get()}")) + api("io.github.llamalad7:mixinextras-forge:${this.forge.versions.mixinextras.get()}") /* -------------------------------------------------- Libraries -------------------------------------------------- */ @@ -35,7 +35,7 @@ dependencies { modCompileOnly(forge.jei.common.api) { transitive = false } // JEI modCompileOnly(forge.jei.forge.api) { transitive = false } - modImplementation(forge.jei.forge.impl) { transitive = false } + modCompileOnly(forge.jei.forge.impl) { transitive = false } modCompileOnly forge.rei.plugin // REI modCompileOnly forge.rei.api @@ -53,8 +53,8 @@ dependencies { if (System.getenv("RUN_SERVER") == null) { modRuntimeOnly(forge.shimmer.forge) { transitive = false } // Shimmer - modRuntimeOnly("maven.modrinth:embeddium:0.2.10+mc1.20.1") // Embeddium - modRuntimeOnly("maven.modrinth:oculus:1.20.1-1.6.9") // Oculus + modRuntimeOnly("maven.modrinth:embeddium:0.3.19+mc1.20.1") // Embeddium + modRuntimeOnly("maven.modrinth:oculus:1.20.1-1.7.0") // Oculus } //modRuntimeOnly(forge.worldStripper) } diff --git a/settings.gradle b/settings.gradle index 9b7646b..abb3ff2 100644 --- a/settings.gradle +++ b/settings.gradle @@ -18,12 +18,12 @@ dependencyResolutionManagement { // Mod Dependencies Versions // Common - def jeiVersion = "15.2.0.27" - def reiVersion = "12.0.684" - def emiVersion = "1.1.4" - def ae2Version = "15.0.18" + def jeiVersion = "15.12.1.46" + def reiVersion = "12.1.725" + def emiVersion = "1.1.11" + def ae2Version = "15.2.11" def kjsVersion = "2001.6.5-build.7" - def gtmVersion = "1.2.3.a" + def gtmVersion = "1.4.0" // Forge def forgeVersion = "47.2.0" @@ -39,11 +39,11 @@ dependencyResolutionManagement { def architecturyLoomVersion = "1.6-SNAPSHOT" def macheteVersion = "1.+" def configurationVersion = "2.2.0" - def ldLibVersion = "1.0.25.l" + def ldLibVersion = "1.0.26.b" def mixinextrasVersion = "0.3.2" - def shimmerVersion = "0.2.2" - def monomorphismLibVersion = "1.0.10-build.17" + def shimmerVersion = "0.2.4" def spotlessVersion = "7.0.0.BETA1" + def monoLibVersion = "1.2.0-build.33" forge { version("forgeShortVersion", forgeVersion) @@ -93,8 +93,8 @@ dependencyResolutionManagement { def gtm = version("gtm", gtmVersion) library("gtm", "com.gregtechceu.gtceu", "gtceu-${minecraftVersion}").versionRef(gtm) - def monomorphismLib = version("monomorphism", monomorphismLibVersion) - library("monomorphism", "com.epimorphismmc.monomorphism", "monomorphism-${minecraftVersion}").versionRef(monomorphismLib) + def monoLib = version("monomorphism", monoLibVersion) + library("monomorphism", "com.epimorphismmc.monomorphism", "monomorphism-${minecraftVersion}").versionRef(monoLib) } libs { diff --git a/src/main/java/com/example/examplemod/ExampleGTAddon.java b/src/main/java/com/example/examplemod/ExampleGTAddon.java index 635e98a..23c1924 100644 --- a/src/main/java/com/example/examplemod/ExampleGTAddon.java +++ b/src/main/java/com/example/examplemod/ExampleGTAddon.java @@ -1,16 +1,24 @@ package com.example.examplemod; -import com.epimorphismmc.monomorphism.MOGTAddon; - import com.gregtechceu.gtceu.api.addon.GTAddon; +import com.gregtechceu.gtceu.api.addon.IGTAddon; +import com.gregtechceu.gtceu.api.registry.registrate.GTRegistrate; @GTAddon -public class ExampleGTAddon extends MOGTAddon { +public class ExampleGTAddon implements IGTAddon { - public ExampleGTAddon() { - super(ExampleMod.MODID); + @Override + public GTRegistrate getRegistrate() { + return ExampleMod.REGISTRATE; } @Override - public void initializeAddon() {} + public void initializeAddon() { + + } + + @Override + public String addonModId() { + return ExampleMod.MODID; + } } diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java index c7228d0..ac191a3 100644 --- a/src/main/java/com/example/examplemod/ExampleMod.java +++ b/src/main/java/com/example/examplemod/ExampleMod.java @@ -1,88 +1,26 @@ package com.example.examplemod; -import com.example.examplemod.client.ClientProxy; -import com.example.examplemod.common.CommonProxy; -import com.example.examplemod.config.ExampleConfigHolder; -import com.example.examplemod.data.ExampleLangHandler; - -import com.epimorphismmc.monomorphism.MOMod; -import com.epimorphismmc.monomorphism.datagen.MOProviderTypes; -import com.epimorphismmc.monomorphism.registry.registrate.MORegistrate; - +import com.epimorphismmc.monomorphism.integration.registrate.MORegistrate; +import com.epimorphismmc.monomorphism.utility.DistLogger; import com.gregtechceu.gtceu.utils.FormattingUtil; - -import com.lowdragmc.lowdraglib.networking.INetworking; - import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.fml.common.Mod; - import org.slf4j.Logger; -// The value here should match an entry in the META-INF/mods.toml file -@Mod(ExampleMod.MODID) -public class ExampleMod extends MOMod { +public interface ExampleMod { // Define mod id in a common place for everything to reference - public static final String MODID = "examplemod"; - public static final String NAME = "Example Mod"; - - public static ExampleMod instance; + String MODID = "examplemod"; - public ExampleMod() { - super(); - } - - @Override - public String getModId() { - return MODID; - } + String NAME = "Example Mod"; - @Override - public String getModName() { - return NAME; - } + Logger LOGGER = new DistLogger(NAME); - @Override - protected void onModConstructed() { - instance = this; - ExampleConfigHolder.init(); - } + MORegistrate REGISTRATE = MORegistrate.create(MODID); - @Override - @OnlyIn(Dist.CLIENT) - protected CommonProxy createClientProxy() { - return new ClientProxy(); + static ExampleMod instance() { + return ExampleModCommon.instance; } - @Override - @OnlyIn(Dist.DEDICATED_SERVER) - protected CommonProxy createServerProxy() { - return new CommonProxy(); - } - - @Override - public void addDataGenerator(MORegistrate registrate) { - registrate.addDataGenerator(MOProviderTypes.MO_LANG, ExampleLangHandler::init); - } - - public static ResourceLocation id(String path) { + static ResourceLocation id(String path) { return new ResourceLocation(MODID, FormattingUtil.toLowerCaseUnder(path)); } - - public static Logger logger() { - return instance.getLogger(); - } - - public static CommonProxy proxy() { - return instance.getProxy(); - } - - public static MORegistrate registrate() { - return instance.getRegistrate(); - } - - public static INetworking network() { - return instance.getNetwork(); - } } diff --git a/src/main/java/com/example/examplemod/ExampleModBootstrap.java b/src/main/java/com/example/examplemod/ExampleModBootstrap.java new file mode 100644 index 0000000..2ee8d04 --- /dev/null +++ b/src/main/java/com/example/examplemod/ExampleModBootstrap.java @@ -0,0 +1,13 @@ +package com.example.examplemod; + +import com.example.examplemod.client.ExampleModClient; +import net.minecraftforge.fml.DistExecutor; +import net.minecraftforge.fml.common.Mod; + +// The value here should match an entry in the META-INF/mods.toml file +@Mod(ExampleModCommon.MODID) +public class ExampleModBootstrap { + public ExampleModBootstrap() { + DistExecutor.unsafeRunForDist(() -> ExampleModClient::new, () -> ExampleModServer::new); + } +} diff --git a/src/main/java/com/example/examplemod/ExampleModCommon.java b/src/main/java/com/example/examplemod/ExampleModCommon.java new file mode 100644 index 0000000..8644cee --- /dev/null +++ b/src/main/java/com/example/examplemod/ExampleModCommon.java @@ -0,0 +1,19 @@ +package com.example.examplemod; + +import com.epimorphismmc.monomorphism.integration.registrate.providers.MOProviderTypes; +import com.example.examplemod.config.ExampleConfigHolder; +import com.example.examplemod.data.ExampleLangHandler; + +public class ExampleModCommon implements ExampleMod { + + public static ExampleModCommon instance; + + public ExampleModCommon() { + super(); + instance = this; + ExampleConfigHolder.init(); + REGISTRATE.addDataGenerator(MOProviderTypes.MO_LANG, ExampleLangHandler::init); + + LOGGER.info("ExampleMod's Initialization Completed!"); + } +} diff --git a/src/main/java/com/example/examplemod/ExampleModServer.java b/src/main/java/com/example/examplemod/ExampleModServer.java new file mode 100644 index 0000000..f0ffb16 --- /dev/null +++ b/src/main/java/com/example/examplemod/ExampleModServer.java @@ -0,0 +1,9 @@ +package com.example.examplemod; + +public class ExampleModServer extends ExampleModCommon { + + public ExampleModServer() { + super(); + } + +} diff --git a/src/main/java/com/example/examplemod/client/ClientProxy.java b/src/main/java/com/example/examplemod/client/ClientProxy.java deleted file mode 100644 index ff9a1cc..0000000 --- a/src/main/java/com/example/examplemod/client/ClientProxy.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.example.examplemod.client; - -import com.example.examplemod.common.CommonProxy; - -import com.epimorphismmc.monomorphism.proxy.base.IClientProxyBase; - -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; - -@OnlyIn(Dist.CLIENT) -public class ClientProxy extends CommonProxy implements IClientProxyBase { - public ClientProxy() { - super(); - } -} diff --git a/src/main/java/com/example/examplemod/client/ExampleModClient.java b/src/main/java/com/example/examplemod/client/ExampleModClient.java new file mode 100644 index 0000000..9d8f18b --- /dev/null +++ b/src/main/java/com/example/examplemod/client/ExampleModClient.java @@ -0,0 +1,13 @@ +package com.example.examplemod.client; + +import com.example.examplemod.ExampleModCommon; + +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +@OnlyIn(Dist.CLIENT) +public class ExampleModClient extends ExampleModCommon { + public ExampleModClient() { + super(); + } +} diff --git a/src/main/java/com/example/examplemod/common/CommonProxy.java b/src/main/java/com/example/examplemod/common/CommonProxy.java deleted file mode 100644 index 8f61458..0000000 --- a/src/main/java/com/example/examplemod/common/CommonProxy.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.example.examplemod.common; - -import com.example.examplemod.ExampleMod; - -import com.epimorphismmc.monomorphism.proxy.base.ICommonProxyBase; - -public class CommonProxy implements ICommonProxyBase { - - public CommonProxy() { - ExampleMod.logger().info("ExampleMod's Initialization Completed!"); - } - - @Override - public void registerEventHandlers() {} - - @Override - public void registerCapabilities() {} -} diff --git a/src/main/java/com/example/examplemod/config/ExampleConfigHolder.java b/src/main/java/com/example/examplemod/config/ExampleConfigHolder.java index cd2183e..da1ea19 100644 --- a/src/main/java/com/example/examplemod/config/ExampleConfigHolder.java +++ b/src/main/java/com/example/examplemod/config/ExampleConfigHolder.java @@ -1,12 +1,12 @@ package com.example.examplemod.config; -import com.example.examplemod.ExampleMod; +import com.example.examplemod.ExampleModCommon; import dev.toma.configuration.Configuration; import dev.toma.configuration.config.Config; import dev.toma.configuration.config.format.ConfigFormats; -@Config(id = ExampleMod.MODID) +@Config(id = ExampleModCommon.MODID) public class ExampleConfigHolder { public static ExampleConfigHolder INSTANCE; diff --git a/src/main/java/com/example/examplemod/data/ExampleLangHandler.java b/src/main/java/com/example/examplemod/data/ExampleLangHandler.java index 7bc36f3..66b56fb 100644 --- a/src/main/java/com/example/examplemod/data/ExampleLangHandler.java +++ b/src/main/java/com/example/examplemod/data/ExampleLangHandler.java @@ -1,6 +1,6 @@ package com.example.examplemod.data; -import com.epimorphismmc.monomorphism.datagen.lang.MOLangProvider; +import com.epimorphismmc.monomorphism.integration.registrate.providers.MOLangProvider; public class ExampleLangHandler { From d5b87098bebc6662b04090f8d63fc398418af9ba Mon Sep 17 00:00:00 2001 From: Gate Guardian Date: Sat, 7 Sep 2024 02:32:10 +0800 Subject: [PATCH 2/2] spotless --- src/main/java/com/example/examplemod/ExampleGTAddon.java | 4 +--- src/main/java/com/example/examplemod/ExampleMod.java | 3 +++ src/main/java/com/example/examplemod/ExampleModBootstrap.java | 1 + src/main/java/com/example/examplemod/ExampleModCommon.java | 3 ++- src/main/java/com/example/examplemod/ExampleModServer.java | 1 - 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/example/examplemod/ExampleGTAddon.java b/src/main/java/com/example/examplemod/ExampleGTAddon.java index 23c1924..b670932 100644 --- a/src/main/java/com/example/examplemod/ExampleGTAddon.java +++ b/src/main/java/com/example/examplemod/ExampleGTAddon.java @@ -13,9 +13,7 @@ public GTRegistrate getRegistrate() { } @Override - public void initializeAddon() { - - } + public void initializeAddon() {} @Override public String addonModId() { diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java index ac191a3..98eb1e5 100644 --- a/src/main/java/com/example/examplemod/ExampleMod.java +++ b/src/main/java/com/example/examplemod/ExampleMod.java @@ -2,8 +2,11 @@ import com.epimorphismmc.monomorphism.integration.registrate.MORegistrate; import com.epimorphismmc.monomorphism.utility.DistLogger; + import com.gregtechceu.gtceu.utils.FormattingUtil; + import net.minecraft.resources.ResourceLocation; + import org.slf4j.Logger; public interface ExampleMod { diff --git a/src/main/java/com/example/examplemod/ExampleModBootstrap.java b/src/main/java/com/example/examplemod/ExampleModBootstrap.java index 2ee8d04..e03ea4a 100644 --- a/src/main/java/com/example/examplemod/ExampleModBootstrap.java +++ b/src/main/java/com/example/examplemod/ExampleModBootstrap.java @@ -1,6 +1,7 @@ package com.example.examplemod; import com.example.examplemod.client.ExampleModClient; + import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.common.Mod; diff --git a/src/main/java/com/example/examplemod/ExampleModCommon.java b/src/main/java/com/example/examplemod/ExampleModCommon.java index 8644cee..2c708a7 100644 --- a/src/main/java/com/example/examplemod/ExampleModCommon.java +++ b/src/main/java/com/example/examplemod/ExampleModCommon.java @@ -1,9 +1,10 @@ package com.example.examplemod; -import com.epimorphismmc.monomorphism.integration.registrate.providers.MOProviderTypes; import com.example.examplemod.config.ExampleConfigHolder; import com.example.examplemod.data.ExampleLangHandler; +import com.epimorphismmc.monomorphism.integration.registrate.providers.MOProviderTypes; + public class ExampleModCommon implements ExampleMod { public static ExampleModCommon instance; diff --git a/src/main/java/com/example/examplemod/ExampleModServer.java b/src/main/java/com/example/examplemod/ExampleModServer.java index f0ffb16..d63aad7 100644 --- a/src/main/java/com/example/examplemod/ExampleModServer.java +++ b/src/main/java/com/example/examplemod/ExampleModServer.java @@ -5,5 +5,4 @@ public class ExampleModServer extends ExampleModCommon { public ExampleModServer() { super(); } - }