diff --git a/.gitignore b/.gitignore old mode 100755 new mode 100644 index 823aca8..ccb0c56 --- a/.gitignore +++ b/.gitignore @@ -1,25 +1,19 @@ -# gradle - -.gradle/ -out/ -classes/ build/ - -# idea - -.idea/ -*.iml *.ipr +run/ *.iws - -# vscode - -.settings/ -.vscode/ +out/ +*.iml +.gradle/ +output/ bin/ +libs/ + .classpath .project - -# fabric - -run/ \ No newline at end of file +.idea/ +classes/ +.metadata +.vscode +.settings +*.launch \ No newline at end of file diff --git a/build.gradle b/build.gradle old mode 100755 new mode 100644 index 387d307..c5d41c7 --- a/build.gradle +++ b/build.gradle @@ -1,84 +1,58 @@ plugins { - id 'fabric-loom' version '0.12-SNAPSHOT' - id 'maven-publish' + id "architectury-plugin" version "3.4-SNAPSHOT" + id "dev.architectury.loom" version "1.0-SNAPSHOT" apply false } -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 - -archivesBaseName = project.archives_base_name -version = project.mod_version -group = project.maven_group +architectury { + injectInjectables = false + minecraft = rootProject.minecraft_version +} repositories { - maven { - url = "https://api.modrinth.com/maven" - } + maven { + url = "https://api.modrinth.com/maven" + } } -dependencies { - //to change the versions see the gradle.properties file - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" +subprojects { + apply plugin: "dev.architectury.loom" - modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + loom { + silentMojangMappingsLicense() + } - modImplementation "maven.modrinth:midnightlib:${project.midnightlib_version}" - include "maven.modrinth:midnightlib:${project.midnightlib_version}" + dependencies { + minecraft "com.mojang:minecraft:${rootProject.minecraft_version}" + // The following line declares the mojmap mappings, you may use other mappings as well + //mappings loom.officialMojangMappings() + // The following line declares the yarn mappings you may select this one as well. + mappings "net.fabricmc:yarn:1.19.2+build.3:v2" + } } -processResources { - inputs.property "version", project.version +allprojects { + apply plugin: "java" + apply plugin: "architectury-plugin" + apply plugin: "maven-publish" - filesMatching("fabric.mod.json") { - expand "version": project.version - } -} - -tasks.withType(JavaCompile).configureEach { - // ensure that the encoding is set to UTF-8, no matter what the system default is - // this fixes some edge cases with special characters not displaying correctly - // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html - // If Javadoc is generated, this must be specified in that task too. - it.options.encoding = "UTF-8" - - // Minecraft 1.17 (21w19a) upwards uses Java 16. - it.options.release = 17 -} - -java { - // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task - // if it is present. - // If you remove this line, sources will not be generated. - withSourcesJar() -} - -jar { - from("LICENSE") { - rename { "${it}_${project.archivesBaseName}"} - } -} - -// configure the maven publication -publishing { - publications { - mavenJava(MavenPublication) { - // add all the jars that should be included when publishing to maven - artifact(remapJar) { - builtBy remapJar - } - artifact(sourcesJar) { - builtBy remapSourcesJar - } - } - } - - // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. - repositories { - // Add repositories to publish to here. - // Notice: This block does NOT have the same function as the block in the top level. - // The repositories here will be used for publishing your artifact, not for - // retrieving dependencies. - } + archivesBaseName = rootProject.archives_base_name + version = rootProject.mod_version + group = rootProject.maven_group + + repositories { + // Add repositories to retrieve artifacts from in here. + // You should only use this when depending on other mods because + // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. + // See https://docs.gradle.org/current/userguide/declaring_repositories.html + // for more information about repositories. + } + + tasks.withType(JavaCompile) { + options.encoding = "UTF-8" + options.release = 17 + } + + java { + withSourcesJar() + } } diff --git a/common/build.gradle b/common/build.gradle new file mode 100644 index 0000000..8795389 --- /dev/null +++ b/common/build.gradle @@ -0,0 +1,34 @@ +architectury { + injectInjectables = false + common(rootProject.enabled_platforms.split(",")) +} + +loom { +} +repositories { + maven { url "https://api.modrinth.com/maven" } +} + +dependencies { + // We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies + // Do NOT use other classes from fabric loader + modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" + modCompileOnlyApi "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-fabric" + + // Remove the next line if you don't want to depend on the API + modApi "dev.architectury:architectury:${rootProject.architectury_version}" +} + +publishing { + publications { + mavenCommon(MavenPublication) { + artifactId = rootProject.archives_base_name + from components.java + } + } + + // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. + repositories { + // Add repositories to publish to here. + } +} diff --git a/common/src/main/java/eu/midnightdust/cullleaves/CullLeavesClient.java b/common/src/main/java/eu/midnightdust/cullleaves/CullLeavesClient.java new file mode 100755 index 0000000..7ee8275 --- /dev/null +++ b/common/src/main/java/eu/midnightdust/cullleaves/CullLeavesClient.java @@ -0,0 +1,10 @@ +package eu.midnightdust.cullleaves; + +import eu.midnightdust.cullleaves.config.CullLeavesConfig; + +public class CullLeavesClient { + + public static void onInitializeClient() { + CullLeavesConfig.init("cullleaves", CullLeavesConfig.class); + } +} diff --git a/src/main/java/eu/midnightdust/cullleaves/config/CullLeavesConfig.java b/common/src/main/java/eu/midnightdust/cullleaves/config/CullLeavesConfig.java similarity index 100% rename from src/main/java/eu/midnightdust/cullleaves/config/CullLeavesConfig.java rename to common/src/main/java/eu/midnightdust/cullleaves/config/CullLeavesConfig.java diff --git a/src/main/java/eu/midnightdust/cullleaves/mixin/MixinLeavesBlock.java b/common/src/main/java/eu/midnightdust/cullleaves/mixin/MixinLeavesBlock.java similarity index 100% rename from src/main/java/eu/midnightdust/cullleaves/mixin/MixinLeavesBlock.java rename to common/src/main/java/eu/midnightdust/cullleaves/mixin/MixinLeavesBlock.java diff --git a/common/src/main/resources/architectury.common.json b/common/src/main/resources/architectury.common.json new file mode 100644 index 0000000..7a73a41 --- /dev/null +++ b/common/src/main/resources/architectury.common.json @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/src/main/resources/assets/cullleaves/icon.png b/common/src/main/resources/assets/cullleaves/icon.png similarity index 100% rename from src/main/resources/assets/cullleaves/icon.png rename to common/src/main/resources/assets/cullleaves/icon.png diff --git a/src/main/resources/assets/cullleaves/lang/en_us.json b/common/src/main/resources/assets/cullleaves/lang/en_us.json similarity index 100% rename from src/main/resources/assets/cullleaves/lang/en_us.json rename to common/src/main/resources/assets/cullleaves/lang/en_us.json diff --git a/src/main/resources/assets/cullleaves/lang/pt_br.json b/common/src/main/resources/assets/cullleaves/lang/pt_br.json similarity index 100% rename from src/main/resources/assets/cullleaves/lang/pt_br.json rename to common/src/main/resources/assets/cullleaves/lang/pt_br.json diff --git a/src/main/resources/assets/cullleaves/lang/ru_ru.json b/common/src/main/resources/assets/cullleaves/lang/ru_ru.json similarity index 100% rename from src/main/resources/assets/cullleaves/lang/ru_ru.json rename to common/src/main/resources/assets/cullleaves/lang/ru_ru.json diff --git a/src/main/resources/cullleaves.mixins.json b/common/src/main/resources/cullleaves.mixins.json old mode 100755 new mode 100644 similarity index 74% rename from src/main/resources/cullleaves.mixins.json rename to common/src/main/resources/cullleaves.mixins.json index 32a524a..19cd774 --- a/src/main/resources/cullleaves.mixins.json +++ b/common/src/main/resources/cullleaves.mixins.json @@ -1,11 +1,13 @@ -{ - "required": true, - "package": "eu.midnightdust.cullleaves.mixin", - "compatibilityLevel": "JAVA_8", - "client": [ - "MixinLeavesBlock" - ], - "injectors": { - "defaultRequire": 1 - } +{ + "required": true, + "package": "eu.midnightdust.cullleaves.mixin", + "compatibilityLevel": "JAVA_17", + "client": [ + "MixinLeavesBlock" + ], + "mixins": [ + ], + "injectors": { + "defaultRequire": 1 + } } \ No newline at end of file diff --git a/src/main/resources/resourcepacks/smartleaves/assets/minecraft/models/block/leaves.json b/common/src/main/resources/resourcepacks/smartleaves/assets/minecraft/models/block/leaves.json similarity index 100% rename from src/main/resources/resourcepacks/smartleaves/assets/minecraft/models/block/leaves.json rename to common/src/main/resources/resourcepacks/smartleaves/assets/minecraft/models/block/leaves.json diff --git a/src/main/resources/resourcepacks/smartleaves/license.txt b/common/src/main/resources/resourcepacks/smartleaves/license.txt similarity index 100% rename from src/main/resources/resourcepacks/smartleaves/license.txt rename to common/src/main/resources/resourcepacks/smartleaves/license.txt diff --git a/src/main/resources/resourcepacks/smartleaves/pack.mcmeta b/common/src/main/resources/resourcepacks/smartleaves/pack.mcmeta similarity index 100% rename from src/main/resources/resourcepacks/smartleaves/pack.mcmeta rename to common/src/main/resources/resourcepacks/smartleaves/pack.mcmeta diff --git a/src/main/resources/resourcepacks/smartleaves/pack.png b/common/src/main/resources/resourcepacks/smartleaves/pack.png similarity index 100% rename from src/main/resources/resourcepacks/smartleaves/pack.png rename to common/src/main/resources/resourcepacks/smartleaves/pack.png diff --git a/fabric-like/build.gradle b/fabric-like/build.gradle new file mode 100644 index 0000000..e73e3f4 --- /dev/null +++ b/fabric-like/build.gradle @@ -0,0 +1,16 @@ +architectury { + injectInjectables = false + common(rootProject.enabled_platforms.split(",")) +} + +loom { +} + +dependencies { + modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" + modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}" + // Remove the next line if you don't want to depend on the API + modApi "dev.architectury:architectury-fabric:${rootProject.architectury_version}" + + compileClasspath(project(path: ":common", configuration: "namedElements")) { transitive false } +} diff --git a/fabric/build.gradle b/fabric/build.gradle new file mode 100644 index 0000000..1b86738 --- /dev/null +++ b/fabric/build.gradle @@ -0,0 +1,88 @@ +plugins { + id "com.github.johnrengelman.shadow" version "7.1.2" +} + +architectury { + injectInjectables = false + platformSetupLoomIde() + fabric() +} + +loom { +} +repositories { + maven { url "https://api.modrinth.com/maven" } +} + +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 + developmentFabric.extendsFrom common +} + +dependencies { + modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" + modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}" + // Remove the next line if you don't want to depend on the API + //modApi "dev.architectury:architectury-fabric:${rootProject.architectury_version}" + modImplementation "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-fabric" + include "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-fabric" + + common(project(path: ":common", configuration: "namedElements")) { transitive false } + shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false } + common(project(path: ":fabric-like", configuration: "namedElements")) { transitive false } + shadowCommon(project(path: ":fabric-like", configuration: "transformProductionFabric")) { transitive false } +} + +processResources { + inputs.property "version", project.version + + filesMatching("fabric.mod.json") { + expand "version": project.version + } +} + +shadowJar { + exclude "architectury.common.json" + + configurations = [project.configurations.shadowCommon] + classifier "dev-shadow" +} + +remapJar { + input.set shadowJar.archiveFile + dependsOn shadowJar + classifier null +} + +jar { + classifier "dev" +} + +sourcesJar { + def commonSources = project(":common").sourcesJar + dependsOn commonSources + from commonSources.archiveFile.map { zipTree(it) } +} + +components.java { + withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { + skip() + } +} + +publishing { + publications { + mavenFabric(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 { + // Add repositories to publish to here. + } +} diff --git a/src/main/java/eu/midnightdust/cullleaves/CullLeavesClient.java b/fabric/src/main/java/eu/midnightdust/cullleaves/fabric/CullLeavesClientFabric.java old mode 100755 new mode 100644 similarity index 66% rename from src/main/java/eu/midnightdust/cullleaves/CullLeavesClient.java rename to fabric/src/main/java/eu/midnightdust/cullleaves/fabric/CullLeavesClientFabric.java index ced9206..bc20d2f --- a/src/main/java/eu/midnightdust/cullleaves/CullLeavesClient.java +++ b/fabric/src/main/java/eu/midnightdust/cullleaves/fabric/CullLeavesClientFabric.java @@ -1,20 +1,18 @@ -package eu.midnightdust.cullleaves; - -import eu.midnightdust.cullleaves.config.CullLeavesConfig; -import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.fabric.api.resource.ResourceManagerHelper; -import net.fabricmc.fabric.api.resource.ResourcePackActivationType; -import net.fabricmc.loader.ModContainer; -import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.util.Identifier; - -public class CullLeavesClient implements ClientModInitializer { - - public void onInitializeClient() { - CullLeavesConfig.init("cullleaves", CullLeavesConfig.class); - - FabricLoader.getInstance().getModContainer("cullleaves").ifPresent(modContainer -> { - ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("cullleaves:smartleaves"), modContainer, ResourcePackActivationType.NORMAL); - }); - } -} +package eu.midnightdust.cullleaves.fabric; + +import eu.midnightdust.cullleaves.CullLeavesClient; +import net.fabricmc.api.ClientModInitializer; +import net.fabricmc.fabric.api.resource.ResourceManagerHelper; +import net.fabricmc.fabric.api.resource.ResourcePackActivationType; +import net.fabricmc.loader.api.FabricLoader; +import net.minecraft.util.Identifier; + +public class CullLeavesClientFabric implements ClientModInitializer { + @Override + public void onInitializeClient() { + CullLeavesClient.onInitializeClient(); + FabricLoader.getInstance().getModContainer("cullleaves").ifPresent(modContainer -> { + ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("cullleaves:smartleaves"), modContainer, ResourcePackActivationType.NORMAL); + }); + } +} diff --git a/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json old mode 100755 new mode 100644 similarity index 91% rename from src/main/resources/fabric.mod.json rename to fabric/src/main/resources/fabric.mod.json index ddfe397..791e271 --- a/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -21,7 +21,7 @@ "environment": "client", "entrypoints": { "client": [ - "eu.midnightdust.cullleaves.CullLeavesClient" + "eu.midnightdust.cullleaves.fabric.CullLeavesClientFabric" ] }, @@ -33,4 +33,4 @@ "mixins": [ "cullleaves.mixins.json" ] -} +} \ No newline at end of file diff --git a/forge/build.gradle b/forge/build.gradle new file mode 100644 index 0000000..941f077 --- /dev/null +++ b/forge/build.gradle @@ -0,0 +1,89 @@ +plugins { + id "com.github.johnrengelman.shadow" version "7.1.2" +} + +architectury { + injectInjectables = false + platformSetupLoomIde() + forge() +} + +loom { + forge { + mixinConfig "cullleaves.mixins.json" + } +} +repositories { + maven { url "https://api.modrinth.com/maven" } +} + +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 + developmentForge.extendsFrom common +} + +dependencies { + forge "net.minecraftforge:forge:${rootProject.forge_version}" + // Remove the next line if you don't want to depend on the API + //modApi "dev.architectury:architectury-forge:${rootProject.architectury_version}" + modImplementation "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-forge" + include "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-forge" + + common(project(path: ":common", configuration: "namedElements")) { transitive false } + shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { 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] + classifier "dev-shadow" +} + +remapJar { + input.set shadowJar.archiveFile + dependsOn shadowJar + classifier null +} + +jar { + classifier "dev" +} + +sourcesJar { + def commonSources = project(":common").sourcesJar + dependsOn commonSources + from commonSources.archiveFile.map { zipTree(it) } +} + +components.java { + withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { + skip() + } +} + +publishing { + publications { + mavenForge(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 { + // Add repositories to publish to here. + } +} diff --git a/forge/gradle.properties b/forge/gradle.properties new file mode 100644 index 0000000..32f842a --- /dev/null +++ b/forge/gradle.properties @@ -0,0 +1 @@ +loom.platform=forge \ No newline at end of file diff --git a/forge/src/main/java/eu/midnightdust/cullleaves/forge/CullLeavesClientForge.java b/forge/src/main/java/eu/midnightdust/cullleaves/forge/CullLeavesClientForge.java new file mode 100644 index 0000000..c486fc3 --- /dev/null +++ b/forge/src/main/java/eu/midnightdust/cullleaves/forge/CullLeavesClientForge.java @@ -0,0 +1,16 @@ +package eu.midnightdust.cullleaves.forge; + +import eu.midnightdust.cullleaves.CullLeavesClient; +import eu.midnightdust.lib.config.MidnightConfig; +import net.minecraftforge.client.ConfigScreenHandler; +import net.minecraftforge.fml.ModLoadingContext; +import net.minecraftforge.fml.common.Mod; + +@Mod("cullleaves") +public class CullLeavesClientForge { + public CullLeavesClientForge() { + CullLeavesClient.onInitializeClient(); + ModLoadingContext.get().registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class, () -> + new ConfigScreenHandler.ConfigScreenFactory((client, parent) -> MidnightConfig.getScreen(parent, "cullleaves"))); + } +} diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml new file mode 100644 index 0000000..7638c79 --- /dev/null +++ b/forge/src/main/resources/META-INF/mods.toml @@ -0,0 +1,35 @@ +modLoader = "javafml" +loaderVersion = "[43,)" +#issueTrackerURL = "" +license = "MIT" + +[[mods]] +modId = "cullleaves" +version = "${version}" +displayName = "CullLeaves" +authors = "Motschen, TeamMidnightDust" +description = ''' +Adds culling to leaf blocks, providing a huge performance boost over vanilla. +''' +logoFile = "icon.png" + +[[dependencies.cullleaves]] +modId = "forge" +mandatory = true +versionRange = "[43,)" +ordering = "NONE" +side = "CLIENT" + +[[dependencies.cullleaves]] +modId = "minecraft" +mandatory = true +versionRange = "[1.19.2,)" +ordering = "NONE" +side = "CLIENT" + +[[dependencies.cullleaves]] +modId = "midnightlib" +mandatory = true +versionRange = "[1.0.0,)" +ordering = "NONE" +side = "CLIENT" \ No newline at end of file diff --git a/forge/src/main/resources/icon.png b/forge/src/main/resources/icon.png new file mode 100755 index 0000000..8b0898f Binary files /dev/null and b/forge/src/main/resources/icon.png differ diff --git a/forge/src/main/resources/pack.mcmeta b/forge/src/main/resources/pack.mcmeta new file mode 100644 index 0000000..5cae9ae --- /dev/null +++ b/forge/src/main/resources/pack.mcmeta @@ -0,0 +1,6 @@ +{ + "pack": { + "description": "CullLeaves", + "pack_format": 9 + } +} diff --git a/gradle.properties b/gradle.properties old mode 100755 new mode 100644 index e14cc55..9f9b861 --- a/gradle.properties +++ b/gradle.properties @@ -1,18 +1,19 @@ -# Done to increase the memory available to gradle. -org.gradle.jvmargs=-Xmx1G +org.gradle.jvmargs=-Xmx4096M -# Fabric Properties - # check these on https://fabricmc.net/use - minecraft_version=1.19-rc2 - yarn_mappings=1.19-rc2+build.1 - loader_version=0.14.6 +minecraft_version=1.19.2 +enabled_platforms=quilt,fabric,forge -# Mod Properties - mod_version = 2.3.4 - maven_group = eu.midnightdust - archives_base_name = cullleaves +archives_base_name=cullleaves +mod_version=3.0.0 +maven_group=eu.midnightdust -# 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.55.1+1.19 - midnightlib_version=0.5.2 +architectury_version=6.2.43 +midnightlib_version=1.0.0 + +fabric_loader_version=0.14.9 +fabric_api_version=0.59.0+1.19.2 + +forge_version=1.19.2-43.0.8 + +quilt_loader_version=0.17.2-beta.3 +quilt_fabric_api_version=4.0.0-beta.7+0.59.0-1.19.2 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180..249e583 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ffed3a2..ae04661 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-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c787..a69d9cb 100755 --- a/gradlew +++ b/gradlew @@ -205,6 +205,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 107acd3..53a6b23 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,89 +1,91 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/quilt/build.gradle b/quilt/build.gradle new file mode 100644 index 0000000..d8f28aa --- /dev/null +++ b/quilt/build.gradle @@ -0,0 +1,96 @@ +plugins { + id "com.github.johnrengelman.shadow" version "7.1.2" +} + +repositories { + maven { url "https://maven.quiltmc.org/repository/release/" } + maven { url "https://api.modrinth.com/maven" } +} + +architectury { + injectInjectables = false + platformSetupLoomIde() + loader("quilt") +} + +loom { +} + +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 + developmentQuilt.extendsFrom common +} + +dependencies { + modImplementation "org.quiltmc:quilt-loader:${rootProject.quilt_loader_version}" + modApi "org.quiltmc.quilted-fabric-api:quilted-fabric-api:${rootProject.quilt_fabric_api_version}" + // Remove the next few lines if you don't want to depend on the API + //modApi("dev.architectury:architectury-fabric:${rootProject.architectury_version}") { + // // We must not pull Fabric Loader from Architectury Fabric + // exclude group: "net.fabricmc" + // exclude group: "net.fabricmc.fabric-api" + //} + modImplementation "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-quilt" + include "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-quilt" + + common(project(path: ":common", configuration: "namedElements")) { transitive false } + shadowCommon(project(path: ":common", configuration: "transformProductionQuilt")) { transitive false } + common(project(path: ":fabric-like", configuration: "namedElements")) { transitive false } + shadowCommon(project(path: ":fabric-like", configuration: "transformProductionQuilt")) { transitive false } +} + +processResources { + inputs.property "group", rootProject.maven_group + inputs.property "version", project.version + + filesMatching("quilt.mod.json") { + expand "group": rootProject.maven_group, + "version": project.version + } +} + +shadowJar { + exclude "architectury.common.json" + + configurations = [project.configurations.shadowCommon] + classifier "dev-shadow" +} + +remapJar { + input.set shadowJar.archiveFile + dependsOn shadowJar + classifier null +} + +jar { + classifier "dev" +} + +sourcesJar { + def commonSources = project(":common").sourcesJar + dependsOn commonSources + from commonSources.archiveFile.map { zipTree(it) } +} + +components.java { + withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { + skip() + } +} + +publishing { + publications { + mavenQuilt(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 { + // Add repositories to publish to here. + } +} diff --git a/quilt/gradle.properties b/quilt/gradle.properties new file mode 100644 index 0000000..96758ce --- /dev/null +++ b/quilt/gradle.properties @@ -0,0 +1 @@ +loom.platform=quilt \ No newline at end of file diff --git a/quilt/src/main/java/eu/midnightdust/cullleaves/quilt/CullLeavesClientQuilt.java b/quilt/src/main/java/eu/midnightdust/cullleaves/quilt/CullLeavesClientQuilt.java new file mode 100644 index 0000000..df34141 --- /dev/null +++ b/quilt/src/main/java/eu/midnightdust/cullleaves/quilt/CullLeavesClientQuilt.java @@ -0,0 +1,16 @@ +package eu.midnightdust.cullleaves.quilt; + +import eu.midnightdust.cullleaves.CullLeavesClient; +import net.minecraft.util.Identifier; +import org.quiltmc.loader.api.ModContainer; +import org.quiltmc.qsl.base.api.entrypoint.client.ClientModInitializer; +import org.quiltmc.qsl.resource.loader.api.ResourceLoader; +import org.quiltmc.qsl.resource.loader.api.ResourcePackActivationType; + +public class CullLeavesClientQuilt implements ClientModInitializer { + @Override + public void onInitializeClient(ModContainer mod) { + CullLeavesClient.onInitializeClient(); + ResourceLoader.registerBuiltinResourcePack(new Identifier("cullleaves:smartleaves"), mod, ResourcePackActivationType.NORMAL); + } +} diff --git a/quilt/src/main/resources/quilt.mod.json b/quilt/src/main/resources/quilt.mod.json new file mode 100644 index 0000000..ad6d33b --- /dev/null +++ b/quilt/src/main/resources/quilt.mod.json @@ -0,0 +1,59 @@ +{ + "schema_version": 1, + "quilt_loader": { + "group": "${group}", + "id": "cullleaves", + "version": "${version}", + "name": "Cull Leaves", + "description": "Adds culling to leaf blocks, providing a huge performance boost over vanilla.", + "authors": [ + "Motschen", + "TeamMidnightDust" + ], + "contact": { + "homepage": "https://www.midnightdust.eu/", + "sources": "https://github.com/TeamMidnightDust/MidnightLib", + "issues": "https://github.com/TeamMidnightDust/MidnightLib/issues" + }, + "license": "MIT", + "icon": "assets/cullleaves/icon.png", + "intermediate_mappings": "net.fabricmc:intermediary", + "environment": "*", + "entrypoints": { + "client_init": [ + "eu.midnightdust.cullleaves.quilt.CullLeavesClientQuilt" + ] + }, + "depends": [ + { + "id": "quilt_loader", + "version": "*" + }, + { + "id": "quilt_base", + "version": "*" + }, + { + "id": "midnightlib", + "version": "*" + } + ], + "metadata": { + "name": "Cull Leaves (Quilt)", + "contributors": { + "Motschen": "Author", + "TeamMidnightDust": "Mascot" + }, + "contact": { + "email": "mail@midnightdust.eu", + "homepage": "https://modrinth.com/mod/cullleaves", + "issues": "https://github.com/TeamMidnightDust/CullLeaves/issues", + "sources": "https://github.com/TeamMidnightDust/CullLeaves" + }, + "icon": "assets/cullleaves/icon.png" + } + }, + "mixin": [ + "cullleaves.mixins.json" + ] +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle old mode 100755 new mode 100644 index 5b60df3..231e72f --- a/settings.gradle +++ b/settings.gradle @@ -1,10 +1,16 @@ pluginManagement { repositories { - jcenter() - maven { - name = 'Fabric' - url = 'https://maven.fabricmc.net/' - } + maven { url "https://maven.fabricmc.net/" } + maven { url "https://maven.architectury.dev/" } + maven { url "https://maven.minecraftforge.net/" } gradlePluginPortal() } } + +include("common") +include("fabric-like") +include("fabric") +include("quilt") +include("forge") + +rootProject.name = "cullleaves"