mirror of
https://github.com/TeamMidnightDust/CullLeaves.git
synced 2025-12-15 14:15:08 +01:00
Compare commits
61 Commits
v2.1.0
...
8d1dec071b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d1dec071b | ||
|
|
673a936bf7 | ||
|
|
e4113eac7c | ||
|
|
3d7ede7725 | ||
|
|
084c892e44 | ||
|
|
ff60cf4873 | ||
|
|
7b4ecdc4e9 | ||
|
|
0d191e2888 | ||
|
|
eef6c2aca0 | ||
|
|
c0cdc982e7 | ||
|
|
796c2f246b | ||
|
|
e8b62d24e1 | ||
|
|
766693070a | ||
|
|
57613f465d | ||
|
|
6c399af13a | ||
|
|
13a6710ee1 | ||
|
|
b8d2e6b4ab | ||
|
|
5a3f687ae6 | ||
|
|
c555df0f4d | ||
|
|
4afbe3d740 | ||
|
|
3ac34a6f9b | ||
|
|
1ad05aa6bf | ||
|
|
3e24b1ac0a | ||
|
|
849e089ff2 | ||
|
|
f3fb019bca | ||
|
|
41a4ddf633 | ||
|
|
1877e7d65d | ||
|
|
2f89a3a0db | ||
|
|
41efe55ea6 | ||
|
|
6c3f8f369e | ||
|
|
a293fdaeb3 | ||
|
|
5177f4897f | ||
|
|
74f2efbc88 | ||
|
|
054f6f35e4 | ||
|
|
e4fbd0a8f5 | ||
|
|
61e167198a | ||
|
|
4f70a32bee | ||
|
|
a979e760c7 | ||
|
|
d2b8a9dda5 | ||
|
|
87fb2c8ed7 | ||
|
|
26fefced39 | ||
|
|
6babf21877 | ||
|
|
5f0cc2f27a | ||
|
|
07ae6f47c0 | ||
|
|
2edfac7537 | ||
|
|
24f654fd67 | ||
|
|
8f2fdb6574 | ||
|
|
54e6d69456 | ||
|
|
9e5ff1cb94 | ||
|
|
102f0798b1 | ||
|
|
f74a3a1524 | ||
|
|
3cfcc46321 | ||
|
|
d5b1196751 | ||
|
|
887303f27f | ||
|
|
57a675b038 | ||
|
|
b9f0eeaacb | ||
|
|
e13f28af5c | ||
|
|
b0953e80fe | ||
|
|
8c6b995c46 | ||
|
|
2179c3eb05 | ||
|
|
628335048b |
33
.gitignore
vendored
33
.gitignore
vendored
@@ -1,25 +1,20 @@
|
||||
# gradle
|
||||
|
||||
.gradle/
|
||||
out/
|
||||
classes/
|
||||
build/
|
||||
|
||||
# idea
|
||||
|
||||
.idea/
|
||||
*.iml
|
||||
*.ipr
|
||||
run/
|
||||
*.iws
|
||||
|
||||
# vscode
|
||||
|
||||
.settings/
|
||||
.vscode/
|
||||
out/
|
||||
*.iml
|
||||
.gradle/
|
||||
output/
|
||||
bin/
|
||||
libs/
|
||||
.architectury-transformer/
|
||||
|
||||
.classpath
|
||||
.project
|
||||
|
||||
# fabric
|
||||
|
||||
run/
|
||||
.idea/
|
||||
classes/
|
||||
.metadata
|
||||
.vscode
|
||||
.settings
|
||||
*.launch
|
||||
0
CHANGELOG.md
Normal file
0
CHANGELOG.md
Normal file
84
build.gradle
84
build.gradle
@@ -1,84 +0,0 @@
|
||||
plugins {
|
||||
id 'fabric-loom' version '0.5-SNAPSHOT'
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
archivesBaseName = project.archives_base_name
|
||||
version = project.mod_version
|
||||
group = project.maven_group
|
||||
|
||||
minecraft {
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven { url "https://jitpack.io" }
|
||||
}
|
||||
|
||||
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"
|
||||
modCompile "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||
|
||||
modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||
|
||||
modImplementation ("io.github.prospector:modmenu:${project.mod_menu_version}"){
|
||||
exclude module: "fabric-api"
|
||||
}
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include "fabric.mod.json"
|
||||
expand "version": project.version
|
||||
}
|
||||
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude "fabric.mod.json"
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
|
||||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
||||
// if it is present.
|
||||
// If you remove this task, sources will not be generated.
|
||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||
classifier = "sources"
|
||||
from sourceSets.main.allSource
|
||||
}
|
||||
|
||||
jar {
|
||||
from "LICENSE"
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// select the repositories you want to publish to
|
||||
repositories {
|
||||
// uncomment to publish to the local maven
|
||||
// mavenLocal()
|
||||
}
|
||||
}
|
||||
237
build.gradle.kts
Normal file
237
build.gradle.kts
Normal file
@@ -0,0 +1,237 @@
|
||||
plugins {
|
||||
id("dev.architectury.loom")
|
||||
id("architectury-plugin")
|
||||
id("me.modmuss50.mod-publish-plugin")
|
||||
id("com.github.johnrengelman.shadow")
|
||||
`maven-publish`
|
||||
}
|
||||
|
||||
val minecraft = stonecutter.current.version
|
||||
val loader = loom.platform.get().name.lowercase()
|
||||
|
||||
version = "${mod.version}+$minecraft"
|
||||
group = mod.group
|
||||
base {
|
||||
archivesName.set("${mod.id}-$loader")
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven("https://maven.neoforged.net/releases/")
|
||||
maven("https://api.modrinth.com/maven")
|
||||
|
||||
// modmenu
|
||||
maven("https://maven.terraformersmc.com/")
|
||||
maven("https://maven.nucleoid.xyz/")
|
||||
|
||||
// MidnightLib
|
||||
maven("https://maven.midnightdust.eu/snapshots/")
|
||||
}
|
||||
dependencies {
|
||||
minecraft("com.mojang:minecraft:$minecraft")
|
||||
|
||||
// MidnightLib
|
||||
modImplementation ("eu.midnightdust:midnightlib:${mod.dep("midnightlib_version")}+${minecraft}-${loader}")
|
||||
|
||||
if (loader == "fabric") {
|
||||
modImplementation("net.fabricmc:fabric-loader:${mod.dep("fabric_loader")}")
|
||||
modImplementation("net.fabricmc.fabric-api:fabric-api:${mod.dep("fabric_version")}")
|
||||
|
||||
modCompileOnly("maven.modrinth:sodium:${mod.dep("sodium_version")}-fabric")
|
||||
}
|
||||
if (loader == "forge") {
|
||||
"forge"("net.minecraftforge:forge:${minecraft}-${mod.dep("forge_loader")}")
|
||||
|
||||
modCompileOnly("maven.modrinth:xenon-forge:0.3.31")
|
||||
}
|
||||
if (loader == "neoforge") {
|
||||
"neoForge"("net.neoforged:neoforge:${mod.dep("neoforge_loader")}")
|
||||
modCompileOnly("maven.modrinth:sodium:${mod.dep("sodium_version")}-neoforge")
|
||||
}
|
||||
mappings (loom.officialMojangMappings())
|
||||
}
|
||||
|
||||
loom {
|
||||
//accessWidenerPath = rootProject.file("src/main/resources/template.accesswidener")
|
||||
|
||||
decompilers {
|
||||
get("vineflower").apply { // Adds names to lambdas - useful for mixins
|
||||
options.put("mark-corresponding-synthetics", "1")
|
||||
}
|
||||
}
|
||||
if (loader == "forge") {
|
||||
forge.mixinConfigs("cullleaves.mixins.json", "cullleaves-neoforge.mixins.json")
|
||||
}
|
||||
}
|
||||
|
||||
publishMods {
|
||||
val modrinthToken = System.getenv("MODRINTH_TOKEN")
|
||||
val curseforgeToken = System.getenv("CURSEFORGE_TOKEN")
|
||||
val githubToken = System.getenv("GITHUB_TOKEN").orEmpty()
|
||||
|
||||
file = project.tasks.remapJar.get().archiveFile
|
||||
dryRun = modrinthToken == null || curseforgeToken == null
|
||||
|
||||
displayName = "${mod.name} ${loader.replaceFirstChar { it.uppercase() }} ${property("mod.mc_title")}-${mod.version}"
|
||||
version = mod.version
|
||||
changelog = rootProject.file("CHANGELOG.md").readText()
|
||||
type = BETA
|
||||
|
||||
modLoaders.add(loader)
|
||||
|
||||
val targets = property("mod.mc_targets").toString().split(' ')
|
||||
modrinth {
|
||||
projectId = property("publish.modrinth").toString()
|
||||
accessToken = modrinthToken
|
||||
targets.forEach(minecraftVersions::add)
|
||||
if (loader == "fabric") {
|
||||
requires("fabric-api")
|
||||
optional("modmenu")
|
||||
}
|
||||
}
|
||||
|
||||
curseforge {
|
||||
projectId = property("publish.curseforge").toString()
|
||||
accessToken = curseforgeToken.toString()
|
||||
targets.forEach(minecraftVersions::add)
|
||||
if (loader == "fabric") {
|
||||
requires("fabric-api")
|
||||
optional("modmenu")
|
||||
}
|
||||
}
|
||||
|
||||
github {
|
||||
accessToken = githubToken
|
||||
repository = "TeamMidnightDust/CullLeaves"
|
||||
commitish = "multiversion" // This is the branch the release tag will be created from
|
||||
|
||||
tagName = "v" + properties["mod.version"]
|
||||
|
||||
// Allow the release to be initially created without any files.
|
||||
allowEmptyFiles = true
|
||||
}
|
||||
}
|
||||
//publishing {
|
||||
// publications {
|
||||
// create<MavenPublication>("mavenJava") {
|
||||
// pom {
|
||||
// groupId = "eu.midnightdust"
|
||||
// artifactId = "midnightlib"
|
||||
// version = project.version
|
||||
//
|
||||
// from(components["java"])
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
name = "MidnightDust"
|
||||
url = uri("https://maven.midnightdust.eu/snapshots")
|
||||
credentials(PasswordCredentials::class)
|
||||
}
|
||||
}
|
||||
publications {
|
||||
create<MavenPublication>("mavenJava") {
|
||||
pom {
|
||||
groupId = "eu.midnightdust"
|
||||
artifactId = project.mod.id
|
||||
version = "${project.version}-${loader}"
|
||||
|
||||
from(components["java"])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
java {
|
||||
withSourcesJar()
|
||||
val java = if (stonecutter.eval(minecraft, ">=1.20.5")) JavaVersion.VERSION_21 else JavaVersion.VERSION_17
|
||||
targetCompatibility = java
|
||||
sourceCompatibility = java
|
||||
}
|
||||
|
||||
val shadowBundle: Configuration by configurations.creating {
|
||||
isCanBeConsumed = false
|
||||
isCanBeResolved = true
|
||||
}
|
||||
|
||||
tasks.shadowJar {
|
||||
configurations = listOf(shadowBundle)
|
||||
archiveClassifier = "dev-shadow"
|
||||
}
|
||||
|
||||
tasks.remapJar {
|
||||
injectAccessWidener = true
|
||||
input = tasks.shadowJar.get().archiveFile
|
||||
archiveClassifier = null
|
||||
dependsOn(tasks.shadowJar)
|
||||
}
|
||||
|
||||
tasks.jar {
|
||||
archiveClassifier = "dev"
|
||||
}
|
||||
|
||||
val buildAndCollect = tasks.register<Copy>("buildAndCollect") {
|
||||
group = "build"
|
||||
from(tasks.remapJar.get().archiveFile, tasks.remapSourcesJar.get().archiveFile)
|
||||
into(rootProject.layout.buildDirectory.file("libs/${mod.version}/$loader"))
|
||||
dependsOn("build")
|
||||
}
|
||||
|
||||
if (stonecutter.current.isActive) {
|
||||
rootProject.tasks.register("buildActive") {
|
||||
group = "project"
|
||||
dependsOn(buildAndCollect)
|
||||
}
|
||||
|
||||
rootProject.tasks.register("runActive") {
|
||||
group = "project"
|
||||
dependsOn(tasks.named("runClient"))
|
||||
}
|
||||
}
|
||||
|
||||
tasks.processResources {
|
||||
properties(
|
||||
listOf("fabric.mod.json"),
|
||||
"id" to mod.id,
|
||||
"name" to mod.name,
|
||||
"version" to mod.version,
|
||||
"minecraft" to mod.prop("mc_dep_fabric")
|
||||
)
|
||||
properties(
|
||||
listOf("META-INF/mods.toml", "pack.mcmeta"),
|
||||
"id" to mod.id,
|
||||
"name" to mod.name,
|
||||
"version" to mod.version,
|
||||
"minecraft" to mod.prop("mc_dep_forgelike")
|
||||
)
|
||||
properties(
|
||||
listOf("META-INF/neoforge.mods.toml", "pack.mcmeta"),
|
||||
"id" to mod.id,
|
||||
"name" to mod.name,
|
||||
"version" to mod.version,
|
||||
"minecraft" to mod.prop("mc_dep_forgelike")
|
||||
)
|
||||
}
|
||||
|
||||
tasks.build {
|
||||
group = "versioned"
|
||||
description = "Must run through 'chiseledBuild'"
|
||||
}
|
||||
|
||||
|
||||
stonecutter {
|
||||
constants {
|
||||
arrayOf("fabric", "neoforge", "forge").forEach { it -> put(it, loader == it) }
|
||||
}
|
||||
replacements.string {
|
||||
direction = eval(current.version, ">=1.21")
|
||||
replace("new ResourceLocation", "ResourceLocation.fromNamespaceAndPath")
|
||||
}
|
||||
replacements.string {
|
||||
direction = eval(current.version, ">=1.21")
|
||||
replace("me.jellysquid.mods.sodium", "net.caffeinemc.mods.sodium")
|
||||
}
|
||||
}
|
||||
8
buildSrc/build.gradle.kts
Normal file
8
buildSrc/build.gradle.kts
Normal file
@@ -0,0 +1,8 @@
|
||||
plugins {
|
||||
`kotlin-dsl`
|
||||
kotlin("jvm") version "2.0.20"
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
33
buildSrc/src/main/kotlin/build-extensions.kt
Normal file
33
buildSrc/src/main/kotlin/build-extensions.kt
Normal file
@@ -0,0 +1,33 @@
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.artifacts.dsl.RepositoryHandler
|
||||
import org.gradle.kotlin.dsl.expand
|
||||
import org.gradle.kotlin.dsl.maven
|
||||
import org.gradle.language.jvm.tasks.ProcessResources
|
||||
import java.util.*
|
||||
|
||||
val Project.mod: ModData get() = ModData(this)
|
||||
fun Project.prop(key: String): String? = findProperty(key)?.toString()
|
||||
fun String.upperCaseFirst() = replaceFirstChar { if (it.isLowerCase()) it.uppercaseChar() else it }
|
||||
|
||||
fun RepositoryHandler.strictMaven(url: String, alias: String, vararg groups: String) = exclusiveContent {
|
||||
forRepository { maven(url) { name = alias } }
|
||||
filter { groups.forEach(::includeGroup) }
|
||||
}
|
||||
|
||||
fun ProcessResources.properties(files: Iterable<String>, vararg properties: Pair<String, Any>) {
|
||||
for ((name, value) in properties) inputs.property(name, value)
|
||||
filesMatching(files) {
|
||||
expand(properties.toMap())
|
||||
}
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
value class ModData(private val project: Project) {
|
||||
val id: String get() = requireNotNull(project.prop("mod.id")) { "Missing 'mod.id'" }
|
||||
val name: String get() = requireNotNull(project.prop("mod.name")) { "Missing 'mod.name'" }
|
||||
val version: String get() = requireNotNull(project.prop("mod.version")) { "Missing 'mod.version'" }
|
||||
val group: String get() = requireNotNull(project.prop("mod.group")) { "Missing 'mod.group'" }
|
||||
|
||||
fun prop(key: String) = requireNotNull(project.prop("mod.$key")) { "Missing 'mod.$key'" }
|
||||
fun dep(key: String) = requireNotNull(project.prop("deps.$key")) { "Missing 'deps.$key'" }
|
||||
}
|
||||
@@ -1,19 +1,37 @@
|
||||
# Done to increase the memory available to gradle.
|
||||
org.gradle.jvmargs=-Xmx1G
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
#org.gradle.parallel=true
|
||||
org.gradle.caching=false
|
||||
org.gradle.caching.debug=false
|
||||
org.gradle.parallel=false
|
||||
#org.gradle.configureondemand=true
|
||||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/use
|
||||
minecraft_version=1.16.5
|
||||
yarn_mappings=1.16.5+build.5
|
||||
loader_version=0.11.2
|
||||
# Mod properties
|
||||
mod.version=4.1.0
|
||||
mod.group=eu.midnightdust
|
||||
mod.id=cullleaves
|
||||
mod.name=CullLeaves
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 2.1.0
|
||||
maven_group = eu.midnightdust
|
||||
archives_base_name = cullleaves
|
||||
# Used for the mod metadata
|
||||
mod.mc_dep_fabric=[VERSIONED]
|
||||
mod.mc_dep_forgelike=[VERSIONED]
|
||||
# Used for the release title. I.e. '1.20.x'
|
||||
mod.mc_title=[VERSIONED]
|
||||
# Space separated versions for publishing. I.e. '1.20, 1.20.1'
|
||||
mod.mc_targets=[VERSIONED]
|
||||
|
||||
# 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.31.0+1.16
|
||||
|
||||
mod_menu_version = 1.14.6+build.31
|
||||
# Mod setup
|
||||
deps.fabric_loader=0.17.3
|
||||
deps.fabric_version=[VERSIONED]
|
||||
|
||||
deps.forge_loader=[VERSIONED]
|
||||
deps.neoforge_loader=[VERSIONED]
|
||||
deps.neoforge_patch=[VERSIONED]
|
||||
|
||||
# Mod dependencies
|
||||
deps.midnightlib_version=1.9.0-alpha.1
|
||||
deps.sodium_version=mc1.21.8-0.7.0
|
||||
|
||||
# Publishing
|
||||
publish.modrinth=GNxdLCoP
|
||||
publish.curseforge=423254
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
286
gradlew
vendored
Normal file → Executable file
286
gradlew
vendored
Normal file → Executable file
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env sh
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -17,78 +17,113 @@
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
@@ -97,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
@@ -105,84 +140,105 @@ location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
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.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
||||
192
gradlew.bat
vendored
192
gradlew.bat
vendored
@@ -1,100 +1,92 @@
|
||||
@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 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 init
|
||||
|
||||
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 init
|
||||
|
||||
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
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
: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 %CMD_LINE_ARGS%
|
||||
|
||||
: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=.
|
||||
@rem This is normally unused
|
||||
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
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
jcenter()
|
||||
maven {
|
||||
name = 'Fabric'
|
||||
url = 'https://maven.fabricmc.net/'
|
||||
}
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
33
settings.gradle.kts
Normal file
33
settings.gradle.kts
Normal file
@@ -0,0 +1,33 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven("https://maven.fabricmc.net/")
|
||||
maven("https://maven.architectury.dev")
|
||||
maven("https://maven.minecraftforge.net")
|
||||
maven("https://maven.neoforged.net/releases/")
|
||||
maven("https://maven.kikugie.dev/snapshots")
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("dev.kikugie.stonecutter") version "0.7"
|
||||
}
|
||||
|
||||
stonecutter {
|
||||
centralScript = "build.gradle.kts"
|
||||
kotlinController = true
|
||||
shared {
|
||||
fun mc(loader: String, vararg versions: String) {
|
||||
for (version in versions) vers("$version-$loader", version)
|
||||
}
|
||||
//i would recommend to use neoforge for mc > 1.20.1, i haven't tested template for forge on versions higher than that
|
||||
mc("fabric","1.20.1", "1.21.1", "1.21.5", "1.21.8", "1.21.10")
|
||||
mc("forge","1.20.1")
|
||||
//WARNING: neoforge uses mods.toml instead of neoforge.mods.toml for versions 1.20.4 (?) and earlier
|
||||
mc("neoforge", "1.21.1", "1.21.5", "1.21.8", "1.21.10")
|
||||
}
|
||||
create(rootProject)
|
||||
}
|
||||
|
||||
rootProject.name = "CullLeaves"
|
||||
@@ -1,18 +1,203 @@
|
||||
package eu.midnightdust.cullleaves;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import eu.midnightdust.cullleaves.config.CullLeavesConfig;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import eu.midnightdust.lib.config.MidnightConfig;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.packs.PackType;
|
||||
|
||||
import net.minecraft.server.packs.resources.ResourceManager;
|
||||
import net.minecraft.server.packs.resources.ResourceManagerReloadListener;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.MangroveRootsBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
//? fabric {
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
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;
|
||||
//? if >= 1.21.9 {
|
||||
import net.fabricmc.fabric.api.resource.v1.ResourceLoader;
|
||||
//?} else {
|
||||
/*import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener;
|
||||
*///?}
|
||||
|
||||
public class CullLeavesClient implements ClientModInitializer {
|
||||
//?} neoforge {
|
||||
/*import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.packs.repository.Pack;
|
||||
import net.minecraft.server.packs.repository.PackSource;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
import net.neoforged.neoforge.event.AddPackFindersEvent;
|
||||
//? if >= 1.21.4 {
|
||||
import net.neoforged.neoforge.client.event.AddClientReloadListenersEvent;
|
||||
//?} else {
|
||||
/^import net.neoforged.neoforge.client.event.RegisterClientReloadListenersEvent;
|
||||
^///?}
|
||||
*///?}
|
||||
|
||||
public void onInitializeClient() {
|
||||
CullLeavesConfig.init("cullleaves", CullLeavesConfig.class);
|
||||
//? forge {
|
||||
/*import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.packs.repository.Pack;
|
||||
import net.minecraft.server.packs.repository.PackSource;
|
||||
|
||||
FabricLoader.getInstance().getModContainer("cullleaves").ifPresent(modContainer -> {
|
||||
ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("cullleaves:smartleaves"), "resourcepacks/smartleaves", modContainer, true);
|
||||
});
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.ConfigScreenHandler;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.AddPackFindersEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.IExtensionPoint;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.forgespi.locating.IModFile;
|
||||
import net.minecraftforge.network.NetworkConstants;
|
||||
import net.minecraftforge.resource.PathPackResources;
|
||||
*///?}
|
||||
|
||||
//? neoforge || forge
|
||||
/*@Mod(CullLeavesClient.MOD_ID)*/
|
||||
public class CullLeavesClient /*? fabric {*/ implements ModInitializer /*?}*/ {
|
||||
public static final String MOD_ID = "cullleaves";
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
|
||||
|
||||
public static boolean forceLeafCulling = false;
|
||||
public static boolean forceHideInnerLeaves = false;
|
||||
|
||||
public static boolean shouldHideBlock(BlockAndTintGetter world, BlockPos pos) {
|
||||
if (CullLeavesClient.forceHideInnerLeaves) {
|
||||
boolean shouldForceCull = true;
|
||||
for (Direction dir : Direction.values()) {
|
||||
BlockState otherState = world.getBlockState(pos.relative(dir));
|
||||
if (!(otherState.getBlock() instanceof LeavesBlock) &&
|
||||
!otherState.isFaceSturdy(world, pos, dir.getOpposite())) {
|
||||
shouldForceCull = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return shouldForceCull;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isLeafSideInvisible(BlockState neighborState) {
|
||||
if (CullLeavesConfig.enabled || CullLeavesClient.forceLeafCulling) {
|
||||
return neighborState.getBlock() instanceof LeavesBlock;
|
||||
} else return false;
|
||||
}
|
||||
|
||||
public static boolean isRootSideInvisible(BlockState neighborState) {
|
||||
if (CullLeavesConfig.cullRoots) {
|
||||
return neighborState.getBlock() instanceof MangroveRootsBlock;
|
||||
} else return false;
|
||||
}
|
||||
|
||||
public static class ReloadListener implements ResourceManagerReloadListener {
|
||||
public static final ReloadListener INSTANCE = new ReloadListener();
|
||||
|
||||
private ReloadListener() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResourceManagerReload(ResourceManager manager) {
|
||||
CullLeavesClient.forceLeafCulling = false;
|
||||
CullLeavesClient.forceHideInnerLeaves = false;
|
||||
manager.listResources("options", path -> path.toString().startsWith("cullleaves") && path.toString().endsWith("options.json")).forEach((id, resource) -> {
|
||||
try {
|
||||
JsonObject json = JsonParser.parseReader(resource.openAsReader()).getAsJsonObject();
|
||||
if (json.has("forceLeafCulling")) {
|
||||
CullLeavesClient.forceLeafCulling = json.get("forceLeafCulling").getAsBoolean();
|
||||
LOGGER.info("Forcing leaf culling as requested by resourcepack");
|
||||
}
|
||||
if (json.has("forceHideInnerLeaves")) {
|
||||
CullLeavesClient.forceHideInnerLeaves = json.get("forceHideInnerLeaves").getAsBoolean();
|
||||
LOGGER.info("Not rendering inner leaves as requested by resourcepack");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//? fabric {
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
MidnightConfig.init(CullLeavesClient.MOD_ID, CullLeavesConfig.class);
|
||||
FabricLoader.getInstance().getModContainer("cullleaves").ifPresent(modContainer -> {
|
||||
ResourceManagerHelper.registerBuiltinResourcePack(ResourceLocation.fromNamespaceAndPath(CullLeavesClient.MOD_ID, "smartleaves"), modContainer, ResourcePackActivationType.NORMAL);
|
||||
});
|
||||
//? if >= 1.21.9 {
|
||||
ResourceLoader.get(PackType.CLIENT_RESOURCES).registerReloader(ResourceLocation.fromNamespaceAndPath(CullLeavesClient.MOD_ID, "resourcepack_options"), CullLeavesClient.ReloadListener.INSTANCE);
|
||||
//?} else {
|
||||
/*ResourceManagerHelper.get(PackType.CLIENT_RESOURCES).registerReloadListener(new SimpleSynchronousResourceReloadListener() {
|
||||
@Override
|
||||
public ResourceLocation getFabricId() {
|
||||
return ResourceLocation.fromNamespaceAndPath(CullLeavesClient.MOD_ID, "resourcepack_options");
|
||||
}
|
||||
@Override
|
||||
public void onResourceManagerReload(ResourceManager manager) {
|
||||
CullLeavesClient.ReloadListener.INSTANCE.onResourceManagerReload(manager);
|
||||
}
|
||||
});
|
||||
*///?}
|
||||
}
|
||||
//?} else if neoforge {
|
||||
/*public CullLeavesClient() {
|
||||
MidnightConfig.init(CullLeavesClient.MOD_ID, CullLeavesConfig.class);
|
||||
}
|
||||
|
||||
@EventBusSubscriber(modid = CullLeavesClient.MOD_ID, value = Dist.CLIENT/^? if <=1.21.5 {^//^, bus = EventBusSubscriber.Bus.MOD ^//^?}^/)
|
||||
public static class CullLeavesClientEvents {
|
||||
@SubscribeEvent
|
||||
public static void addPackFinders(AddPackFindersEvent event) {
|
||||
if (event.getPackType() == PackType.CLIENT_RESOURCES) {
|
||||
event.addPackFinders(ResourceLocation.fromNamespaceAndPath(CullLeavesClient.MOD_ID, "resourcepacks/smartleaves"), PackType.CLIENT_RESOURCES, Component.literal("cullleaves/smartleaves"), PackSource.BUILT_IN, false, Pack.Position.TOP);
|
||||
}
|
||||
}
|
||||
@SubscribeEvent
|
||||
public static void onResourceReload(/^? if >= 1.21.4 {^/ AddClientReloadListenersEvent /^?} else {^//^RegisterClientReloadListenersEvent ^//^?}^/ event) {
|
||||
event. /^? if >= 1.21.4 {^/ addListener(ResourceLocation.fromNamespaceAndPath(CullLeavesClient.MOD_ID, "resourcepack_options"), /^?} else {^/ /^registerReloadListener( ^//^?}^/ CullLeavesClient.ReloadListener.INSTANCE);
|
||||
}
|
||||
}
|
||||
*///?} else if forge {
|
||||
/*public CullLeavesClient() {
|
||||
MidnightConfig.init(MOD_ID, CullLeavesConfig.class);
|
||||
ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest(() -> NetworkConstants.IGNORESERVERONLY, (remote, server) -> true));
|
||||
ModLoadingContext.get().registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class, () ->
|
||||
new ConfigScreenHandler.ConfigScreenFactory((client, parent) -> MidnightConfig.getScreen(parent, "cullleaves")));
|
||||
//MinecraftForge.EVENT_BUS.register(new CullLeavesClientEvents());
|
||||
}
|
||||
|
||||
@Mod.EventBusSubscriber(modid = MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
|
||||
public static class CullLeavesClientEvents {
|
||||
@SubscribeEvent
|
||||
public static void addPackFinders(AddPackFindersEvent event) {
|
||||
if (event.getPackType() == PackType.CLIENT_RESOURCES) {
|
||||
registerResourcePack(event, ResourceLocation.fromNamespaceAndPath(MOD_ID, "smartleaves"), false);
|
||||
}
|
||||
}
|
||||
private static void registerResourcePack(AddPackFindersEvent event, ResourceLocation id, boolean alwaysEnabled) {
|
||||
event.addRepositorySource((profileAdder -> {
|
||||
IModFile file = ModList.get().getModFileById(id.getNamespace()).getFile();
|
||||
try (PathPackResources pack = new PathPackResources(id.toString(), true, file.findResource("resourcepacks/"+id.getPath()))) {
|
||||
profileAdder.accept(Pack.readMetaAndCreate(id.toString(), Component.literal(id.getNamespace()+"/"+id.getPath()), alwaysEnabled, a -> pack, PackType.CLIENT_RESOURCES, Pack.Position.TOP, PackSource.BUILT_IN));
|
||||
} catch (NullPointerException e) {e.printStackTrace();}
|
||||
}));
|
||||
}
|
||||
}
|
||||
*///?}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package eu.midnightdust.cullleaves;
|
||||
|
||||
import eu.midnightdust.lib.util.PlatformFunctions;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class CullLeavesMixinPlugin implements IMixinConfigPlugin {
|
||||
private String mixinPackage;
|
||||
|
||||
@Override
|
||||
public void onLoad(String mixinPackage) {
|
||||
this.mixinPackage = mixinPackage + ".";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
|
||||
final String mixinName = mixinClassName.substring(this.mixinPackage.length());
|
||||
|
||||
if (mixinName.indexOf('.') < 0) return true;
|
||||
return PlatformFunctions.isModLoaded(mixinName.substring(0, mixinName.indexOf('.')));
|
||||
}
|
||||
|
||||
@Override public List<String> getMixins() { return null; }
|
||||
@Override public String getRefMapperConfig() { return null; }
|
||||
@Override public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {}
|
||||
@Override public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {}
|
||||
@Override public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {}
|
||||
}
|
||||
@@ -1,7 +1,18 @@
|
||||
package eu.midnightdust.cullleaves.config;
|
||||
|
||||
public class CullLeavesConfig extends MidnightConfig {
|
||||
|
||||
@Entry // Enable/Disable the mod. Requires Chunk Reload (F3 + A).
|
||||
public static boolean enabled = true;
|
||||
}
|
||||
package eu.midnightdust.cullleaves.config;
|
||||
|
||||
import eu.midnightdust.lib.config.MidnightConfig;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
public class CullLeavesConfig extends MidnightConfig {
|
||||
@Entry // Enable/Disable the mod. Requires Chunk Reload (F3 + A).
|
||||
public static boolean enabled = true;
|
||||
@Entry // Enable/Disable culling on Mangrove Roots.
|
||||
public static boolean cullRoots = true;
|
||||
|
||||
@Override
|
||||
public void writeChanges() {
|
||||
var client = Minecraft.getInstance();
|
||||
if (client != null && client.level != null) client.levelRenderer.needsUpdate();
|
||||
super.writeChanges();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,288 +0,0 @@
|
||||
package eu.midnightdust.cullleaves.config;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.ScreenTexts;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.*;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.*;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
// MidnightConfig v0.1.0 //
|
||||
|
||||
/* Based on https://github.com/Minenash/TinyConfig
|
||||
Credits to Minenash - CC0-1.0
|
||||
You can copy this class to get a standalone version of MidnightConfig */
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class MidnightConfig {
|
||||
|
||||
private static final Pattern INTEGER_ONLY = Pattern.compile("(-?[0-9]*)");
|
||||
private static final Pattern DECIMAL_ONLY = Pattern.compile("-?([\\d]+\\.?[\\d]*|[\\d]*\\.?[\\d]+|\\.)");
|
||||
|
||||
private static final List<EntryInfo> entries = new ArrayList<>();
|
||||
|
||||
protected static class EntryInfo {
|
||||
Field field;
|
||||
Object widget;
|
||||
int width;
|
||||
Method dynamicTooltip;
|
||||
Map.Entry<TextFieldWidget,Text> error;
|
||||
Object defaultValue;
|
||||
Object value;
|
||||
String tempValue;
|
||||
boolean inLimits = true;
|
||||
}
|
||||
|
||||
private static Class configClass;
|
||||
private static String translationPrefix;
|
||||
private static Path path;
|
||||
|
||||
private static final Gson gson = new GsonBuilder()
|
||||
.excludeFieldsWithModifiers(Modifier.TRANSIENT)
|
||||
.excludeFieldsWithModifiers(Modifier.PRIVATE)
|
||||
.setPrettyPrinting()
|
||||
.create();
|
||||
|
||||
public static void init(String modid, Class<?> config) {
|
||||
translationPrefix = modid + ".midnightconfig.";
|
||||
path = FabricLoader.getInstance().getConfigDir().resolve(modid + ".json");
|
||||
configClass = config;
|
||||
|
||||
for (Field field : config.getFields()) {
|
||||
Class<?> type = field.getType();
|
||||
EntryInfo info = new EntryInfo();
|
||||
|
||||
Entry e;
|
||||
try { e = field.getAnnotation(Entry.class); }
|
||||
catch (Exception ignored) { continue; }
|
||||
|
||||
info.width = e.width();
|
||||
info.field = field;
|
||||
|
||||
if (type == int.class) textField(info, Integer::parseInt, INTEGER_ONLY, e.min(), e.max(), true);
|
||||
else if (type == double.class) textField(info, Double::parseDouble, DECIMAL_ONLY, e.min(), e.max(),false);
|
||||
else if (type == String.class) textField(info, String::length, null, Math.min(e.min(),0), Math.max(e.max(),1),true);
|
||||
else if (type == boolean.class) {
|
||||
Function<Object,Text> func = value -> new LiteralText((Boolean) value ? "True" : "False").formatted((Boolean) value ? Formatting.GREEN : Formatting.RED);
|
||||
info.widget = new AbstractMap.SimpleEntry<ButtonWidget.PressAction, Function<Object, Text>>(button -> {
|
||||
info.value = !(Boolean) info.value;
|
||||
button.setMessage(func.apply(info.value));
|
||||
}, func);
|
||||
}
|
||||
else if (type.isEnum()) {
|
||||
List<?> values = Arrays.asList(field.getType().getEnumConstants());
|
||||
Function<Object,Text> func = value -> new TranslatableText(translationPrefix + "enum." + type.getSimpleName() + "." + info.value.toString());
|
||||
info.widget = new AbstractMap.SimpleEntry<ButtonWidget.PressAction, Function<Object,Text>>( button -> {
|
||||
int index = values.indexOf(info.value) + 1;
|
||||
info.value = values.get(index >= values.size()? 0 : index);
|
||||
button.setMessage(func.apply(info.value));
|
||||
}, func);
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
||||
entries.add(info);
|
||||
|
||||
try { info.defaultValue = field.get(null); }
|
||||
catch (IllegalAccessException ignored) {}
|
||||
|
||||
try {
|
||||
info.dynamicTooltip = config.getMethod(e.dynamicTooltip());
|
||||
info.dynamicTooltip.setAccessible(true);
|
||||
} catch (Exception ignored) {}
|
||||
|
||||
}
|
||||
|
||||
try { gson.fromJson(Files.newBufferedReader(path), config); }
|
||||
catch (Exception e) { write(); }
|
||||
|
||||
for (EntryInfo info : entries) {
|
||||
try {
|
||||
info.value = info.field.get(null);
|
||||
info.tempValue = info.value.toString();
|
||||
}
|
||||
catch (IllegalAccessException ignored) {}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void textField(EntryInfo info, Function<String,Number> f, Pattern pattern, double min, double max, boolean cast) {
|
||||
boolean isNumber = pattern != null;
|
||||
info.widget = (BiFunction<TextFieldWidget, ButtonWidget, Predicate<String>>) (t, b) -> s -> {
|
||||
s = s.trim();
|
||||
if (!(s.isEmpty() || !isNumber || pattern.matcher(s).matches()))
|
||||
return false;
|
||||
|
||||
Number value = 0;
|
||||
boolean inLimits = false;
|
||||
System.out.println(((isNumber ^ s.isEmpty())));
|
||||
System.out.println(!s.equals("-") && !s.equals("."));
|
||||
info.error = null;
|
||||
if (!(isNumber && s.isEmpty()) && !s.equals("-") && !s.equals(".")) {
|
||||
value = f.apply(s);
|
||||
inLimits = value.doubleValue() >= min && value.doubleValue() <= max;
|
||||
info.error = inLimits? null : new AbstractMap.SimpleEntry<>(t, new LiteralText(value.doubleValue() < min ?
|
||||
"§cMinimum " + (isNumber? "value" : "length") + (cast? " is " + (int)min : " is " + min) :
|
||||
"§cMaximum " + (isNumber? "value" : "length") + (cast? " is " + (int)max : " is " + max)));
|
||||
}
|
||||
|
||||
info.tempValue = s;
|
||||
t.setEditableColor(inLimits? 0xFFFFFFFF : 0xFFFF7777);
|
||||
info.inLimits = inLimits;
|
||||
b.active = entries.stream().allMatch(e -> e.inLimits);
|
||||
|
||||
if (inLimits)
|
||||
info.value = isNumber? value : s;
|
||||
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
public static void write() {
|
||||
try {
|
||||
if (!Files.exists(path)) Files.createFile(path);
|
||||
Files.write(path, gson.toJson(configClass.newInstance()).getBytes());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Screen getScreen(Screen parent) {
|
||||
return new TinyConfigScreen(parent);
|
||||
}
|
||||
|
||||
private static class TinyConfigScreen extends Screen {
|
||||
protected TinyConfigScreen(Screen parent) {
|
||||
super(new TranslatableText(MidnightConfig.translationPrefix + "title"));
|
||||
this.parent = parent;
|
||||
}
|
||||
private final Screen parent;
|
||||
|
||||
// Real Time config update //
|
||||
@Override
|
||||
public void tick() {
|
||||
for (EntryInfo info : entries)
|
||||
try { info.field.set(null, info.value); }
|
||||
catch (IllegalAccessException ignore) {}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
this.addButton(new ButtonWidget(this.width / 2 - 154, this.height - 28, 150, 20, ScreenTexts.CANCEL, button -> {
|
||||
try { gson.fromJson(Files.newBufferedReader(path), configClass); }
|
||||
catch (Exception e) { write(); }
|
||||
|
||||
for (EntryInfo info : entries) {
|
||||
try {
|
||||
info.value = info.field.get(null);
|
||||
info.tempValue = info.value.toString();
|
||||
}
|
||||
catch (IllegalAccessException ignored) {}
|
||||
}
|
||||
Objects.requireNonNull(client).openScreen(parent);
|
||||
}));
|
||||
|
||||
ButtonWidget done = this.addButton(new ButtonWidget(this.width / 2 + 4, this.height - 28, 150, 20, ScreenTexts.DONE, (button) -> {
|
||||
for (EntryInfo info : entries)
|
||||
try { info.field.set(null, info.value); }
|
||||
catch (IllegalAccessException ignore) {}
|
||||
write();
|
||||
Objects.requireNonNull(client).openScreen(parent);
|
||||
}));
|
||||
|
||||
int y = 45;
|
||||
for (EntryInfo info : entries) {
|
||||
addButton(new ButtonWidget(width - 155, y, 40,20, new LiteralText("Reset").formatted(Formatting.RED), (button -> {
|
||||
info.value = info.defaultValue;
|
||||
info.tempValue = info.value.toString();
|
||||
Objects.requireNonNull(client).openScreen(this);
|
||||
})));
|
||||
|
||||
if (info.widget instanceof Map.Entry) {
|
||||
Map.Entry<ButtonWidget.PressAction,Function<Object,Text>> widget = (Map.Entry<ButtonWidget.PressAction, Function<Object, Text>>) info.widget;
|
||||
addButton(new ButtonWidget(width-110,y,info.width,20, widget.getValue().apply(info.value), widget.getKey()));
|
||||
}
|
||||
else {
|
||||
TextFieldWidget widget = addButton(new TextFieldWidget(textRenderer, width-110, y, info.width, 20, null));
|
||||
widget.setText(info.tempValue);
|
||||
|
||||
Predicate<String> processor = ((BiFunction<TextFieldWidget, ButtonWidget, Predicate<String>>) info.widget).apply(widget,done);
|
||||
widget.setTextPredicate(processor);
|
||||
|
||||
children.add(widget);
|
||||
}
|
||||
y += 25;
|
||||
}
|
||||
|
||||
}
|
||||
int aniX = this.width / 2;
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(matrices);
|
||||
|
||||
if (aniX < this.width / 2) {
|
||||
aniX = aniX +40;
|
||||
}
|
||||
|
||||
int stringWidth = (int) (title.getString().length() * 2.75f);
|
||||
this.fillGradient(matrices, this.width / 2 - stringWidth, 10, this.width /2 + stringWidth, 29, -1072689136, -804253680);
|
||||
this.fillGradient(matrices, this.width / 2 - aniX, 35, width/2 + aniX, this.height - 40, -1072689136, -804253680);
|
||||
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
drawCenteredText(matrices, textRenderer, title, width/2, 15, 0xFFFFFF);
|
||||
|
||||
int y = 40;
|
||||
for (EntryInfo info : entries) {
|
||||
drawTextWithShadow(matrices, textRenderer, new TranslatableText(translationPrefix + info.field.getName()), 12, y + 10, 0xFFFFFF);
|
||||
|
||||
if (info.error != null && info.error.getKey().isMouseOver(mouseX,mouseY))
|
||||
renderTooltip(matrices, info.error.getValue(), mouseX, mouseY);
|
||||
else if (mouseY >= y && mouseY < (y + 25)) {
|
||||
if (info.dynamicTooltip != null) {
|
||||
try {
|
||||
renderTooltip(matrices, (List<Text>) info.dynamicTooltip.invoke(null, entries), mouseX, mouseY);
|
||||
y += 25;
|
||||
continue;
|
||||
} catch (Exception e) { e.printStackTrace(); }
|
||||
}
|
||||
String key = translationPrefix + info.field.getName() + ".tooltip";
|
||||
if (I18n.hasTranslation(key)) {
|
||||
List<Text> list = new ArrayList<>();
|
||||
for (String str : I18n.translate(key).split("\n"))
|
||||
list.add(new LiteralText(str));
|
||||
renderTooltip(matrices, list, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
y += 25;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface Entry {
|
||||
String dynamicTooltip() default "";
|
||||
int width() default 100;
|
||||
double min() default Double.MIN_NORMAL;
|
||||
double max() default Double.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package eu.midnightdust.cullleaves.config;
|
||||
|
||||
import io.github.prospector.modmenu.api.ConfigScreenFactory;
|
||||
import io.github.prospector.modmenu.api.ModMenuApi;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class ModMenuIntegration implements ModMenuApi {
|
||||
|
||||
@Override
|
||||
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
||||
return parent -> new CullLeavesConfig().getScreen(parent);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package eu.midnightdust.cullleaves.mixin;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import eu.midnightdust.cullleaves.CullLeavesClient;
|
||||
import net.minecraft.client.renderer.block.ModelBlockRenderer;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
//? if >= 1.21.4 {
|
||||
import net.minecraft.client.renderer.block.model.BlockModelPart;
|
||||
import java.util.List;
|
||||
//?} else {
|
||||
/*import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
*///?}
|
||||
|
||||
@Mixin(ModelBlockRenderer.class)
|
||||
public class MixinBlockModelRenderer {
|
||||
@Inject(at = @At("HEAD"), method = "tesselateBlock", cancellable = true)
|
||||
//? if >= 1.21.4 {
|
||||
private void cullleaves$cancelRendering(BlockAndTintGetter world, List<BlockModelPart> parts, BlockState state, BlockPos pos, PoseStack matrices, VertexConsumer vertexConsumer, boolean cull, int overlay, CallbackInfo ci) {
|
||||
//?} else {
|
||||
/*private void cullleaves$cancelRendering(BlockAndTintGetter world, BakedModel bakedModel, BlockState state, BlockPos pos, PoseStack matrices, VertexConsumer vertexConsumer, boolean cull, RandomSource randomSource, long l, int overlay, CallbackInfo ci) {
|
||||
*///?}
|
||||
if (state.getBlock() instanceof LeavesBlock &&
|
||||
CullLeavesClient.shouldHideBlock(world, pos)) ci.cancel();
|
||||
}
|
||||
}
|
||||
@@ -1,28 +1,20 @@
|
||||
package eu.midnightdust.cullleaves.mixin;
|
||||
|
||||
import eu.midnightdust.cullleaves.config.CullLeavesConfig;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.LeavesBlock;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
@Mixin(LeavesBlock.class)
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class MixinLeavesBlock extends Block {
|
||||
|
||||
public MixinLeavesBlock(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean isSideInvisible(BlockState state, BlockState neighborState, Direction offset) {
|
||||
if (CullLeavesConfig.enabled) {
|
||||
return neighborState.getBlock() instanceof LeavesBlock;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
package eu.midnightdust.cullleaves.mixin;
|
||||
|
||||
import eu.midnightdust.cullleaves.CullLeavesClient;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
@Mixin(value = LeavesBlock.class, priority = 1900)
|
||||
public abstract class MixinLeavesBlock extends Block {
|
||||
public MixinLeavesBlock(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean skipRendering(BlockState state, BlockState neighborState, Direction offset) {
|
||||
return CullLeavesClient.isLeafSideInvisible(neighborState);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package eu.midnightdust.cullleaves.mixin;
|
||||
|
||||
import eu.midnightdust.cullleaves.CullLeavesClient;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.MangroveRootsBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
@Mixin(value = MangroveRootsBlock.class, priority = 1900)
|
||||
public abstract class MixinMangroveRootsBlock extends Block {
|
||||
public MixinMangroveRootsBlock(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean skipRendering(BlockState state, BlockState neighborState, Direction offset) {
|
||||
return CullLeavesClient.isRootSideInvisible(neighborState);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package eu.midnightdust.cullleaves.mixin.sodium;
|
||||
|
||||
import net.caffeinemc.mods.sodium.client.render.chunk.compile.pipeline.BlockRenderer;
|
||||
import eu.midnightdust.cullleaves.CullLeavesClient;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
//? if >= 1.21.4 {
|
||||
import net.minecraft.client.renderer.block.model.BlockStateModel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.core.BlockPos;
|
||||
//?} else if >= 1.21 {
|
||||
/*import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
*///?} else {
|
||||
/*import net.caffeinemc.mods.sodium.client.render.chunk.compile.ChunkBuildBuffers;
|
||||
import net.caffeinemc.mods.sodium.client.render.chunk.compile.pipeline.BlockRenderContext;
|
||||
*///?}
|
||||
|
||||
//? if fabric && >= 1.21 {
|
||||
import net.caffeinemc.mods.sodium.client.render.frapi.render.AbstractBlockRenderContext;
|
||||
//?} else {
|
||||
/*import net.minecraft.client.Minecraft;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
*///?}
|
||||
|
||||
@Mixin(BlockRenderer.class)
|
||||
public abstract class MixinBlockRenderer /*? if fabric && >= 1.21 {*/ extends AbstractBlockRenderContext /*?}*/ {
|
||||
//? if neoforge || < 1.21 {
|
||||
/*@Unique
|
||||
private static final Minecraft cullleaves$client = Minecraft.getInstance();
|
||||
*///?}
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "renderModel", cancellable = true /*? if forge {*//*, remap = false *//*?}*/)
|
||||
//? if >= 1.21.4 {
|
||||
public void cullleaves$cancelRendering(BlockStateModel model, BlockState state, BlockPos pos, BlockPos origin, CallbackInfo ci) {
|
||||
//?} else if >= 1.21 {
|
||||
/*public void cullleaves$cancelRendering(BakedModel model, BlockState state, BlockPos pos, BlockPos origin, CallbackInfo ci) {
|
||||
*///?} else {
|
||||
/*public void cullleaves$cancelRendering(BlockRenderContext ctx, ChunkBuildBuffers buffers, CallbackInfo ci) {
|
||||
var state = ctx.state();
|
||||
var pos = ctx.pos();
|
||||
*///?}
|
||||
if (state.getBlock() instanceof LeavesBlock && CullLeavesClient.shouldHideBlock(/*? if fabric && >= 1.21 {*/ this.level /*?} else {*/ /*cullleaves$client.level *//*?}*/, pos))
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package eu.midnightdust.cullleaves.mixin.sodium;
|
||||
|
||||
import eu.midnightdust.cullleaves.config.CullLeavesConfig;
|
||||
import net.caffeinemc.mods.sodium.client.gui.SodiumGameOptionPages;
|
||||
import net.caffeinemc.mods.sodium.client.gui.options.OptionFlag;
|
||||
import net.caffeinemc.mods.sodium.client.gui.options.OptionGroup;
|
||||
import net.caffeinemc.mods.sodium.client.gui.options.OptionImpact;
|
||||
import net.caffeinemc.mods.sodium.client.gui.options.OptionImpl;
|
||||
import net.caffeinemc.mods.sodium.client.gui.options.control.TickBoxControl;
|
||||
import net.caffeinemc.mods.sodium.client.gui.options.storage.SodiumOptionsStorage;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mixin(value = SodiumGameOptionPages.class, remap = false)
|
||||
public class MixinSodiumGameOptionPages {
|
||||
|
||||
@Shadow @Final private static SodiumOptionsStorage sodiumOpts;
|
||||
|
||||
@ModifyVariable(method = "performance", at = @At(value = "INVOKE", target = "Lcom/google/common/collect/ImmutableList;copyOf(Ljava/util/Collection;)Lcom/google/common/collect/ImmutableList;"))
|
||||
private static List<OptionGroup> cullleaves$addCullLeavesOption(List<OptionGroup> groups) {
|
||||
groups.add(OptionGroup.createBuilder()
|
||||
.add(OptionImpl.createBuilder(boolean.class, sodiumOpts)
|
||||
.setName(Component.translatable("cullleaves.midnightconfig.enabled"))
|
||||
.setTooltip(Component.translatable("cullleaves.midnightconfig.enabled.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setBinding((opts, value) -> {
|
||||
CullLeavesConfig.enabled = value;
|
||||
CullLeavesConfig.write("cullleaves");
|
||||
}, opts -> CullLeavesConfig.enabled)
|
||||
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
.build()
|
||||
).add(OptionImpl.createBuilder(boolean.class, sodiumOpts)
|
||||
.setName(Component.translatable("cullleaves.midnightconfig.cullRoots"))
|
||||
.setTooltip(Component.translatable("cullleaves.midnightconfig.cullRoots.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setBinding((opts, value) -> {
|
||||
CullLeavesConfig.cullRoots = value;
|
||||
CullLeavesConfig.write("cullleaves");
|
||||
}, opts -> CullLeavesConfig.cullRoots)
|
||||
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
.build()
|
||||
)
|
||||
.build()
|
||||
);
|
||||
|
||||
return groups;
|
||||
}
|
||||
}
|
||||
41
src/main/resources/META-INF/neoforge.mods.toml
Normal file
41
src/main/resources/META-INF/neoforge.mods.toml
Normal file
@@ -0,0 +1,41 @@
|
||||
modLoader = "javafml"
|
||||
loaderVersion = "[1,)"
|
||||
#issueTrackerURL = ""
|
||||
license = "MIT License"
|
||||
|
||||
[[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"
|
||||
|
||||
[[mixins]]
|
||||
config = "cullleaves.mixins.json"
|
||||
|
||||
[[mixins]]
|
||||
config = "cullleaves-neoforge.mixins.json"
|
||||
|
||||
[[dependencies.cullleaves]]
|
||||
modId = "neoforge"
|
||||
required = true
|
||||
versionRange = "[20.3,)"
|
||||
ordering = "NONE"
|
||||
side = "CLIENT"
|
||||
|
||||
[[dependencies.cullleaves]]
|
||||
modId = "minecraft"
|
||||
required = true
|
||||
versionRange = "[1.21,)"
|
||||
ordering = "NONE"
|
||||
side = "CLIENT"
|
||||
|
||||
[[dependencies.cullleaves]]
|
||||
modId = "midnightlib"
|
||||
required = true
|
||||
versionRange = "[1.0.0,)"
|
||||
ordering = "BEFORE"
|
||||
side = "CLIENT"
|
||||
2
src/main/resources/architectury.common.json
Normal file
2
src/main/resources/architectury.common.json
Normal file
@@ -0,0 +1,2 @@
|
||||
{
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 6.2 KiB |
7
src/main/resources/assets/cullleaves/lang/de_de.json
Executable file
7
src/main/resources/assets/cullleaves/lang/de_de.json
Executable file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"cullleaves.midnightconfig.title":"Cull Leaves Konfiguration",
|
||||
"cullleaves.midnightconfig.enabled.tooltip":"Aktiviert Culling bei Blättern, was zu besserer Performance führt",
|
||||
"cullleaves.midnightconfig.enabled":"Aktiviere Culling von Blättern",
|
||||
"cullleaves.midnightconfig.cullRoots.tooltip":"Aktiviert Culling von Mangrovenwurzeln",
|
||||
"cullleaves.midnightconfig.cullRoots":"Culling von Mangrovenwurzeln"
|
||||
}
|
||||
10
src/main/resources/assets/cullleaves/lang/en_us.json
Normal file → Executable file
10
src/main/resources/assets/cullleaves/lang/en_us.json
Normal file → Executable file
@@ -1,5 +1,7 @@
|
||||
{
|
||||
"cullleaves.midnightconfig.title":"Cull Leaves Config",
|
||||
"cullleaves.midnightconfig.enabled.tooltip":"After changing this setting you have to reload all chunks (F3 + A)",
|
||||
"cullleaves.midnightconfig.enabled":"Enabled"
|
||||
{
|
||||
"cullleaves.midnightconfig.title":"Cull Leaves Config",
|
||||
"cullleaves.midnightconfig.enabled.tooltip":"Enables culling for leaves, providing a nice performance boost",
|
||||
"cullleaves.midnightconfig.enabled":"Enable Leaf Culling",
|
||||
"cullleaves.midnightconfig.cullRoots.tooltip":"Enables culling for mangrove roots",
|
||||
"cullleaves.midnightconfig.cullRoots":"Enable Mangrove Root Culling"
|
||||
}
|
||||
7
src/main/resources/assets/cullleaves/lang/ms_my.json
Normal file
7
src/main/resources/assets/cullleaves/lang/ms_my.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"cullleaves.midnightconfig.title": "Konfigurasi Cull Leaves",
|
||||
"cullleaves.midnightconfig.enabled.tooltip": "Mendayakan penyorokan daun yang memberikan peningkatan prestasi yang bagus",
|
||||
"cullleaves.midnightconfig.enabled": "Dayakan Penyorokan Daun",
|
||||
"cullleaves.midnightconfig.cullRoots.tooltip": "Mendayakan penyorokan akar bakau.",
|
||||
"cullleaves.midnightconfig.cullRoots": "Dayakan Penyorokan Akar Bakau"
|
||||
}
|
||||
5
src/main/resources/assets/cullleaves/lang/pt_br.json
Normal file
5
src/main/resources/assets/cullleaves/lang/pt_br.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"cullleaves.midnightconfig.title":"Definições do Cull Leaves",
|
||||
"cullleaves.midnightconfig.enabled.tooltip":"Recarregue os chunks (F3 + A) ao alterar essa opção",
|
||||
"cullleaves.midnightconfig.enabled":"Ativado Cull Leaves"
|
||||
}
|
||||
8
src/main/resources/assets/cullleaves/lang/ru_ru.json
Normal file
8
src/main/resources/assets/cullleaves/lang/ru_ru.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"cullleaves.midnightconfig.title": "Настройки отбраковки листьев",
|
||||
"cullleaves.midnightconfig.enabled.tooltip": "Включает отбраковку листьев, что значительно повышает производительность",
|
||||
"cullleaves.midnightconfig.enabled": "Включить отбраковку листьев",
|
||||
"cullleaves.midnightconfig.cullRoots.tooltip": "Включает отбраковку мангровых корней.",
|
||||
"cullleaves.midnightconfig.cullRoots": "Включить отбраковку мангровых корней",
|
||||
"cullleaves.resourcepack.translation": "§2Делает листья идентичными 'умным листьям' в OptiFine"
|
||||
}
|
||||
5
src/main/resources/assets/cullleaves/lang/uk_ua.json
Normal file
5
src/main/resources/assets/cullleaves/lang/uk_ua.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"cullleaves.midnightconfig.title":"Конфігурація Cull Leaves",
|
||||
"cullleaves.midnightconfig.enabled.tooltip":"Вмикає вибраковування листя, забезпечуючи хороше підвищення продуктивності",
|
||||
"cullleaves.midnightconfig.enabled":"Увімкнути вибраковування листя"
|
||||
}
|
||||
5
src/main/resources/assets/cullleaves/lang/vi_vn.json
Normal file
5
src/main/resources/assets/cullleaves/lang/vi_vn.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"cullleaves.midnightconfig.title":"Cấu hình Cull Leaves",
|
||||
"cullleaves.midnightconfig.enabled.tooltip":"Cho phép loại bỏ lá, giúp tăng hiệu suất tốt",
|
||||
"cullleaves.midnightconfig.enabled":"Kích hoạt loại bỏ lá"
|
||||
}
|
||||
7
src/main/resources/assets/cullleaves/lang/zh_cn.json
Normal file
7
src/main/resources/assets/cullleaves/lang/zh_cn.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"cullleaves.midnightconfig.title":"Cull Leaves 选项",
|
||||
"cullleaves.midnightconfig.enabled.tooltip":"剔除树叶,提升性能",
|
||||
"cullleaves.midnightconfig.enabled":"启用树叶剔除",
|
||||
"cullleaves.midnightconfig.cullRoots.tooltip":"启用红树根剔除",
|
||||
"cullleaves.midnightconfig.cullRoots":"启用红树根剔除"
|
||||
}
|
||||
5
src/main/resources/assets/cullleaves/lang/zh_tw.json
Normal file
5
src/main/resources/assets/cullleaves/lang/zh_tw.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"cullleaves.midnightconfig.title":"Cull Leaves 設定",
|
||||
"cullleaves.midnightconfig.enabled.tooltip":"啟用樹葉剔除,獲得良好的效能提升",
|
||||
"cullleaves.midnightconfig.enabled":"啟用樹葉剔除"
|
||||
}
|
||||
7
src/main/resources/assets/cullleaves/lang/zlm_arab.json
Normal file
7
src/main/resources/assets/cullleaves/lang/zlm_arab.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"cullleaves.midnightconfig.title": "کونفيݢوراسي Cull Leaves",
|
||||
"cullleaves.midnightconfig.enabled.tooltip": "منداياکن ڤڽوروقن داٴون يڠ ممبريکن ڤنيڠکتن ڤريستاسي يڠ باݢوس",
|
||||
"cullleaves.midnightconfig.enabled": "داياکن ڤڽوروقن داٴون",
|
||||
"cullleaves.midnightconfig.cullRoots.tooltip": "منداياکن ڤڽوروقن اکر باکاو.",
|
||||
"cullleaves.midnightconfig.cullRoots": "داياکن ڤڽوروقن اکر باکاو"
|
||||
}
|
||||
14
src/main/resources/cullleaves-fabric.mixins.json
Normal file
14
src/main/resources/cullleaves-fabric.mixins.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "eu.midnightdust.cullleaves.mixin",
|
||||
"plugin": "eu.midnightdust.cullleaves.CullLeavesMixinPlugin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"minVersion": "0.8",
|
||||
"client": [
|
||||
"sodium.MixinBlockRenderer",
|
||||
"sodium.MixinSodiumGameOptionPages"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
13
src/main/resources/cullleaves-neoforge.mixins.json
Normal file
13
src/main/resources/cullleaves-neoforge.mixins.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "eu.midnightdust.cullleaves.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"minVersion": "0.8",
|
||||
"client": [
|
||||
"sodium.MixinBlockRenderer",
|
||||
"sodium.MixinSodiumGameOptionPages"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,12 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "eu.midnightdust.cullleaves.mixin",
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"minVersion": "0.8",
|
||||
"client": [
|
||||
"MixinLeavesBlock"
|
||||
"MixinBlockModelRenderer",
|
||||
"MixinLeavesBlock",
|
||||
"MixinMangroveRootsBlock"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
||||
@@ -20,20 +20,21 @@
|
||||
|
||||
"environment": "client",
|
||||
"entrypoints": {
|
||||
"client": [
|
||||
"main": [
|
||||
"eu.midnightdust.cullleaves.CullLeavesClient"
|
||||
],
|
||||
"modmenu": [
|
||||
"eu.midnightdust.cullleaves.config.ModMenuIntegration"
|
||||
]
|
||||
},
|
||||
|
||||
"depends": {
|
||||
"fabric-resource-loader-v0": "*",
|
||||
"minecraft": ">=1.16"
|
||||
"midnightlib": "*",
|
||||
"minecraft": ">=1.20"
|
||||
},
|
||||
"breaks": {
|
||||
"sodium": "<0.6.0"
|
||||
},
|
||||
|
||||
"mixins": [
|
||||
"cullleaves.mixins.json"
|
||||
"cullleaves.mixins.json",
|
||||
"cullleaves-fabric.mixins.json"
|
||||
]
|
||||
}
|
||||
}
|
||||
BIN
src/main/resources/icon.png
Normal file
BIN
src/main/resources/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.2 KiB |
6
src/main/resources/pack.mcmeta
Normal file
6
src/main/resources/pack.mcmeta
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"pack": {
|
||||
"description": "CullLeaves",
|
||||
"pack_format": 9
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"forceLeafCulling": true
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "minecraft:block/leaves_notint",
|
||||
"textures": {
|
||||
"all": "minecraft:block/azalea_leaves"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "minecraft:block/leaves_notint",
|
||||
"textures": {
|
||||
"all": "minecraft:block/flowering_azalea_leaves"
|
||||
}
|
||||
}
|
||||
0
src/main/resources/resourcepacks/smartleaves/assets/minecraft/models/block/leaves.json
Normal file → Executable file
0
src/main/resources/resourcepacks/smartleaves/assets/minecraft/models/block/leaves.json
Normal file → Executable file
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"credit": "made by Motschen",
|
||||
"parent": "block/block",
|
||||
"textures": {
|
||||
"particle": "#all"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"name": "main",
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 16, 16],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "north"},
|
||||
"east": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "east"},
|
||||
"south": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "south"},
|
||||
"west": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "west"},
|
||||
"up": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "up"},
|
||||
"down": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "down"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "bottom",
|
||||
"from": [0, 0.01, 0],
|
||||
"to": [16, 0.01, 16],
|
||||
"faces": {
|
||||
"up": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "down"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "west",
|
||||
"from": [0.01, 0, 0],
|
||||
"to": [0.01, 16, 16],
|
||||
"faces": {
|
||||
"east": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "west"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "north",
|
||||
"from": [0, 0, 0.01],
|
||||
"to": [16, 16, 0.01],
|
||||
"faces": {
|
||||
"south": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "north"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "east",
|
||||
"from": [15.99, 0, 0],
|
||||
"to": [15.99, 16, 16],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [23, 8, 8]},
|
||||
"faces": {
|
||||
"west": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "east"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "south",
|
||||
"from": [0, 0, 15.99],
|
||||
"to": [16, 16, 15.99],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 23]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "south"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "up",
|
||||
"from": [0, 15.99, 0],
|
||||
"to": [16, 15.99, 16],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 23, 8]},
|
||||
"faces": {
|
||||
"down": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "up"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
18
src/main/resources/resourcepacks/smartleaves/license.txt
Normal file → Executable file
18
src/main/resources/resourcepacks/smartleaves/license.txt
Normal file → Executable file
@@ -1,10 +1,10 @@
|
||||
The MIT License
|
||||
Copyright © 2020 Motschen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
The MIT License
|
||||
Copyright © 2022 Motschen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
18
src/main/resources/resourcepacks/smartleaves/pack.mcmeta
Normal file → Executable file
18
src/main/resources/resourcepacks/smartleaves/pack.mcmeta
Normal file → Executable file
@@ -1,6 +1,12 @@
|
||||
{
|
||||
"pack": {
|
||||
"pack_format": 6,
|
||||
"description": "§2Makes the leaves look identical to the optifine smart leaves effect"
|
||||
}
|
||||
}
|
||||
{
|
||||
"pack": {
|
||||
"pack_format": 15,
|
||||
"supported_formats": [15, 255],
|
||||
"min_format": 15,
|
||||
"max_format": 255,
|
||||
"description": {
|
||||
"translate": "cullleaves.resourcepack.description",
|
||||
"fallback": "§2Makes leaves look identical to OptiFine's smart leaves"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 3.9 KiB |
16
stonecutter.gradle.kts
Normal file
16
stonecutter.gradle.kts
Normal file
@@ -0,0 +1,16 @@
|
||||
plugins {
|
||||
id("dev.kikugie.stonecutter")
|
||||
id("dev.architectury.loom") version "1.13-SNAPSHOT" apply false
|
||||
id("architectury-plugin") version "3.4-SNAPSHOT" apply false
|
||||
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
|
||||
id("me.modmuss50.mod-publish-plugin") version "0.8.4" apply false
|
||||
}
|
||||
stonecutter active "1.21.10-fabric" /* [SC] DO NOT EDIT */
|
||||
|
||||
// See https://stonecutter.kikugie.dev/wiki/config/params
|
||||
stonecutter parameters {
|
||||
swaps["mod_version"] = "\"" + property("mod.version") + "\";"
|
||||
swaps["minecraft"] = "\"" + node.metadata.version + "\";"
|
||||
constants["release"] = property("mod.id") != "template"
|
||||
dependencies["fapi"] = node.project.property("deps.fabric_version") as String
|
||||
}
|
||||
13
versions/1.20.1-fabric/gradle.properties
Normal file
13
versions/1.20.1-fabric/gradle.properties
Normal file
@@ -0,0 +1,13 @@
|
||||
mod.mc_dep_fabric==1.20.1
|
||||
mod.mc_dep_forgelike=[1.20, 1.20.1]
|
||||
mod.mc_title=1.20.1
|
||||
mod.mc_targets=1.20.1
|
||||
|
||||
deps.forge_loader=47.3.0
|
||||
deps.neoforge_loader=[UNSUPPORTED]
|
||||
|
||||
deps.fabric_version=0.92.3+1.20.1
|
||||
deps.modmenu_version=7.2.2
|
||||
deps.sodium_version=mc1.20.1-0.5.13
|
||||
|
||||
loom.platform=fabric
|
||||
13
versions/1.20.1-forge/gradle.properties
Normal file
13
versions/1.20.1-forge/gradle.properties
Normal file
@@ -0,0 +1,13 @@
|
||||
mod.mc_dep_fabric==1.20.1
|
||||
mod.mc_dep_forgelike=[1.20, 1.20.1]
|
||||
mod.mc_title=1.20.1
|
||||
mod.mc_targets=1.20.1
|
||||
|
||||
deps.forge_loader=47.3.0
|
||||
deps.neoforge_loader=[UNSUPPORTED]
|
||||
|
||||
deps.fabric_version=0.92.3+1.20.1
|
||||
|
||||
deps.modmenu_version=[UNSUPPORTED]
|
||||
|
||||
loom.platform=forge
|
||||
35
versions/1.20.1-forge/src/main/resources/META-INF/mods.toml
Normal file
35
versions/1.20.1-forge/src/main/resources/META-INF/mods.toml
Normal file
@@ -0,0 +1,35 @@
|
||||
modLoader = "javafml"
|
||||
loaderVersion = "[43,)"
|
||||
#issueTrackerURL = ""
|
||||
license = "MIT License"
|
||||
|
||||
[[mods]]
|
||||
modId = "${id}"
|
||||
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 = "BEFORE"
|
||||
side = "CLIENT"
|
||||
13
versions/1.21.1-fabric/gradle.properties
Normal file
13
versions/1.21.1-fabric/gradle.properties
Normal file
@@ -0,0 +1,13 @@
|
||||
mod.mc_dep_fabric=>=1.21 <=1.21.1
|
||||
mod.mc_dep_forgelike=[1.21, 1.21.1]
|
||||
mod.mc_title=1.21.1
|
||||
mod.mc_targets=1.21 1.21.1
|
||||
|
||||
deps.forge_loader=0
|
||||
deps.neoforge_loader=21.1.66
|
||||
|
||||
deps.fabric_version=0.114.0+1.21.1
|
||||
|
||||
deps.modmenu_version=11.0.3
|
||||
|
||||
loom.platform=fabric
|
||||
13
versions/1.21.1-neoforge/gradle.properties
Normal file
13
versions/1.21.1-neoforge/gradle.properties
Normal file
@@ -0,0 +1,13 @@
|
||||
mod.mc_dep_fabric=>=1.21 <=1.21.1
|
||||
mod.mc_dep_forgelike=[1.21, 1.21.1]
|
||||
mod.mc_title=1.21.1
|
||||
mod.mc_targets=1.21 1.21.1
|
||||
|
||||
deps.forge_loader=0
|
||||
deps.neoforge_loader=21.1.66
|
||||
|
||||
deps.fabric_version=0.114.0+1.21.1
|
||||
|
||||
deps.sodium_version=mc1.21.1-0.6.13
|
||||
|
||||
loom.platform=neoforge
|
||||
12
versions/1.21.10-fabric/gradle.properties
Normal file
12
versions/1.21.10-fabric/gradle.properties
Normal file
@@ -0,0 +1,12 @@
|
||||
mod.mc_dep_fabric=>=1.21.9
|
||||
mod.mc_dep_forgelike=[1.21.10,)
|
||||
mod.mc_title=1.21.10
|
||||
mod.mc_targets=1.21.9, 1.21.10
|
||||
|
||||
deps.forge_loader=0
|
||||
deps.neoforge_loader=21.10.47-beta
|
||||
|
||||
deps.fabric_version=0.138.0+1.21.10
|
||||
deps.modmenu_version=16.0.0-rc.1
|
||||
|
||||
loom.platform=fabric
|
||||
12
versions/1.21.10-neoforge/gradle.properties
Normal file
12
versions/1.21.10-neoforge/gradle.properties
Normal file
@@ -0,0 +1,12 @@
|
||||
mod.mc_dep_fabric=>=1.21.9
|
||||
mod.mc_dep_forgelike=[1.21.10,)
|
||||
mod.mc_title=1.21.10
|
||||
mod.mc_targets=1.21.9, 1.21.10
|
||||
|
||||
deps.forge_loader=0
|
||||
deps.neoforge_loader=21.10.47-beta
|
||||
|
||||
deps.fabric_version=0.138.0+1.21.10
|
||||
deps.modmenu_version=16.0.0-rc.1
|
||||
|
||||
loom.platform=neoforge
|
||||
12
versions/1.21.5-fabric/gradle.properties
Normal file
12
versions/1.21.5-fabric/gradle.properties
Normal file
@@ -0,0 +1,12 @@
|
||||
mod.mc_dep_fabric==1.21.5
|
||||
mod.mc_dep_forgelike=[1.21.5]
|
||||
mod.mc_title=1.21.5
|
||||
mod.mc_targets=1.21.5
|
||||
|
||||
deps.forge_loader=54.0.13
|
||||
deps.neoforge_loader=21.4.47-beta
|
||||
|
||||
deps.fabric_version=0.121.0+1.21.5
|
||||
deps.modmenu_version=14.0.0-rc.1
|
||||
|
||||
loom.platform=fabric
|
||||
12
versions/1.21.5-neoforge/gradle.properties
Normal file
12
versions/1.21.5-neoforge/gradle.properties
Normal file
@@ -0,0 +1,12 @@
|
||||
mod.mc_dep_fabric==1.21.5
|
||||
mod.mc_dep_forgelike=[1.21.5]
|
||||
mod.mc_title=1.21.5
|
||||
mod.mc_targets=1.21.5
|
||||
|
||||
deps.forge_loader=0
|
||||
deps.neoforge_loader=21.5.54-beta
|
||||
|
||||
deps.fabric_version=0.121.0+1.21.5
|
||||
deps.modmenu_version=[UNSUPPORTED]
|
||||
|
||||
loom.platform=neoforge
|
||||
12
versions/1.21.8-fabric/gradle.properties
Normal file
12
versions/1.21.8-fabric/gradle.properties
Normal file
@@ -0,0 +1,12 @@
|
||||
mod.mc_dep_fabric==1.21.8
|
||||
mod.mc_dep_forgelike=[1.21.8]
|
||||
mod.mc_title=1.21.8
|
||||
mod.mc_targets=1.21.8
|
||||
|
||||
deps.forge_loader=0
|
||||
deps.neoforge_loader=21.8.50
|
||||
|
||||
deps.fabric_version=0.136.0+1.21.8
|
||||
deps.modmenu_version=15.0.0
|
||||
|
||||
loom.platform=fabric
|
||||
12
versions/1.21.8-neoforge/gradle.properties
Normal file
12
versions/1.21.8-neoforge/gradle.properties
Normal file
@@ -0,0 +1,12 @@
|
||||
mod.mc_dep_fabric==1.21.5
|
||||
mod.mc_dep_forgelike=[1.21.5]
|
||||
mod.mc_title=1.21.5
|
||||
mod.mc_targets=1.21.5
|
||||
|
||||
deps.forge_loader=0
|
||||
deps.neoforge_loader=21.8.50
|
||||
|
||||
deps.fabric_version=0.136.0+1.21.8
|
||||
deps.modmenu_version=[UNSUPPORTED]
|
||||
|
||||
loom.platform=neoforge
|
||||
Reference in New Issue
Block a user