diff --git a/.gitignore b/.gitignore index 45b9159..625ddfc 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,5 @@ build eclipse run libs + +src/generated/**/.cache/ diff --git a/build.gradle.kts b/build.gradle.kts index 89d01cc..3e78fe0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,201 +1,187 @@ -import com.matthewprenger.cursegradle.CurseArtifact -import com.matthewprenger.cursegradle.CurseExtension -import com.matthewprenger.cursegradle.CurseProject -import com.matthewprenger.cursegradle.CurseRelation -import net.minecraftforge.gradle.common.util.RunConfig -import java.time.Instant -import java.time.format.DateTimeFormatter - -fun property(key: String) = project.findProperty(key).toString() - -apply(from = "https://gist.githubusercontent.com/Harleyoc1/4d23d4e991e868d98d548ac55832381e/raw/applesiliconfg.gradle") +import me.modmuss50.mpp.ReleaseType +import org.gradle.api.publish.maven.MavenPublication plugins { - id("java") - id("net.minecraftforge.gradle") - id("org.parchmentmc.librarian.forgegradle") - id("idea") + id("java-library") id("maven-publish") - id("com.matthewprenger.cursegradle") version "1.4.0" - id("com.modrinth.minotaur") version "2.+" - id("com.harleyoconnor.autoupdatetool") version "1.0.7" + id("net.neoforged.moddev") version "2.0.143" + id("me.modmuss50.mod-publish-plugin") version "2.+" } -repositories { - maven("https://ldtteam.jfrog.io/ldtteam/modding/") - maven("https://www.cursemaven.com") { - content { - includeGroup("curse.maven") - } - } - maven("https://harleyoconnor.com/maven") - maven("https://squiddev.cc/maven/") - mavenLocal() - flatDir { - dirs("libs") - } +val mcVersion = providers.gradleProperty("mcVersion") +val neoVersion = providers.gradleProperty("neoVersion") +val modName = providers.gradleProperty("modName") +val modId = providers.gradleProperty("modId") +val modVersion = providers.gradleProperty("modVersion") +val modGroup = providers.gradleProperty("group") +val dynamicTreesVersion = providers.gradleProperty("dynamicTreesVersion") +val dynamicTreesPlusVersion = providers.gradleProperty("dynamicTreesPlusVersion") +val dynamicTreesAddonLibVersion = providers.gradleProperty("dynamicTreesAddonLibVersion") +val ecologicsVersion = providers.gradleProperty("ecologicsVersion") +val versionType = providers.gradleProperty("versionType") +val curseProjectId = providers.gradleProperty("curseProjectId") +val rinthProjectId = providers.gradleProperty("rinthProjectId") + +version = "${mcVersion.get()}-${modVersion.get()}" +group = modGroup.get() + +base { + archivesName.set(modName) } -val modName = property("modName") -val modId = property("modId") -val modVersion = property("modVersion") -val mcVersion = property("mcVersion") +java { + withSourcesJar() -version = "$mcVersion-$modVersion" -group = property("group") + toolchain { + languageVersion.set(JavaLanguageVersion.of(21)) + } +} -minecraft { - mappings("parchment", "${property("mappingsVersion")}-$mcVersion") +neoForge { + version = neoVersion.get() runs { create("client") { - applyDefaultConfiguration() - - if (project.hasProperty("mcUuid")) { - args("--uuid", property("mcUuid")) - } - if (project.hasProperty("mcUsername")) { - args("--username", property("mcUsername")) - } - if (project.hasProperty("mcAccessToken")) { - args("--accessToken", property("mcAccessToken")) - } + client() } create("server") { - applyDefaultConfiguration("run-server") + server() } create("data") { - applyDefaultConfiguration() + data() - args( - "--mod", modId, + programArguments.addAll( "--all", - "--output", file("src/generated/resources/"), - "--existing", file("src/main/resources"), + "--existing", file("src/main/resources").absolutePath, + "--output", file("src/generated/resources/").absolutePath, + "--mod", modId.get(), "--existing-mod", "dynamictrees", "--existing-mod", "dynamictreesplus", "--existing-mod", "ecologics" ) } } -} -sourceSets.main.get().resources { - srcDir("src/generated/resources") -} + mods { + create(modId.get()) { + sourceSet(sourceSets.main.get()) + } + } -dependencies { - // Forge - minecraft("net.minecraftforge:forge:$mcVersion-${property("forgeVersion")}") - - // DynamicTrees - implementation(fg.deobf("com.ferreusveritas.dynamictrees:DynamicTrees-$mcVersion:${property("dynamicTreesVersion")}")) - implementation(fg.deobf("com.ferreusveritas.dynamictreesplus:DynamicTreesPlus-$mcVersion:${property("dynamicTreesPlusVersion")}")) - implementation(fg.deobf("curse.maven:dynamic-trees-addon-lib-1404692:8289347")) - - // DynmaicTrees Tools/Utilities - runtimeOnly(fg.deobf("curse.maven:jade-324717:5072729")) - runtimeOnly(fg.deobf("curse.maven:jei-238222:5101366")) - runtimeOnly(fg.deobf("curse.maven:cc-tweaked-282001:5118388")) - runtimeOnly(fg.deobf("curse.maven:suggestion-provider-fix-469647:4591193")) - runtimeOnly(fg.deobf("vazkii.patchouli:Patchouli:${property("patchouliVersion")}")) - - //Other - implementation(fg.deobf("curse.maven:ecologics-570463:4857272")) + parchment { + minecraftVersion.set(mcVersion) + } } -tasks.jar { - manifest.attributes( - "Specification-Title" to project.name, - "Specification-Vendor" to "Max Hyper", - "Specification-Version" to "1", - "Implementation-Title" to project.name, - "Implementation-Version" to project.version, - "Implementation-Vendor" to "Max Hyper", - "Implementation-Timestamp" to DateTimeFormatter.ISO_INSTANT.format(Instant.now()) - ) - - archiveBaseName.set(modName) - finalizedBy("reobfJar") +sourceSets { + main { + resources { + srcDir("src/generated/resources") + } + } } -java { - withSourcesJar() - - toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) +repositories { + maven("https://ldtteam.jfrog.io/ldtteam/modding/") + exclusiveContent { + forRepository { + maven("https://api.modrinth.com/maven") { + name = "Modrinth" + } + } + filter { + includeGroup("maven.modrinth") + } + } + maven("https://www.cursemaven.com") { + content { + includeGroup("curse.maven") + } } + flatDir { + dir("libs") + } + mavenLocal() } -curseforge { - if (project.hasProperty("curseApiKey") && project.hasProperty("curseFileType")) { - apiKey = property("curseApiKey") +dependencies { + implementation("com.dtteam.dynamictrees:dynamictrees-neoforge-${mcVersion.get()}:${dynamicTreesVersion.get()}") + implementation("com.dtteam.dynamictreesplus:DynamicTreesPlus:${dynamicTreesPlusVersion.get()}") + implementation("maven.modrinth:dynamic-trees-addon-lib:${dynamicTreesAddonLibVersion.get()}") - project { - id = property("curseProjectId") + implementation("maven.modrinth:ecologics:${ecologicsVersion.get()}-NeoForge") +} - addGameVersion(mcVersion) +tasks.processResources { + val replaceProperties = mapOf( + "mcVersion" to mcVersion, + "neoVersion" to neoVersion, + "modId" to modId, + "modVersion" to modVersion, + "dynamicTreesVersion" to dynamicTreesVersion, + "dynamicTreesPlusVersion" to dynamicTreesPlusVersion, + "dynamicTreesAddonLibVersion" to dynamicTreesAddonLibVersion, + "ecologicsVersion" to ecologicsVersion + ) - changelog = file("build/changelog.txt") - changelogType = "markdown" - releaseType = property("curseFileType") + inputs.properties(replaceProperties) - addArtifact(tasks.findByName("sourcesJar")) + filteringCharset = "UTF-8" - mainArtifact(tasks.findByName("jar")) { - relations { - requiredDependency("dynamictrees") - optionalDependency("dynamictreesplus") - requiredDependency("ecologics") - } - } - } - } else { - project.logger.log(LogLevel.WARN, "API Key and file type for CurseForge not detected; uploading will be disabled.") + filesMatching("META-INF/neoforge.mods.toml") { + expand(replaceProperties.mapValues { it.value.get() }) } } -tasks.withType { - enabled = false +tasks.withType().configureEach { + options.encoding = "UTF-8" +} + +tasks.jar { + from("LICENSE") } publishing { publications { - create("mavenJava") { + register("mavenJava") { from(components["java"]) } } repositories { - maven("file:///${project.projectDir}/mcmodsrepo") + maven("file://${project.projectDir}/repo") } } -fun RunConfig.applyDefaultConfiguration(runDirectory: String = "run") { - workingDirectory = file(runDirectory).absolutePath - - property("forge.logging.markers", "SCAN,REGISTRIES,REGISTRYDUMP") - property("forge.logging.console.level", "debug") - - property("mixin.env.remapRefMap", "true") - property("mixin.env.refMapRemappingFile", "${buildDir}/createSrgToMcp/output.srg") - - mods { - create(modId) { - source(sourceSets.main.get()) - } +publishMods { + file.set(tasks.jar.flatMap { it.archiveFile }) + additionalFiles.from(tasks.named("sourcesJar")) + displayName.set("${modName.get()}-NeoForge-${project.version}") + val changelogFile = file("build/changelog.md") + if (changelogFile.exists()) { + changelog.set(changelogFile.readText()) + } + type.set(versionType.map(String::uppercase).map(ReleaseType::of)) + modLoaders.add("neoforge") + + curseforge { + projectId.set(curseProjectId) + projectSlug.set("dynamic-trees-ecologics") + accessToken.set(System.getenv("CURSEFORGE_API_KEY")) + minecraftVersions.add(mcVersion) + requires("dynamictrees") + optional("dynamictreesplus") + requires("dynamic-trees-addon-lib") + requires("ecologics") + } + modrinth { + projectId.set(rinthProjectId) + accessToken.set(System.getenv("MODRINTH_TOKEN")) + minecraftVersions.add(mcVersion) + requires("vdjF5PL5") //dt + optional("qaO9Dqpu") //dt+ + requires("ju42L8G7") //dynamic-trees-addon-lib + requires("NCKpPR0Z") //ecologics } -} - -fun CurseExtension.project(action: CurseProject.() -> Unit) { - this.project(closureOf(action)) -} - -fun CurseProject.mainArtifact(artifact: Task?, action: CurseArtifact.() -> Unit) { - this.mainArtifact(artifact, closureOf(action)) -} - -fun CurseArtifact.relations(action: CurseRelation.() -> Unit) { - this.relations(closureOf(action)) } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts deleted file mode 100644 index e92ccf5..0000000 --- a/buildSrc/build.gradle.kts +++ /dev/null @@ -1,16 +0,0 @@ -plugins { - `kotlin-dsl` - `java-library` -} - -repositories { - mavenCentral() - maven("https://files.minecraftforge.net/maven") - maven("https://maven.parchmentmc.org") -} - -dependencies { - implementation("com.google.code.gson:gson:2.8.7") - implementation("net.minecraftforge.gradle:ForgeGradle:5.1.+") - implementation("org.parchmentmc:librarian:1.+") -} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index a490bf7..d29dedc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,20 +1,22 @@ +org.gradle.jvmargs=-Xmx2G +org.gradle.daemon=true +org.gradle.parallel=true +org.gradle.caching=true +org.gradle.configuration-cache=true + +mcVersion=1.21.1 +neoVersion=21.1.248 +neoForge.parchment.mappingsVersion=2024.11.17 modName=DynamicTreesEcologics modId=dtecologics modVersion=1.1.1 group=com.maxhyper.dtecologics -mcVersion=1.20.1 -forgeVersion=47.4.3 -mappingsVersion=2023.09.03 - -dynamicTreesVersion=1.4.10 -dynamicTreesPlusVersion=1.2.2 -patchouliVersion=1.20.1-84-FORGE -ccVersion=1.111.0 -suggestionProviderFixVersion=1.0.0 +dynamicTreesVersion=1.7.2 +dynamicTreesPlusVersion=1.3.2 +dynamicTreesAddonLibVersion=0.2.0-BETA03 +ecologicsVersion=2.3.7 -curseFileType=release +versionType=release curseProjectId=871323 - -org.gradle.jvmargs=-Xmx3G -org.gradle.daemon=false +rinthProjectId=2H9XSQjq diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7a3265e..eddabd2 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ceccc3a..69dd0d0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,9 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.0-bin.zip +networkTimeout=10000 +retries=0 +retryBackOffMs=500 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip diff --git a/gradlew b/gradlew old mode 100755 new mode 100644 index cccdd3d..249efbb --- a/gradlew +++ b/gradlew @@ -1,78 +1,128 @@ -#!/usr/bin/env sh +#!/bin/sh + +# +# Copyright © 2015 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. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## -## -## Gradle start up script for UN*X -## +# +# gradlew 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 gradlew +# +# 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/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/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 +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 -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # 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 @@ -81,92 +131,118 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - 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. + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + 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 location of your Java installation." + fi 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 +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=SC2039,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=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac 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 +# 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. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) -# 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\"" + 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 - i=$((i+1)) + # 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 - 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" ;; - 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, 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" -# 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")" +# 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"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# 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" "$@" diff --git a/gradlew.bat b/gradlew.bat index f955316..a51ec4f 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,84 +1,82 @@ -@if "%DEBUG%" == "" @echo off +@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 +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem -@rem Gradle startup script for Windows +@rem gradlew startup script for Windows @rem @rem ########################################################################## -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal +@rem Set local scope for the variables, and ensure extensions are enabled +setlocal EnableExtensions set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +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= +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 +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. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 -goto fail +"%COMSPEC%" /c exit 1 :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +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. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 -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=%* +"%COMSPEC%" /c exit 1 :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 +@rem Execute gradlew +@rem endlocal doesn't take effect until after the line is parsed and variables are expanded +@rem which allows us to clear the local environment before executing the java command +endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel -:omega +:exitWithErrorLevel +@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts +"%COMSPEC%" /c exit %ERRORLEVEL% diff --git a/settings.gradle.kts b/settings.gradle.kts index e90df4a..6742365 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1 +1,14 @@ +pluginManagement { + repositories { + gradlePluginPortal() + mavenCentral() + + maven("https://maven.neoforged.net/releases") { name = "Neoforged" } + } +} + +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" +} + rootProject.name = "DT Ecologics" \ No newline at end of file diff --git a/src/generated/resources/.cache/4dbcee293b56fe1b43bba8f6b6dafcdecc485daa b/src/generated/resources/.cache/4dbcee293b56fe1b43bba8f6b6dafcdecc485daa deleted file mode 100644 index 722271d..0000000 --- a/src/generated/resources/.cache/4dbcee293b56fe1b43bba8f6b6dafcdecc485daa +++ /dev/null @@ -1,7 +0,0 @@ -// 1.20.1 2024-07-17T10:43:01.2063322 Item Models: dtecologics -bbc20f4b78d582354a6724e1312e83af454c4f53 assets/dtecologics/models/item/azalea_branch.json -8403401337b96eaaf139d984cb9cd205b6a5ba9a assets/dtecologics/models/item/coconut_branch.json -4d2e1735388a190f16514af799f7d740f5b319ba assets/dtecologics/models/item/coconut_seed.json -979d9065a39701308caab9ce64a97568af75bbf9 assets/dtecologics/models/item/prickly_pear_cactus_seed.json -1897e127255ab164357db0068e35d950ec62593f assets/dtecologics/models/item/walnut_branch.json -6d4e643a42274da65cef136e5c8371793063201a assets/dtecologics/models/item/walnut_seed.json diff --git a/src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d b/src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d deleted file mode 100644 index a3a75d9..0000000 --- a/src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d +++ /dev/null @@ -1,16 +0,0 @@ -// 1.20.1 2024-07-17T10:43:01.1998107 Loot Tables -44a884c04dabda24539fa6a48ab6cc87211d9134 data/dtecologics/loot_tables/blocks/coconut.json -779af76666f534fb627ca3673150d9f554a816f9 data/dtecologics/loot_tables/blocks/coconut_leaves.json -3b0b042fcf036670d1452f47602ffe86444fda34 data/dtecologics/loot_tables/blocks/prickly_pear.json -70224dae4bb848a6880c3be1b2e0e6705777e791 data/dtecologics/loot_tables/blocks/walnut.json -6a77d0996ed5418dd30285c3c9d732a3ecdfd925 data/dtecologics/loot_tables/blocks/walnut_leaves.json -e01d09d105dbf28cb0a44dd855d3a80a61d909b3 data/dtecologics/loot_tables/trees/branches/azalea.json -8d63ff8f615f4a941ffae69de1f300ab987ae829 data/dtecologics/loot_tables/trees/branches/coconut.json -74ace6ee24b0f132120717ffc7f73c6d4a53c829 data/dtecologics/loot_tables/trees/branches/stripped_azalea.json -22c2d1f6b9c982d0b65633bda3ad301389a210db data/dtecologics/loot_tables/trees/branches/stripped_coconut.json -722307935a9895dd30e587ee99c0a3fea7eff3b6 data/dtecologics/loot_tables/trees/branches/stripped_walnut.json -dc7b7eee66e3dc693f40837df7714ac11dbb9170 data/dtecologics/loot_tables/trees/branches/walnut.json -6f0a2de540706bb07592c109516b573287b4ab5b data/dtecologics/loot_tables/trees/leaves/coconut.json -158eb5803cdea81475d1f92a9250acc18a7aa1cf data/dtecologics/loot_tables/trees/leaves/walnut.json -059fbd5d2010ed22af5bd9f3cad8e834069f3fd4 data/dtecologics/loot_tables/trees/voluntary/coconut.json -52e0d3cf9aac673bed748737a49ef1f3b117c87a data/dtecologics/loot_tables/trees/voluntary/walnut.json diff --git a/src/generated/resources/.cache/bbda727dc13484b6b22308bd3b163b53737b0ae5 b/src/generated/resources/.cache/bbda727dc13484b6b22308bd3b163b53737b0ae5 deleted file mode 100644 index 789e2fc..0000000 --- a/src/generated/resources/.cache/bbda727dc13484b6b22308bd3b163b53737b0ae5 +++ /dev/null @@ -1,3 +0,0 @@ -// 1.20.1 2024-07-17T10:43:01.2018431 dtecologics DT Item Tags -b0b266d56494f114af9429e3674d8a2eea74e915 data/dynamictrees/tags/items/branches_that_burn.json -5277ba1fbceb375336d713618a191ee009998433 data/dynamictrees/tags/items/seeds.json diff --git a/src/generated/resources/.cache/bfc7c06436dea6b5bd0995629362145d44ff6afe b/src/generated/resources/.cache/bfc7c06436dea6b5bd0995629362145d44ff6afe deleted file mode 100644 index 3b5afdd..0000000 --- a/src/generated/resources/.cache/bfc7c06436dea6b5bd0995629362145d44ff6afe +++ /dev/null @@ -1,24 +0,0 @@ -// 1.20.1 2024-07-17T10:43:01.1963464 Block States: dtecologics -167a01d3590e2e1b9c082809b7bdd12f1eeda00f assets/dtecologics/blockstates/azalea_branch.json -c0cc5150c5788a0c7487c6afb64cd97f2eba991a assets/dtecologics/blockstates/coconut_branch.json -19092201261688ae991b9491c513397b821aaf63 assets/dtecologics/blockstates/coconut_leaves.json -10882d7f42bbd5a39a32b832391b1924b4e64cfa assets/dtecologics/blockstates/coconut_sapling.json -9768e0f1ae27819aabb217611e58c207bc1ae725 assets/dtecologics/blockstates/prickly_pear_cactus_sapling.json -40f072c7188a251cdf694889db65e06a544fb0af assets/dtecologics/blockstates/stripped_azalea_branch.json -e2e7fa23d5d2fa133c51f0666a71adfd95d43564 assets/dtecologics/blockstates/stripped_coconut_branch.json -bd82d2e21d7392dd1c2a8dd66a538fe6fc9dc5c9 assets/dtecologics/blockstates/stripped_walnut_branch.json -56e8c58864eaa259a9fd9692ef2f24a01c8fb08c assets/dtecologics/blockstates/walnut_branch.json -3f31e5d253fb03aa10a912e2d37553547dd39888 assets/dtecologics/blockstates/walnut_leaves.json -17194ad4372aa62b74e895c04ca5a3b75b609b05 assets/dtecologics/blockstates/walnut_sapling.json -31a78f7944a9002dd3f373d56126fd6886aa5ab5 assets/dtecologics/models/block/azalea_branch.json -d2a79560a3442eeb3dcd278db9539b488a37fdc4 assets/dtecologics/models/block/coconut_branch.json -270b4a89a9f25712e57d717717b5de6567acee39 assets/dtecologics/models/block/palm_leaves/coconut_core_bottom.json -445b94689bbb533d466dd6ca7bd50b176332f044 assets/dtecologics/models/block/palm_leaves/coconut_core_top.json -afbd6639a266eecd8d5fee76b06d89c5170f383c assets/dtecologics/models/block/palm_leaves/coconut_frond.json -be129141408eb4d87a718356686d44a61b981351 assets/dtecologics/models/block/saplings/coconut.json -85c98b7398420f52b51f14b5c96e0430a96e5ed3 assets/dtecologics/models/block/saplings/prickly_pear_cactus.json -09df350f4c80d5ce392df789148725645d7018bf assets/dtecologics/models/block/saplings/walnut.json -d9588e6bbc97de09a224edd86d844a7c584e264a assets/dtecologics/models/block/stripped_azalea_branch.json -2c9d5c2a61afac4c39568631eefd50424abc40d5 assets/dtecologics/models/block/stripped_coconut_branch.json -03232185ec2d077dc91e29b8aacc4f8be8affbdd assets/dtecologics/models/block/stripped_walnut_branch.json -efe8c55ef2cb0be570d0785e8f30162841c96973 assets/dtecologics/models/block/walnut_branch.json diff --git a/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 b/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 deleted file mode 100644 index 9ce7ca4..0000000 --- a/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 +++ /dev/null @@ -1,2 +0,0 @@ -// 1.20.1 2024-07-17T10:57:09.5515775 Languages: en_us -7d05285e9582e840df9fc9ca19deb9394b8e27a9 assets/dtecologics/lang/en_us.json diff --git a/src/generated/resources/.cache/e5060f9a9bf6cfbb6c72c5413383fcbbd2a9d690 b/src/generated/resources/.cache/e5060f9a9bf6cfbb6c72c5413383fcbbd2a9d690 deleted file mode 100644 index 830d8c8..0000000 --- a/src/generated/resources/.cache/e5060f9a9bf6cfbb6c72c5413383fcbbd2a9d690 +++ /dev/null @@ -1,5 +0,0 @@ -// 1.20.1 2024-07-17T10:43:01.2053172 dtecologics DT Block Tags -b0b266d56494f114af9429e3674d8a2eea74e915 data/dynamictrees/tags/blocks/branches_that_burn.json -5982b5091ec12b6fe8cf416dd1d987d584e95ccc data/dynamictrees/tags/blocks/leaves.json -2f196b8558172907d47cfa22838f908911e2a97f data/dynamictrees/tags/blocks/saplings.json -302fae0eeaca63b078a6a91f9c5dc27c89891b09 data/dynamictrees/tags/blocks/stripped_branches_that_burn.json diff --git a/src/generated/resources/assets/dtecologics/lang/en_us.json b/src/generated/resources/assets/dtecologics/lang/en_us.json index ef36410..ff9bb94 100644 --- a/src/generated/resources/assets/dtecologics/lang/en_us.json +++ b/src/generated/resources/assets/dtecologics/lang/en_us.json @@ -7,7 +7,5 @@ "item.dtecologics.walnut_seed": "Germinated Walnut", "species.dtecologics.coconut": "Coconut", "species.dtecologics.prickly_pear_cactus": "Prickly Pear Cactus", - "species.dtecologics.walnut": "Walnut", - "death.attack.dtecologics.falling_fruit.coconut": "%1$s was bonked in the head by a falling Coconut", - "subtitle.dtecologics.falling_fruit.bonk": "Player bonked by fruit" + "species.dtecologics.walnut": "Walnut" } \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/atlases/blocks.json b/src/generated/resources/assets/minecraft/atlases/blocks.json new file mode 100644 index 0000000..e5f3208 --- /dev/null +++ b/src/generated/resources/assets/minecraft/atlases/blocks.json @@ -0,0 +1,28 @@ +{ + "sources": [ + { + "type": "dynamictrees:thick_branch_rings", + "resource": "ecologics:block/azalea_log_top" + }, + { + "type": "dynamictrees:thick_branch_rings", + "resource": "ecologics:block/stripped_azalea_log_top" + }, + { + "type": "dynamictrees:thick_branch_rings", + "resource": "ecologics:block/coconut_log_top" + }, + { + "type": "dynamictrees:thick_branch_rings", + "resource": "ecologics:block/stripped_coconut_log_top" + }, + { + "type": "dynamictrees:thick_branch_rings", + "resource": "ecologics:block/walnut_log_top" + }, + { + "type": "dynamictrees:thick_branch_rings", + "resource": "ecologics:block/stripped_walnut_log_top" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dtecologics/loot_tables/blocks/coconut.json b/src/generated/resources/data/dtecologics/loot_table/blocks/coconut.json similarity index 100% rename from src/generated/resources/data/dtecologics/loot_tables/blocks/coconut.json rename to src/generated/resources/data/dtecologics/loot_table/blocks/coconut.json diff --git a/src/generated/resources/data/dtecologics/loot_table/blocks/coconut_leaves.json b/src/generated/resources/data/dtecologics/loot_table/blocks/coconut_leaves.json new file mode 100644 index 0000000..45fb347 --- /dev/null +++ b/src/generated/resources/data/dtecologics/loot_table/blocks/coconut_leaves.json @@ -0,0 +1,138 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:any_of", + "terms": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "items": "minecraft:shears" + } + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "predicates": { + "minecraft:enchantments": [ + { + "enchantments": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + } + ] + } + ], + "name": "ecologics:coconut_leaves" + }, + { + "type": "dynamictrees:seed_item", + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "chances": [ + 0.015625, + 0.03125, + 0.046875, + 0.0625 + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" + }, + { + "condition": "dynamictrees:seasonal_seed_drop_chance" + } + ] + } + ] + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:inverted", + "term": { + "condition": "minecraft:any_of", + "terms": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "items": "minecraft:shears" + } + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "predicates": { + "minecraft:enchantments": [ + { + "enchantments": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + } + ] + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "chances": [ + 0.02, + 0.022222223, + 0.025, + 0.033333335, + 0.1 + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" + } + ], + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 2.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "dtecologics:blocks/coconut_leaves" +} \ No newline at end of file diff --git a/src/generated/resources/data/dtecologics/loot_tables/blocks/prickly_pear.json b/src/generated/resources/data/dtecologics/loot_table/blocks/prickly_pear.json similarity index 100% rename from src/generated/resources/data/dtecologics/loot_tables/blocks/prickly_pear.json rename to src/generated/resources/data/dtecologics/loot_table/blocks/prickly_pear.json diff --git a/src/generated/resources/data/dtecologics/loot_tables/blocks/walnut.json b/src/generated/resources/data/dtecologics/loot_table/blocks/walnut.json similarity index 100% rename from src/generated/resources/data/dtecologics/loot_tables/blocks/walnut.json rename to src/generated/resources/data/dtecologics/loot_table/blocks/walnut.json diff --git a/src/generated/resources/data/dtecologics/loot_tables/blocks/walnut_leaves.json b/src/generated/resources/data/dtecologics/loot_table/blocks/walnut_leaves.json similarity index 79% rename from src/generated/resources/data/dtecologics/loot_tables/blocks/walnut_leaves.json rename to src/generated/resources/data/dtecologics/loot_table/blocks/walnut_leaves.json index 6d2649e..6645db5 100644 --- a/src/generated/resources/data/dtecologics/loot_tables/blocks/walnut_leaves.json +++ b/src/generated/resources/data/dtecologics/loot_table/blocks/walnut_leaves.json @@ -16,22 +16,22 @@ { "condition": "minecraft:match_tool", "predicate": { - "items": [ - "minecraft:shears" - ] + "items": "minecraft:shears" } }, { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantments": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] @@ -76,22 +76,22 @@ { "condition": "minecraft:match_tool", "predicate": { - "items": [ - "minecraft:shears" - ] + "items": "minecraft:shears" } }, { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantments": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] diff --git a/src/generated/resources/data/dtecologics/loot_tables/trees/branches/azalea.json b/src/generated/resources/data/dtecologics/loot_table/trees/branches/azalea.json similarity index 100% rename from src/generated/resources/data/dtecologics/loot_tables/trees/branches/azalea.json rename to src/generated/resources/data/dtecologics/loot_table/trees/branches/azalea.json diff --git a/src/generated/resources/data/dtecologics/loot_tables/trees/branches/coconut.json b/src/generated/resources/data/dtecologics/loot_table/trees/branches/coconut.json similarity index 100% rename from src/generated/resources/data/dtecologics/loot_tables/trees/branches/coconut.json rename to src/generated/resources/data/dtecologics/loot_table/trees/branches/coconut.json diff --git a/src/generated/resources/data/dtecologics/loot_tables/trees/branches/stripped_azalea.json b/src/generated/resources/data/dtecologics/loot_table/trees/branches/stripped_azalea.json similarity index 100% rename from src/generated/resources/data/dtecologics/loot_tables/trees/branches/stripped_azalea.json rename to src/generated/resources/data/dtecologics/loot_table/trees/branches/stripped_azalea.json diff --git a/src/generated/resources/data/dtecologics/loot_tables/trees/branches/stripped_coconut.json b/src/generated/resources/data/dtecologics/loot_table/trees/branches/stripped_coconut.json similarity index 100% rename from src/generated/resources/data/dtecologics/loot_tables/trees/branches/stripped_coconut.json rename to src/generated/resources/data/dtecologics/loot_table/trees/branches/stripped_coconut.json diff --git a/src/generated/resources/data/dtecologics/loot_tables/trees/branches/stripped_walnut.json b/src/generated/resources/data/dtecologics/loot_table/trees/branches/stripped_walnut.json similarity index 100% rename from src/generated/resources/data/dtecologics/loot_tables/trees/branches/stripped_walnut.json rename to src/generated/resources/data/dtecologics/loot_table/trees/branches/stripped_walnut.json diff --git a/src/generated/resources/data/dtecologics/loot_tables/trees/branches/walnut.json b/src/generated/resources/data/dtecologics/loot_table/trees/branches/walnut.json similarity index 100% rename from src/generated/resources/data/dtecologics/loot_tables/trees/branches/walnut.json rename to src/generated/resources/data/dtecologics/loot_table/trees/branches/walnut.json diff --git a/src/generated/resources/data/dtecologics/loot_table/trees/leaves/coconut.json b/src/generated/resources/data/dtecologics/loot_table/trees/leaves/coconut.json new file mode 100644 index 0000000..663e39d --- /dev/null +++ b/src/generated/resources/data/dtecologics/loot_table/trees/leaves/coconut.json @@ -0,0 +1,70 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "dynamictrees:seed_item", + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "chances": [ + 0.015625, + 0.03125, + 0.046875, + 0.0625 + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" + }, + { + "condition": "dynamictrees:seasonal_seed_drop_chance" + } + ] + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "chances": [ + 0.02, + 0.022222223, + 0.025, + 0.033333335, + 0.1 + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" + } + ], + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 2.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "dtecologics:trees/leaves/coconut" +} \ No newline at end of file diff --git a/src/generated/resources/data/dtecologics/loot_tables/trees/leaves/walnut.json b/src/generated/resources/data/dtecologics/loot_table/trees/leaves/walnut.json similarity index 100% rename from src/generated/resources/data/dtecologics/loot_tables/trees/leaves/walnut.json rename to src/generated/resources/data/dtecologics/loot_table/trees/leaves/walnut.json diff --git a/src/generated/resources/data/dtecologics/loot_tables/trees/voluntary/coconut.json b/src/generated/resources/data/dtecologics/loot_table/trees/voluntary/coconut.json similarity index 100% rename from src/generated/resources/data/dtecologics/loot_tables/trees/voluntary/coconut.json rename to src/generated/resources/data/dtecologics/loot_table/trees/voluntary/coconut.json diff --git a/src/generated/resources/data/dtecologics/loot_tables/trees/voluntary/walnut.json b/src/generated/resources/data/dtecologics/loot_table/trees/voluntary/walnut.json similarity index 100% rename from src/generated/resources/data/dtecologics/loot_tables/trees/voluntary/walnut.json rename to src/generated/resources/data/dtecologics/loot_table/trees/voluntary/walnut.json diff --git a/src/generated/resources/data/dtecologics/loot_tables/blocks/coconut_leaves.json b/src/generated/resources/data/dtecologics/loot_tables/blocks/coconut_leaves.json deleted file mode 100644 index 766d2d5..0000000 --- a/src/generated/resources/data/dtecologics/loot_tables/blocks/coconut_leaves.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "bonus_rolls": 0.0, - "entries": [ - { - "type": "minecraft:alternatives", - "children": [ - { - "type": "minecraft:item", - "conditions": [ - { - "condition": "minecraft:any_of", - "terms": [ - { - "condition": "minecraft:match_tool", - "predicate": { - "items": [ - "minecraft:shears" - ] - } - }, - { - "condition": "minecraft:match_tool", - "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } - } - ] - } - } - ] - } - ], - "name": "ecologics:coconut_leaves" - }, - { - "type": "dynamictrees:seed_item", - "conditions": [ - { - "condition": "minecraft:survives_explosion" - }, - { - "chances": [ - 0.015625, - 0.03125, - 0.046875, - 0.0625 - ], - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune" - }, - { - "condition": "dynamictrees:seasonal_seed_drop_chance" - } - ] - } - ] - } - ], - "rolls": 1.0 - } - ], - "random_sequence": "dtecologics:blocks/coconut_leaves" -} \ No newline at end of file diff --git a/src/generated/resources/data/dtecologics/loot_tables/trees/leaves/coconut.json b/src/generated/resources/data/dtecologics/loot_tables/trees/leaves/coconut.json deleted file mode 100644 index b67d09b..0000000 --- a/src/generated/resources/data/dtecologics/loot_tables/trees/leaves/coconut.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "bonus_rolls": 0.0, - "entries": [ - { - "type": "dynamictrees:seed_item", - "conditions": [ - { - "condition": "minecraft:survives_explosion" - }, - { - "chances": [ - 0.015625, - 0.03125, - 0.046875, - 0.0625 - ], - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune" - }, - { - "condition": "dynamictrees:seasonal_seed_drop_chance" - } - ] - } - ], - "rolls": 1.0 - } - ], - "random_sequence": "dtecologics:trees/leaves/coconut" -} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/tags/blocks/branches_that_burn.json b/src/generated/resources/data/dynamictrees/tags/block/branches_that_burn.json similarity index 100% rename from src/generated/resources/data/dynamictrees/tags/blocks/branches_that_burn.json rename to src/generated/resources/data/dynamictrees/tags/block/branches_that_burn.json diff --git a/src/generated/resources/data/dynamictrees/tags/blocks/leaves.json b/src/generated/resources/data/dynamictrees/tags/block/leaves.json similarity index 100% rename from src/generated/resources/data/dynamictrees/tags/blocks/leaves.json rename to src/generated/resources/data/dynamictrees/tags/block/leaves.json diff --git a/src/generated/resources/data/dynamictrees/tags/blocks/saplings.json b/src/generated/resources/data/dynamictrees/tags/block/saplings.json similarity index 70% rename from src/generated/resources/data/dynamictrees/tags/blocks/saplings.json rename to src/generated/resources/data/dynamictrees/tags/block/saplings.json index f73fef5..403ecc7 100644 --- a/src/generated/resources/data/dynamictrees/tags/blocks/saplings.json +++ b/src/generated/resources/data/dynamictrees/tags/block/saplings.json @@ -1,11 +1,10 @@ { - "replace": false, "values": [ "dtecologics:coconut_sapling", - "dtecologics:walnut_sapling", { "id": "dtecologics:prickly_pear_cactus_sapling", "required": false - } + }, + "dtecologics:walnut_sapling" ] } \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/tags/blocks/stripped_branches_that_burn.json b/src/generated/resources/data/dynamictrees/tags/block/stripped_branches_that_burn.json similarity index 100% rename from src/generated/resources/data/dynamictrees/tags/blocks/stripped_branches_that_burn.json rename to src/generated/resources/data/dynamictrees/tags/block/stripped_branches_that_burn.json diff --git a/src/generated/resources/data/dynamictrees/tags/items/branches_that_burn.json b/src/generated/resources/data/dynamictrees/tags/item/branches_that_burn.json similarity index 100% rename from src/generated/resources/data/dynamictrees/tags/items/branches_that_burn.json rename to src/generated/resources/data/dynamictrees/tags/item/branches_that_burn.json diff --git a/src/generated/resources/data/dynamictrees/tags/items/seeds.json b/src/generated/resources/data/dynamictrees/tags/item/seeds.json similarity index 70% rename from src/generated/resources/data/dynamictrees/tags/items/seeds.json rename to src/generated/resources/data/dynamictrees/tags/item/seeds.json index 7063d2a..f487b5e 100644 --- a/src/generated/resources/data/dynamictrees/tags/items/seeds.json +++ b/src/generated/resources/data/dynamictrees/tags/item/seeds.json @@ -1,11 +1,10 @@ { - "replace": false, "values": [ "dtecologics:coconut_seed", - "dtecologics:walnut_seed", { "id": "dtecologics:prickly_pear_cactus_seed", "required": false - } + }, + "dtecologics:walnut_seed" ] } \ No newline at end of file diff --git a/src/main/java/maxhyper/dtecologics/DynamicTreesEcologics.java b/src/main/java/maxhyper/dtecologics/DynamicTreesEcologics.java index b803f32..292679b 100644 --- a/src/main/java/maxhyper/dtecologics/DynamicTreesEcologics.java +++ b/src/main/java/maxhyper/dtecologics/DynamicTreesEcologics.java @@ -1,46 +1,40 @@ package maxhyper.dtecologics; -import com.ferreusveritas.dynamictrees.api.GatherDataHelper; -import com.ferreusveritas.dynamictrees.api.registry.RegistryHandler; -import com.ferreusveritas.dynamictrees.block.leaves.LeavesProperties; -import com.ferreusveritas.dynamictrees.block.rooty.SoilProperties; -import com.ferreusveritas.dynamictrees.systems.fruit.Fruit; -import com.ferreusveritas.dynamictrees.systems.pod.Pod; -import com.ferreusveritas.dynamictrees.tree.family.Family; -import com.ferreusveritas.dynamictrees.tree.species.Species; -import maxhyper.dtecologics.init.PlusRegistries; +import com.dtteam.dynamictrees.api.registry.TypedRegistry; +import com.dtteam.dynamictrees.block.fruit.Fruit; +import com.dtteam.dynamictrees.block.leaves.LeavesProperties; +import com.dtteam.dynamictrees.block.pod.Pod; +import com.dtteam.dynamictrees.block.soil.SoilProperties; +import com.dtteam.dynamictrees.data.GatherDataHelper; +import com.dtteam.dynamictrees.registry.NeoForgeRegistryHandler; +import com.dtteam.dynamictrees.tree.family.Family; +import com.dtteam.dynamictrees.tree.species.Species; +import maxhyper.dtecologics.init.PlusModRegistries; import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.data.event.GatherDataEvent; -import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.fml.ModList; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; -import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; - -// The value here should match an entry in the META-INF/mods.toml file +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.Property; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.ModList; +import net.neoforged.fml.common.Mod; +import net.neoforged.neoforge.data.event.GatherDataEvent; +import org.jetbrains.annotations.Contract; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + @Mod(DynamicTreesEcologics.MOD_ID) public class DynamicTreesEcologics { public static final String MOD_ID = "dtecologics"; + private static LeavesProperties azaleaProperties; - public DynamicTreesEcologics() { - IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); - - modEventBus.addListener(this::clientSetup); - modEventBus.addListener(this::commonSetup); - modEventBus.addListener(this::gatherData); + public DynamicTreesEcologics(@NotNull IEventBus modBus) { + modBus.addListener(this::gatherData); - if (ModList.get().isLoaded("dynamictreesplus")){ - modEventBus.register(PlusRegistries.class); + if (ModList.get().isLoaded("dynamictreesplus")) { + modBus.register(PlusModRegistries.class); } - RegistryHandler.setup(MOD_ID); - } - - private void clientSetup(final FMLClientSetupEvent event) { - } - - private void commonSetup(final FMLCommonSetupEvent event) { + NeoForgeRegistryHandler.setup(MOD_ID, modBus); } private void gatherData(final GatherDataEvent event) { @@ -50,11 +44,46 @@ private void gatherData(final GatherDataEvent event) { Species.REGISTRY, Fruit.REGISTRY, Pod.REGISTRY, - LeavesProperties.REGISTRY); + LeavesProperties.REGISTRY + ); } + @NotNull + @Contract("_ -> new") public static ResourceLocation location(final String path) { - return new ResourceLocation(MOD_ID, path); + return ResourceLocation.fromNamespaceAndPath(MOD_ID, path); + } + + public static void updateAzaleaProperties() { + TypedRegistry registry = LeavesProperties.REGISTRY; + if (!registry.isLocked()) + return; + + for (LeavesProperties properties : registry) { + @Nullable BlockState state = properties.getPrimitiveLeaves(); + + //noinspection ConstantValue + if (state != null && state.is(Blocks.AZALEA_LEAVES)) { + azaleaProperties = properties; + return; + } + } + } + + @Nullable + public static LeavesProperties getAzaleaProperties() { + if (azaleaProperties == null) + updateAzaleaProperties(); + return azaleaProperties; + } + + @NotNull + public static > BlockState copyProperty( + @NotNull BlockState from, + @NotNull BlockState to, + Property property + ) { + return to.setValue(property, from.getValue(property)); } } diff --git a/src/main/java/maxhyper/dtecologics/cactus/PricklyPearCactusSpecies.java b/src/main/java/maxhyper/dtecologics/cactus/PricklyPearCactusSpecies.java index 1c966b6..7d938b7 100644 --- a/src/main/java/maxhyper/dtecologics/cactus/PricklyPearCactusSpecies.java +++ b/src/main/java/maxhyper/dtecologics/cactus/PricklyPearCactusSpecies.java @@ -1,21 +1,23 @@ package maxhyper.dtecologics.cactus; -import com.ferreusveritas.dynamictrees.api.registry.TypedRegistry; -import com.ferreusveritas.dynamictrees.block.leaves.LeavesProperties; -import com.ferreusveritas.dynamictrees.growthlogic.GrowthLogicKit; -import com.ferreusveritas.dynamictrees.tree.family.Family; -import com.ferreusveritas.dynamictrees.tree.species.Species; -import com.ferreusveritas.dynamictreesplus.tree.CactusSpecies; +import com.dtteam.dtaddon_lib.growthlogic.DTAddonLibGrowthLogicKits; +import com.dtteam.dynamictrees.api.registry.TypedRegistry; +import com.dtteam.dynamictrees.block.leaves.LeavesProperties; +import com.dtteam.dynamictrees.tree.family.Family; +import com.dtteam.dynamictrees.tree.species.Species; +import com.dtteam.dynamictreesplus.tree.CactusSpecies; import maxhyper.dtecologics.DynamicTreesEcologics; import net.minecraft.resources.ResourceLocation; +import org.jetbrains.annotations.NotNull; public class PricklyPearCactusSpecies extends CactusSpecies { public static final TypedRegistry.EntryType TYPE = createDefaultType(PricklyPearCactusSpecies::new); + @NotNull @Override public Species setPreReloadDefaults() { - return super.setPreReloadDefaults().setGrowthLogicKit(GrowthLogicKit.DEFAULT); + return super.setPreReloadDefaults().setGrowthLogicKit(DTAddonLibGrowthLogicKits.PRICKLY_PEAR); } public PricklyPearCactusSpecies(ResourceLocation name, Family family, LeavesProperties leavesProperties) { @@ -27,6 +29,7 @@ public int getProbabilityForCurrentDir() { return 2; } + @NotNull @Override public ResourceLocation getSaplingSmartModelLocation() { return DynamicTreesEcologics.location("block/"+this.getRegistryName().getPath()+"_sapling"); diff --git a/src/main/java/maxhyper/dtecologics/coconut/FallingCoconutBlock.java b/src/main/java/maxhyper/dtecologics/coconut/FallingCoconutBlock.java new file mode 100644 index 0000000..1729e79 --- /dev/null +++ b/src/main/java/maxhyper/dtecologics/coconut/FallingCoconutBlock.java @@ -0,0 +1,142 @@ +package maxhyper.dtecologics.coconut; + +import com.dtteam.dtaddon_lib.blocks.fruit.FallingPodBlock; +import com.dtteam.dtaddon_lib.blocks.fruit.IFallingFruit; +import com.dtteam.dtaddon_lib.init.DTAddonLibRegistries; +import com.dtteam.dynamictrees.block.pod.Pod; +import net.minecraft.core.BlockPos; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.item.FallingBlockEntity; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Fallable; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; +import samebutdifferent.ecologics.entity.CoconutCrab; +import samebutdifferent.ecologics.platform.ConfigPlatformHelper; +import samebutdifferent.ecologics.registry.ModEntityTypes; +import samebutdifferent.ecologics.registry.ModSoundEvents; + +public class FallingCoconutBlock extends FallingPodBlock implements Fallable { + + public FallingCoconutBlock(Properties properties, Pod pod) { + super(properties, pod); + } + + @NotNull + public VoxelShape getShape(@NotNull BlockState state) { + return pod.getBlockShape(state.getValue(FACING), getAge(state)); + } + + @NotNull + public AABB getBoundingBox(@NotNull FallingBlockEntity fallingBlockEntity) { + return getShape(fallingBlockEntity.getBlockState()) + .bounds() + .move( + fallingBlockEntity.getX() - 0.5, + fallingBlockEntity.getY(), + fallingBlockEntity.getZ() - 0.5 + ); + } + + @Override + public FallingBlockEntity getFallingEntity(Level level, BlockPos pos, BlockState state) { + if (getAge(state) != getMaxAge() || level.random.nextDouble() > ConfigPlatformHelper.coconutCrabSpawnChance()) { + return super.getFallingEntity(level, pos, state); + } + + return new FallingBlockEntity(level, pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5, state) { + + @Override + public boolean causeFallDamage(float pFallDistance, float pMultiplier, @NotNull DamageSource pSource) { + int i = (int)Math.ceil(pFallDistance - 1.0F); + if (i <= 0) { + return false; + } + + Level level = level(); + + for (Entity entity : level.getEntities(this, this.getBoundingBox())) { + if (!(entity instanceof LivingEntity)) { + continue; + } + + entity.hurt( + getDamageSource(level), + (float)Math.min(Math.floor(i * IFallingFruit.fallDamageAmount), IFallingFruit.fallDamageMax) * pMultiplier + ); + level.playSound( + null, getX(), getY(), getZ(), + DTAddonLibRegistries.FRUIT_BONK.get(), + SoundSource.BLOCKS, + 1.0F, 1.0F + ); + } + + return false; + } + + @Override + public ItemEntity spawnAtLocation(@NotNull ItemStack pStack, float pOffsetY) { + return null; + } + + @Override + public void callOnBrokenAfterFall(@NotNull Block block, @NotNull BlockPos pos) { + super.callOnBrokenAfterFall(block, pos); + + Level level = level(); + + CoconutCrab coconutCrab = ModEntityTypes.COCONUT_CRAB.create(level); + if (coconutCrab == null) { + return; + } + + AABB bb = getBoundingBox(); + + double x = (bb.minX + bb.maxX) / 2.0; + double z = (bb.minZ + bb.maxZ) / 2.0; + + switch (getBlockState().getValue(FACING)) { + case NORTH -> z = bb.maxZ; + case SOUTH -> z = bb.minZ; + case WEST -> x = bb.maxX; + case EAST -> x = bb.minX; + } + + coconutCrab.setPos(x, bb.minY, z); + level.addFreshEntity(coconutCrab); + } + + }; + } + + @Override + public void onBrokenAfterFall( + @NotNull Level level, + @NotNull BlockPos pos, + @NotNull FallingBlockEntity fallingBlock + ) { + level.playSound( + null, pos, + ModSoundEvents.COCONUT_SMASH, + SoundSource.BLOCKS, + 0.7f, + 0.9f + level.getRandom().nextFloat() * 0.2f + ); + } + + @NotNull + @Override + public DamageSource getFallDamageSource(@NotNull Entity entity) { + return getDamageSource(entity.level()); + } + +} diff --git a/src/main/java/maxhyper/dtecologics/coconut/FallingCoconutPod.java b/src/main/java/maxhyper/dtecologics/coconut/FallingCoconutPod.java new file mode 100644 index 0000000..bc60eaf --- /dev/null +++ b/src/main/java/maxhyper/dtecologics/coconut/FallingCoconutPod.java @@ -0,0 +1,23 @@ +package maxhyper.dtecologics.coconut; + +import com.dtteam.dtaddon_lib.fruits.FallingPalmPod; +import com.dtteam.dynamictrees.api.registry.TypedRegistry; +import com.dtteam.dynamictrees.block.pod.Pod; +import com.dtteam.dynamictrees.block.pod.PodBlock; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.Block; + +public class FallingCoconutPod extends FallingPalmPod { + + public static final TypedRegistry.EntryType TYPE = TypedRegistry.newType(FallingCoconutPod::new); + + public FallingCoconutPod(ResourceLocation registryName) { + super(registryName); + } + + @Override + protected PodBlock createBlock(Block.Properties properties) { + return new FallingCoconutBlock(properties, this); + } + +} diff --git a/src/main/java/maxhyper/dtecologics/init/EcologicsEventRegistries.java b/src/main/java/maxhyper/dtecologics/init/EcologicsEventRegistries.java new file mode 100644 index 0000000..b72f157 --- /dev/null +++ b/src/main/java/maxhyper/dtecologics/init/EcologicsEventRegistries.java @@ -0,0 +1,39 @@ +package maxhyper.dtecologics.init; + +import maxhyper.dtecologics.DynamicTreesEcologics; +import maxhyper.dtecologics.coconut.FallingCoconutBlock; +import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.item.FallingBlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.AABB; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.event.entity.EntityEvent; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +@EventBusSubscriber(modid = DynamicTreesEcologics.MOD_ID) +public class EcologicsEventRegistries { + + @SubscribeEvent + public static void onEntitySize(@NotNull final EntityEvent.Size event) { + if (!(event.getEntity() instanceof FallingBlockEntity fallingBlock)) { + return; + } + + @Nullable BlockState blockState = fallingBlock.getBlockState(); + + //noinspection ConstantValue + if (blockState == null || !(blockState.getBlock() instanceof FallingCoconutBlock coconutBlock)) { + return; + } + + AABB bounds = coconutBlock.getShape(blockState).bounds(); + + event.setNewSize(EntityDimensions.fixed( + (float) Math.max(bounds.getXsize(), bounds.getZsize()), + (float) bounds.getYsize() + )); + } + +} diff --git a/src/main/java/maxhyper/dtecologics/init/EcologicsModRegistries.java b/src/main/java/maxhyper/dtecologics/init/EcologicsModRegistries.java new file mode 100644 index 0000000..3e35f54 --- /dev/null +++ b/src/main/java/maxhyper/dtecologics/init/EcologicsModRegistries.java @@ -0,0 +1,21 @@ +package maxhyper.dtecologics.init; + +import com.dtteam.dynamictrees.block.pod.Pod; +import com.dtteam.dynamictrees.event.TypeRegistryEvent; +import maxhyper.dtecologics.DynamicTreesEcologics; +import maxhyper.dtecologics.coconut.FallingCoconutPod; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import org.jetbrains.annotations.NotNull; + +@EventBusSubscriber(modid = DynamicTreesEcologics.MOD_ID) +public class EcologicsModRegistries { + + @SubscribeEvent + public static void registerPodType(@NotNull final TypeRegistryEvent event) { + if (event.isEntryOfType(Pod.class)) { + event.registerType(DynamicTreesEcologics.location("falling_coconut"), FallingCoconutPod.TYPE); + } + } + +} diff --git a/src/main/java/maxhyper/dtecologics/init/PlusModRegistries.java b/src/main/java/maxhyper/dtecologics/init/PlusModRegistries.java new file mode 100644 index 0000000..1f489fe --- /dev/null +++ b/src/main/java/maxhyper/dtecologics/init/PlusModRegistries.java @@ -0,0 +1,19 @@ +package maxhyper.dtecologics.init; + +import com.dtteam.dynamictrees.event.TypeRegistryEvent; +import com.dtteam.dynamictrees.tree.species.Species; +import maxhyper.dtecologics.DynamicTreesEcologics; +import maxhyper.dtecologics.cactus.PricklyPearCactusSpecies; +import net.neoforged.bus.api.SubscribeEvent; +import org.jetbrains.annotations.NotNull; + +public class PlusModRegistries { + + @SubscribeEvent + public static void registerSpeciesType(@NotNull final TypeRegistryEvent event) { + if (event.isEntryOfType(Species.class)) { + event.registerType(DynamicTreesEcologics.location("prickly_pear_cactus"), PricklyPearCactusSpecies.TYPE); + } + } + +} diff --git a/src/main/java/maxhyper/dtecologics/init/PlusRegistries.java b/src/main/java/maxhyper/dtecologics/init/PlusRegistries.java deleted file mode 100644 index 56da129..0000000 --- a/src/main/java/maxhyper/dtecologics/init/PlusRegistries.java +++ /dev/null @@ -1,16 +0,0 @@ -package maxhyper.dtecologics.init; - -import com.ferreusveritas.dynamictrees.api.registry.TypeRegistryEvent; -import com.ferreusveritas.dynamictrees.tree.species.Species; -import maxhyper.dtecologics.DynamicTreesEcologics; -import maxhyper.dtecologics.cactus.PricklyPearCactusSpecies; -import net.minecraftforge.eventbus.api.SubscribeEvent; - -public class PlusRegistries { - - @SubscribeEvent - public static void registerSpeciesType(final TypeRegistryEvent event) { - event.registerType(DynamicTreesEcologics.location("prickly_pear_cactus"), PricklyPearCactusSpecies.TYPE); - } - -} diff --git a/src/main/java/maxhyper/dtecologics/mixin/AbstractRegistryMixin.java b/src/main/java/maxhyper/dtecologics/mixin/AbstractRegistryMixin.java new file mode 100644 index 0000000..34e6072 --- /dev/null +++ b/src/main/java/maxhyper/dtecologics/mixin/AbstractRegistryMixin.java @@ -0,0 +1,25 @@ +package maxhyper.dtecologics.mixin; + +import com.dtteam.dynamictrees.api.registry.AbstractRegistry; +import com.dtteam.dynamictrees.block.leaves.LeavesProperties; +import maxhyper.dtecologics.DynamicTreesEcologics; +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; + +@Mixin(AbstractRegistry.class) +public abstract class AbstractRegistryMixin { + + @Inject( + method = "lock", + at = @At("RETURN") + ) + private void afterLock(CallbackInfo ci) { + //noinspection ConstantValue + if ((Object) this == LeavesProperties.REGISTRY) { + DynamicTreesEcologics.updateAzaleaProperties(); + } + } + +} diff --git a/src/main/java/maxhyper/dtecologics/mixin/EcologicsNeoForgeMixin.java b/src/main/java/maxhyper/dtecologics/mixin/EcologicsNeoForgeMixin.java new file mode 100644 index 0000000..84cb2ce --- /dev/null +++ b/src/main/java/maxhyper/dtecologics/mixin/EcologicsNeoForgeMixin.java @@ -0,0 +1,86 @@ +package maxhyper.dtecologics.mixin; + +import com.dtteam.dynamictrees.block.leaves.DynamicLeavesBlock; +import com.dtteam.dynamictrees.block.leaves.LeavesProperties; +import com.llamalad7.mixinextras.sugar.Local; +import maxhyper.dtecologics.DynamicTreesEcologics; +import net.minecraft.core.Direction; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.Property; +import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +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.Slice; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import samebutdifferent.ecologics.block.FloweringAzaleaLogBlock; +import samebutdifferent.ecologics.neoforge.EcologicsNeoForge; + +@Mixin(EcologicsNeoForge.class) +public abstract class EcologicsNeoForgeMixin { + + @Inject( + method = "onRightClick", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/world/level/block/state/BlockState;is(Lnet/minecraft/world/level/block/Block;)Z", + ordinal = 0 + ), + slice = @Slice( + from = @At( + value = "INVOKE", + target = "Lnet/minecraft/world/item/ItemStack;is(Lnet/minecraft/world/item/Item;)Z" + ) + ) + ) + private static void onRightClick( + PlayerInteractEvent.RightClickBlock event, + CallbackInfo ci, + @Local(name = "state") @NotNull BlockState state, + @Local(name = "direction") Direction direction + ) { + if (!(state.getBlock() instanceof DynamicLeavesBlock dynamicLeavesBlock)) { + return; + } + + @Nullable BlockState primitiveState = dynamicLeavesBlock.getLeavesProperties().getPrimitiveLeaves(); + + //noinspection ConstantValue + if (primitiveState == null || !primitiveState.is(Blocks.FLOWERING_AZALEA_LEAVES)) { + return; + } + + @Nullable LeavesProperties leavesProperties = DynamicTreesEcologics.getAzaleaProperties(); + if (leavesProperties == null) { + return; + } + + BlockState dynamicState = leavesProperties.getDynamicLeavesState(state.getValue(DynamicLeavesBlock.DISTANCE)); + + for (Property property : state.getProperties()) { + if (dynamicState.hasProperty(property)) { + dynamicState = DynamicTreesEcologics.copyProperty(state, dynamicState, property); + } + } + + Player player = event.getEntity(); + InteractionHand hand = event.getHand(); + + FloweringAzaleaLogBlock.shearAzalea( + event.getLevel(), + player, + event.getPos(), + event.getItemStack(), + hand, + direction, + dynamicState + ); + player.swing(hand, true); + } + +} diff --git a/src/main/java/maxhyper/dtecologics/mixin/EntityMixin.java b/src/main/java/maxhyper/dtecologics/mixin/EntityMixin.java new file mode 100644 index 0000000..cd4d34e --- /dev/null +++ b/src/main/java/maxhyper/dtecologics/mixin/EntityMixin.java @@ -0,0 +1,37 @@ +package maxhyper.dtecologics.mixin; + +import maxhyper.dtecologics.coconut.FallingCoconutBlock; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.item.FallingBlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.AABB; +import org.jetbrains.annotations.Nullable; +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.CallbackInfoReturnable; + +@Mixin(Entity.class) +public abstract class EntityMixin { + + @Inject( + method = "makeBoundingBox", + at = @At("HEAD"), + cancellable = true + ) + protected void makeBoundingBox(CallbackInfoReturnable cir) { + if (!((Entity) (Object) this instanceof FallingBlockEntity fallingBlock)) { + return; + } + + @Nullable BlockState blockState = fallingBlock.getBlockState(); + + if (blockState == null || !(blockState.getBlock() instanceof FallingCoconutBlock coconutBlock)) { + return; + } + + cir.setReturnValue(coconutBlock.getBoundingBox(fallingBlock)); + cir.cancel(); + } + +} diff --git a/src/main/java/maxhyper/dtecologics/mixin/FallingBlockEntityMixin.java b/src/main/java/maxhyper/dtecologics/mixin/FallingBlockEntityMixin.java new file mode 100644 index 0000000..ca34417 --- /dev/null +++ b/src/main/java/maxhyper/dtecologics/mixin/FallingBlockEntityMixin.java @@ -0,0 +1,69 @@ +package maxhyper.dtecologics.mixin; + +import maxhyper.dtecologics.coconut.FallingCoconutBlock; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; +import net.minecraft.world.entity.item.FallingBlockEntity; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.NotNull; +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; + +@Mixin(FallingBlockEntity.class) +public abstract class FallingBlockEntityMixin { + + @Inject( + method = "(Lnet/minecraft/world/level/Level;DDDLnet/minecraft/world/level/block/state/BlockState;)V", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/world/entity/item/FallingBlockEntity;setPos(DDD)V" + ) + ) + private void init( + Level level, + double x, double y, double z, + @NotNull BlockState state, + CallbackInfo ci + ) { + if (state.getBlock() instanceof FallingCoconutBlock) { + FallingBlockEntity self = (FallingBlockEntity) (Object) this; + self.refreshDimensions(); + } + } + + @Inject( + method = "recreateFromPacket", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/world/entity/item/FallingBlockEntity;setPos(DDD)V" + ) + ) + private void recreateFromPacket( + ClientboundAddEntityPacket packet, + CallbackInfo ci + ) { + FallingBlockEntity self = (FallingBlockEntity) (Object) this; + if (self.getBlockState().getBlock() instanceof FallingCoconutBlock) { + self.refreshDimensions(); + } + } + + @Inject( + method = "readAdditionalSaveData", + at = @At("RETURN") + ) + private void readAdditionalSaveData( + CompoundTag compound, + CallbackInfo ci + ) { + FallingBlockEntity self = (FallingBlockEntity) (Object) this; + if (self.getBlockState().getBlock() instanceof FallingCoconutBlock coconutBlock) { + self.refreshDimensions(); + self.setBoundingBox(coconutBlock.getBoundingBox(self)); + } + } + +} diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg new file mode 100644 index 0000000..5e1839f --- /dev/null +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -0,0 +1 @@ +public net.minecraft.world.entity.item.FallingBlockEntity (Lnet/minecraft/world/level/Level;DDDLnet/minecraft/world/level/block/state/BlockState;)V diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml deleted file mode 100644 index 3f9a42b..0000000 --- a/src/main/resources/META-INF/mods.toml +++ /dev/null @@ -1,59 +0,0 @@ -modLoader="javafml" -loaderVersion = "[47,)" -license="MIT" -issueTrackerURL="https://github.com/DynamicTreesTeam/DynamicTrees-Ecologics/issues" - -[[mods]] -modId="dtecologics" -version="${file.jarVersion}" -displayName="Dynamic Trees for Ecologics" - -updateJSONURL="https://github.com/DynamicTreesTeam/DynamicTreesVersionInfo/blob/master/Add-ons/Ecologics.json?raw=true" -displayURL="https://www.curseforge.com/minecraft/mc-mods/dynamic-trees-ecologics" - -authors="Max Hyper" -description=''' -Compatibility Mod between Dynamic trees and Ecologics -''' - -[[dependencies.dtecologics]] - modId="forge" - mandatory=true - versionRange="[47,)" - ordering="NONE" - side="BOTH" - -[[dependencies.dtecologics]] - modId="minecraft" - mandatory=true - versionRange="[1.20.1]" - ordering="NONE" - side="BOTH" - -[[dependencies.dtecologics]] - modId="dynamictrees" - mandatory=true - versionRange="[1.4.0,)" - ordering="AFTER" - side="BOTH" - -[[dependencies.dtecologics]] - modId="dtaddon_lib" - mandatory=true - versionRange="[0.1.0-BETA5,)" - ordering="AFTER" - side="BOTH" - -[[dependencies.dtecologics]] - modId="dynamictreesplus" - mandatory=false - versionRange="[1.2.0,)" - ordering="AFTER" - side="BOTH" - -[[dependencies.dtecologics]] - modId="ecologics" - mandatory=true - versionRange="[2.2.0,)" - ordering="AFTER" - side="BOTH" diff --git a/src/main/resources/META-INF/neoforge.mods.toml b/src/main/resources/META-INF/neoforge.mods.toml new file mode 100644 index 0000000..1c29f99 --- /dev/null +++ b/src/main/resources/META-INF/neoforge.mods.toml @@ -0,0 +1,62 @@ +modLoader = "javafml" +loaderVersion = "[4,)" +license = "MIT" +issueTrackerURL = "https://github.com/DynamicTreesTeam/DynamicTrees-Ecologics/issues" + +[[mods]] +modId = "${modId}" +version = "${modVersion}" +displayName = "Dynamic Trees for Ecologics" + +updateJSONURL = "https://github.com/DynamicTreesTeam/DynamicTreesVersionInfo/blob/master/Add-ons/Ecologics.json?raw=true" +displayURL = "https://www.curseforge.com/minecraft/mc-mods/dynamic-trees-ecologics" + +authors = "Max Hyper" +description = ''' +Compatibility Mod between Dynamic trees and Ecologics +''' + +[[mixins]] +config = "${modId}.mixins.json" + +[[dependencies."${modId}"]] +modId = "neoforge" +type = "required" +versionRange = "[${neoVersion},)" +ordering = "NONE" +side = "BOTH" + +[[dependencies."${modId}"]] +modId = "minecraft" +type = "required" +versionRange = "[${mcVersion}]" +ordering = "NONE" +side = "BOTH" + +[[dependencies."${modId}"]] +modId = "dynamictrees" +type = "required" +versionRange = "[${dynamicTreesVersion},)" +ordering = "AFTER" +side = "BOTH" + +[[dependencies."${modId}"]] +modId = "dynamictreesplus" +type = "optional" +versionRange = "[${dynamicTreesPlusVersion},)" +ordering = "AFTER" +side = "BOTH" + +[[dependencies."${modId}"]] +modId = "dtaddon_lib" +type = "required" +versionRange = "[${dynamicTreesAddonLibVersion},)" +ordering = "AFTER" +side = "BOTH" + +[[dependencies."${modId}"]] +modId = "ecologics" +type = "required" +versionRange = "[${ecologicsVersion},)" +ordering = "AFTER" +side = "BOTH" diff --git a/src/main/resources/assets/dtecologics/models/block/fruit/coconut_age0.json b/src/main/resources/assets/dtecologics/models/block/fruit/coconut_age0.json index 9ac6914..0924b02 100644 --- a/src/main/resources/assets/dtecologics/models/block/fruit/coconut_age0.json +++ b/src/main/resources/assets/dtecologics/models/block/fruit/coconut_age0.json @@ -1,5 +1,6 @@ { "credit": "Made with Blockbench", + "render_type": "minecraft:cutout", "texture_size": [32, 32], "textures": { "particle": "dtecologics:block/coconut", diff --git a/src/main/resources/assets/dtecologics/models/block/fruit/coconut_age1.json b/src/main/resources/assets/dtecologics/models/block/fruit/coconut_age1.json index e91c190..e26b8bb 100644 --- a/src/main/resources/assets/dtecologics/models/block/fruit/coconut_age1.json +++ b/src/main/resources/assets/dtecologics/models/block/fruit/coconut_age1.json @@ -1,5 +1,6 @@ { "credit": "Made with Blockbench", + "render_type": "minecraft:cutout", "texture_size": [32, 32], "textures": { "particle": "dtecologics:block/coconut", diff --git a/src/main/resources/assets/dtecologics/models/block/fruit/coconut_age2.json b/src/main/resources/assets/dtecologics/models/block/fruit/coconut_age2.json index 89ec7a0..04b2a77 100644 --- a/src/main/resources/assets/dtecologics/models/block/fruit/coconut_age2.json +++ b/src/main/resources/assets/dtecologics/models/block/fruit/coconut_age2.json @@ -1,5 +1,6 @@ { "credit": "Made with Blockbench", + "render_type": "minecraft:cutout", "texture_size": [32, 32], "textures": { "particle": "dtecologics:block/coconut", diff --git a/src/main/resources/assets/dtecologics/models/block/fruit/coconut_age3.json b/src/main/resources/assets/dtecologics/models/block/fruit/coconut_age3.json index 67aa83a..23b8a1c 100644 --- a/src/main/resources/assets/dtecologics/models/block/fruit/coconut_age3.json +++ b/src/main/resources/assets/dtecologics/models/block/fruit/coconut_age3.json @@ -1,5 +1,6 @@ { "credit": "Made with Blockbench", + "render_type": "minecraft:cutout", "texture_size": [32, 32], "textures": { "particle": "dtecologics:block/coconut", diff --git a/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_age0.json b/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_age0.json index b7aad16..e73a3c8 100644 --- a/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_age0.json +++ b/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_age0.json @@ -1,3 +1,4 @@ { - "parent": "ecologics:block/prickly_pear_stage0" + "parent": "ecologics:block/prickly_pear_stage0", + "render_type": "minecraft:cutout" } \ No newline at end of file diff --git a/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_age1.json b/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_age1.json index 64399f5..337c054 100644 --- a/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_age1.json +++ b/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_age1.json @@ -1,3 +1,4 @@ { - "parent": "ecologics:block/prickly_pear_stage1" + "parent": "ecologics:block/prickly_pear_stage1", + "render_type": "minecraft:cutout" } \ No newline at end of file diff --git a/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_age2.json b/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_age2.json index 955d409..d4ad047 100644 --- a/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_age2.json +++ b/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_age2.json @@ -1,3 +1,4 @@ { - "parent": "ecologics:block/prickly_pear_stage2" + "parent": "ecologics:block/prickly_pear_stage2", + "render_type": "minecraft:cutout" } \ No newline at end of file diff --git a/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_age3.json b/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_age3.json index 8ff96dd..90a3186 100644 --- a/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_age3.json +++ b/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_age3.json @@ -1,3 +1,4 @@ { - "parent": "ecologics:block/prickly_pear_stage3" + "parent": "ecologics:block/prickly_pear_stage3", + "render_type": "minecraft:cutout" } \ No newline at end of file diff --git a/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_offset_age0.json b/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_offset_age0.json index 56b78c5..ee70b85 100644 --- a/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_offset_age0.json +++ b/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_offset_age0.json @@ -1,5 +1,6 @@ { "credit": "Made with Blockbench, copy from Ecologics", + "render_type": "minecraft:cutout", "ambientocclusion": false, "textures": { "0": "ecologics:block/prickly_pear_stage0", diff --git a/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_offset_age1.json b/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_offset_age1.json index 9f102ea..e6de4ce 100644 --- a/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_offset_age1.json +++ b/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_offset_age1.json @@ -1,5 +1,6 @@ { "credit": "Made with Blockbench, copy from Ecologics", + "render_type": "minecraft:cutout", "ambientocclusion": false, "textures": { "0": "ecologics:block/prickly_pear_stage1", diff --git a/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_offset_age2.json b/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_offset_age2.json index e0cbfba..563a139 100644 --- a/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_offset_age2.json +++ b/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_offset_age2.json @@ -1,5 +1,6 @@ { "credit": "Made with Blockbench, copy from Ecologics", + "render_type": "minecraft:cutout", "ambientocclusion": false, "texture_size": [32, 32], "textures": { diff --git a/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_offset_age3.json b/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_offset_age3.json index 27dcb44..f00fb1e 100644 --- a/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_offset_age3.json +++ b/src/main/resources/assets/dtecologics/models/block/fruit/prickly_pear_offset_age3.json @@ -1,5 +1,6 @@ { "credit": "Made with Blockbench, copy from Ecologics", + "render_type": "minecraft:cutout", "ambientocclusion": false, "texture_size": [32, 32], "textures": { diff --git a/src/main/resources/assets/dtecologics/models/block/fruit/walnut_age0.json b/src/main/resources/assets/dtecologics/models/block/fruit/walnut_age0.json index f6c0e24..7d576ee 100644 --- a/src/main/resources/assets/dtecologics/models/block/fruit/walnut_age0.json +++ b/src/main/resources/assets/dtecologics/models/block/fruit/walnut_age0.json @@ -1,5 +1,6 @@ { "credit": "Made with Blockbench", + "render_type": "minecraft:cutout", "ambientocclusion": false, "textures": { "particle": "dtecologics:block/walnut", diff --git a/src/main/resources/assets/dtecologics/models/block/fruit/walnut_age1.json b/src/main/resources/assets/dtecologics/models/block/fruit/walnut_age1.json index 9982efb..3221659 100644 --- a/src/main/resources/assets/dtecologics/models/block/fruit/walnut_age1.json +++ b/src/main/resources/assets/dtecologics/models/block/fruit/walnut_age1.json @@ -1,4 +1,5 @@ { + "render_type": "minecraft:cutout", "ambientocclusion": false, "textures": { "particle": "dtecologics:block/walnut", diff --git a/src/main/resources/assets/dtecologics/models/block/fruit/walnut_age2.json b/src/main/resources/assets/dtecologics/models/block/fruit/walnut_age2.json index 1d9de1c..701e883 100644 --- a/src/main/resources/assets/dtecologics/models/block/fruit/walnut_age2.json +++ b/src/main/resources/assets/dtecologics/models/block/fruit/walnut_age2.json @@ -1,4 +1,5 @@ { + "render_type": "minecraft:cutout", "ambientocclusion": false, "textures": { "particle": "dtecologics:block/walnut", diff --git a/src/main/resources/assets/dtecologics/models/block/fruit/walnut_age3.json b/src/main/resources/assets/dtecologics/models/block/fruit/walnut_age3.json index b9f0f8e..e7a201f 100644 --- a/src/main/resources/assets/dtecologics/models/block/fruit/walnut_age3.json +++ b/src/main/resources/assets/dtecologics/models/block/fruit/walnut_age3.json @@ -1,5 +1,6 @@ { "credit": "Made with Blockbench", + "render_type": "minecraft:cutout", "ambientocclusion": false, "textures": { "particle": "dtecologics:block/walnut", diff --git a/src/main/resources/assets/dtecologics/models/block/prickly_pear_cactus_sapling.json b/src/main/resources/assets/dtecologics/models/block/prickly_pear_cactus_sapling.json index 4a4e51c..75487c7 100644 --- a/src/main/resources/assets/dtecologics/models/block/prickly_pear_cactus_sapling.json +++ b/src/main/resources/assets/dtecologics/models/block/prickly_pear_cactus_sapling.json @@ -1,6 +1,7 @@ { "credit": "Made with Blockbench", "parent": "block/block", + "render_type": "minecraft:cutout", "textures": { "particle": "#side", "fruit": "ecologics:item/prickly_pear" diff --git a/src/main/resources/data/dtecologics/damage_type/falling_fruit/coconut.json b/src/main/resources/data/dtecologics/damage_type/falling_fruit/coconut.json index 93c5d3d..9568dff 100644 --- a/src/main/resources/data/dtecologics/damage_type/falling_fruit/coconut.json +++ b/src/main/resources/data/dtecologics/damage_type/falling_fruit/coconut.json @@ -1,5 +1,5 @@ { - "message_id": "dtecologics.falling_fruit.coconut", + "message_id": "coconut", "scaling": "when_caused_by_living_non_player", "exhaustion": 1.0, "effects": "hurt", diff --git a/src/main/resources/dtecologics.mixins.json b/src/main/resources/dtecologics.mixins.json new file mode 100644 index 0000000..0e853c7 --- /dev/null +++ b/src/main/resources/dtecologics.mixins.json @@ -0,0 +1,15 @@ +{ + "required": true, + "minVersion": "0.8", + "package": "maxhyper.dtecologics.mixin", + "compatibilityLevel": "JAVA_21", + "mixins": [ + "AbstractRegistryMixin", + "EcologicsNeoForgeMixin", + "EntityMixin", + "FallingBlockEntityMixin" + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index 342792f..7c48ae9 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { "description": "Dynamic Trees for Ecologics", - "pack_format": 15 + "pack_format": 34 } } diff --git a/src/main/resources/trees/dtecologics/families/coconut.json b/src/main/resources/trees/dtecologics/families/coconut.json index 293471e..760845f 100644 --- a/src/main/resources/trees/dtecologics/families/coconut.json +++ b/src/main/resources/trees/dtecologics/families/coconut.json @@ -1,4 +1,5 @@ { + "type": "palm", "common_leaves": "dtecologics:coconut", "common_species": "dtecologics:coconut", "primitive_log": "ecologics:coconut_log", diff --git a/src/main/resources/trees/dtecologics/fruits/prickly_pear.json b/src/main/resources/trees/dtecologics/fruits/prickly_pear.json index ac1aa2e..4acb1bc 100644 --- a/src/main/resources/trees/dtecologics/fruits/prickly_pear.json +++ b/src/main/resources/trees/dtecologics/fruits/prickly_pear.json @@ -3,9 +3,9 @@ "type": "dynamictreesplus:cactus_fruit", "item_stack": "ecologics:prickly_pear", "block_shapes": [ - { "function": "fruit", "parameters": { "radius": 4, "height": 5, "stem_length": 11, "fraction": 16 } }, - { "function": "fruit", "parameters": { "radius": 3, "height": 4, "stem_length": 12, "fraction": 16 } }, - { "function": "fruit", "parameters": { "radius": 3, "height": 7, "stem_length": 9, "fraction": 16 } }, - { "function": "fruit", "parameters": { "radius": 4, "height": 8, "stem_length": 8, "fraction": 16 } } + { "function": "fruit", "parameters": { "width": 8, "height": 5, "stem_length": 11, "fraction": 16 } }, + { "function": "fruit", "parameters": { "width": 6, "height": 4, "stem_length": 12, "fraction": 16 } }, + { "function": "fruit", "parameters": { "width": 6, "height": 7, "stem_length": 9, "fraction": 16 } }, + { "function": "fruit", "parameters": { "width": 8, "height": 8, "stem_length": 8, "fraction": 16 } } ] } \ No newline at end of file diff --git a/src/main/resources/trees/dtecologics/fruits/walnut.json b/src/main/resources/trees/dtecologics/fruits/walnut.json index a9006ab..b97a6af 100644 --- a/src/main/resources/trees/dtecologics/fruits/walnut.json +++ b/src/main/resources/trees/dtecologics/fruits/walnut.json @@ -1,9 +1,9 @@ { "item_stack": "ecologics:walnut", "block_shapes": [ - { "function": "fruit", "parameters": { "radius": 1, "height": 1, "stem_length": 0, "fraction": 16 } }, - { "function": "fruit", "parameters": { "radius": 1, "height": 2, "stem_length": 0, "fraction": 16 } }, - { "function": "fruit", "parameters": { "radius": 2, "height": 5, "stem_length": 0 } }, - { "function": "fruit", "parameters": { "radius": 2.5, "height": 5, "stem_length": 1.25 } } + { "function": "fruit", "parameters": { "width": 2, "height": 1, "stem_length": 0, "fraction": 16 } }, + { "function": "fruit", "parameters": { "width": 2, "height": 2, "stem_length": 0, "fraction": 16 } }, + { "function": "fruit", "parameters": { "width": 4, "height": 5, "stem_length": 0 } }, + { "function": "fruit", "parameters": { "width": 5, "height": 5, "stem_length": 1.25 } } ] } \ No newline at end of file diff --git a/src/main/resources/trees/dtecologics/pods/coconut.json b/src/main/resources/trees/dtecologics/pods/coconut.json index 0b2ad6b..edf15b9 100644 --- a/src/main/resources/trees/dtecologics/pods/coconut.json +++ b/src/main/resources/trees/dtecologics/pods/coconut.json @@ -1,31 +1,31 @@ { - "type": "dtaddon_lib:falling_palm", + "type": "dtecologics:falling_coconut", "item_stack": "dtecologics:coconut_seed", "max_age": 3, "block_shapes": { "east": [ [0.45, 0.7, 0.35, 0.9, 1, 0.65], - { "function": "pod", "parameters": { "radius": 3.5, "height": 7, "stem_length": 2, "side_offset": 6.5, "side": "east", "fraction": 20 } }, - { "function": "pod", "parameters": { "radius": 4.5, "height": 9, "stem_length": 3, "side_offset": 5.5, "side": "east", "fraction": 20 } }, - { "function": "pod", "parameters": { "radius": 5, "height": 10, "stem_length": 4, "side_offset": 5, "side": "east", "fraction": 20 } } + { "function": "pod", "parameters": { "width": 7, "height": 7, "stem_length": 2, "side_offset": 6.5, "side": "east", "fraction": 20 } }, + { "function": "pod", "parameters": { "width": 9, "height": 9, "stem_length": 3, "side_offset": 5.5, "side": "east", "fraction": 20 } }, + { "function": "pod", "parameters": { "width": 10, "height": 10, "stem_length": 4, "side_offset": 5, "side": "east", "fraction": 20 } } ], "west": [ [0.1, 0.7, 0.35, 0.55, 1, 0.65], - { "function": "pod", "parameters": { "radius": 3.5, "height": 7, "stem_length": 2, "side_offset": 6.5, "side": "west", "fraction": 20 } }, - { "function": "pod", "parameters": { "radius": 4.5, "height": 9, "stem_length": 3, "side_offset": 5.5, "side": "west", "fraction": 20 } }, - { "function": "pod", "parameters": { "radius": 5, "height": 10, "stem_length": 4, "side_offset": 5, "side": "west", "fraction": 20 } } + { "function": "pod", "parameters": { "width": 7, "height": 7, "stem_length": 2, "side_offset": 6.5, "side": "west", "fraction": 20 } }, + { "function": "pod", "parameters": { "width": 9, "height": 9, "stem_length": 3, "side_offset": 5.5, "side": "west", "fraction": 20 } }, + { "function": "pod", "parameters": { "width": 10, "height": 10, "stem_length": 4, "side_offset": 5, "side": "west", "fraction": 20 } } ], "north": [ [0.35, 0.7, 0.1, 0.65, 1, 0.55], - { "function": "pod", "parameters": { "radius": 3.5, "height": 7, "stem_length": 2, "side_offset": 6.5, "side": "north", "fraction": 20 } }, - { "function": "pod", "parameters": { "radius": 4.5, "height": 9, "stem_length": 3, "side_offset": 5.5, "side": "north", "fraction": 20 } }, - { "function": "pod", "parameters": { "radius": 5, "height": 10, "stem_length": 4, "side_offset": 5, "side": "north", "fraction": 20 } } + { "function": "pod", "parameters": { "width": 7, "height": 7, "stem_length": 2, "side_offset": 6.5, "side": "north", "fraction": 20 } }, + { "function": "pod", "parameters": { "width": 9, "height": 9, "stem_length": 3, "side_offset": 5.5, "side": "north", "fraction": 20 } }, + { "function": "pod", "parameters": { "width": 10, "height": 10, "stem_length": 4, "side_offset": 5, "side": "north", "fraction": 20 } } ], "south": [ [0.35, 0.7, 0.45, 0.65, 1, 0.9], - { "function": "pod", "parameters": { "radius": 3.5, "height": 7, "stem_length": 2, "side_offset": 6.5, "side": "south", "fraction": 20 } }, - { "function": "pod", "parameters": { "radius": 4.5, "height": 9, "stem_length": 3, "side_offset": 5.5, "side": "south", "fraction": 20 } }, - { "function": "pod", "parameters": { "radius": 5, "height": 10, "stem_length": 4, "side_offset": 5, "side": "south", "fraction": 20 } } + { "function": "pod", "parameters": { "width": 7, "height": 7, "stem_length": 2, "side_offset": 6.5, "side": "south", "fraction": 20 } }, + { "function": "pod", "parameters": { "width": 9, "height": 9, "stem_length": 3, "side_offset": 5.5, "side": "south", "fraction": 20 } }, + { "function": "pod", "parameters": { "width": 10, "height": 10, "stem_length": 4, "side_offset": 5, "side": "south", "fraction": 20 } } ] } } diff --git a/src/main/resources/trees/dtecologics/species/prickly_pear_cactus.json b/src/main/resources/trees/dtecologics/species/prickly_pear_cactus.json index bd6ead6..e927e68 100644 --- a/src/main/resources/trees/dtecologics/species/prickly_pear_cactus.json +++ b/src/main/resources/trees/dtecologics/species/prickly_pear_cactus.json @@ -7,6 +7,9 @@ "lowest_branch_height": 0, "growth_rate": 1, "soil_longevity": 2, + "growth_logic_kit": { + "name": "dtaddon_lib:prickly_pear" + }, "always_show_on_waila": true, "drop_seeds": false, "generate_seed": true, @@ -34,5 +37,14 @@ ], "lang_overrides": { "seed": "Prickly Pear Seeds" - } + }, + + "preferred_climate": "arid", + "climate_tolerance": 0.0, + "seasonal_offsets": { + "fruiting": { + "arid": 2 + } + }, + "mega_species": "dynamictreesplus:mega_cactus" } diff --git a/src/main/resources/trees/dtecologics/world_gen/default.json b/src/main/resources/trees/dtecologics/world_gen/default.json index c03873f..a5e9b5a 100644 --- a/src/main/resources/trees/dtecologics/world_gen/default.json +++ b/src/main/resources/trees/dtecologics/world_gen/default.json @@ -1,6 +1,6 @@ [ { - "select": { "tags" : [ "#minecraft:is_beach", "!#forge:is_snowy" ] }, + "select": { "tags" : [ "#minecraft:is_beach", "!#c:is_snowy" ] }, "apply": { "species" : { "method" : "splice_before", @@ -26,7 +26,7 @@ }, { "only_if_loaded": "dynamictreesplus", - "select": { "tags" : [ "#forge:is_desert", "!#minecraft:is_badlands" ] }, + "select": { "tags" : [ "#c:is_desert", "!#minecraft:is_badlands" ] }, "apply": { "species" : { "method" : "splice_before",