From 3f02e67344bffe31349475d78952ecc0e31b6dc2 Mon Sep 17 00:00:00 2001 From: OroArmor Date: Wed, 20 Jan 2021 17:13:42 -0800 Subject: [PATCH] Update libraries and make config command work on forge --- build.gradle | 6 ++--- common/build.gradle | 19 +++++++--------- .../netherite_plus/NetheritePlusMod.java | 5 +++++ fabric/build.gradle | 9 +++++--- .../NetheritePlusModFabric.java | 5 ----- forge/build.gradle | 22 ++++++------------- forge/src/main/resources/META-INF/mods.toml | 12 ++++++---- gradle.properties | 6 ++--- 8 files changed, 40 insertions(+), 44 deletions(-) diff --git a/build.gradle b/build.gradle index 18dc82e..52b28b8 100644 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,13 @@ plugins { - id "architectury-plugin" version "1.3.48" - id "forgified-fabric-loom" version "0.5.32" apply false + id "architectury-plugin" version "2.0.56" + id "forgified-fabric-loom" version "0.6.45" apply false id 'com.jfrog.bintray' version "1.8.4" id "com.matthewprenger.cursegradle" version "1.4.0" apply false id 'maven-publish' id "maven" } -architect { +architectury { minecraft = rootProject.minecraft_version } diff --git a/common/build.gradle b/common/build.gradle index 4081805..0ed9d03 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -1,4 +1,7 @@ repositories { + maven { + url = "https://dl.bintray.com/oroarmor/oroarmor" + } maven { url = "https://jitpack.io" } @@ -9,7 +12,7 @@ minecraft { } dependencies { - minecraft "com.mojang:minecraft:${rootProject.architect.minecraft}" + minecraft "com.mojang:minecraft:${rootProject.architectury.minecraft}" mappings("net.fabricmc:yarn:${rootProject.mappings}:v2") // We depend on fabric loader here to use the fabric @Environment annotations // Do NOT use other classes from fabric loader @@ -19,14 +22,9 @@ dependencies { exclude(module: "fabric-api") } - modCompile('com.github.OroArmor:oro-config:-SNAPSHOT') { - exclude(module: "fabric-api") - exclude(module: "fabric-loader") - } - include('com.github.OroArmor:oro-config:-SNAPSHOT') { - exclude(module: "fabric-api") - exclude(module: "fabric-loader") - } + modCompile('com.oroarmor:oro-config:1.1.0') + include('com.oroarmor:oro-config:1.1.0') + modCompile('com.github.OroArmor:Multi-Item-Lib:-SNAPSHOT') { exclude(module: "fabric-api") @@ -38,7 +36,7 @@ dependencies { } } -architect { +architectury { common() } @@ -77,7 +75,6 @@ publishing { bintray { user = System.getenv('BINTRAY_USER') - System.out.println(user) key = System.getenv('BINTRAY_KEY') publications = ["mavenCommon"] publish = true diff --git a/common/src/main/java/com/oroarmor/netherite_plus/NetheritePlusMod.java b/common/src/main/java/com/oroarmor/netherite_plus/NetheritePlusMod.java index 525bc64..3d8d660 100644 --- a/common/src/main/java/com/oroarmor/netherite_plus/NetheritePlusMod.java +++ b/common/src/main/java/com/oroarmor/netherite_plus/NetheritePlusMod.java @@ -5,6 +5,7 @@ import java.util.List; import com.oroarmor.config.ConfigItemGroup; +import com.oroarmor.config.command.ConfigCommand; import com.oroarmor.multi_item_lib.UniqueItemRegistry; import com.oroarmor.netherite_plus.advancement.criterion.NetheritePlusCriteria; import com.oroarmor.netherite_plus.config.NetheritePlusConfig; @@ -15,6 +16,7 @@ import com.oroarmor.netherite_plus.screen.NetheriteBeaconScreenHandler; import com.oroarmor.netherite_plus.screen.NetheritePlusScreenHandlers; import com.oroarmor.netherite_plus.stat.NetheritePlusStats; +import me.shedaniel.architectury.event.events.CommandRegistrationEvent; import me.shedaniel.architectury.networking.NetworkManager; import me.shedaniel.architectury.registry.Registries; import org.apache.logging.log4j.Level; @@ -22,6 +24,7 @@ import org.apache.logging.log4j.Logger; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.server.command.CommandManager; import net.minecraft.util.Identifier; import net.minecraft.util.Lazy; @@ -60,6 +63,8 @@ public static void initialize() { } }); }); + + CommandRegistrationEvent.EVENT.register((commandSourceCommandDispatcher, registrationEnvironment) -> new ConfigCommand(CONFIG).register(commandSourceCommandDispatcher, registrationEnvironment == CommandManager.RegistrationEnvironment.DEDICATED)); } private static void processConfig() { diff --git a/fabric/build.gradle b/fabric/build.gradle index cd8d862..42a6640 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -34,6 +34,9 @@ repositories { maven { url = "https://dl.bintray.com/kyrptonaught/Quickshulker/" } maven { url = "https://dl.bintray.com/kyrptonaught/kyrptconfig/" } maven { url = "https://maven.misterpemodder.com/libs-release/" } + maven { + url = "https://dl.bintray.com/oroarmor/oroarmor" + } } sourceCompatibility = JavaVersion.VERSION_1_8 @@ -80,7 +83,7 @@ dependencies { modCompile "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_version}" //Libraries - includeLibraries(['com.github.OroArmor:oro-config:-SNAPSHOT', + includeLibraries(['com.oroarmor:oro-config:1.1.0', 'com.github.OroArmor:Multi-Item-Lib:-SNAPSHOT']) runAndCompile(["net.kyrptonaught:quickshulker:${project.quickshulker}", @@ -105,11 +108,11 @@ dependencies { transitive = false exclude(module: "fabric-api") } - runtimeOnly(project(path: ":common", configuration: "transformedRuntime")) { + runtimeOnly(project(path: ":common", configuration: "transformDevelopmentFabric")) { transitive = false exclude(module: "fabric-api") } - shadow(project(path: ":common", configuration: "transformed")) { + shadow(project(path: ":common", configuration: "transformProductionFabric")) { transitive = false exclude(module: "fabric-api") } diff --git a/fabric/src/main/java/com/oroarmor/netherite_plus/NetheritePlusModFabric.java b/fabric/src/main/java/com/oroarmor/netherite_plus/NetheritePlusModFabric.java index a94f2ef..459e033 100644 --- a/fabric/src/main/java/com/oroarmor/netherite_plus/NetheritePlusModFabric.java +++ b/fabric/src/main/java/com/oroarmor/netherite_plus/NetheritePlusModFabric.java @@ -1,9 +1,6 @@ package com.oroarmor.netherite_plus; -import com.oroarmor.config.command.ConfigCommand; - import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; public class NetheritePlusModFabric implements ModInitializer { @@ -12,8 +9,6 @@ public void onInitialize() { ServerLifecycleEvents.SERVER_STOPPED.register(l -> NetheritePlusMod.CONFIG.saveConfigToFile()); - CommandRegistrationCallback.EVENT.register(new ConfigCommand(NetheritePlusMod.CONFIG)); - NetheritePlusMod.registerItemsWithMultiItemLib(); } } diff --git a/forge/build.gradle b/forge/build.gradle index 6836beb..7d6510d 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -14,7 +14,7 @@ architectury { repositories { maven { - url = "https://jitpack.io" + url = "https://dl.bintray.com/oroarmor/oroarmor" } } @@ -28,29 +28,21 @@ loom { //} dependencies { - minecraft("com.mojang:minecraft:${rootProject.architect.minecraft}") + minecraft("com.mojang:minecraft:${rootProject.architectury.minecraft}") mappings("net.fabricmc:yarn:${rootProject.mappings}:v2") - forge("net.minecraftforge:forge:${rootProject.architect.minecraft}-${rootProject.forge_version}") + forge("net.minecraftforge:forge:${rootProject.architectury.minecraft}-${rootProject.forge_version}") modCompile("me.shedaniel:architectury:${rootProject.architectury_version}:forge") - compile('com.github.OroArmor:oro-config:-SNAPSHOT') { - exclude(module: "fabric-api") - exclude(module: "fabric-loader") - } - shadow('com.github.OroArmor:oro-config:-SNAPSHOT') { - exclude(module: "fabric-api") - exclude(module: "fabric-loader") - exclude(module: "modmenu") - exclude(module: "config-2") - } + compile('com.oroarmor:oro-config:1.1.0') + shadow('com.oroarmor:oro-config:1.1.0') compileOnly(project(path: ":common")) { transitive = false } - runtimeOnly(project(path: ":common", configuration: "transformForgeFakeMod")) { + runtimeOnly(project(path: ":common", configuration: "transformDevelopmentForge")) { transitive = false } - shadow(project(path: ":common", configuration: "transformForge")) { + shadow(project(path: ":common", configuration: "transformProductionForge")) { transitive = false } } diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index d154916..acbeb98 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -17,9 +17,7 @@ logoFile="logo.png" credits="Ron for Textures" authors="OroArmor" - description=''' - This mod adds extra netherite features that aren't vanillia. NOTE: Editing the config requires a game restart - ''' + description='''This mod adds extra netherite features that aren't vanillia. NOTE: Editing the config requires a game restart''' [[dependencies.netherite_plus]] modId="forge" @@ -33,4 +31,10 @@ mandatory=true versionRange="[1.16.4,1.17)" ordering="NONE" - side="BOTH" \ No newline at end of file + side="BOTH" + + [[dependencies.netherite_plus]] + modId="architectury-forge" + mandatory=true + ordering="NONE" + side="BOTH" \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index f7738ac..1fcb421 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,13 +5,13 @@ org.gradle.jvmargs=-Xmx2G minecraft_version=1.16.5 fabric_loader_version=0.10.8 # Mod Properties -mod_version=1.3.5 +mod_version=1.3.6 maven_group=com.oroarmor archives_base_name=netherite-plus-mod release=false # Dependencies # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api -fabric_version=0.29.3+1.16 +fabric_version=0.29.4+1.16 forge_version=36.0.0 -architectury_version=1.3.80 +architectury_version=1.3.83 mappings=1.16.5+build.1 \ No newline at end of file