From 5a7c945e4dd7fce916465fd5f3faf7210a834c46 Mon Sep 17 00:00:00 2001 From: Gareth Williams Date: Sun, 7 Jan 2024 16:08:50 +0000 Subject: [PATCH] update --- CHANGELOG.md | 4 + build.gradle | 37 +++---- .../playerplates/block/PlayerPlateBlock.java | 2 +- gradle.properties | 18 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- neoforge/build.gradle | 97 +++++++++++++++++++ neoforge/gradle.properties | 1 + .../playerplates/forge/PlayerPlatesForge.java | 12 +++ .../src/main/resources/META-INF/mods.toml | 35 +++++++ neoforge/src/main/resources/pack.mcmeta | 6 ++ settings.gradle | 3 + 11 files changed, 191 insertions(+), 26 deletions(-) create mode 100644 neoforge/build.gradle create mode 100644 neoforge/gradle.properties create mode 100644 neoforge/src/main/java/dev/wuffs/playerplates/forge/PlayerPlatesForge.java create mode 100644 neoforge/src/main/resources/META-INF/mods.toml create mode 100644 neoforge/src/main/resources/pack.mcmeta diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a54867..3d1047d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to this project will be documented in this file. +## [4.0.0] + +- Update to 1.20.4 and support neoforge + ## [3.0.4] - Fix long break times diff --git a/build.gradle b/build.gradle index 9b25ad4..c06814e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,7 @@ plugins { id "architectury-plugin" version "3.4-SNAPSHOT" - id "dev.architectury.loom" version "1.3-SNAPSHOT" apply false - id "com.matthewprenger.cursegradle" version "1.4.0" apply false - id "me.modmuss50.mod-publish-plugin" version "0.3.0" + id "dev.architectury.loom" version "1.4-SNAPSHOT" apply false + id "me.modmuss50.mod-publish-plugin" version "0.4.5" } ext.isSnapshot = providers.environmentVariable("SNAPSHOT").map { it == "true" }.getOrElse(false) @@ -28,13 +27,14 @@ allprojects { apply plugin: "java" apply plugin: "architectury-plugin" apply plugin: "maven-publish" - apply plugin: 'com.matthewprenger.cursegradle' archivesBaseName = rootProject.archives_base_name version = "${mod_version}+mc${minecraft_version}${isSnapshot ? '-SNAPSHOT' : ''}" group = rootProject.maven_group repositories { +// maven { url "https://maven.wuffs.wtf/releases"} + maven { url "https://maven.neomc.dev/releases"} } tasks.withType(JavaCompile) { @@ -65,6 +65,12 @@ publishMods { modLoaders.add("forge") } + def neoOptions = publishOptions { + file = project.provider { project(":neoforge").tasks.remapJar }.flatMap { it.archiveFile } + displayName = "${project.name} NeoForged ${mod_version}+mc${minecraft_version}" + modLoaders.add("neoforge") + } + def curseForgeOptions = curseforgeOptions { accessToken = providers.environmentVariable("CURSE_TOKEN") projectId = "${curseforge_id}" @@ -82,16 +88,14 @@ publishMods { requires { slug = "fabric-api" } - requires { - slug = "architectury-api" - } } curseforge("curseforgeForge") { from(curseForgeOptions, forgeOptions) - requires { - slug = "architectury-api" - } + } + + curseforge("curseforgeNeo") { + from(curseForgeOptions, neoOptions) } if (providers.environmentVariable("MODRINTH_TOKEN").getOrNull() != null) { @@ -100,24 +104,23 @@ publishMods { requires { slug = "fabric-api" } - requires { - slug = "architectury-api" - } } modrinth("modrinthForge") { from(modrinthOptions, forgeOptions) - requires { - slug = "architectury-api" - } + } + + modrinth("modrinthNeo") { + from(modrinthOptions, neoOptions) } } github { file = project.provider { project(":forge").tasks.remapJar }.flatMap { it.archiveFile } additionalFiles.from project.provider { project(":fabric").tasks.remapJar }.flatMap { it.archiveFile } + additionalFiles.from project.provider { project(":neoforge").tasks.remapJar }.flatMap { it.archiveFile } repository = "${github_repo}" accessToken = providers.environmentVariable("GITHUB_TOKEN") commitish = providers.environmentVariable("GITHUB_SHA").orElse("dryRun") } -} +} \ No newline at end of file diff --git a/common/src/main/java/dev/wuffs/playerplates/block/PlayerPlateBlock.java b/common/src/main/java/dev/wuffs/playerplates/block/PlayerPlateBlock.java index 01872ce..3db0fba 100644 --- a/common/src/main/java/dev/wuffs/playerplates/block/PlayerPlateBlock.java +++ b/common/src/main/java/dev/wuffs/playerplates/block/PlayerPlateBlock.java @@ -33,7 +33,7 @@ public class PlayerPlateBlock extends PressurePlateBlock { private boolean isInvisible; public PlayerPlateBlock(Sensitivity sensitivity, boolean invisible, Block copy, BlockSetType type) { - super(PressurePlateBlock.Sensitivity.EVERYTHING, BlockBehaviour.Properties.copy(copy).noCollission().sound(SoundType.WOOD), type); + super(type, BlockBehaviour.Properties.ofFullCopy(copy).noCollission().sound(SoundType.WOOD)); this.sensitivity = sensitivity; this.isInvisible = invisible; diff --git a/gradle.properties b/gradle.properties index 1ba0566..35c6145 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,19 +1,23 @@ # Project -mod_version=3.0.4 +mod_version=4.0.0 maven_group=dev.wuffs.playerplates -enabled_platforms=fabric,forge +enabled_platforms=fabric,forge,neoforge archives_base_name=playerplates # Common -minecraft_version=1.20.1 -architectury_version=9.1.12 +minecraft_version=1.20.4 +architectury_version=11.0.10 # Fabric -fabric_loader_version=0.14.22 -fabric_api_version=0.86.1+1.20.1 +fabric_loader_version=0.15.3 +fabric_api_version=0.92.1+1.20.4 # Forge -forge_version=1.20.1-47.1.5 +forge_version=1.20.4-49.0.14 + +# Neo +neo_version=20.4.80-beta +neo_gradle=[7.0.60,) # Publishing curseforge_id=311645 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index fae0804..a595206 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/neoforge/build.gradle b/neoforge/build.gradle new file mode 100644 index 0000000..0870add --- /dev/null +++ b/neoforge/build.gradle @@ -0,0 +1,97 @@ +plugins { + id "com.github.johnrengelman.shadow" version "8.1.1" +} + +architectury { + platformSetupLoomIde() + neoForge() +} + +loom { + accessWidenerPath = project(":common").loom.accessWidenerPath + +// neoforge { +// convertAccessWideners = true +// extraAccessWideners.add loom.accessWidenerPath.get().asFile.name +// } +} + +configurations { + common + shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. + compileClasspath.extendsFrom common + runtimeClasspath.extendsFrom common + developmentNeoForge.extendsFrom common +} + +dependencies { + neoForge "net.neoforged:neoforge:${rootProject.neo_version}" + // Remove the next line if you don't want to depend on the API + modApi "dev.architectury:architectury-neoforge:${rootProject.architectury_version}" + + common(project(path: ":common", configuration: "namedElements")) { transitive false } + shadowCommon(project(path: ":common", configuration: "transformProductionNeoForge")) { transitive = false } +} + +processResources { + inputs.property "version", project.version + + filesMatching("META-INF/mods.toml") { + expand "version": project.version + } +} + +shadowJar { + exclude "fabric.mod.json" + exclude "architectury.common.json" + + configurations = [project.configurations.shadowCommon] + setArchiveClassifier("dev-shadow") +} + +remapJar { + input.set shadowJar.archiveFile + dependsOn shadowJar + archiveBaseName.set "${rootProject.archives_base_name}-${project.name}" + setArchiveClassifier(null) +} + +jar { + setArchiveClassifier("dev") +} + +sourcesJar { + def commonSources = project(":common").sourcesJar + dependsOn commonSources + from commonSources.archiveFile.map { zipTree(it) } +} + +components.java { + withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { + skip() + } +} + +def ENV = System.getenv() + +publishing { + publications { + mavenNeoForge(MavenPublication) { + artifactId = rootProject.archives_base_name + "-" + project.name + from components.java + } + } + + // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. + repositories { + if (ENV.NANITE_TOKEN) { + maven { + url "https://maven.nanite.dev/releases" + credentials { + username = "nanite" + password = "${ENV.NANITE_TOKEN}" + } + } + } + } +} \ No newline at end of file diff --git a/neoforge/gradle.properties b/neoforge/gradle.properties new file mode 100644 index 0000000..2914393 --- /dev/null +++ b/neoforge/gradle.properties @@ -0,0 +1 @@ +loom.platform=neoforge \ No newline at end of file diff --git a/neoforge/src/main/java/dev/wuffs/playerplates/forge/PlayerPlatesForge.java b/neoforge/src/main/java/dev/wuffs/playerplates/forge/PlayerPlatesForge.java new file mode 100644 index 0000000..eca57b1 --- /dev/null +++ b/neoforge/src/main/java/dev/wuffs/playerplates/forge/PlayerPlatesForge.java @@ -0,0 +1,12 @@ +package dev.wuffs.playerplates.forge; + +import dev.wuffs.playerplates.PlayerPlates; +import net.neoforged.fml.common.Mod; + +@Mod(PlayerPlates.MOD_ID) +public class PlayerPlatesForge { + public PlayerPlatesForge() { +// EventBuses.registerModEventBus(PlayerPlates.MOD_ID, FMLJavaModLoadingContext.get().getModEventBus()); + PlayerPlates.init(); + } +} diff --git a/neoforge/src/main/resources/META-INF/mods.toml b/neoforge/src/main/resources/META-INF/mods.toml new file mode 100644 index 0000000..20f36ca --- /dev/null +++ b/neoforge/src/main/resources/META-INF/mods.toml @@ -0,0 +1,35 @@ +modLoader = "javafml" +loaderVersion = "[1,)" +#issueTrackerURL = "" +license = "All rights reserved" + +[[mods]] +modId = "playerplates" +version = "${version}" +displayName = "Player Plates" +authors = "Gaz" +description = ''' +Obsidian pressure plates and mossy plates +''' +#logoFile = "" + +[[dependencies.playerplates]] +modId = "neoforge" +required = true +versionRange = "[1,)" +ordering = "NONE" +side = "BOTH" + +[[dependencies.playerplates]] +modId = "minecraft" +required = true +versionRange = "[1.20.4,)" +ordering = "NONE" +side = "BOTH" + +[[dependencies.playerplates]] +modId = "architectury" +required = true +versionRange = "[11.0.10,)" +ordering = "AFTER" +side = "BOTH" \ No newline at end of file diff --git a/neoforge/src/main/resources/pack.mcmeta b/neoforge/src/main/resources/pack.mcmeta new file mode 100644 index 0000000..7e89d48 --- /dev/null +++ b/neoforge/src/main/resources/pack.mcmeta @@ -0,0 +1,6 @@ +{ + "pack": { + "description": "Example Mod", + "pack_format": 9 + } +} diff --git a/settings.gradle b/settings.gradle index 32ca643..013c737 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,5 +1,7 @@ pluginManagement { repositories { + maven { url "https://maven.wuffs.wtf/releases" } + maven { url "https://maven.neomc.dev/releases" } maven { url "https://maven.fabricmc.net/" } maven { url "https://maven.architectury.dev/" } maven { url "https://maven.minecraftforge.net/" } @@ -10,5 +12,6 @@ pluginManagement { include("common") include("fabric") include("forge") +include("neoforge") rootProject.name = "PlayerPlates"