diff --git a/.gitignore b/.gitignore index 31d2550..6f16beb 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,6 @@ run runs run-data -repo \ No newline at end of file +repo + +.DS_Store diff --git a/build.gradle b/build.gradle index adee230..a067f61 100644 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,8 @@ plugins { id 'java-library' - id 'eclipse' - id 'idea' id 'maven-publish' - id 'net.neoforged.gradle.userdev' version '7.0.145' -} - -tasks.named('wrapper', Wrapper).configure { - distributionType = Wrapper.DistributionType.BIN + id 'idea' + id 'net.neoforged.moddev' version '2.0.77' } version = "${minecraft_version}-${mod_version}" @@ -23,30 +18,52 @@ base { java.toolchain.languageVersion = JavaLanguageVersion.of(21) -runs { - configureEach { - systemProperty 'forge.logging.markers', 'REGISTRIES' - systemProperty 'forge.logging.console.level', 'debug' +neoForge { + // Specify the version of NeoForge to use. + version = project.neo_version - modSource project.sourceSets.main + parchment { + mappingsVersion = project.parchment_mappings_version + minecraftVersion = project.parchment_minecraft_version } - client { - systemProperty 'forge.enabledGameTestNamespaces', project.mod_id + runs { + client { + client() + systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id + } + + server { + server() + programArgument '--nogui' + systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id + } + + gameTestServer { + type = "gameTestServer" + systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id + } + + data { + data() + programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath() + } + + configureEach { + systemProperty 'forge.logging.markers', 'REGISTRIES' + logLevel = org.slf4j.event.Level.DEBUG + } } - server { - systemProperty 'forge.enabledGameTestNamespaces', project.mod_id - programArgument '--nogui' + mods { + "${mod_id}" { + sourceSet(sourceSets.main) + } } } sourceSets.main.resources { srcDir 'src/generated/resources' } -configurations { - runtimeClasspath.extendsFrom localRuntime -} - repositories { maven { url 'https://maven.squiddev.cc' @@ -60,10 +77,10 @@ repositories { includeGroup 'net.commoble.morered' } } + mavenLocal() } dependencies { - implementation "net.neoforged:neoforge:${neo_version}" compileOnly "cc.tweaked:cc-tweaked-${minecraft_version}-forge-api:${cctweaked_version}" implementation "cc.tweaked:cc-tweaked-${minecraft_version}-forge:${cctweaked_version}" @@ -71,23 +88,32 @@ dependencies { implementation "net.commoble.morered:morered-${minecraft_version_major}:${morered_version}" } -tasks.withType(ProcessResources).configureEach { - var replaceProperties = [ - minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range, - neo_version: neo_version, neo_version_range: neo_version_range, - loader_version_range: loader_version_range, - mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version, - mod_authors: mod_authors, mod_description: mod_description, - mod_issue_tracker_url: mod_issue_tracker_url, mod_display_url: mod_display_url, - cctweaked_version_range: cctweaked_version_range, morered_version_range: morered_version_range, - ] +var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) { + var replaceProperties = [minecraft_version : minecraft_version, + minecraft_version_range: minecraft_version_range, + neo_version : neo_version, + neo_version_range : neo_version_range, + loader_version_range : loader_version_range, + mod_id : mod_id, + mod_name : mod_name, + mod_license : mod_license, + mod_version : mod_version, + mod_authors : mod_authors, + mod_description : mod_description, + mod_issue_tracker_url : mod_issue_tracker_url, + mod_display_url : mod_display_url, + cctweaked_version_range: cctweaked_version_range, + morered_version_range : morered_version_range] inputs.properties replaceProperties - - filesMatching(['META-INF/neoforge.mods.toml']) { - expand replaceProperties - } + expand replaceProperties + from "src/main/templates" + into "build/generated/sources/modMetadata" } +sourceSets.main.resources.srcDir generateModMetadata + +neoForge.ideSyncTask generateModMetadata + publishing { publications { register('mavenJava', MavenPublication) { @@ -101,10 +127,6 @@ publishing { } } -tasks.withType(JavaCompile).configureEach { - options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation -} - idea { module { downloadSources = true diff --git a/gradle.properties b/gradle.properties index 699da44..79e37e6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,13 +1,10 @@ # Sets default memory used for gradle commands. Can be overridden by user or command line properties. -org.gradle.jvmargs=-Xmx1G -org.gradle.daemon=false -org.gradle.debug=false - -#read more on this at https://github.com/neoforged/NeoGradle/blob/NG_7.0/README.md#apply-parchment-mappings -# you can also find the latest versions at: https://parchmentmc.org/docs/getting-started -neogradle.subsystems.parchment.minecraftVersion=1.21 -neogradle.subsystems.parchment.mappingsVersion=2024.07.28 -# Environment Properties +org.gradle.jvmargs=-Xmx2G +org.gradle.daemon=true +org.gradle.parallel=true +org.gradle.caching=true +org.gradle.configuration-cache=true +## Environment Properties # You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge # The Minecraft version must agree with the Neo version to get a valid artifact minecraft_version=1.21.1 @@ -19,12 +16,12 @@ minecraft_version_range=[1.21.1,1.22) # The Neo version must agree with the Minecraft version to get a valid artifact neo_version=21.1.9 # The Neo version range can use any version of Neo as bounds -neo_version_range=[21.1.9,) +neo_version_range=[21,) # The loader version range can only use the major version of FML as bounds loader_version_range=[4,) - +parchment_minecraft_version=1.21.1 +parchment_mappings_version=2024.11.17 ## Mod Properties - # The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63} # Must match the String constant located in the main mod class annotated with @Mod. mod_id=moreredxcctcompat @@ -53,7 +50,7 @@ archive_base_name=MoreRed-CCT-Compat ## Mod Dependencies Properties # CC:Tweaked version -cctweaked_version=1.113.0 +cctweaked_version=1.114.4 cctweaked_version_range=[1.113.0,) # More Red version morered_version=6.0.0.2 diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 index f5feea6..b740cf1 --- a/gradlew +++ b/gradlew @@ -15,8 +15,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# SPDX-License-Identifier: Apache-2.0 -# ############################################################################## # @@ -86,8 +84,7 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s -' "$PWD" ) || exit +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum diff --git a/src/main/java/ru/yurannnzzz/moreredcccompat/MoreRedCCCompatMod.java b/src/main/java/ru/yurannnzzz/moreredcccompat/MoreRedCCCompatMod.java index e509d65..564948e 100644 --- a/src/main/java/ru/yurannnzzz/moreredcccompat/MoreRedCCCompatMod.java +++ b/src/main/java/ru/yurannnzzz/moreredcccompat/MoreRedCCCompatMod.java @@ -35,6 +35,7 @@ public class MoreRedCCCompatMod { registry.put(ModRegistry.Blocks.COMPUTER_COMMAND.get(), connector); registry.put(ModRegistry.Blocks.TURTLE_NORMAL.get(), connector); registry.put(ModRegistry.Blocks.TURTLE_ADVANCED.get(), connector); + registry.put(ModRegistry.Blocks.REDSTONE_RELAY.get(), connector); } private void registerCapabilities(RegisterCapabilitiesEvent event) { @@ -43,5 +44,6 @@ public class MoreRedCCCompatMod { event.registerBlockEntity(MoreRedAPI.CHANNELED_POWER_CAPABILITY, ModRegistry.BlockEntities.COMPUTER_COMMAND.get(), (be, side) -> new ComputerChanneledPowerCapability(side)); event.registerBlockEntity(MoreRedAPI.CHANNELED_POWER_CAPABILITY, ModRegistry.BlockEntities.TURTLE_NORMAL.get(), (be, side) -> new ComputerChanneledPowerCapability(side)); event.registerBlockEntity(MoreRedAPI.CHANNELED_POWER_CAPABILITY, ModRegistry.BlockEntities.TURTLE_ADVANCED.get(), (be, side) -> new ComputerChanneledPowerCapability(side)); + event.registerBlockEntity(MoreRedAPI.CHANNELED_POWER_CAPABILITY, ModRegistry.BlockEntities.REDSTONE_RELAY.get(), (be, side) -> new ComputerChanneledPowerCapability(side)); } } diff --git a/src/main/resources/META-INF/neoforge.mods.toml b/src/main/templates/META-INF/neoforge.mods.toml similarity index 100% rename from src/main/resources/META-INF/neoforge.mods.toml rename to src/main/templates/META-INF/neoforge.mods.toml