diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..f811f6ae --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +# Disable autocrlf on generated files, they always generate with LF +# Add any extra files or paths here to make git stop saying they +# are changed when only line endings change. +src/generated/**/.cache/cache text eol=lf +src/generated/**/*.json text eol=lf diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..bf864e12 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,24 @@ +name: Build + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1000 + fetch-tags: true + + - name: Setup JDK 17 + uses: actions/setup-java@v2 + with: + java-version: '17' + distribution: 'temurin' + + - name: Build with Gradle + uses: gradle/gradle-build-action@v2 + with: + arguments: build diff --git a/.gitignore b/.gitignore index 12f86447..31d25505 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ build # other eclipse run +runs +run-data -# Files from Forge MDK -forge*changelog.txt +repo \ No newline at end of file diff --git a/README.md b/README.md index 9125782b..d4a8ac61 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,28 @@ -# Baubley Heart Canisters [![](http://cf.way2muchnoise.eu/full_282947_downloads.svg)](https://minecraft.curseforge.com/projects/baubley-heart-canisters) ---- -[![](http://cf.way2muchnoise.eu/versions/Available%20for%20MC_282947_all.svg)](https://minecraft.curseforge.com/projects/baubley-heart-canisters/files) ---- -## Requires [Baubles](https://minecraft.curseforge.com/projects/baubles "Download on CurseForge") and [Mantle](https://minecraft.curseforge.com/projects/mantle "Download on CurseForge") ---- -1.16 Version -## Requires [Curios API](https://www.curseforge.com/minecraft/mc-mods/curios "Download on CurseForge") and [Mantle](https://minecraft.curseforge.com/projects/mantle "Download on CurseForge") - -![](https://i.gyazo.com/245e4d299413fdc6a6eb843b9d32bc29.gif) + +Installation information +======= + +This template repository can be directly cloned to get you started with a new +mod. Simply create a new repository cloned from this one, by following the +instructions at [github](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template). + +Once you have your clone, simply open the repository in the IDE of your choice. The usual recommendation for an IDE is either IntelliJ IDEA or Eclipse. + +> **Note**: For Eclipse, use tasks in `Launch Group` instead of ones founds in `Java Application`. A preparation task must run before launching the game. NeoGradle uses launch groups to do these subsequently. + +If at any point you are missing libraries in your IDE, or you've run into problems you can +run `gradlew --refresh-dependencies` to refresh the local cache. `gradlew clean` to reset everything +{this does not affect your code} and then start the process again. + +Mapping Names: +============ +By default, the MDK is configured to use the official mapping names from Mojang for methods and fields +in the Minecraft codebase. These names are covered by a specific license. All modders should be aware of this +license, if you do not agree with it you can change your mapping names to other crowdsourced names in your +build.gradle. For the latest license text, refer to the mapping file itself, or the reference copy here: +https://github.com/NeoForged/NeoForm/blob/main/Mojang.md + +Additional Resources: +========== +Community Documentation: https://docs.neoforged.net/ +NeoForged Discord: https://discord.neoforged.net/ diff --git a/TEMPLATE_LICENSE.txt b/TEMPLATE_LICENSE.txt new file mode 100644 index 00000000..b64bc64b --- /dev/null +++ b/TEMPLATE_LICENSE.txt @@ -0,0 +1,24 @@ +MIT License + +Copyright (c) 2023 NeoForged project + +This license applies to the template files as supplied by github.com/NeoForged/MDK + + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/build.gradle b/build.gradle index 2094ba52..76a6e2da 100644 --- a/build.gradle +++ b/build.gradle @@ -1,119 +1,127 @@ -buildscript { - repositories { - maven { url = 'https://maven.minecraftforge.net' } - mavenCentral() - } - dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true - } +plugins { + id 'java-library' + id 'eclipse' + id 'idea' + id 'maven-publish' + id 'net.neoforged.gradle.userdev' version '7.0.80' } -apply plugin: 'net.minecraftforge.gradle' - -apply plugin: 'eclipse' -apply plugin: 'maven-publish' - -version = '1.16.5-1.1.11' -group = 'com.traverse.bhc' // http://maven.apache.org/guides/mini/guide-naming-conventions.html -archivesBaseName = 'bhc' - -java.toolchain.languageVersion = JavaLanguageVersion.of(8) // Mojang ships Java 8 to end users, so your mod should target Java 8. - -println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) -minecraft { - mappings channel: 'official', version: '1.16.5' +version = mod_version +group = mod_group_id - runs { - client { - workingDirectory project.file('run') - - property 'forge.logging.markers', 'REGISTRIES' - - property 'forge.logging.console.level', 'debug' - - mods { - examplemod { - source sourceSets.main - } - } - } - - server { - workingDirectory project.file('run') - - property 'forge.logging.markers', 'REGISTRIES' +repositories { + mavenLocal() +} - property 'forge.logging.console.level', 'debug' +base { + archivesName = "baubley-heart-canisters" +} - mods { - examplemod { - source sourceSets.main - } - } - } +// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. +java.toolchain.languageVersion = JavaLanguageVersion.of(17) + +//minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg') +//minecraft.accessTransformers.entry public net.minecraft.client.Minecraft textureManager # textureManager + +// Default run configurations. +// These can be tweaked, removed, or duplicated as needed. +runs { + // applies to all the run configs below + configureEach { + // Recommended logging data for a userdev environment + // The markers can be added/remove as needed separated by commas. + // "SCAN": For mods scan. + // "REGISTRIES": For firing of registry events. + // "REGISTRYDUMP": For getting the contents of all registries. + systemProperty 'forge.logging.markers', 'REGISTRIES' + + // Recommended logging level for the console + // You can set various levels here. + // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels + systemProperty 'forge.logging.console.level', 'debug' + + modSource project.sourceSets.main + } - data { - workingDirectory project.file('run') + client { + // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. + systemProperty 'forge.enabledGameTestNamespaces', project.mod_id + } - property 'forge.logging.markers', 'REGISTRIES' + server { + systemProperty 'forge.enabledGameTestNamespaces', project.mod_id + programArgument '--nogui' + } - property 'forge.logging.console.level', 'debug' + // This run config launches GameTestServer and runs all registered gametests, then exits. + // By default, the server will crash when no gametests are provided. + // The gametest system is also enabled by default for other run configs under the /test command. + gameTestServer { + systemProperty 'forge.enabledGameTestNamespaces', project.mod_id + } - // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. - args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') + data { + // example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it + // workingDirectory project.file('run-data') - mods { - examplemod { - source sourceSets.main - } - } - } + // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. + programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath() } } // Include resources generated by data generators. sourceSets.main.resources { srcDir 'src/generated/resources' } + repositories { maven { - url "https://www.cursemaven.com" + url "https://www.cursemaven.com" content { includeGroup "curse.maven" } } } + dependencies { - minecraft 'net.minecraftforge:forge:1.16.5-36.2.2' - implementation fg.deobf("curse.maven:jade-324717:3439522") - implementation fg.deobf("curse.maven:jei-238222:3438494") - implementation fg.deobf("curse.maven:curios-309927:3456953") + implementation "net.neoforged:neoforge:${neo_version}" + implementation "curse.maven:${curios_version}" + implementation "curse.maven:${jei_version}" + } -jar { - manifest { - attributes([ - "Specification-Title": "bhc", - "Specification-Vendor": "bhc", - "Specification-Version": "1", // We are version 1 of ourselves - "Implementation-Title": project.name, - "Implementation-Version": "${version}", - "Implementation-Vendor" :"traverse_joe", - "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") - ]) +// This block of code expands all declared replace properties in the specified resource targets. +// A missing property will result in an error. Properties are expanded using ${} Groovy notation. +// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments. +// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html +tasks.withType(ProcessResources).configureEach { + var replaceProperties = [ + minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range, + neo_version : neo_version, neo_version_range: neo_version_range, + loader_version_range: loader_version_range, + mod_id : mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version, + mod_authors : mod_authors, mod_description: mod_description, + ] + inputs.properties replaceProperties + + filesMatching(['META-INF/mods.toml']) { + expand replaceProperties + [project: project] } } -jar.finalizedBy('reobfJar') - +// Example configuration to allow publishing using the maven-publish plugin publishing { publications { - mavenJava(MavenPublication) { - artifact jar + register('mavenJava', MavenPublication) { + from components.java } } repositories { maven { - url "file:///${project.projectDir}/mcmodsrepo" + url "file://${project.projectDir}/repo" } } } + +tasks.withType(JavaCompile).configureEach { + options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation +} diff --git a/gradle.properties b/gradle.properties index 299bc9f6..1accfe0c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,10 +1,48 @@ # Sets default memory used for gradle commands. Can be overridden by user or command line properties. -# This is required to provide enough memory for the Minecraft decompilation process. -org.gradle.jvmargs=-Xmx3G +#org.gradle.jvmargs= org.gradle.daemon=false +org.gradle.debug=false -mc_version=1.16.4 +#read more on this at https://github.com/neoforged/NeoGradle/blob/NG_7.0/README.md#apply-parchment-mappings +# you can also find the latest versions at: https://parchmentmc.org/docs/getting-started +neogradle.subsystems.parchment.minecraftVersion=1.20.3 +neogradle.subsystems.parchment.mappingsVersion=2023.12.31 +# Environment Properties +# You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge +# The Minecraft version must agree with the Neo version to get a valid artifact +minecraft_version=1.20.4 +# The Minecraft version range can use any release version of Minecraft as bounds. +# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly +# as they do not follow standard versioning conventions. +minecraft_version_range=[1.20.4,1.21) +# The Neo version must agree with the Minecraft version to get a valid artifact +neo_version=20.4.153-beta +# The Neo version range can use any version of Neo as bounds +neo_version_range=[20.4,) +# The loader version range can only use the major version of FML as bounds +loader_version_range=[2,) -#optional dependencies -jei_version=7.6.0.62 -curios_version=1.16.4-4.0.3.5 \ No newline at end of file + +##Dependencies +curios_version=curios-309927:5066869 +jei_version=jei-238222:5074416 + +## Mod Properties + +# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63} +# Must match the String constant located in the main mod class annotated with @Mod. +mod_id=bhc +# The human-readable display name for the mod. +mod_name=Baubley Heart Canisters +# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. +mod_license=MIT +# The mod version. See https://semver.org/ +mod_version=1.20.4-1.0.0 +# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. +# This should match the base package used for the mod sources. +# See https://maven.apache.org/guides/mini/guide-naming-conventions.html +mod_group_id=com.traverse.bhc +# The authors of the mod. This is a simple text string that is used for display purposes in the mod list. +mod_authors=Traverse_Joe +# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list. +mod_description=Heart Canisters for Baubles/Curios Enjoy :D \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e708b1c0..943f0cbf 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 05679dc3..37aef8d3 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index cccdd3d5..65dcd68d 100644 --- a/gradlew +++ b/gradlew @@ -1,78 +1,129 @@ -#!/usr/bin/env sh +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# 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. +# ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +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"` +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -81,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -89,84 +140,105 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# 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" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + 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")" +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" fi +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index f9553162..93e3f59f 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,4 +1,20 @@ -@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 + +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -9,19 +25,23 @@ if "%OS%"=="Windows_NT" setlocal 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. @@ -35,7 +55,7 @@ goto fail 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% @@ -45,38 +65,26 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/lib/javax.annotation.jar b/lib/javax.annotation.jar deleted file mode 100644 index 52dca7f5..00000000 Binary files a/lib/javax.annotation.jar and /dev/null differ diff --git a/lib/javax.ejb.jar b/lib/javax.ejb.jar deleted file mode 100644 index 4ebf5ecd..00000000 Binary files a/lib/javax.ejb.jar and /dev/null differ diff --git a/lib/javax.jms.jar b/lib/javax.jms.jar deleted file mode 100644 index d31451ad..00000000 Binary files a/lib/javax.jms.jar and /dev/null differ diff --git a/lib/javax.persistence.jar b/lib/javax.persistence.jar deleted file mode 100644 index 21d80e0e..00000000 Binary files a/lib/javax.persistence.jar and /dev/null differ diff --git a/lib/javax.resource.jar b/lib/javax.resource.jar deleted file mode 100644 index 696a2345..00000000 Binary files a/lib/javax.resource.jar and /dev/null differ diff --git a/lib/javax.servlet.jar b/lib/javax.servlet.jar deleted file mode 100644 index 0519e4a4..00000000 Binary files a/lib/javax.servlet.jar and /dev/null differ diff --git a/lib/javax.servlet.jsp.jar b/lib/javax.servlet.jsp.jar deleted file mode 100644 index 9c0631ce..00000000 Binary files a/lib/javax.servlet.jsp.jar and /dev/null differ diff --git a/lib/javax.servlet.jsp.jstl.jar b/lib/javax.servlet.jsp.jstl.jar deleted file mode 100644 index 7be17cc7..00000000 Binary files a/lib/javax.servlet.jsp.jstl.jar and /dev/null differ diff --git a/lib/javax.transaction.jar b/lib/javax.transaction.jar deleted file mode 100644 index 729c6952..00000000 Binary files a/lib/javax.transaction.jar and /dev/null differ diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000..b359a59d --- /dev/null +++ b/settings.gradle @@ -0,0 +1,11 @@ +pluginManagement { + repositories { + mavenLocal() + gradlePluginPortal() + maven { url = 'https://maven.neoforged.net/releases' } + } +} + +plugins { + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0' +} diff --git a/src/main/java/com/traverse/bhc/client/ClientBaubleyHeartCanisters.java b/src/main/java/com/traverse/bhc/client/ClientBaubleyHeartCanisters.java index fcc0cf80..b8295bcd 100644 --- a/src/main/java/com/traverse/bhc/client/ClientBaubleyHeartCanisters.java +++ b/src/main/java/com/traverse/bhc/client/ClientBaubleyHeartCanisters.java @@ -1,33 +1,31 @@ package com.traverse.bhc.client; -import com.traverse.bhc.client.screens.HeartAmuletScreen; import com.traverse.bhc.common.BaubleyHeartCanisters; -import com.traverse.bhc.common.init.RegistryHandler; -import net.minecraft.client.gui.ScreenManager; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.client.event.TextureStitchEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; -import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; +import com.traverse.bhc.common.util.EasterEgg; +import net.minecraft.resources.ResourceLocation; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.Mod; +import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent; -@Mod.EventBusSubscriber(modid = BaubleyHeartCanisters.MODID, value = Dist.CLIENT, bus = Bus.MOD) +import static net.neoforged.fml.common.Mod.EventBusSubscriber.Bus.MOD; + + +@Mod.EventBusSubscriber(modid = BaubleyHeartCanisters.MODID, bus = MOD) public class ClientBaubleyHeartCanisters { - public static final ResourceLocation SLOT_TEXTURE = new ResourceLocation(BaubleyHeartCanisters.MODID, "slots/empty_heartamulet"); + public static final ResourceLocation SLOT_TEXTURE = new ResourceLocation(BaubleyHeartCanisters.MODID, "slot/empty_heartamulet"); - @OnlyIn(Dist.CLIENT) +/* @OnlyIn(Dist.CLIENT) @SubscribeEvent - public static void textureStitch(TextureStitchEvent.Pre event) { - event.addSprite(SLOT_TEXTURE); - } + public static void textureStitch(final TextureStitchEvent.Post evt) { + evt.getAtlas().getTextureLocations().add(SLOT_TEXTURE); + } */ @OnlyIn(Dist.CLIENT) @SubscribeEvent - public static void doClientStuff(final FMLClientSetupEvent event) { - ScreenManager.register(RegistryHandler.HEART_AMUlET_CONTAINER.get(), HeartAmuletScreen::new); + public static void addItemProperty(FMLClientSetupEvent evt) { + EasterEgg.secretCode(); } - -} +} \ No newline at end of file diff --git a/src/main/java/com/traverse/bhc/client/proxy/ClientProxy.java b/src/main/java/com/traverse/bhc/client/proxy/ClientProxy.java new file mode 100644 index 00000000..e0b10caf --- /dev/null +++ b/src/main/java/com/traverse/bhc/client/proxy/ClientProxy.java @@ -0,0 +1,19 @@ +package com.traverse.bhc.client.proxy; + +import com.traverse.bhc.client.screens.BladeOfVitalityScreen; +import com.traverse.bhc.client.screens.HeartAmuletScreen; +import com.traverse.bhc.client.screens.SoulHeartAmuletScreen; +import com.traverse.bhc.common.init.RegistryHandler; +import com.traverse.bhc.common.proxy.CommonProxy; +import net.minecraft.client.gui.screens.MenuScreens; + +public class ClientProxy extends CommonProxy { + + @Override + public void doClientStuff() { + MenuScreens.register(RegistryHandler.HEART_AMUlET_CONTAINER.get(), HeartAmuletScreen::new); + MenuScreens.register(RegistryHandler.SOUL_HEART_AMUlET_CONTAINER.get(), SoulHeartAmuletScreen::new); + MenuScreens.register(RegistryHandler.BLADE_OF_VITALITY_CONTAINER.get(), BladeOfVitalityScreen::new); + super.doClientStuff(); + } +} diff --git a/src/main/java/com/traverse/bhc/client/screens/BladeOfVitalityScreen.java b/src/main/java/com/traverse/bhc/client/screens/BladeOfVitalityScreen.java new file mode 100644 index 00000000..628924be --- /dev/null +++ b/src/main/java/com/traverse/bhc/client/screens/BladeOfVitalityScreen.java @@ -0,0 +1,35 @@ +package com.traverse.bhc.client.screens; + +import com.mojang.blaze3d.systems.RenderSystem; +import com.traverse.bhc.common.BaubleyHeartCanisters; +import com.traverse.bhc.common.container.BladeOfVitalityContainer; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; + +public class BladeOfVitalityScreen extends AbstractContainerScreen { + + private static final ResourceLocation BACKGROUND_TEXTURE = new ResourceLocation(BaubleyHeartCanisters.MODID, "textures/gui/blade_of_vitality.png"); + + public BladeOfVitalityScreen(BladeOfVitalityContainer container, Inventory inventory, Component title) { + super(container, inventory, title); + } + + @Override + protected void renderBg(GuiGraphics guiGraphics, float partialTicks, int mouseX, int mouseY) { + RenderSystem.setShader(GameRenderer::getPositionTexShader); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.setShaderTexture(0, this.BACKGROUND_TEXTURE); + guiGraphics.blit(BACKGROUND_TEXTURE, leftPos, topPos, 0, 0, imageWidth, imageHeight); + } + + @Override + public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { + this.renderBg(guiGraphics, partialTicks, mouseX, mouseY); + super.render(guiGraphics, mouseX, mouseY, partialTicks); + this.renderTooltip(guiGraphics, mouseX, mouseY); + } +} diff --git a/src/main/java/com/traverse/bhc/client/screens/HeartAmuletScreen.java b/src/main/java/com/traverse/bhc/client/screens/HeartAmuletScreen.java index 8c1fe37c..17dd568b 100644 --- a/src/main/java/com/traverse/bhc/client/screens/HeartAmuletScreen.java +++ b/src/main/java/com/traverse/bhc/client/screens/HeartAmuletScreen.java @@ -1,34 +1,39 @@ package com.traverse.bhc.client.screens; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.systems.RenderSystem; import com.traverse.bhc.common.BaubleyHeartCanisters; import com.traverse.bhc.common.container.HeartAmuletContainer; -import net.minecraft.client.gui.screen.inventory.ContainerScreen; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) -public class HeartAmuletScreen extends ContainerScreen { +public class HeartAmuletScreen extends AbstractContainerScreen { private static final ResourceLocation BACKGROUND_TEXTURE = new ResourceLocation(BaubleyHeartCanisters.MODID, "textures/gui/heart_amulet.png"); - public HeartAmuletScreen(HeartAmuletContainer container, PlayerInventory inventory, ITextComponent title) { + public HeartAmuletScreen(HeartAmuletContainer container, Inventory inventory, Component title) { super(container, inventory, title); } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { - this.renderBackground(matrixStack); - super.render(matrixStack, mouseX, mouseY, partialTicks); - this.renderTooltip(matrixStack, mouseX, mouseY); + protected void renderBg(GuiGraphics guiGraphics, float partialTicks, int mouseX, int mouseY) { + RenderSystem.setShader(GameRenderer::getPositionTexShader); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.setShaderTexture(0, this.BACKGROUND_TEXTURE); + guiGraphics.blit(BACKGROUND_TEXTURE, leftPos, topPos, 0, 0, imageWidth, imageHeight); } @Override - public void renderBg(MatrixStack matrixStack, float partialTicks, int mouseX, int mouseY) { - getMinecraft().getTextureManager().bind(BACKGROUND_TEXTURE); - blit(matrixStack, leftPos, topPos, 0, 0, imageWidth, imageHeight); + public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { + this.renderBg(guiGraphics, partialTicks, mouseX, mouseY); + super.render(guiGraphics, mouseX, mouseY, partialTicks); + this.renderTooltip(guiGraphics, mouseX, mouseY); } + } diff --git a/src/main/java/com/traverse/bhc/client/screens/SoulHeartAmuletScreen.java b/src/main/java/com/traverse/bhc/client/screens/SoulHeartAmuletScreen.java new file mode 100644 index 00000000..3ebaca2f --- /dev/null +++ b/src/main/java/com/traverse/bhc/client/screens/SoulHeartAmuletScreen.java @@ -0,0 +1,39 @@ +package com.traverse.bhc.client.screens; + +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; +import com.traverse.bhc.common.BaubleyHeartCanisters; +import com.traverse.bhc.common.container.SoulHeartAmuletContainer; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; + + +@OnlyIn(Dist.CLIENT) +public class SoulHeartAmuletScreen extends AbstractContainerScreen { + private static final ResourceLocation BACKGROUND_TEXTURE = new ResourceLocation(BaubleyHeartCanisters.MODID, "textures/gui/soul_heart_amulet.png"); + + public SoulHeartAmuletScreen(SoulHeartAmuletContainer container, Inventory inventory, Component title) { + super(container, inventory, title); + } + + @Override + protected void renderBg(GuiGraphics guiGraphics, float partialTicks, int mouseX, int mouseY) { + RenderSystem.setShader(GameRenderer::getPositionTexShader); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.setShaderTexture(0, this.BACKGROUND_TEXTURE); + guiGraphics.blit(BACKGROUND_TEXTURE, leftPos, topPos, 0, 0, imageWidth, imageHeight); + } + + @Override + public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { + this.renderBg(guiGraphics, partialTicks, mouseX, mouseY); + super.render(guiGraphics, mouseX, mouseY, partialTicks); + this.renderTooltip(guiGraphics, mouseX, mouseY); + } +} diff --git a/src/main/java/com/traverse/bhc/common/BaubleyHeartCanisters.java b/src/main/java/com/traverse/bhc/common/BaubleyHeartCanisters.java index 96580165..5d36280b 100644 --- a/src/main/java/com/traverse/bhc/common/BaubleyHeartCanisters.java +++ b/src/main/java/com/traverse/bhc/common/BaubleyHeartCanisters.java @@ -2,27 +2,19 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import com.traverse.bhc.client.ClientBaubleyHeartCanisters; -import com.traverse.bhc.client.screens.HeartAmuletScreen; +import com.traverse.bhc.client.proxy.ClientProxy; import com.traverse.bhc.common.config.BHCConfig; import com.traverse.bhc.common.config.ConfigHandler; import com.traverse.bhc.common.init.RegistryHandler; -import net.minecraft.client.gui.ScreenManager; -import net.minecraft.item.ItemGroup; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.eventbus.api.EventPriority; -import net.minecraftforge.fml.InterModComms; -import net.minecraftforge.fml.ModLoadingContext; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.config.ModConfig; -import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; -import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; -import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.fml.loading.FMLPaths; -import top.theillusivec4.curios.api.CuriosApi; -import top.theillusivec4.curios.api.SlotTypeMessage; +import com.traverse.bhc.common.proxy.CommonProxy; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.DistExecutor; +import net.neoforged.fml.ModLoadingContext; +import net.neoforged.fml.common.Mod; +import net.neoforged.fml.config.ModConfig; +import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; +import net.neoforged.fml.event.lifecycle.InterModEnqueueEvent; +import net.neoforged.fml.loading.FMLPaths; import java.io.File; import java.io.FileReader; @@ -33,34 +25,33 @@ public class BaubleyHeartCanisters { public static final String MODID = "bhc"; - public static final ItemGroup TAB = new ItemGroup("bhcTab") { - @Override - public ItemStack makeIcon() { - return new ItemStack(RegistryHandler.RED_HEART.get()); - } - }; public static BHCConfig config; + public static final CommonProxy proxy = DistExecutor.safeRunForDist(() -> ClientProxy::new, () -> CommonProxy::new); - public BaubleyHeartCanisters() { - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueue); + public BaubleyHeartCanisters(IEventBus eventBus) { + RegistryHandler.ITEMS.register(eventBus); + RegistryHandler.TAB.register(eventBus); + RegistryHandler.CONTAINERS.register(eventBus); + RegistryHandler.RECIPESERIALIZER.register(eventBus); ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, ConfigHandler.configSpec); ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, ConfigHandler.serverConfigSpec); - RegistryHandler.ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus()); - RegistryHandler.CONTAINERS.register(FMLJavaModLoadingContext.get().getModEventBus()); + eventBus.addListener(this::setup); + eventBus.addListener(this::enqueue); + } private void setup(final FMLCommonSetupEvent event) { + proxy.doClientStuff(); jsonSetup(); } private void enqueue(InterModEnqueueEvent event) { - InterModComms.sendTo(CuriosApi.MODID, SlotTypeMessage.REGISTER_TYPE, () -> new SlotTypeMessage.Builder("heartamulet").icon(ClientBaubleyHeartCanisters.SLOT_TEXTURE).build()); - + // InterModComms.sendTo(CuriosApi.MODID, SlotTypeMessage.REGISTER_TYPE, () -> new SlotTypeMessage.Builder("heartamulet").icon(ClientBaubleyHeartCanisters.SLOT_TEXTURE).build()); } + private void jsonSetup() { Gson gson = new GsonBuilder().setPrettyPrinting().create(); File folder = FMLPaths.CONFIGDIR.get().resolve("bhc").toFile(); @@ -75,7 +66,7 @@ private void jsonSetup() { config.addEntrytoMap("red", "hostile", 0.05); config.addEntrytoMap("yellow", "boss", 1.0); config.addEntrytoMap("green", "dragon", 1.0); - config.addEntrytoMap("blue", "minecraft:evoker", 1.0); + config.addEntrytoMap("blue", "minecraft:warden", 1.0); String json = gson.toJson(config, BHCConfig.class); FileWriter writer = new FileWriter(file); writer.write(json); diff --git a/src/main/java/com/traverse/bhc/common/config/ConfigHandler.java b/src/main/java/com/traverse/bhc/common/config/ConfigHandler.java index 4ee612a7..ec3d9255 100644 --- a/src/main/java/com/traverse/bhc/common/config/ConfigHandler.java +++ b/src/main/java/com/traverse/bhc/common/config/ConfigHandler.java @@ -1,14 +1,16 @@ package com.traverse.bhc.common.config; -import net.minecraftforge.common.ForgeConfigSpec; +import net.neoforged.neoforge.common.ModConfigSpec; public class ConfigHandler { public static class General { - public final ForgeConfigSpec.ConfigValue heartStackSize; - public final ForgeConfigSpec.ConfigValue boneDropRate; + public final ModConfigSpec.ConfigValue heartStackSize; + public final ModConfigSpec.ConfigValue boneDropRate; + public final ModConfigSpec.ConfigValue echoShardDropRate; + public final ModConfigSpec.ConfigValue soulHeartReturnChance; - General(ForgeConfigSpec.Builder builder) { + General(ModConfigSpec.Builder builder) { builder.push("General"); heartStackSize = builder .comment("The maximum stacksize for heart canisters, also the maximum amount of full hearts you can get per heart container type") @@ -16,31 +18,36 @@ public static class General { boneDropRate = builder .comment("How often do wither bones Drop? (1.0 = 100 % and 0.0 means 0%)") .define("boneDropRate", 0.15); + echoShardDropRate = builder + .comment("How often do echo shards drop from Warden? (1.0 = 100 % and 0.0 means 0%)") + .define("echoShardDropRate", 0.5); + soulHeartReturnChance = builder + .comment("Chance for the Soul Heart to return a Blue Heart Canister after being broken") + .define("soulHeartReturnChance", 1.0); builder.pop(); } + } - public static class BHCServer { - - public final ForgeConfigSpec.ConfigValue allowStartingHeathTweaks; - public final ForgeConfigSpec.ConfigValue startingHealth; - - BHCServer(ForgeConfigSpec.Builder builder) { - builder.push("Server"); - allowStartingHeathTweaks = builder - .comment("Allow Player to Use Starting Tweaks") - .define("allowStartingHealthTweaks", false); - startingHealth = builder - .comment("Set Starting Amount for Player to Start with (ALLOW STARTING HEALTH TWEAKS NEEDS TO BE TRUE)") - .define("startingHealth", 20); - builder.pop(); - } + public static class BHCServer { + public final ModConfigSpec.ConfigValue allowStartingHeathTweaks; + public final ModConfigSpec.ConfigValue startingHealth; + + BHCServer(ModConfigSpec.Builder builder) { + builder.push("Server"); + allowStartingHeathTweaks = builder + .comment("Allow Starting Health Tweaks") + .define("allowStartingHealthTweaks", false); + startingHealth = builder + .comment("Starting Health of Player (Default:20)") + .define("startingHealth", 20); + builder.pop(); } } - private static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder(); - private static final ForgeConfigSpec.Builder SERVER_BUILDER = new ForgeConfigSpec.Builder(); + private static final ModConfigSpec.Builder BUILDER = new ModConfigSpec.Builder(); + private static final ModConfigSpec.Builder SERVER_BUILDER = new ModConfigSpec.Builder(); public static final General general = new General(BUILDER); - public static final General.BHCServer server = new General.BHCServer(SERVER_BUILDER); - public static final ForgeConfigSpec configSpec = BUILDER.build(); - public static final ForgeConfigSpec serverConfigSpec = SERVER_BUILDER.build(); + public static final BHCServer server = new BHCServer(SERVER_BUILDER); + public static final ModConfigSpec configSpec = BUILDER.build(); + public static final ModConfigSpec serverConfigSpec = SERVER_BUILDER.build(); } diff --git a/src/main/java/com/traverse/bhc/common/container/BladeOfVitalityContainer.java b/src/main/java/com/traverse/bhc/common/container/BladeOfVitalityContainer.java new file mode 100644 index 00000000..a236778e --- /dev/null +++ b/src/main/java/com/traverse/bhc/common/container/BladeOfVitalityContainer.java @@ -0,0 +1,149 @@ +package com.traverse.bhc.common.container; + +import com.traverse.bhc.common.config.ConfigHandler; +import com.traverse.bhc.common.init.RegistryHandler; +import com.traverse.bhc.common.items.BaseHeartCanister; +import com.traverse.bhc.common.util.InventoryUtil; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.Container; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.neoforged.neoforge.items.IItemHandler; +import net.neoforged.neoforge.items.ItemStackHandler; +import net.neoforged.neoforge.items.SlotItemHandler; + + +import javax.annotation.Nonnull; + +public class BladeOfVitalityContainer extends AbstractContainerMenu { + public static final String HEART_AMOUNT = "heart_amount"; + public ItemStackHandler itemStackHandler; + + public BladeOfVitalityContainer(int windowId, Inventory playerInventory, ItemStack stack) { + super(RegistryHandler.BLADE_OF_VITALITY_CONTAINER.get(), windowId); + this.itemStackHandler = InventoryUtil.createVirtualInventory(4, stack); + + + //Heart Container Slots + this.addSlot(new BladeOfVitalityContainer.SlotPendant(this.itemStackHandler, 0, 80, 5));//RED + this.addSlot(new BladeOfVitalityContainer.SlotPendant(this.itemStackHandler, 1, 80, 25));//YELLOW + this.addSlot(new BladeOfVitalityContainer.SlotPendant(this.itemStackHandler, 2, 80, 45));//GREEN + this.addSlot(new BladeOfVitalityContainer.SlotPendant(this.itemStackHandler, 3, 80, 65));//BLUE + + //Add player inventory slots + for (int row = 0; row < 9; ++row) { + int x = 8 + row * 18; + int y = 56 + 86; + if (row == getSlotFor(playerInventory, stack)) { + addSlot(new BladeOfVitalityContainer.LockedSlot(playerInventory, row, x, y)); + continue; + } + + addSlot(new Slot(playerInventory, row, x, y)); + } + + for (int row = 1; row < 4; ++row) { + for (int col = 0; col < 9; ++col) { + int x = 8 + col * 18; + int y = row * 18 + (56 + 10); + addSlot(new Slot(playerInventory, col + row * 9, x, y)); + } + } + } + + @Override + public void removed(Player playerIn) { + ItemStack sword = playerIn.getMainHandItem(); + InventoryUtil.serializeInventory(this.itemStackHandler, sword); + + + + CompoundTag nbt = sword.getTag(); + int[] hearts = new int[this.itemStackHandler.getSlots()]; + for (int i = 0; i < hearts.length; i++) { + ItemStack stack = this.itemStackHandler.getStackInSlot(i); + if (!stack.isEmpty()) hearts[i] = stack.getCount() * 2; + } + nbt.putIntArray(HEART_AMOUNT, hearts); + sword.setTag(nbt); + + super.removed(playerIn); + } + + @Override + public boolean stillValid(Player playerIn) { + return true; + } + + @Override + public ItemStack quickMoveStack(Player playerIn, int index) { + ItemStack stack = ItemStack.EMPTY; + Slot slot = slots.get(index); + if (slot != null && slot.hasItem()) { + ItemStack slotStack = slot.getItem(); + stack = slotStack.copy(); + if (index < this.itemStackHandler.getSlots()) { + if (!this.moveItemStackTo(slotStack, this.itemStackHandler.getSlots(), this.slots.size(), true)) + ; + return ItemStack.EMPTY; + } else if (!this.moveItemStackTo(slotStack, 0, this.itemStackHandler.getSlots(), false)) { + return ItemStack.EMPTY; + } + if (slotStack.isEmpty()) slot.set(ItemStack.EMPTY); + else slot.setChanged(); + } + return stack; + } + + + private static class SlotPendant extends SlotItemHandler { + public SlotPendant(IItemHandler itemHandler, int index, int xPosition, int yPosition) { + super(itemHandler, index, xPosition, yPosition); + } + + @Override + public boolean mayPlace(@Nonnull ItemStack stack) { + return super.mayPlace(stack) && stack.getItem() instanceof BaseHeartCanister && ((BaseHeartCanister) stack.getItem()).type.ordinal() == this.getSlotIndex(); + } + + @Override + public int getMaxStackSize() { + return ConfigHandler.general.heartStackSize.get(); + } + } + + private static class LockedSlot extends Slot { + + public LockedSlot(Inventory inventoryIn, int index, int xPosition, int yPosition) { + super((Container) inventoryIn, index, xPosition, yPosition); + } + + @Override + public boolean mayPlace(ItemStack stack) { + return false; + } + + @Override + public boolean mayPickup(Player playerIn) { + return false; + } + } + + public int getSlotFor(Inventory inventory, ItemStack stack) { + for (int i = 0; i < inventory.items.size(); ++i) { + if (!inventory.items.get(i).isEmpty() && stackEqualExact(stack, inventory.items.get(i))) { + return i; + } + } + + return -1; + } + + private boolean stackEqualExact(ItemStack stack1, ItemStack stack2) { + return stack1.getItem() == stack2.getItem() && ItemStack.isSameItemSameTags(stack1, stack2); + } +} diff --git a/src/main/java/com/traverse/bhc/common/container/HeartAmuletContainer.java b/src/main/java/com/traverse/bhc/common/container/HeartAmuletContainer.java index c465272f..6a3cf312 100644 --- a/src/main/java/com/traverse/bhc/common/container/HeartAmuletContainer.java +++ b/src/main/java/com/traverse/bhc/common/container/HeartAmuletContainer.java @@ -5,27 +5,27 @@ import com.traverse.bhc.common.items.BaseHeartCanister; import com.traverse.bhc.common.items.ItemHeartAmulet; import com.traverse.bhc.common.util.InventoryUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.Hand; -import net.minecraftforge.items.IItemHandler; -import net.minecraftforge.items.ItemStackHandler; -import net.minecraftforge.items.SlotItemHandler; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.Container; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.neoforged.neoforge.items.IItemHandler; +import net.neoforged.neoforge.items.ItemStackHandler; +import net.neoforged.neoforge.items.SlotItemHandler; import javax.annotation.Nonnull; -public class HeartAmuletContainer extends Container { +public class HeartAmuletContainer extends AbstractContainerMenu { public static final String HEART_AMOUNT = "heart_amount"; public ItemStackHandler itemStackHandler; - public HeartAmuletContainer(int windowId, PlayerInventory playerInventory, ItemStack stack) { + public HeartAmuletContainer(int windowId, Inventory playerInventory, ItemStack stack) { super(RegistryHandler.HEART_AMUlET_CONTAINER.get(), windowId); this.itemStackHandler = InventoryUtil.createVirtualInventory(4, stack); @@ -57,12 +57,13 @@ public HeartAmuletContainer(int windowId, PlayerInventory playerInventory, ItemS } @Override - public void removed(PlayerEntity playerIn) { - Hand hand = ItemHeartAmulet.getHandForAmulet(playerIn); - if (hand != null) + public void removed(Player playerIn) { + InteractionHand hand = ItemHeartAmulet.getHandForAmulet(playerIn); + if (hand == null) return; + InventoryUtil.serializeInventory(this.itemStackHandler, playerIn.getItemInHand(hand)); - CompoundNBT nbt = playerIn.getItemInHand(hand).getTag(); + CompoundTag nbt = playerIn.getItemInHand(hand).getTag(); int[] hearts = new int[this.itemStackHandler.getSlots()]; for (int i = 0; i < hearts.length; i++) { ItemStack stack = this.itemStackHandler.getStackInSlot(i); @@ -75,12 +76,17 @@ public void removed(PlayerEntity playerIn) { } @Override - public boolean stillValid(PlayerEntity playerIn) { - return true; + public boolean stillValid(Player playerIn) { + if(InventoryUtil.hasAmulet(playerIn)) { + return true; + } + else { + return false; + } } @Override - public ItemStack quickMoveStack(PlayerEntity playerIn, int index) { + public ItemStack quickMoveStack(Player playerIn, int index) { ItemStack stack = ItemStack.EMPTY; Slot slot = slots.get(index); if (slot != null && slot.hasItem()) { @@ -99,6 +105,7 @@ public ItemStack quickMoveStack(PlayerEntity playerIn, int index) { return stack; } + private static class SlotPendant extends SlotItemHandler { public SlotPendant(IItemHandler itemHandler, int index, int xPosition, int yPosition) { super(itemHandler, index, xPosition, yPosition); @@ -117,8 +124,8 @@ public int getMaxStackSize() { private static class LockedSlot extends Slot { - public LockedSlot(IInventory inventoryIn, int index, int xPosition, int yPosition) { - super(inventoryIn, index, xPosition, yPosition); + public LockedSlot(Inventory inventoryIn, int index, int xPosition, int yPosition) { + super((Container) inventoryIn, index, xPosition, yPosition); } @Override @@ -127,12 +134,14 @@ public boolean mayPlace(ItemStack stack) { } @Override - public boolean mayPickup(PlayerEntity playerIn) { + public boolean mayPickup(Player playerIn) { return false; } + } - public int getSlotFor(PlayerInventory inventory, ItemStack stack) { + + public int getSlotFor(Inventory inventory, ItemStack stack) { for (int i = 0; i < inventory.items.size(); ++i) { if (!inventory.items.get(i).isEmpty() && stackEqualExact(stack, inventory.items.get(i))) { return i; @@ -143,6 +152,6 @@ public int getSlotFor(PlayerInventory inventory, ItemStack stack) { } private boolean stackEqualExact(ItemStack stack1, ItemStack stack2) { - return stack1.getItem() == stack2.getItem() && ItemStack.tagMatches(stack1, stack2); + return stack1.getItem() == stack2.getItem() && ItemStack.isSameItemSameTags(stack1, stack2); } } diff --git a/src/main/java/com/traverse/bhc/common/container/SoulHeartAmuletContainer.java b/src/main/java/com/traverse/bhc/common/container/SoulHeartAmuletContainer.java new file mode 100644 index 00000000..fb4fbe84 --- /dev/null +++ b/src/main/java/com/traverse/bhc/common/container/SoulHeartAmuletContainer.java @@ -0,0 +1,152 @@ +package com.traverse.bhc.common.container; + +import com.traverse.bhc.common.config.ConfigHandler; +import com.traverse.bhc.common.init.RegistryHandler; +import com.traverse.bhc.common.items.BaseHeartCanister; +import com.traverse.bhc.common.items.ItemHeartAmulet; +import com.traverse.bhc.common.items.ItemSoulHeartAmulet; +import com.traverse.bhc.common.util.InventoryUtil; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.Container; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.neoforged.neoforge.items.IItemHandler; +import net.neoforged.neoforge.items.ItemStackHandler; +import net.neoforged.neoforge.items.SlotItemHandler; + + +import javax.annotation.Nonnull; + +public class SoulHeartAmuletContainer extends AbstractContainerMenu { + public static final String HEART_AMOUNT = "heart_amount"; + public ItemStackHandler itemStackHandler; + + public SoulHeartAmuletContainer(int windowId, Inventory playerInventory, ItemStack stack) { + super(RegistryHandler.SOUL_HEART_AMUlET_CONTAINER.get(), windowId); + this.itemStackHandler = InventoryUtil.createVirtualInventory(5, stack); + + + //Heart Container Slots + this.addSlot(new SoulHeartAmuletContainer.SlotPendant(this.itemStackHandler, 0, 80, 7));//RED + this.addSlot(new SoulHeartAmuletContainer.SlotPendant(this.itemStackHandler, 1, 53, 33));//YELLOW + this.addSlot(new SoulHeartAmuletContainer.SlotPendant(this.itemStackHandler, 2, 107, 33));//GREEN + this.addSlot(new SoulHeartAmuletContainer.SlotPendant(this.itemStackHandler, 3, 80, 59));//BLUE + this.addSlot(new SoulHeartAmuletContainer.SlotPendant(this.itemStackHandler, 4, 80, 33));//SOUL + + //Add player inventory slots + for (int row = 0; row < 9; ++row) { + int x = 8 + row * 18; + int y = 56 + 86; + if (row == getSlotFor(playerInventory, stack)) { + addSlot(new SoulHeartAmuletContainer.LockedSlot(playerInventory, row, x, y)); + continue; + } + + addSlot(new Slot(playerInventory, row, x, y)); + } + + for (int row = 1; row < 4; ++row) { + for (int col = 0; col < 9; ++col) { + int x = 8 + col * 18; + int y = row * 18 + (56 + 10); + addSlot(new Slot(playerInventory, col + row * 9, x, y)); + } + } + } + + @Override + public void removed(Player playerIn) { + InteractionHand hand = ItemSoulHeartAmulet.getHandForAmulet(playerIn); + if (hand == null) return; + + InventoryUtil.serializeInventory(this.itemStackHandler, playerIn.getItemInHand(hand)); + + CompoundTag nbt = playerIn.getItemInHand(hand).getTag(); + int[] hearts = new int[this.itemStackHandler.getSlots()]; + for (int i = 0; i < hearts.length; i++) { + ItemStack stack = this.itemStackHandler.getStackInSlot(i); + if (!stack.isEmpty()) hearts[i] = stack.getCount() * 2; + } + nbt.putIntArray(HEART_AMOUNT, hearts); + playerIn.getItemInHand(hand).setTag(nbt); + + super.removed(playerIn); + } + + @Override + public boolean stillValid(Player playerIn) { + return true; + } + + @Override + public ItemStack quickMoveStack(Player playerIn, int index) { + ItemStack stack = ItemStack.EMPTY; + Slot slot = slots.get(index); + if (slot != null && slot.hasItem()) { + ItemStack slotStack = slot.getItem(); + stack = slotStack.copy(); + if (index < this.itemStackHandler.getSlots()) { + if (!this.moveItemStackTo(slotStack, this.itemStackHandler.getSlots(), this.slots.size(), true)) + ; + return ItemStack.EMPTY; + } else if (!this.moveItemStackTo(slotStack, 0, this.itemStackHandler.getSlots(), false)) { + return ItemStack.EMPTY; + } + if (slotStack.isEmpty()) slot.set(ItemStack.EMPTY); + else slot.setChanged(); + } + return stack; + } + + + private static class SlotPendant extends SlotItemHandler { + public SlotPendant(IItemHandler itemHandler, int index, int xPosition, int yPosition) { + super(itemHandler, index, xPosition, yPosition); + } + + @Override + public boolean mayPlace(@Nonnull ItemStack stack) { + return super.mayPlace(stack) && stack.getItem() instanceof BaseHeartCanister && ((BaseHeartCanister) stack.getItem()).type.ordinal() == this.getSlotIndex(); + } + + @Override + public int getMaxStackSize() { + return ConfigHandler.general.heartStackSize.get(); + } + } + + private static class LockedSlot extends Slot { + + public LockedSlot(Inventory inventoryIn, int index, int xPosition, int yPosition) { + super((Container) inventoryIn, index, xPosition, yPosition); + } + + @Override + public boolean mayPlace(ItemStack stack) { + return false; + } + + @Override + public boolean mayPickup(Player playerIn) { + return false; + } + } + + public int getSlotFor(Inventory inventory, ItemStack stack) { + for (int i = 0; i < inventory.items.size(); ++i) { + if (!inventory.items.get(i).isEmpty() && stackEqualExact(stack, inventory.items.get(i))) { + return i; + } + } + + return -1; + } + + private boolean stackEqualExact(ItemStack stack1, ItemStack stack2) { + return stack1.getItem() == stack2.getItem() && ItemStack.isSameItemSameTags(stack1, stack2); + } +} diff --git a/src/main/java/com/traverse/bhc/common/init/RegistryHandler.java b/src/main/java/com/traverse/bhc/common/init/RegistryHandler.java index f7f61664..0d2781f6 100644 --- a/src/main/java/com/traverse/bhc/common/init/RegistryHandler.java +++ b/src/main/java/com/traverse/bhc/common/init/RegistryHandler.java @@ -1,35 +1,76 @@ package com.traverse.bhc.common.init; import com.traverse.bhc.common.BaubleyHeartCanisters; +import com.traverse.bhc.common.container.BladeOfVitalityContainer; import com.traverse.bhc.common.container.HeartAmuletContainer; +import com.traverse.bhc.common.container.SoulHeartAmuletContainer; import com.traverse.bhc.common.items.*; +import com.traverse.bhc.common.items.tools.ItemBladeOfVitality; +import com.traverse.bhc.common.recipes.HeartAmuletRecipe; import com.traverse.bhc.common.util.HeartType; -import net.minecraft.inventory.container.ContainerType; -import net.minecraft.item.Item; -import net.minecraftforge.common.extensions.IForgeContainerType; -import net.minecraftforge.fml.RegistryObject; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.chat.Component; +import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.neoforged.neoforge.common.extensions.IMenuTypeExtension; +import net.neoforged.neoforge.registries.DeferredHolder; +import net.neoforged.neoforge.registries.DeferredRegister; + +import java.util.function.Supplier; + public class RegistryHandler { - public static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, BaubleyHeartCanisters.MODID); - public static final DeferredRegister> CONTAINERS = DeferredRegister.create(ForgeRegistries.CONTAINERS, BaubleyHeartCanisters.MODID); + public static final DeferredRegister ITEMS = DeferredRegister.createItems(BaubleyHeartCanisters.MODID); + public static final DeferredRegister> CONTAINERS = DeferredRegister.create(Registries.MENU, BaubleyHeartCanisters.MODID); + public static final DeferredRegister> RECIPESERIALIZER = DeferredRegister.create(Registries.RECIPE_SERIALIZER, BaubleyHeartCanisters.MODID); + public static DeferredRegister TAB = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, BaubleyHeartCanisters.MODID); //Items - public static final RegistryObject RED_HEART = ITEMS.register("red_heart", () -> new ItemHeart(HeartType.RED)); - public static final RegistryObject YELLOW_HEART = ITEMS.register("yellow_heart", () -> new ItemHeart(HeartType.YELLOW)); - public static final RegistryObject GREEN_HEART = ITEMS.register("green_heart", () -> new ItemHeart(HeartType.GREEN)); - public static final RegistryObject BLUE_HEART = ITEMS.register("blue_heart", () -> new ItemHeart(HeartType.BLUE)); - public static final RegistryObject CANISTER = ITEMS.register("canister", BaseItem::new); - public static final RegistryObject RED_CANISTER = ITEMS.register("red_heart_canister", () -> new BaseHeartCanister(HeartType.RED)); - public static final RegistryObject YELLOW_CANISTER = ITEMS.register("yellow_heart_canister", () -> new BaseHeartCanister(HeartType.YELLOW)); - public static final RegistryObject GREEN_CANISTER = ITEMS.register("green_heart_canister", () -> new BaseHeartCanister(HeartType.GREEN)); - public static final RegistryObject BLUE_CANISTER = ITEMS.register("blue_heart_canister", () -> new BaseHeartCanister(HeartType.BLUE)); - public static final RegistryObject WITHER_BONE = ITEMS.register("wither_bone", BaseItem::new); - public static final RegistryObject RELIC_APPLE = ITEMS.register("relic_apple", ItemRelicApple::new); - public static final RegistryObject HEART_AMULET = ITEMS.register("heart_amulet", ItemHeartAmulet::new); + public static final DeferredHolder RED_CANISTER = ITEMS.register("red_heart_canister", () -> new BaseHeartCanister(HeartType.RED)); + public static final DeferredHolder YELLOW_CANISTER = ITEMS.register("yellow_heart_canister", () -> new BaseHeartCanister(HeartType.YELLOW)); + public static final DeferredHolder GREEN_CANISTER = ITEMS.register("green_heart_canister", () -> new BaseHeartCanister(HeartType.GREEN)); + public static final DeferredHolder BLUE_CANISTER = ITEMS.register("blue_heart_canister", () -> new BaseHeartCanister(HeartType.BLUE)); + public static final DeferredHolder SOUL_CANISTER = ITEMS.register("soul_heart_canister", () -> new BaseHeartCanister(HeartType.SOUL)); + + public static final DeferredHolder RED_HEART_MELTED = ITEMS.register("red_heart_melted", () -> new BaseItem()); + public static final DeferredHolder YELLOW_HEART_MELTED = ITEMS.register("yellow_heart_melted", () -> new BaseItem()); + public static final DeferredHolder GREEN_HEART_MELTED = ITEMS.register("green_heart_melted", () -> new BaseItem()); + public static final DeferredHolder BLUE_HEART_MELTED = ITEMS.register("blue_heart_melted", () -> new BaseItem()); + + public static final DeferredHolder RED_HEART_PATCH = ITEMS.register("red_heart_patch", () -> new ItemHeartPatch(2, 5*20, 20)); + public static final DeferredHolder YELLOW_HEART_PATCH = ITEMS.register("yellow_heart_patch", () -> new ItemHeartPatch(6, 10*20, 25)); + public static final DeferredHolder GREEN_HEART_PATCH = ITEMS.register("green_heart_patch", () -> new ItemHeartPatch(10, 20*20, 30)); + public static final DeferredHolder BLUE_HEART_PATCH = ITEMS.register("blue_heart_patch", () -> new ItemHeartPatch(20, 30*20, 50)); + + public static final DeferredHolder RED_HEART = ITEMS.register("red_heart", () -> new ItemHeart(HeartType.RED)); + public static final DeferredHolder YELLOW_HEART = ITEMS.register("yellow_heart", () -> new ItemHeart(HeartType.YELLOW)); + public static final DeferredHolder GREEN_HEART = ITEMS.register("green_heart", () -> new ItemHeart(HeartType.GREEN)); + public static final DeferredHolder BLUE_HEART = ITEMS.register("blue_heart", () -> new ItemHeart(HeartType.BLUE)); + public static final DeferredHolder CANISTER = ITEMS.register("canister", () -> new BaseItem()); + public static final DeferredHolder BLADE_OF_VITALITY = ITEMS.register("blade_of_vitality", ItemBladeOfVitality::new); + + public static final DeferredHolder WITHER_BONE = ITEMS.register("wither_bone", ()-> new BaseItem()); + public static final DeferredHolder RELIC_APPLE = ITEMS.register("relic_apple", ItemRelicApple::new); + public static final DeferredHolder HEART_AMULET = ITEMS.register("heart_amulet", ItemHeartAmulet::new); + public static final DeferredHolder SOUL_HEART_AMULET = ITEMS.register("soul_heart_amulet", ItemSoulHeartAmulet::new); + public static final DeferredHolder SOUL_HEART_CRYSTAL = ITEMS.register("soul_heart_crystal", () -> new BaseItem()); //Container - public static final RegistryObject> HEART_AMUlET_CONTAINER = CONTAINERS.register("heart_amulet_container", () -> IForgeContainerType.create((windowId, inv, data) -> new HeartAmuletContainer(windowId, inv, data.readItem()))); + public static final Supplier> HEART_AMUlET_CONTAINER = CONTAINERS.register("heart_amulet_container", () -> IMenuTypeExtension.create((windowId, inv, data) -> new HeartAmuletContainer(windowId, inv, data.readItem()))); + public static final Supplier> SOUL_HEART_AMUlET_CONTAINER = CONTAINERS.register("soul_heart_amulet_container", () -> IMenuTypeExtension.create((windowId, inv, data) -> new SoulHeartAmuletContainer(windowId, inv, data.readItem()))); + public static final Supplier> BLADE_OF_VITALITY_CONTAINER = CONTAINERS.register("blade_of_vitality_container", () -> IMenuTypeExtension.create((windowId, inv, data) -> new BladeOfVitalityContainer(windowId, inv, data.readItem()))); + + //Recipe Serializer + public static final Supplier> HEART_AMULET_RECIPE_SERIALIZER = RECIPESERIALIZER.register("amulet_shapeless",HeartAmuletRecipe.BHCSerializer::new); + + //Creative Mod Tab + public static final Supplier BHC_TAB = TAB.register("bhc_tab", () -> CreativeModeTab.builder() + .icon(() -> new ItemStack(RegistryHandler.HEART_AMULET.get())) + .displayItems((params, output) -> RegistryHandler.ITEMS.getEntries().forEach(item -> output.accept(item.get()))) + .title(Component.translatable("itemGroup.bhcTab")) + .build()); } diff --git a/src/main/java/com/traverse/bhc/common/items/BaseHeartCanister.java b/src/main/java/com/traverse/bhc/common/items/BaseHeartCanister.java index 03a28c96..30696a63 100644 --- a/src/main/java/com/traverse/bhc/common/items/BaseHeartCanister.java +++ b/src/main/java/com/traverse/bhc/common/items/BaseHeartCanister.java @@ -2,17 +2,18 @@ import com.traverse.bhc.common.config.ConfigHandler; import com.traverse.bhc.common.util.HeartType; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.ItemStack; public class BaseHeartCanister extends BaseItem { public HeartType type; public BaseHeartCanister(HeartType type){ + super(); this.type = type; } @Override - public int getItemStackLimit(ItemStack stack) { + public int getMaxStackSize(ItemStack stack) { return ConfigHandler.general.heartStackSize.get(); } } diff --git a/src/main/java/com/traverse/bhc/common/items/BaseItem.java b/src/main/java/com/traverse/bhc/common/items/BaseItem.java index 59494118..29d85fd1 100644 --- a/src/main/java/com/traverse/bhc/common/items/BaseItem.java +++ b/src/main/java/com/traverse/bhc/common/items/BaseItem.java @@ -1,20 +1,20 @@ package com.traverse.bhc.common.items; import com.traverse.bhc.common.BaubleyHeartCanisters; -import net.minecraft.item.Food; -import net.minecraft.item.Item; +import net.minecraft.world.food.FoodProperties; +import net.minecraft.world.item.Item; public class BaseItem extends Item { public BaseItem() { - super(new Item.Properties().tab(BaubleyHeartCanisters.TAB)); + super(new Item.Properties()); } public BaseItem(int maxCount) { - super(new Item.Properties().tab(BaubleyHeartCanisters.TAB).stacksTo(maxCount)); + super(new Item.Properties().stacksTo(maxCount)); } public BaseItem(int hunger, float saturation) { - super(new Item.Properties().tab(BaubleyHeartCanisters.TAB).food(new Food.Builder().saturationMod(saturation).alwaysEat().nutrition(hunger).build())); + super(new Item.Properties().food(new FoodProperties.Builder().saturationMod(saturation).alwaysEat ().nutrition(hunger).build())); } } diff --git a/src/main/java/com/traverse/bhc/common/items/ItemHeart.java b/src/main/java/com/traverse/bhc/common/items/ItemHeart.java index d922fcf6..e6971f7b 100644 --- a/src/main/java/com/traverse/bhc/common/items/ItemHeart.java +++ b/src/main/java/com/traverse/bhc/common/items/ItemHeart.java @@ -1,14 +1,14 @@ package com.traverse.bhc.common.items; import com.traverse.bhc.common.util.HeartType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.UseAction; -import net.minecraft.util.ActionResult; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.world.World; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.UseAnim; +import net.minecraft.world.level.Level; public class ItemHeart extends BaseItem { @@ -20,28 +20,31 @@ public ItemHeart(HeartType type) { } @Override - public UseAction getUseAnimation(ItemStack stack) { - return UseAction.EAT; + public UseAnim getUseAnimation(ItemStack stack) { + return UseAnim.EAT; } + @Override public int getUseDuration(ItemStack stack) { return 30; } @Override - public ActionResult use(World worldIn, PlayerEntity playerIn, Hand handIn) { + public InteractionResultHolder use(Level worldIn, Player playerIn, InteractionHand handIn) { playerIn.startUsingItem(handIn); - return new ActionResult<>(ActionResultType.SUCCESS, playerIn.getItemInHand(handIn)); + return new InteractionResultHolder<>(InteractionResult.SUCCESS, playerIn.getItemInHand(handIn)); } @Override - public ItemStack finishUsingItem(ItemStack stack, World worldIn, LivingEntity entityLiving) { - if (!worldIn.isClientSide && entityLiving instanceof PlayerEntity) { - PlayerEntity player = (PlayerEntity) entityLiving; + public ItemStack finishUsingItem(ItemStack stack, Level worldIn, LivingEntity entityLiving) { + if (!worldIn.isClientSide && entityLiving instanceof Player) { + Player player = (Player) entityLiving; player.heal(this.type.healAmount); if (!player.isCreative()) stack.shrink(1); } return stack; } + + } diff --git a/src/main/java/com/traverse/bhc/common/items/ItemHeartAmulet.java b/src/main/java/com/traverse/bhc/common/items/ItemHeartAmulet.java index 451b87f7..906c8963 100644 --- a/src/main/java/com/traverse/bhc/common/items/ItemHeartAmulet.java +++ b/src/main/java/com/traverse/bhc/common/items/ItemHeartAmulet.java @@ -4,51 +4,56 @@ import com.traverse.bhc.common.container.HeartAmuletContainer; import com.traverse.bhc.common.init.RegistryHandler; import com.traverse.bhc.common.util.HeartType; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.INamedContainerProvider; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Util; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.Style; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.World; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.util.Constants; -import net.minecraftforge.fml.network.NetworkHooks; +import net.minecraft.ChatFormatting; +import net.minecraft.Util; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.Style; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.Level; +import top.theillusivec4.curios.api.CuriosApi; +import top.theillusivec4.curios.api.SlotContext; +import top.theillusivec4.curios.api.SlotResult; import top.theillusivec4.curios.api.type.capability.ICurioItem; import top.theillusivec4.curios.api.type.capability.ICuriosItemHandler; import java.util.List; -public class ItemHeartAmulet extends BaseItem implements INamedContainerProvider { +import static com.traverse.bhc.common.util.HealthModifier.updatePlayerHealth; + +; + +public class ItemHeartAmulet extends BaseItem implements MenuProvider, ICurioItem { public ItemHeartAmulet() { super(1); } @Override - public ActionResult use(World worldIn, PlayerEntity playerIn, Hand handIn) { - if (!worldIn.isClientSide() && !playerIn.isShiftKeyDown()) { - NetworkHooks.openGui((ServerPlayerEntity) playerIn, this, buffer -> buffer.writeItem(playerIn.getItemInHand(handIn))); + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { + if (hand != InteractionHand.MAIN_HAND) + return InteractionResultHolder.fail(player.getItemInHand(hand)); + + if (!level.isClientSide() && !player.isShiftKeyDown()) { + player.openMenu(this, friendlyByteBuf -> friendlyByteBuf.writeItem(player.getItemInHand(hand))); } - return super.use(worldIn, playerIn, handIn); + return super.use(level, player, hand); } public int[] getHeartCount(ItemStack stack) { if (stack.hasTag()) { - CompoundNBT nbt = stack.getTag(); - if (nbt.contains(HeartAmuletContainer.HEART_AMOUNT, Constants.NBT.TAG_INT_ARRAY)) + CompoundTag nbt = stack.getTag(); + if (nbt.contains(HeartAmuletContainer.HEART_AMOUNT)) return nbt.getIntArray(HeartAmuletContainer.HEART_AMOUNT); } @@ -56,28 +61,49 @@ public int[] getHeartCount(ItemStack stack) { } @Override - public ITextComponent getDisplayName() { - return new TranslationTextComponent("container.bhc.heart_amulet"); + public Component getDisplayName() { + return Component.translatable("container.bhc.heart_amulet"); } @Override - public Container createMenu(int id, PlayerInventory playerInventory, PlayerEntity playerEntity) { - Hand hand = getHandForAmulet(playerEntity); - return new HeartAmuletContainer(id, playerInventory, hand != null ? playerEntity.getItemInHand(hand) : ItemStack.EMPTY); + public AbstractContainerMenu createMenu(int id, Inventory inventory, Player player) { + InteractionHand hand = getHandForAmulet(player); + return new HeartAmuletContainer(id, inventory, hand != null ? player.getItemInHand(hand) : ItemStack.EMPTY); } @Override - public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn) { + public void appendHoverText(ItemStack stack, Level worldIn, List tooltip, TooltipFlag flagIn) { super.appendHoverText(stack, worldIn, tooltip, flagIn); - tooltip.add(new TranslationTextComponent(Util.makeDescriptionId("tooltip", new ResourceLocation(BaubleyHeartCanisters.MODID, "heartamulet"))).setStyle(Style.EMPTY.applyFormat(TextFormatting.GOLD))); + tooltip.add(Component.translatable(Util.makeDescriptionId("tooltip", new ResourceLocation(BaubleyHeartCanisters.MODID, "heartamulet"))).setStyle(Style.EMPTY.applyFormat(ChatFormatting.GOLD))); } - public static Hand getHandForAmulet(PlayerEntity player) { - if(player.getMainHandItem().getItem() == RegistryHandler.HEART_AMULET.get()) - return Hand.MAIN_HAND; - else if(player.getOffhandItem().getItem() == RegistryHandler.HEART_AMULET.get()) - return Hand.OFF_HAND; + public static InteractionHand getHandForAmulet(Player player) { + if (player.getMainHandItem().getItem() == RegistryHandler.HEART_AMULET.get()) + return InteractionHand.MAIN_HAND; + else if (player.getOffhandItem().getItem() == RegistryHandler.HEART_AMULET.get()) + return InteractionHand.OFF_HAND; return null; } + + @Override + public void onEquip(SlotContext slotContext, ItemStack prevStack, ItemStack stack) { + LivingEntity livingEntity = slotContext.entity(); + if(livingEntity instanceof Player player) { + ICuriosItemHandler handler = CuriosApi.getCuriosInventory(livingEntity).orElse(null); + if (handler == null) return; + SlotResult equipped = handler.findFirstCurio(RegistryHandler.HEART_AMULET.get()).orElse(null); + if (equipped != null) { + updatePlayerHealth(player, equipped.stack(), true); + } + } + } + + + @Override + public void onUnequip(SlotContext slotContext, ItemStack newStack, ItemStack stack) { + if (slotContext.entity() instanceof Player player) { + updatePlayerHealth((Player) player, ItemStack.EMPTY, false); + } + } } diff --git a/src/main/java/com/traverse/bhc/common/items/ItemHeartPatch.java b/src/main/java/com/traverse/bhc/common/items/ItemHeartPatch.java new file mode 100644 index 00000000..33fc5afe --- /dev/null +++ b/src/main/java/com/traverse/bhc/common/items/ItemHeartPatch.java @@ -0,0 +1,69 @@ +package com.traverse.bhc.common.items; + +import com.traverse.bhc.common.BaubleyHeartCanisters; +import net.minecraft.ChatFormatting; +import net.minecraft.Util; +import net.minecraft.client.renderer.item.ItemProperties; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.Style; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.Level; + +import java.util.List; + +public class ItemHeartPatch extends BaseItem { + + protected final int amount; + protected final int cooldown; + protected final int durabilty; + + public ItemHeartPatch(int healAmount, int cooldown, int durabilty) { + super(); + this.amount = healAmount; + this.cooldown = cooldown; + this.durabilty = durabilty; + } + + @Override + public boolean isDamageable(ItemStack stack) { + return true; + } + + @Override + public int getMaxDamage(ItemStack stack) { + return durabilty; + } + + @Override + public InteractionResultHolder use(Level worldIn, Player playerIn, InteractionHand handIn) { + if(!worldIn.isClientSide()) { + ItemStack stack = playerIn.getItemInHand(handIn); + worldIn.playSound((Player) null, playerIn.getX(), playerIn.getY(), playerIn.getZ(), SoundEvents.ARMOR_EQUIP_LEATHER, SoundSource.NEUTRAL, 0.5F, 0.4F / (worldIn.getRandom().nextFloat() * 0.4F + 0.8F)); + playerIn.getCooldowns().addCooldown(stack.getItem(), cooldown); + playerIn.heal(amount); + if(!playerIn.isCreative()) stack.hurtAndBreak(1, playerIn, (p) -> { + p.broadcastBreakEvent(InteractionHand.MAIN_HAND); + }); + return new InteractionResultHolder<>(InteractionResult.SUCCESS, playerIn.getItemInHand(handIn)); + } + return new InteractionResultHolder<>(InteractionResult.FAIL, playerIn.getItemInHand(handIn)); + } + + @Override + public void appendHoverText(ItemStack stack, Level worldIn, List tooltip, TooltipFlag flagIn) { + super.appendHoverText(stack, worldIn, tooltip, flagIn); + tooltip.add(Component.translatable(Util.makeDescriptionId("tooltip", new ResourceLocation(BaubleyHeartCanisters.MODID, "patch_amount")), amount).setStyle(Style.EMPTY.applyFormat(ChatFormatting.RED))); + tooltip.add(Component.translatable(Util.makeDescriptionId("tooltip", new ResourceLocation(BaubleyHeartCanisters.MODID, "patch_durability")), durabilty - stack.getDamageValue()).setStyle(Style.EMPTY.applyFormat(ChatFormatting.BLUE))); + } + +} diff --git a/src/main/java/com/traverse/bhc/common/items/ItemRelicApple.java b/src/main/java/com/traverse/bhc/common/items/ItemRelicApple.java index 87d153cb..2d5cc3d1 100644 --- a/src/main/java/com/traverse/bhc/common/items/ItemRelicApple.java +++ b/src/main/java/com/traverse/bhc/common/items/ItemRelicApple.java @@ -1,16 +1,11 @@ package com.traverse.bhc.common.items; -import com.traverse.bhc.common.config.ConfigHandler; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Food; -import net.minecraft.item.Foods; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.potion.EffectInstance; -import net.minecraft.potion.Effects; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.world.World; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; public class ItemRelicApple extends BaseItem { @@ -20,14 +15,14 @@ public ItemRelicApple(){ } @Override - public ItemStack finishUsingItem(ItemStack stack, World worldIn, LivingEntity entityLiving) { + public ItemStack finishUsingItem(ItemStack stack, Level worldIn, LivingEntity entityLiving) { - if (!worldIn.isClientSide() && entityLiving instanceof PlayerEntity) { - PlayerEntity player = (PlayerEntity) entityLiving; + if (!worldIn.isClientSide() && entityLiving instanceof Player) { + Player player = (Player) entityLiving; player.eat(worldIn,stack); - player.addEffect(new EffectInstance(Effects.DAMAGE_RESISTANCE, 20 * 60, 1)); - player.addEffect(new EffectInstance(Effects.DAMAGE_BOOST, 20 * 60, 1)); - player.addEffect(new EffectInstance(Effects.DIG_SPEED, 20 * 60, 1)); + player.addEffect(new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 20 * 60, 1)); + player.addEffect(new MobEffectInstance(MobEffects.DAMAGE_BOOST, 20 * 60, 1)); + player.addEffect(new MobEffectInstance(MobEffects.DIG_SPEED, 20 * 60, 1)); player.heal(20); } diff --git a/src/main/java/com/traverse/bhc/common/items/ItemSoulHeartAmulet.java b/src/main/java/com/traverse/bhc/common/items/ItemSoulHeartAmulet.java new file mode 100644 index 00000000..90a76385 --- /dev/null +++ b/src/main/java/com/traverse/bhc/common/items/ItemSoulHeartAmulet.java @@ -0,0 +1,108 @@ +package com.traverse.bhc.common.items; + +import com.traverse.bhc.common.BaubleyHeartCanisters; +import com.traverse.bhc.common.container.SoulHeartAmuletContainer; +import com.traverse.bhc.common.init.RegistryHandler; +import com.traverse.bhc.common.util.HeartType; +import net.minecraft.ChatFormatting; +import net.minecraft.Util; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.Style; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.Level; +import top.theillusivec4.curios.api.CuriosApi; +import top.theillusivec4.curios.api.SlotContext; +import top.theillusivec4.curios.api.SlotResult; +import top.theillusivec4.curios.api.type.capability.ICurioItem; +import top.theillusivec4.curios.api.type.capability.ICuriosItemHandler; + +import java.util.List; + +import static com.traverse.bhc.common.util.HealthModifier.updatePlayerHealth; + +public class ItemSoulHeartAmulet extends BaseItem implements MenuProvider, ICurioItem { + + public ItemSoulHeartAmulet() { + super(1); + } + + @Override + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { + if (hand != InteractionHand.MAIN_HAND) + return InteractionResultHolder.fail(player.getItemInHand(hand)); + + if (!level.isClientSide() && !player.isShiftKeyDown()) { + player.openMenu(this, friendlyByteBuf -> friendlyByteBuf.writeItem(player.getItemInHand(hand))); + } + + return super.use(level, player, hand); + } + + public int[] getHeartCount(ItemStack stack) { + if (stack.hasTag()) { + CompoundTag nbt = stack.getTag(); + if (nbt.contains(SoulHeartAmuletContainer.HEART_AMOUNT)) + return nbt.getIntArray(SoulHeartAmuletContainer.HEART_AMOUNT); + } + + return new int[HeartType.values().length]; + } + + @Override + public Component getDisplayName() { + return Component.translatable("container.bhc.soul_heart_amulet"); + } + + @Override + public AbstractContainerMenu createMenu(int id, Inventory inventory, Player player) { + InteractionHand hand = getHandForAmulet(player); + return new SoulHeartAmuletContainer(id, inventory, hand != null ? player.getItemInHand(hand) : ItemStack.EMPTY); + } + + @Override + public void appendHoverText(ItemStack stack, Level worldIn, List tooltip, TooltipFlag flagIn) { + super.appendHoverText(stack, worldIn, tooltip, flagIn); + tooltip.add(Component.translatable(Util.makeDescriptionId("tooltip", new ResourceLocation(BaubleyHeartCanisters.MODID, "heartamulet"))).setStyle(Style.EMPTY.applyFormat(ChatFormatting.GOLD))); + } + + public static InteractionHand getHandForAmulet(Player player) { + if (player.getMainHandItem().getItem() == RegistryHandler.SOUL_HEART_AMULET.get()) + return InteractionHand.MAIN_HAND; + else if (player.getOffhandItem().getItem() == RegistryHandler.SOUL_HEART_AMULET.get()) + return InteractionHand.OFF_HAND; + + return null; + } + + @Override + public void onEquip(SlotContext slotContext, ItemStack prevStack, ItemStack stack) { + LivingEntity livingEntity = slotContext.entity(); + if(livingEntity instanceof Player player) { + ICuriosItemHandler handler = CuriosApi.getCuriosInventory(livingEntity).orElse(null); + if (handler == null) return; + SlotResult equipped = handler.findFirstCurio(RegistryHandler.SOUL_HEART_AMULET.get()).orElse(null); + if (equipped != null) { + updatePlayerHealth(player, equipped.stack(), true); + } + } + } + + + @Override + public void onUnequip(SlotContext slotContext, ItemStack newStack, ItemStack stack) { + if (slotContext.entity() instanceof Player player) { + updatePlayerHealth((Player) player, ItemStack.EMPTY, false); + } + } + +} diff --git a/src/main/java/com/traverse/bhc/common/items/tools/ItemBladeOfVitality.java b/src/main/java/com/traverse/bhc/common/items/tools/ItemBladeOfVitality.java new file mode 100644 index 00000000..e739e331 --- /dev/null +++ b/src/main/java/com/traverse/bhc/common/items/tools/ItemBladeOfVitality.java @@ -0,0 +1,120 @@ +package com.traverse.bhc.common.items.tools; + +import com.google.common.collect.ImmutableMultimap; +import com.google.common.collect.Multimap; +import com.traverse.bhc.common.BaubleyHeartCanisters; +import com.traverse.bhc.common.container.BladeOfVitalityContainer; +import com.traverse.bhc.common.container.HeartAmuletContainer; +import com.traverse.bhc.common.init.RegistryHandler; +import com.traverse.bhc.common.util.HeartType; +import net.minecraft.ChatFormatting; +import net.minecraft.Util; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.Style; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.ai.attributes.Attribute; +import net.minecraft.world.entity.ai.attributes.AttributeModifier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.*; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.level.Level; +import org.jetbrains.annotations.Nullable; + +import java.util.List; +import java.util.UUID; +import java.util.stream.IntStream; + +public class ItemBladeOfVitality extends SwordItem implements MenuProvider { + + public static final UUID DAMAGE_MODIFIER_ID = UUID.fromString("432ba3b0-c3bd-4f1c-b14c-76a0b32a386c"); + + + //ToDo: make an actual Tier for Blade of Vitality Easier to Customize + public ItemBladeOfVitality() { + super(Tiers.NETHERITE, 3, -2.4F , new Item.Properties()); + } + + @Override + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { + if (hand != InteractionHand.MAIN_HAND) + return InteractionResultHolder.fail(player.getItemInHand(hand)); + + if (!level.isClientSide() && player.isShiftKeyDown()) { + player.openMenu(this, friendlyByteBuf -> friendlyByteBuf.writeItem(player.getItemInHand(hand))); + } + + return super.use(level, player, hand); + } + + @Override + public boolean isRepairable(ItemStack stack) { + return false; + } + + @Override + public Multimap getAttributeModifiers(EquipmentSlot slot, ItemStack stack) { + ImmutableMultimap.Builder RESULT = ImmutableMultimap.builder(); + RESULT.putAll(super.getAttributeModifiers(slot, stack)); + if(slot == EquipmentSlot.MAINHAND) { + int[] heartCount = getHeartCount(stack); + int heartTotal = IntStream.of(heartCount).sum(); + if (heartTotal > 0) { + RESULT.put(Attributes.ATTACK_DAMAGE, new AttributeModifier(DAMAGE_MODIFIER_ID, "Weapon modifier", heartTotal, AttributeModifier.Operation.ADDITION)); + } + } + return RESULT.build(); + } + + public int[] getHeartCount(ItemStack stack) { + if (stack.hasTag()) { + CompoundTag nbt = stack.getTag(); + if (nbt.contains(BladeOfVitalityContainer.HEART_AMOUNT)) + return nbt.getIntArray(BladeOfVitalityContainer.HEART_AMOUNT); + } + + return new int[HeartType.values().length]; + } + + //ToDo Actually check the length of the Hearts on the Weapon and Add to the damage + @Override + public float getDamage() { + return this.getMaxDamage(RegistryHandler.BLADE_OF_VITALITY.get().getDefaultInstance()) + HeartAmuletContainer.HEART_AMOUNT.length(); + } + + @Override + public boolean canBeDepleted() { + return false; + } + + @Override + public Component getDisplayName() { + return Component.translatable("container.bhc.blade_of_vitality"); + } + + @Nullable + @Override + public AbstractContainerMenu createMenu(int id, Inventory inventory, Player player) { + return new BladeOfVitalityContainer(id, inventory, player.getMainHandItem()); + } + + @Override + public void appendHoverText(ItemStack stack, Level worldIn, List tooltip, TooltipFlag flagIn) { + super.appendHoverText(stack, worldIn, tooltip, flagIn); + tooltip.add(Component.translatable(Util.makeDescriptionId("tooltip", new ResourceLocation(BaubleyHeartCanisters.MODID, "vitality_blade"))).setStyle(Style.EMPTY.applyFormat(ChatFormatting.GOLD))); + } + + @Override + public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) { + return true; + } +} diff --git a/src/main/java/com/traverse/bhc/common/proxy/CommonProxy.java b/src/main/java/com/traverse/bhc/common/proxy/CommonProxy.java new file mode 100644 index 00000000..dcc57090 --- /dev/null +++ b/src/main/java/com/traverse/bhc/common/proxy/CommonProxy.java @@ -0,0 +1,8 @@ +package com.traverse.bhc.common.proxy; + +public class CommonProxy { + + public void doClientStuff() { + + } +} diff --git a/src/main/java/com/traverse/bhc/common/recipes/HeartAmuletRecipe.java b/src/main/java/com/traverse/bhc/common/recipes/HeartAmuletRecipe.java new file mode 100644 index 00000000..f1060a28 --- /dev/null +++ b/src/main/java/com/traverse/bhc/common/recipes/HeartAmuletRecipe.java @@ -0,0 +1,121 @@ +package com.traverse.bhc.common.recipes; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.DataResult; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import com.traverse.bhc.common.init.RegistryHandler; +import com.traverse.bhc.common.util.InventoryUtil; +import net.minecraft.core.NonNullList; +import net.minecraft.core.RegistryAccess; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.util.ExtraCodecs; +import net.minecraft.world.inventory.CraftingContainer; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.CraftingBookCategory; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.ShapelessRecipe; +import net.neoforged.neoforge.items.ItemStackHandler; + +public class HeartAmuletRecipe extends ShapelessRecipe { + + final String group; + final ItemStack result; + final NonNullList ingredients; + + + + public HeartAmuletRecipe(String group,ItemStack stack, NonNullList list) { + super(group, CraftingBookCategory.EQUIPMENT, stack, list); + this.group = group; + this.result = stack; + this.ingredients = list; + } + + + @Override + public ItemStack assemble(CraftingContainer craftingContainer, RegistryAccess registryAccess) { + ItemStack oldCanister = ItemStack.EMPTY; + for (int i = 0; i < craftingContainer.getContainerSize(); i++) { + ItemStack input = craftingContainer.getItem(i); + if(input.getItem() == RegistryHandler.HEART_AMULET.get()) { + oldCanister = input; + break; + } + } + ItemStack stack = super.assemble(craftingContainer, registryAccess); + ItemStackHandler oldInv = InventoryUtil.createVirtualInventory(4, oldCanister); + ItemStackHandler newInv = InventoryUtil.createVirtualInventory(5, stack); + for (int i = 0; i < oldInv.getSlots(); i++) { + newInv.setStackInSlot(i, oldInv.getStackInSlot(i)); + } + InventoryUtil.serializeInventory(newInv, stack); + return stack; + } + + + @Override + public RecipeSerializer getSerializer() { + return RegistryHandler.HEART_AMULET_RECIPE_SERIALIZER.get(); + } + + public static class BHCSerializer implements RecipeSerializer { + + private static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group( + ExtraCodecs.strictOptionalField(Codec.STRING, "group", "").forGetter(recipe -> recipe.group), + ItemStack.ITEM_WITH_COUNT_CODEC.fieldOf("result").forGetter(recipe -> recipe.result), + Ingredient.CODEC_NONEMPTY + .listOf() + .fieldOf("ingredients") + .flatXmap( + array -> { + Ingredient[] aingredient = array + .toArray(Ingredient[]::new); //Forge skip the empty check and immediatly create the array. + if (aingredient.length == 0) { + return DataResult.error(() -> "No ingredients for shapeless recipe"); + } else { + return aingredient.length > 3 * 3 + ? DataResult.error(() -> "Too many ingredients for shapeless recipe. The maximum is: %s".formatted(3 * 3)) + : DataResult.success(NonNullList.of(Ingredient.EMPTY, aingredient)); + } + }, + DataResult::success + ) + .forGetter(recipe -> recipe.ingredients) + ) + .apply(instance, HeartAmuletRecipe::new) + ); + + @Override + public HeartAmuletRecipe fromNetwork(FriendlyByteBuf pBuffer) { + String s = pBuffer.readUtf(); + int i = pBuffer.readVarInt(); + NonNullList nonnulllist = NonNullList.withSize(i, Ingredient.EMPTY); + + for(int j = 0; j < nonnulllist.size(); ++j) { + nonnulllist.set(j, Ingredient.fromNetwork(pBuffer)); + } + + ItemStack itemstack = pBuffer.readItem(); + return new HeartAmuletRecipe(s, itemstack, nonnulllist); + } + + @Override + public Codec codec() { + return CODEC; + } + + @Override + public void toNetwork(FriendlyByteBuf buf, HeartAmuletRecipe heartAmuletRecipe) { + buf.writeUtf(heartAmuletRecipe.getGroup()); + buf.writeVarInt(heartAmuletRecipe.getIngredients().size()); + + for(Ingredient ingredient : heartAmuletRecipe.getIngredients()) { + ingredient.toNetwork(buf); + } + buf.writeItem(heartAmuletRecipe.getResultItem(RegistryAccess.EMPTY)); + } + + } +} diff --git a/src/main/java/com/traverse/bhc/common/util/DropHandler.java b/src/main/java/com/traverse/bhc/common/util/DropHandler.java index d7bb9bb3..fae7633b 100644 --- a/src/main/java/com/traverse/bhc/common/util/DropHandler.java +++ b/src/main/java/com/traverse/bhc/common/util/DropHandler.java @@ -3,16 +3,25 @@ import com.traverse.bhc.common.BaubleyHeartCanisters; import com.traverse.bhc.common.config.ConfigHandler; import com.traverse.bhc.common.init.RegistryHandler; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.boss.dragon.EnderDragonEntity; -import net.minecraft.entity.monster.IMob; -import net.minecraft.entity.monster.WitherSkeletonEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraftforge.event.entity.living.LivingDropsEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.ModList; -import net.minecraftforge.fml.common.Mod; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.boss.enderdragon.EnderDragon; +import net.minecraft.world.entity.monster.Monster; +import net.minecraft.world.entity.monster.WitherSkeleton; +import net.minecraft.world.entity.monster.warden.Warden; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.ModList; +import net.neoforged.fml.common.Mod; +import net.neoforged.neoforge.common.Tags; +import net.neoforged.neoforge.event.entity.living.LivingDropsEvent; + import java.util.ArrayList; import java.util.List; @@ -24,15 +33,21 @@ public class DropHandler { @SubscribeEvent public static void onEntityDrop(LivingDropsEvent event) { - LivingEntity entity = event.getEntityLiving(); - if (entity.level.isClientSide || entity instanceof PlayerEntity) return; + LivingEntity entity = event.getEntity(); + if (entity.level().isClientSide || entity instanceof Player) return; - if (!ModList.get().isLoaded("tinkersconstruct") && entity instanceof WitherSkeletonEntity) { - if (entity.level.random.nextDouble() < ConfigHandler.general.boneDropRate.get()) { + if (!ModList.get().isLoaded("tinkersconstruct") && entity instanceof WitherSkeleton) { + if (entity.level().random.nextDouble() < ConfigHandler.general.boneDropRate.get()) { entity.spawnAtLocation(RegistryHandler.WITHER_BONE.get(), 1); } } + if(event.getEntity() instanceof Warden warden) { + if(warden.level().random.nextDouble() < ConfigHandler.general.echoShardDropRate.get()) { + entity.spawnAtLocation(Items.ECHO_SHARD, 1); + } + } + for (ItemStack stack : getEntityDrops(entity)) { entity.spawnAtLocation(stack.getItem(), 0); } @@ -69,18 +84,23 @@ public static void handleEntry(String category, LivingEntity entity, List list, ItemStack stack, double list.add(stack); } } + + private static boolean isBoss(Entity entity) { + if(entity != null) { + if(entity.getType().is(Tags.EntityTypes.BOSSES)) { + return true; + } + } + return false; + } + } diff --git a/src/main/java/com/traverse/bhc/common/util/EasterEgg.java b/src/main/java/com/traverse/bhc/common/util/EasterEgg.java new file mode 100644 index 00000000..fb05f1c4 --- /dev/null +++ b/src/main/java/com/traverse/bhc/common/util/EasterEgg.java @@ -0,0 +1,28 @@ +package com.traverse.bhc.common.util; + +import com.traverse.bhc.common.BaubleyHeartCanisters; +import com.traverse.bhc.common.init.RegistryHandler; +import net.minecraft.client.renderer.item.ItemProperties; +import net.minecraft.resources.ResourceLocation; + +import java.util.Locale; + +public class EasterEgg { + + public static void secretCode() { + ItemProperties.register(RegistryHandler.BLADE_OF_VITALITY.get(), new ResourceLocation(BaubleyHeartCanisters.MODID, "easter_egg"), (stack, level, entity, value) -> { + String hoverName = stack.hasCustomHoverName() ? stack.getHoverName().getString().toLowerCase(Locale.ROOT) : ""; + float result = 0.0F; + + if (hoverName.contains("beautiful eyes")) { + result = 1.0F; + } else if (hoverName.contains("traverse")) { + result = 2.0F; + } else if (hoverName.contains("jamiscus")) { + result = 3.0F; + } + + return result; + }); + } +} diff --git a/src/main/java/com/traverse/bhc/common/util/HealthModifier.java b/src/main/java/com/traverse/bhc/common/util/HealthModifier.java index 55e03364..717df260 100644 --- a/src/main/java/com/traverse/bhc/common/util/HealthModifier.java +++ b/src/main/java/com/traverse/bhc/common/util/HealthModifier.java @@ -3,88 +3,165 @@ import com.google.common.base.Preconditions; import com.traverse.bhc.common.BaubleyHeartCanisters; import com.traverse.bhc.common.config.ConfigHandler; -import com.traverse.bhc.common.init.RegistryHandler; import com.traverse.bhc.common.items.ItemHeartAmulet; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.attributes.AttributeModifier; -import net.minecraft.entity.ai.attributes.Attributes; -import net.minecraft.entity.ai.attributes.ModifiableAttributeInstance; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Direction; -import net.minecraft.util.math.MathHelper; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.event.AttachCapabilitiesEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; -import org.apache.commons.lang3.tuple.ImmutableTriple; -import top.theillusivec4.curios.api.CuriosApi; -import top.theillusivec4.curios.api.CuriosCapability; -import top.theillusivec4.curios.api.type.capability.ICurio; - -import javax.annotation.Nonnull; -import java.util.Optional; +import com.traverse.bhc.common.items.ItemSoulHeartAmulet; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.ai.attributes.AttributeInstance; +import net.minecraft.world.entity.ai.attributes.AttributeModifier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.neoforged.fml.common.Mod; + import java.util.UUID; -@Mod.EventBusSubscriber(modid = BaubleyHeartCanisters.MODID) +//@Mod.EventBusSubscriber(modid = BaubleyHeartCanisters.MODID) public class HealthModifier { public static final UUID HEALTH_MODIFIER_ID = UUID.fromString("caa44aa0-9e6e-4a57-9759-d2f64abfb7d3"); - @SubscribeEvent - public static void attachCapabilities(AttachCapabilitiesEvent event) { - if (event.getObject().getItem() != RegistryHandler.HEART_AMULET.get()) - return; - - ICurio curio = new ICurio() { - @Override - public void onEquip(String identifier, int index, LivingEntity livingEntity) { - Optional> stackOptional = CuriosApi.getCuriosHelper().findEquippedCurio(RegistryHandler.HEART_AMULET.get(), livingEntity); - - stackOptional.ifPresent(triple -> { - if(livingEntity instanceof PlayerEntity) { - ItemStack stack = triple.getRight(); - updatePlayerHealth((PlayerEntity) livingEntity, stack, true); - } - }); - } - - @Override - public void onUnequip(String identifier, int index, LivingEntity livingEntity) { - if(livingEntity instanceof PlayerEntity) - updatePlayerHealth((PlayerEntity) livingEntity, ItemStack.EMPTY, false); + /* + public static void onEquipCurio(CurioEquipEvent event) { + LivingEntity livingEntity = event.getSlotContext().entity(); + if(livingEntity instanceof Player player) { + ICuriosItemHandler handler = CuriosApi.getCuriosInventory(livingEntity).orElse(null); + if (handler == null) return; + IItemHandlerModifiable equipped = handler.getEquippedCurios(); + int slots = equipped.getSlots(); + for (int i = 0; i < slots; i++) { + ItemStack stack = equipped.getStackInSlot(i); + if(stack.is(RegistryHandler.HEART_AMULET)) { + updatePlayerHealth(player, stack, true); + } } - @Override - public boolean canRightClickEquip() { - return false; - } - }; + } + } - ICapabilityProvider provider = new ICapabilityProvider() { - private final LazyOptional curioOpt = LazyOptional.of(() -> curio); + @Override + public void onUnequip(SlotContext slotContext, ItemStack newStack) { + if (slotContext.getWearer() instanceof Player) + updatePlayerHealth((Player) slotContext.getWearer(), ItemStack.EMPTY, false); + } - @Nonnull - @Override - public LazyOptional getCapability(@Nonnull Capability cap, Direction side) { - return CuriosCapability.ITEM.orEmpty(cap, curioOpt); - } - }; +}; - event.addCapability(CuriosCapability.ID_ITEM, provider); + public static void onUnequipCurio(CurioUnequipEvent event) { + if(event.getSlotContext().entity() instanceof Player player) { + updatePlayerHealth(player, ); + } } - public static void updatePlayerHealth(PlayerEntity player, ItemStack stack, boolean addHealth) { - ModifiableAttributeInstance health = player.getAttribute(Attributes.MAX_HEALTH); + @SubscribeEvent + public static void attachCapabilities(AttachCapabilitiesEvent event) { + if (event.getObject().getItem() == RegistryHandler.HEART_AMULET.get()) { + ICurio curio = new ICurio() { + + @Override + public ItemStack getStack() { + return new ItemStack(RegistryHandler.HEART_AMULET.get()); + } + + @Override + public void onEquip(SlotContext slotContext, ItemStack prevStack) { + LivingEntity livingEntity = slotContext.getWearer(); + Optional> stackOptional = CuriosApi.getCuriosHelper().findEquippedCurio(RegistryHandler.HEART_AMULET.get(), livingEntity); + + stackOptional.ifPresent(triple -> { + if (livingEntity instanceof Player) { + ItemStack stack = triple.getRight(); + updatePlayerHealth((Player) livingEntity, stack, true); + } + }); + } + + @Override + public boolean canRightClickEquip() { + return false; + } + + @Override + public void onUnequip(SlotContext slotContext, ItemStack newStack) { + if (slotContext.entity() instanceof Player player) + updatePlayerHealth(player, ItemStack.EMPTY, false); + } + + }; + + ICapabilityProvider provider = new ICapabilityProvider() { + private final LazyOptional curioOpt = LazyOptional.of(() -> curio); + + @Nonnull + @Override + public LazyOptional getCapability(@Nonnull Capability cap, Direction side) { + return CuriosCapability.ITEM.orEmpty(cap, curioOpt); + } + }; + + event.addCapability(CuriosCapability.ID_ITEM, provider); + } else if (event.getObject().getItem() == RegistryHandler.SOUL_HEART_AMULET.get()) { + ICurio curio = new ICurio() { + + @Override + public ItemStack getStack() { + return new ItemStack(RegistryHandler.SOUL_HEART_AMULET.get()); + } + + @Override + public void onEquip(SlotContext slotContext, ItemStack prevStack) { + LivingEntity livingEntity = slotContext.getWearer(); + Optional> stackOptional = CuriosApi.getCuriosHelper().findEquippedCurio(RegistryHandler.SOUL_HEART_AMULET.get(), livingEntity); + + stackOptional.ifPresent(triple -> { + if (livingEntity instanceof Player) { + ItemStack stack = triple.getRight(); + updatePlayerHealth((Player) livingEntity, stack, true); + } + }); + } + + @Override + public boolean canRightClickEquip() { + return false; + } + + @Override + public void onUnequip(SlotContext slotContext, ItemStack newStack) { + if (slotContext.getWearer() instanceof Player) + updatePlayerHealth((Player) slotContext.getWearer(), ItemStack.EMPTY, false); + } + + }; + + ICapabilityProvider provider = new ICapabilityProvider() { + private final LazyOptional curioOpt = LazyOptional.of(() -> curio); + + @Nonnull + @Override + public LazyOptional getCapability(@Nonnull Capability cap, Direction side) { + return CuriosCapability.ITEM.orEmpty(cap, curioOpt); + } + }; + + event.addCapability(CuriosCapability.ID_ITEM, provider); + } + + + } */ + public static void updatePlayerHealth(Player player, ItemStack stack, boolean addHealth) { + AttributeInstance health = player.getAttribute(Attributes.MAX_HEALTH); float diff = player.getMaxHealth() - player.getHealth(); - int[] hearts = new int[HeartType.values().length]; + int[] hearts = new int[4]; - if(addHealth && !stack.isEmpty()) { - int[] amuletHearts = ((ItemHeartAmulet) stack.getItem()).getHeartCount(stack); - Preconditions.checkArgument(amuletHearts.length == HeartType.values().length, "Array must be same length as enum length!"); + if (addHealth && !stack.isEmpty()) { + int[] amuletHearts = null; + if (stack.getItem() instanceof ItemHeartAmulet amulet) { + amuletHearts = amulet.getHeartCount(stack); + } else if (stack.getItem() instanceof ItemSoulHeartAmulet amulet) { + amuletHearts = amulet.getHeartCount(stack); + } + Preconditions.checkArgument(amuletHearts != null, "amuletHearts was never initialized - is this a soul canister?"); for (int i = 0; i < hearts.length; i++) { hearts[i] += amuletHearts[i]; } @@ -92,18 +169,18 @@ public static void updatePlayerHealth(PlayerEntity player, ItemStack stack, bool int extraHearts = 0; for (int i = 0; i < hearts.length; i++) { - extraHearts += MathHelper.clamp(hearts[i], 0, ConfigHandler.general.heartStackSize.get() * 2); + extraHearts += Mth.clamp(hearts[i], 0, ConfigHandler.general.heartStackSize.get() * 2); } AttributeModifier modifier = health.getModifier(HEALTH_MODIFIER_ID); if (modifier != null) { if (modifier.getAmount() == extraHearts) return; - health.removeModifier(modifier); + health.removeModifier(HEALTH_MODIFIER_ID); } health.addPermanentModifier(new AttributeModifier(HEALTH_MODIFIER_ID, BaubleyHeartCanisters.MODID + ":extra_hearts", extraHearts, AttributeModifier.Operation.ADDITION)); - float amount = MathHelper.clamp(player.getMaxHealth() - diff, 0.0f, player.getMaxHealth()); + float amount = Mth.clamp(player.getMaxHealth() - diff, 0.0f, player.getMaxHealth()); if (amount > 0.0F) { player.setHealth(amount); } else { @@ -112,3 +189,5 @@ public static void updatePlayerHealth(PlayerEntity player, ItemStack stack, bool } } } + + diff --git a/src/main/java/com/traverse/bhc/common/util/HeartType.java b/src/main/java/com/traverse/bhc/common/util/HeartType.java index 8bf0d541..a7ea04ce 100644 --- a/src/main/java/com/traverse/bhc/common/util/HeartType.java +++ b/src/main/java/com/traverse/bhc/common/util/HeartType.java @@ -4,7 +4,8 @@ public enum HeartType { RED(20), YELLOW(40), GREEN(60), - BLUE(80); + BLUE(80), + SOUL(0); public final int healAmount; diff --git a/src/main/java/com/traverse/bhc/common/util/InventoryUtil.java b/src/main/java/com/traverse/bhc/common/util/InventoryUtil.java index e9c81939..4d2adf40 100644 --- a/src/main/java/com/traverse/bhc/common/util/InventoryUtil.java +++ b/src/main/java/com/traverse/bhc/common/util/InventoryUtil.java @@ -1,9 +1,13 @@ package com.traverse.bhc.common.util; import com.traverse.bhc.common.BaubleyHeartCanisters; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraftforge.items.ItemStackHandler; +import com.traverse.bhc.common.init.RegistryHandler; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.neoforged.neoforge.items.ItemStackHandler; + +import java.util.stream.Stream; public class InventoryUtil { @@ -11,15 +15,24 @@ public class InventoryUtil { public static ItemStackHandler createVirtualInventory(int slots, ItemStack stack) { ItemStackHandler handler = new ItemStackHandler(slots); - CompoundNBT nbt = stack.hasTag() ? stack.getTag() : new CompoundNBT(); + CompoundTag nbt = stack.hasTag() ? stack.getTag() : new CompoundTag(); handler.deserializeNBT(nbt.getCompound(ITEMLIST)); return handler; } public static void serializeInventory(ItemStackHandler itemHandler, ItemStack stack) { - CompoundNBT nbt = stack.hasTag() ? stack.getTag() : new CompoundNBT(); + CompoundTag nbt = stack.hasTag() ? stack.getTag() : new CompoundTag(); nbt.put(ITEMLIST, itemHandler.serializeNBT()); stack.setTag(nbt); } + + public static boolean hasAmulet(Player player) { + for (int i = 0; player.getInventory().getContainerSize() > i; ++i) { + ItemStack stack = player.getInventory().getItem(i); + if( stack.getItem() != RegistryHandler.HEART_AMULET.get()) continue; + + } + return true; + } } diff --git a/src/main/java/com/traverse/bhc/common/util/PlayerDeathEvent.java b/src/main/java/com/traverse/bhc/common/util/PlayerDeathEvent.java new file mode 100644 index 00000000..c1fc9f0d --- /dev/null +++ b/src/main/java/com/traverse/bhc/common/util/PlayerDeathEvent.java @@ -0,0 +1,61 @@ +package com.traverse.bhc.common.util; + +import com.traverse.bhc.common.BaubleyHeartCanisters; +import com.traverse.bhc.common.config.ConfigHandler; +import com.traverse.bhc.common.init.RegistryHandler; +import com.traverse.bhc.common.items.ItemSoulHeartAmulet; +import net.minecraft.ChatFormatting; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.Style; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.Mod; +import net.neoforged.neoforge.event.entity.living.LivingDeathEvent; +import net.neoforged.neoforge.items.ItemHandlerHelper; +import net.neoforged.neoforge.items.ItemStackHandler; +import top.theillusivec4.curios.api.CuriosApi; +import top.theillusivec4.curios.api.SlotResult; +import top.theillusivec4.curios.api.type.capability.ICuriosItemHandler; + +import java.util.Random; + +@Mod.EventBusSubscriber(modid = BaubleyHeartCanisters.MODID) +public class PlayerDeathEvent { + private static final Random random = new Random(); + + @SubscribeEvent + public static void onPlayerDeathEvent(LivingDeathEvent evt) { + if (!evt.getEntity().level().isClientSide()) { + if (evt.getEntity() instanceof Player player) { + ICuriosItemHandler handler = CuriosApi.getCuriosInventory(evt.getEntity()).orElse(null); + if (handler == null) return; + SlotResult equipped = handler.findFirstCurio(itemStack -> itemStack.getItem() instanceof ItemSoulHeartAmulet).orElse(null); + if (equipped != null) { + ItemStackHandler soulInventory = InventoryUtil.createVirtualInventory(5, equipped.stack()); + + if (!soulInventory.getStackInSlot(4).isEmpty()) { + soulInventory.getStackInSlot(4).shrink(1); + InventoryUtil.serializeInventory(soulInventory, equipped.stack()); + player.displayClientMessage(Component.translatable("soulheartused.bhc.message").setStyle(Style.EMPTY.applyFormat(ChatFormatting.DARK_PURPLE)), true); + player.level().playLocalSound(player.getX(), player.getY(), player.getZ(), SoundEvents.TOTEM_USE, player.getSoundSource(), 1.0F, 1.0F, false); + //15% chance + if (random.nextDouble() <= ConfigHandler.general.soulHeartReturnChance.get()) { + ItemHandlerHelper.giveItemToPlayer(player, new ItemStack(RegistryHandler.BLUE_CANISTER.get())); + } + evt.setCanceled(true); + player.setHealth(player.getMaxHealth()); + player.removeAllEffects(); + player.addEffect(new MobEffectInstance(MobEffects.REGENERATION, 900, 1)); + player.addEffect(new MobEffectInstance(MobEffects.ABSORPTION, 100, 1)); + player.addEffect(new MobEffectInstance(MobEffects.FIRE_RESISTANCE, 800, 0)); + } + + } + } + } + } +} diff --git a/src/main/java/com/traverse/bhc/common/util/StartingHealthHandler.java b/src/main/java/com/traverse/bhc/common/util/StartingHealthHandler.java index f58891ce..9622d821 100644 --- a/src/main/java/com/traverse/bhc/common/util/StartingHealthHandler.java +++ b/src/main/java/com/traverse/bhc/common/util/StartingHealthHandler.java @@ -2,24 +2,23 @@ import com.traverse.bhc.common.BaubleyHeartCanisters; import com.traverse.bhc.common.config.ConfigHandler; -import net.minecraft.entity.ai.attributes.Attributes; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraftforge.common.util.FakePlayer; -import net.minecraftforge.event.entity.EntityJoinWorldEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.player.Player; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.Mod; +import net.neoforged.neoforge.common.util.FakePlayer; +import net.neoforged.neoforge.event.entity.EntityJoinLevelEvent; + @Mod.EventBusSubscriber(modid = BaubleyHeartCanisters.MODID) public class StartingHealthHandler { @SubscribeEvent - public static void setStartingHealth(EntityJoinWorldEvent evt) { - if(ConfigHandler.server.allowStartingHeathTweaks.get()) { - if(evt.getEntity() instanceof PlayerEntity && !(evt.getEntity() instanceof FakePlayer)) { - PlayerEntity player = (PlayerEntity) evt.getEntity(); - if(ConfigHandler.server.startingHealth.get() > 0) { - player.getAttribute(Attributes.MAX_HEALTH).setBaseValue(ConfigHandler.server.startingHealth.get()); - } + public static void setStartingHealth(final EntityJoinLevelEvent evt) { + if(ConfigHandler.server.allowStartingHeathTweaks.get() && evt.getEntity() instanceof Player && !(evt.getEntity()instanceof FakePlayer)) { + final Player player = (Player) evt.getEntity(); + if(ConfigHandler.server.startingHealth.get() > 0) { + player.getAttribute(Attributes.MAX_HEALTH).setBaseValue(ConfigHandler.server.startingHealth.get()); } } } diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index a018003c..70cf0fff 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -1,21 +1,21 @@ modLoader="javafml" -loaderVersion="[35,)" -license="All rights reserved" +loaderVersion="${loader_version_range}" +license="${mod_license}" issueTrackerURL="https://github.com/Traverse-Joe/Baubley-Heart-Canisters/issues" [[mods]] -modId="bhc" -version="${file.jarVersion}" -displayName="Baubley Heart Canisters" +modId="${mod_id}" +version="${mod_version}" +displayName="${mod_name}" credits="Thanks goes to UpcraftLP who helped with original build. Also Abused_Master for helping when i bugged him." -authors="Traverse_Joe" +authors="${mod_authors}" description=''' -Heart Canisters for Baubles/Curios Enjoy :D +{mod_description} ''' [[dependencies.bhc]] - modId="forge" - mandatory=true - versionRange="[35,)" + modId="neoforge" + type = "required" + versionRange="${neo_version_range}" ordering="NONE" side="BOTH" \ No newline at end of file diff --git a/src/main/resources/assets/bhc/lang/en_us.json b/src/main/resources/assets/bhc/lang/en_us.json index c0154fed..f5571191 100644 --- a/src/main/resources/assets/bhc/lang/en_us.json +++ b/src/main/resources/assets/bhc/lang/en_us.json @@ -9,10 +9,28 @@ "item.bhc.yellow_heart_canister" : "Yellow Heart Canister", "item.bhc.green_heart_canister" : "Green Heart Canister", "item.bhc.blue_heart_canister" : "Blue Heart Canister", + "item.bhc.soul_heart_canister" : "Soul Heart Canister", + "item.bhc.red_heart_melted": "Melted Red Heart", + "item.bhc.yellow_heart_melted": "Melted Yellow Heart", + "item.bhc.green_heart_melted": "Melted Green Heart", + "item.bhc.blue_heart_melted": "Melted Blue Heart", + "item.bhc.red_heart_patch": "Red Health Patch", + "item.bhc.yellow_heart_patch": "Yellow Health Patch", + "item.bhc.green_heart_patch": "Green Health Patch", + "item.bhc.blue_heart_patch": "Blue Health Patch", "item.bhc.wither_bone" : "Wither Bone", "item.bhc.relic_apple" : "Relic Apple", "item.bhc.heart_amulet" : "Heart Amulet", + "item.bhc.soul_heart_crystal": "Soul Heart Crystal", + "item.bhc.blade_of_vitality": "Vitality Blade", + "item.bhc.soul_heart_amulet" : "Soul Amulet", "container.bhc.heart_amulet" : "Heart Amulet", + "container.bhc.soul_heart_amulet" : "Soul Amulet", "tooltip.bhc.heartamulet": "Right click to open!", - "curios.identifier.heartamulet": "Heart Amulet" + "tooltip.bhc.vitality_blade": "Shift-Right click to open!", + "tooltip.bhc.patch_amount": "Heal Amount: %s", + "tooltip.bhc.patch_durability": "Uses Left: %s", + "container.bhc.blade_of_vitality": "Vitality Blade", + "soulheartused.bhc.message": "Soul Heart Has Been Consumed!", + "curios.identifier.heart_amulet": "Heart Amulet" } \ No newline at end of file diff --git a/src/main/resources/assets/bhc/models/item/blade_of_vitality.json b/src/main/resources/assets/bhc/models/item/blade_of_vitality.json new file mode 100644 index 00000000..b15b1ae9 --- /dev/null +++ b/src/main/resources/assets/bhc/models/item/blade_of_vitality.json @@ -0,0 +1,26 @@ +{ + "parent": "item/handheld", + "overrides": [ + { + "model": "bhc:item/lash_blade", + "predicate": { + "bhc:easter_egg": 1.0 + } + }, + { + "model": "bhc:item/traverse_blade", + "predicate": { + "bhc:easter_egg": 2.0 + } + }, + { + "model": "bhc:item/jamiscus_blade", + "predicate": { + "bhc:easter_egg": 3.0 + } + } + ], + "textures" : { + "layer0" : "bhc:item/blade_of_vitality" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/bhc/models/item/blue_heart.json b/src/main/resources/assets/bhc/models/item/blue_heart.json index ee3cab73..39002ef7 100644 --- a/src/main/resources/assets/bhc/models/item/blue_heart.json +++ b/src/main/resources/assets/bhc/models/item/blue_heart.json @@ -1,6 +1,6 @@ { "parent": "item/generated", "textures" : { - "layer0" : "bhc:items/blue_heart" + "layer0" : "bhc:item/blue_heart" } } \ No newline at end of file diff --git a/src/main/resources/assets/bhc/models/item/blue_heart_canister.json b/src/main/resources/assets/bhc/models/item/blue_heart_canister.json index e8401fa6..f10ddc61 100644 --- a/src/main/resources/assets/bhc/models/item/blue_heart_canister.json +++ b/src/main/resources/assets/bhc/models/item/blue_heart_canister.json @@ -1,6 +1,6 @@ { "parent": "item/generated", "textures" : { - "layer0" : "bhc:items/blue_heart_canister" + "layer0" : "bhc:item/blue_heart_canister" } } \ No newline at end of file diff --git a/src/main/resources/assets/bhc/models/item/blue_heart_melted.json b/src/main/resources/assets/bhc/models/item/blue_heart_melted.json new file mode 100644 index 00000000..282599f7 --- /dev/null +++ b/src/main/resources/assets/bhc/models/item/blue_heart_melted.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures" : { + "layer0" : "bhc:item/blue_heart_melted" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/bhc/models/item/blue_heart_patch.json b/src/main/resources/assets/bhc/models/item/blue_heart_patch.json new file mode 100644 index 00000000..9bb311f2 --- /dev/null +++ b/src/main/resources/assets/bhc/models/item/blue_heart_patch.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures" : { + "layer0" : "bhc:item/blue_heart_patch" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/bhc/models/item/canister.json b/src/main/resources/assets/bhc/models/item/canister.json index dc0d833e..8ef11934 100644 --- a/src/main/resources/assets/bhc/models/item/canister.json +++ b/src/main/resources/assets/bhc/models/item/canister.json @@ -1,6 +1,6 @@ { "parent": "item/generated", "textures" : { - "layer0" : "bhc:items/canister" + "layer0" : "bhc:item/canister" } } \ No newline at end of file diff --git a/src/main/resources/assets/bhc/models/item/green_heart.json b/src/main/resources/assets/bhc/models/item/green_heart.json index c2ef723c..38d15b0b 100644 --- a/src/main/resources/assets/bhc/models/item/green_heart.json +++ b/src/main/resources/assets/bhc/models/item/green_heart.json @@ -1,6 +1,6 @@ { "parent": "item/generated", "textures" : { - "layer0" : "bhc:items/green_heart" + "layer0" : "bhc:item/green_heart" } } \ No newline at end of file diff --git a/src/main/resources/assets/bhc/models/item/green_heart_canister.json b/src/main/resources/assets/bhc/models/item/green_heart_canister.json index 1255d0f5..ea9d218b 100644 --- a/src/main/resources/assets/bhc/models/item/green_heart_canister.json +++ b/src/main/resources/assets/bhc/models/item/green_heart_canister.json @@ -1,6 +1,6 @@ { "parent": "item/generated", "textures" : { - "layer0" : "bhc:items/green_heart_canister" + "layer0" : "bhc:item/green_heart_canister" } } \ No newline at end of file diff --git a/src/main/resources/assets/bhc/models/item/green_heart_melted.json b/src/main/resources/assets/bhc/models/item/green_heart_melted.json new file mode 100644 index 00000000..88bca935 --- /dev/null +++ b/src/main/resources/assets/bhc/models/item/green_heart_melted.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures" : { + "layer0" : "bhc:item/green_heart_melted" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/bhc/models/item/green_heart_patch.json b/src/main/resources/assets/bhc/models/item/green_heart_patch.json new file mode 100644 index 00000000..daa13352 --- /dev/null +++ b/src/main/resources/assets/bhc/models/item/green_heart_patch.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures" : { + "layer0" : "bhc:item/green_heart_patch" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/bhc/models/item/heart_amulet.json b/src/main/resources/assets/bhc/models/item/heart_amulet.json index 59490ea6..17eadfe8 100644 --- a/src/main/resources/assets/bhc/models/item/heart_amulet.json +++ b/src/main/resources/assets/bhc/models/item/heart_amulet.json @@ -1,6 +1,6 @@ { "parent": "item/generated", "textures": { - "layer0": "bhc:items/heart_amulet" + "layer0": "bhc:item/heart_amulet" } } \ No newline at end of file diff --git a/src/main/resources/assets/bhc/models/item/jamiscus_blade.json b/src/main/resources/assets/bhc/models/item/jamiscus_blade.json new file mode 100644 index 00000000..2f2c7fd1 --- /dev/null +++ b/src/main/resources/assets/bhc/models/item/jamiscus_blade.json @@ -0,0 +1,6 @@ +{ + "parent": "item/handheld", + "textures" : { + "layer0" : "bhc:item/jamiscus_blade" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/bhc/models/item/lash_blade.json b/src/main/resources/assets/bhc/models/item/lash_blade.json new file mode 100644 index 00000000..43fe898a --- /dev/null +++ b/src/main/resources/assets/bhc/models/item/lash_blade.json @@ -0,0 +1,6 @@ +{ + "parent": "item/handheld", + "textures" : { + "layer0" : "bhc:item/lash_blade" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/bhc/models/item/red_heart.json b/src/main/resources/assets/bhc/models/item/red_heart.json index cf4a8aa6..3a95ef89 100644 --- a/src/main/resources/assets/bhc/models/item/red_heart.json +++ b/src/main/resources/assets/bhc/models/item/red_heart.json @@ -1,6 +1,6 @@ { "parent": "item/generated", "textures" : { - "layer0" : "bhc:items/red_heart" + "layer0" : "bhc:item/red_heart" } } \ No newline at end of file diff --git a/src/main/resources/assets/bhc/models/item/red_heart_canister.json b/src/main/resources/assets/bhc/models/item/red_heart_canister.json index 323fce69..d800665d 100644 --- a/src/main/resources/assets/bhc/models/item/red_heart_canister.json +++ b/src/main/resources/assets/bhc/models/item/red_heart_canister.json @@ -1,6 +1,6 @@ { "parent": "item/generated", "textures" : { - "layer0" : "bhc:items/red_heart_canister" + "layer0" : "bhc:item/red_heart_canister" } } \ No newline at end of file diff --git a/src/main/resources/assets/bhc/models/item/red_heart_melted.json b/src/main/resources/assets/bhc/models/item/red_heart_melted.json new file mode 100644 index 00000000..ab65d025 --- /dev/null +++ b/src/main/resources/assets/bhc/models/item/red_heart_melted.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures" : { + "layer0" : "bhc:item/red_heart_melted" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/bhc/models/item/red_heart_patch.json b/src/main/resources/assets/bhc/models/item/red_heart_patch.json new file mode 100644 index 00000000..bbed1120 --- /dev/null +++ b/src/main/resources/assets/bhc/models/item/red_heart_patch.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures" : { + "layer0" : "bhc:item/red_heart_patch" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/bhc/models/item/relic_apple.json b/src/main/resources/assets/bhc/models/item/relic_apple.json index 13618be7..41a14cbf 100644 --- a/src/main/resources/assets/bhc/models/item/relic_apple.json +++ b/src/main/resources/assets/bhc/models/item/relic_apple.json @@ -1,6 +1,6 @@ { "parent": "item/generated", "textures" : { - "layer0" : "bhc:items/relic_apple" + "layer0" : "bhc:item/relic_apple" } } \ No newline at end of file diff --git a/src/main/resources/assets/bhc/models/item/soul_heart_amulet.json b/src/main/resources/assets/bhc/models/item/soul_heart_amulet.json new file mode 100644 index 00000000..0756f2a7 --- /dev/null +++ b/src/main/resources/assets/bhc/models/item/soul_heart_amulet.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "bhc:item/soul_heart_amulet" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/bhc/models/item/soul_heart_canister.json b/src/main/resources/assets/bhc/models/item/soul_heart_canister.json new file mode 100644 index 00000000..69f1480f --- /dev/null +++ b/src/main/resources/assets/bhc/models/item/soul_heart_canister.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures" : { + "layer0" : "bhc:item/soul_heart_canister" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/bhc/models/item/soul_heart_crystal.json b/src/main/resources/assets/bhc/models/item/soul_heart_crystal.json new file mode 100644 index 00000000..236be74c --- /dev/null +++ b/src/main/resources/assets/bhc/models/item/soul_heart_crystal.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures" : { + "layer0" : "bhc:item/soul_heart_crystal" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/bhc/models/item/traverse_blade.json b/src/main/resources/assets/bhc/models/item/traverse_blade.json new file mode 100644 index 00000000..e57a965e --- /dev/null +++ b/src/main/resources/assets/bhc/models/item/traverse_blade.json @@ -0,0 +1,6 @@ +{ + "parent": "item/handheld", + "textures" : { + "layer0" : "bhc:item/traverse_blade" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/bhc/models/item/wither_bone.json b/src/main/resources/assets/bhc/models/item/wither_bone.json index 626e8a16..203f1437 100644 --- a/src/main/resources/assets/bhc/models/item/wither_bone.json +++ b/src/main/resources/assets/bhc/models/item/wither_bone.json @@ -1,6 +1,6 @@ { "parent": "item/generated", "textures" : { - "layer0" : "bhc:items/wither_bone" + "layer0" : "bhc:item/wither_bone" } } \ No newline at end of file diff --git a/src/main/resources/assets/bhc/models/item/yellow_heart.json b/src/main/resources/assets/bhc/models/item/yellow_heart.json index 250a7f4e..92a37b8b 100644 --- a/src/main/resources/assets/bhc/models/item/yellow_heart.json +++ b/src/main/resources/assets/bhc/models/item/yellow_heart.json @@ -1,6 +1,6 @@ { "parent": "item/generated", "textures" : { - "layer0" : "bhc:items/yellow_heart" + "layer0" : "bhc:item/yellow_heart" } } \ No newline at end of file diff --git a/src/main/resources/assets/bhc/models/item/yellow_heart_canister.json b/src/main/resources/assets/bhc/models/item/yellow_heart_canister.json index e9002414..e6ea14a2 100644 --- a/src/main/resources/assets/bhc/models/item/yellow_heart_canister.json +++ b/src/main/resources/assets/bhc/models/item/yellow_heart_canister.json @@ -1,6 +1,6 @@ { "parent": "item/generated", "textures" : { - "layer0" : "bhc:items/yellow_heart_canister" + "layer0" : "bhc:item/yellow_heart_canister" } } \ No newline at end of file diff --git a/src/main/resources/assets/bhc/models/item/yellow_heart_melted.json b/src/main/resources/assets/bhc/models/item/yellow_heart_melted.json new file mode 100644 index 00000000..5d533694 --- /dev/null +++ b/src/main/resources/assets/bhc/models/item/yellow_heart_melted.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures" : { + "layer0" : "bhc:item/yellow_heart_melted" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/bhc/models/item/yellow_heart_patch.json b/src/main/resources/assets/bhc/models/item/yellow_heart_patch.json new file mode 100644 index 00000000..46922df2 --- /dev/null +++ b/src/main/resources/assets/bhc/models/item/yellow_heart_patch.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures" : { + "layer0" : "bhc:item/yellow_heart_patch" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/bhc/textures/gui/advancements.png b/src/main/resources/assets/bhc/textures/gui/advancements.png deleted file mode 100644 index c365f2c5..00000000 Binary files a/src/main/resources/assets/bhc/textures/gui/advancements.png and /dev/null differ diff --git a/src/main/resources/assets/bhc/textures/gui/blade_of_vitality.png b/src/main/resources/assets/bhc/textures/gui/blade_of_vitality.png new file mode 100644 index 00000000..3df52fbc Binary files /dev/null and b/src/main/resources/assets/bhc/textures/gui/blade_of_vitality.png differ diff --git a/src/main/resources/assets/bhc/textures/gui/heart_amulet.png b/src/main/resources/assets/bhc/textures/gui/heart_amulet.png index 34086bbd..f084e2d1 100644 Binary files a/src/main/resources/assets/bhc/textures/gui/heart_amulet.png and b/src/main/resources/assets/bhc/textures/gui/heart_amulet.png differ diff --git a/src/main/resources/assets/bhc/textures/gui/soul_heart_amulet.png b/src/main/resources/assets/bhc/textures/gui/soul_heart_amulet.png new file mode 100644 index 00000000..83bf966b Binary files /dev/null and b/src/main/resources/assets/bhc/textures/gui/soul_heart_amulet.png differ diff --git a/src/main/resources/assets/bhc/textures/item/blade_of_vitality.png b/src/main/resources/assets/bhc/textures/item/blade_of_vitality.png new file mode 100644 index 00000000..53d4709f Binary files /dev/null and b/src/main/resources/assets/bhc/textures/item/blade_of_vitality.png differ diff --git a/src/main/resources/assets/bhc/textures/item/blade_of_vitality.png.mcmeta b/src/main/resources/assets/bhc/textures/item/blade_of_vitality.png.mcmeta new file mode 100644 index 00000000..bb2e173f --- /dev/null +++ b/src/main/resources/assets/bhc/textures/item/blade_of_vitality.png.mcmeta @@ -0,0 +1,6 @@ +{ + "animation": { + "interpolate": true, + "frametime": 20 + } +} diff --git a/src/main/resources/assets/bhc/textures/item/blue_heart.png b/src/main/resources/assets/bhc/textures/item/blue_heart.png new file mode 100644 index 00000000..ea3f9fe7 Binary files /dev/null and b/src/main/resources/assets/bhc/textures/item/blue_heart.png differ diff --git a/src/main/resources/assets/bhc/textures/item/blue_heart_canister.png b/src/main/resources/assets/bhc/textures/item/blue_heart_canister.png new file mode 100644 index 00000000..fa540425 Binary files /dev/null and b/src/main/resources/assets/bhc/textures/item/blue_heart_canister.png differ diff --git a/src/main/resources/assets/bhc/textures/item/blue_heart_melted.png b/src/main/resources/assets/bhc/textures/item/blue_heart_melted.png new file mode 100644 index 00000000..c1ba8b99 Binary files /dev/null and b/src/main/resources/assets/bhc/textures/item/blue_heart_melted.png differ diff --git a/src/main/resources/assets/bhc/textures/item/blue_heart_patch.png b/src/main/resources/assets/bhc/textures/item/blue_heart_patch.png new file mode 100644 index 00000000..524c8261 Binary files /dev/null and b/src/main/resources/assets/bhc/textures/item/blue_heart_patch.png differ diff --git a/src/main/resources/assets/bhc/textures/item/canister.png b/src/main/resources/assets/bhc/textures/item/canister.png new file mode 100644 index 00000000..119c645f Binary files /dev/null and b/src/main/resources/assets/bhc/textures/item/canister.png differ diff --git a/src/main/resources/assets/bhc/textures/item/green_heart.png b/src/main/resources/assets/bhc/textures/item/green_heart.png new file mode 100644 index 00000000..58d11ea0 Binary files /dev/null and b/src/main/resources/assets/bhc/textures/item/green_heart.png differ diff --git a/src/main/resources/assets/bhc/textures/item/green_heart_canister.png b/src/main/resources/assets/bhc/textures/item/green_heart_canister.png new file mode 100644 index 00000000..71742394 Binary files /dev/null and b/src/main/resources/assets/bhc/textures/item/green_heart_canister.png differ diff --git a/src/main/resources/assets/bhc/textures/item/green_heart_melted.png b/src/main/resources/assets/bhc/textures/item/green_heart_melted.png new file mode 100644 index 00000000..9bb330b2 Binary files /dev/null and b/src/main/resources/assets/bhc/textures/item/green_heart_melted.png differ diff --git a/src/main/resources/assets/bhc/textures/item/green_heart_patch.png b/src/main/resources/assets/bhc/textures/item/green_heart_patch.png new file mode 100644 index 00000000..24b286ff Binary files /dev/null and b/src/main/resources/assets/bhc/textures/item/green_heart_patch.png differ diff --git a/src/main/resources/assets/bhc/textures/item/heart_amulet.png b/src/main/resources/assets/bhc/textures/item/heart_amulet.png new file mode 100644 index 00000000..3122af76 Binary files /dev/null and b/src/main/resources/assets/bhc/textures/item/heart_amulet.png differ diff --git a/src/main/resources/assets/bhc/textures/item/heart_amulet.png.mcmeta b/src/main/resources/assets/bhc/textures/item/heart_amulet.png.mcmeta new file mode 100644 index 00000000..bb2e173f --- /dev/null +++ b/src/main/resources/assets/bhc/textures/item/heart_amulet.png.mcmeta @@ -0,0 +1,6 @@ +{ + "animation": { + "interpolate": true, + "frametime": 20 + } +} diff --git a/src/main/resources/assets/bhc/textures/item/jamiscus_blade.png b/src/main/resources/assets/bhc/textures/item/jamiscus_blade.png new file mode 100644 index 00000000..fc44cff8 Binary files /dev/null and b/src/main/resources/assets/bhc/textures/item/jamiscus_blade.png differ diff --git a/src/main/resources/assets/bhc/textures/item/lash_blade.png b/src/main/resources/assets/bhc/textures/item/lash_blade.png new file mode 100644 index 00000000..e943d167 Binary files /dev/null and b/src/main/resources/assets/bhc/textures/item/lash_blade.png differ diff --git a/src/main/resources/assets/bhc/textures/item/lash_blade.png.mcmeta b/src/main/resources/assets/bhc/textures/item/lash_blade.png.mcmeta new file mode 100644 index 00000000..bb2e173f --- /dev/null +++ b/src/main/resources/assets/bhc/textures/item/lash_blade.png.mcmeta @@ -0,0 +1,6 @@ +{ + "animation": { + "interpolate": true, + "frametime": 20 + } +} diff --git a/src/main/resources/assets/bhc/textures/item/red_heart.png b/src/main/resources/assets/bhc/textures/item/red_heart.png new file mode 100644 index 00000000..56bc9e46 Binary files /dev/null and b/src/main/resources/assets/bhc/textures/item/red_heart.png differ diff --git a/src/main/resources/assets/bhc/textures/item/red_heart_canister.png b/src/main/resources/assets/bhc/textures/item/red_heart_canister.png new file mode 100644 index 00000000..281b8175 Binary files /dev/null and b/src/main/resources/assets/bhc/textures/item/red_heart_canister.png differ diff --git a/src/main/resources/assets/bhc/textures/item/red_heart_melted.png b/src/main/resources/assets/bhc/textures/item/red_heart_melted.png new file mode 100644 index 00000000..338f13dd Binary files /dev/null and b/src/main/resources/assets/bhc/textures/item/red_heart_melted.png differ diff --git a/src/main/resources/assets/bhc/textures/item/red_heart_patch.png b/src/main/resources/assets/bhc/textures/item/red_heart_patch.png new file mode 100644 index 00000000..39ddeab3 Binary files /dev/null and b/src/main/resources/assets/bhc/textures/item/red_heart_patch.png differ diff --git a/src/main/resources/assets/bhc/textures/item/relic_apple.png b/src/main/resources/assets/bhc/textures/item/relic_apple.png new file mode 100644 index 00000000..004ceb29 Binary files /dev/null and b/src/main/resources/assets/bhc/textures/item/relic_apple.png differ diff --git a/src/main/resources/assets/bhc/textures/item/soul_heart_amulet.png b/src/main/resources/assets/bhc/textures/item/soul_heart_amulet.png new file mode 100644 index 00000000..77e53881 Binary files /dev/null and b/src/main/resources/assets/bhc/textures/item/soul_heart_amulet.png differ diff --git a/src/main/resources/assets/bhc/textures/item/soul_heart_amulet.png.mcmeta b/src/main/resources/assets/bhc/textures/item/soul_heart_amulet.png.mcmeta new file mode 100644 index 00000000..bb2e173f --- /dev/null +++ b/src/main/resources/assets/bhc/textures/item/soul_heart_amulet.png.mcmeta @@ -0,0 +1,6 @@ +{ + "animation": { + "interpolate": true, + "frametime": 20 + } +} diff --git a/src/main/resources/assets/bhc/textures/item/soul_heart_canister.png b/src/main/resources/assets/bhc/textures/item/soul_heart_canister.png new file mode 100644 index 00000000..6f2bbc50 Binary files /dev/null and b/src/main/resources/assets/bhc/textures/item/soul_heart_canister.png differ diff --git a/src/main/resources/assets/bhc/textures/item/soul_heart_crystal.png b/src/main/resources/assets/bhc/textures/item/soul_heart_crystal.png new file mode 100644 index 00000000..9845be42 Binary files /dev/null and b/src/main/resources/assets/bhc/textures/item/soul_heart_crystal.png differ diff --git a/src/main/resources/assets/bhc/textures/item/traverse_blade.png b/src/main/resources/assets/bhc/textures/item/traverse_blade.png new file mode 100644 index 00000000..3c085ca3 Binary files /dev/null and b/src/main/resources/assets/bhc/textures/item/traverse_blade.png differ diff --git a/src/main/resources/assets/bhc/textures/item/wither_bone.png b/src/main/resources/assets/bhc/textures/item/wither_bone.png new file mode 100644 index 00000000..63ef4348 Binary files /dev/null and b/src/main/resources/assets/bhc/textures/item/wither_bone.png differ diff --git a/src/main/resources/assets/bhc/textures/item/yellow_heart.png b/src/main/resources/assets/bhc/textures/item/yellow_heart.png new file mode 100644 index 00000000..4604f098 Binary files /dev/null and b/src/main/resources/assets/bhc/textures/item/yellow_heart.png differ diff --git a/src/main/resources/assets/bhc/textures/item/yellow_heart_canister.png b/src/main/resources/assets/bhc/textures/item/yellow_heart_canister.png new file mode 100644 index 00000000..a3c83e85 Binary files /dev/null and b/src/main/resources/assets/bhc/textures/item/yellow_heart_canister.png differ diff --git a/src/main/resources/assets/bhc/textures/item/yellow_heart_melted.png b/src/main/resources/assets/bhc/textures/item/yellow_heart_melted.png new file mode 100644 index 00000000..76b2602f Binary files /dev/null and b/src/main/resources/assets/bhc/textures/item/yellow_heart_melted.png differ diff --git a/src/main/resources/assets/bhc/textures/item/yellow_heart_patch.png b/src/main/resources/assets/bhc/textures/item/yellow_heart_patch.png new file mode 100644 index 00000000..78dd2482 Binary files /dev/null and b/src/main/resources/assets/bhc/textures/item/yellow_heart_patch.png differ diff --git a/src/main/resources/assets/bhc/textures/items/blue_heart.png b/src/main/resources/assets/bhc/textures/items/blue_heart.png deleted file mode 100644 index 66c9799d..00000000 Binary files a/src/main/resources/assets/bhc/textures/items/blue_heart.png and /dev/null differ diff --git a/src/main/resources/assets/bhc/textures/items/blue_heart_canister.png b/src/main/resources/assets/bhc/textures/items/blue_heart_canister.png deleted file mode 100644 index e733c6e8..00000000 Binary files a/src/main/resources/assets/bhc/textures/items/blue_heart_canister.png and /dev/null differ diff --git a/src/main/resources/assets/bhc/textures/items/canister.png b/src/main/resources/assets/bhc/textures/items/canister.png deleted file mode 100644 index 13ff7ac0..00000000 Binary files a/src/main/resources/assets/bhc/textures/items/canister.png and /dev/null differ diff --git a/src/main/resources/assets/bhc/textures/items/green_heart.png b/src/main/resources/assets/bhc/textures/items/green_heart.png deleted file mode 100644 index 095e35d7..00000000 Binary files a/src/main/resources/assets/bhc/textures/items/green_heart.png and /dev/null differ diff --git a/src/main/resources/assets/bhc/textures/items/green_heart_canister.png b/src/main/resources/assets/bhc/textures/items/green_heart_canister.png deleted file mode 100644 index 8871c49e..00000000 Binary files a/src/main/resources/assets/bhc/textures/items/green_heart_canister.png and /dev/null differ diff --git a/src/main/resources/assets/bhc/textures/items/heart_amulet.png b/src/main/resources/assets/bhc/textures/items/heart_amulet.png deleted file mode 100644 index 99a73992..00000000 Binary files a/src/main/resources/assets/bhc/textures/items/heart_amulet.png and /dev/null differ diff --git a/src/main/resources/assets/bhc/textures/items/heart_amulet.png.mcmeta b/src/main/resources/assets/bhc/textures/items/heart_amulet.png.mcmeta deleted file mode 100755 index 3368321f..00000000 --- a/src/main/resources/assets/bhc/textures/items/heart_amulet.png.mcmeta +++ /dev/null @@ -1,5 +0,0 @@ -{ - "animation": { - "frametime": 200 - } -} diff --git a/src/main/resources/assets/bhc/textures/items/orange_heart.png b/src/main/resources/assets/bhc/textures/items/orange_heart.png deleted file mode 100644 index f1af1bb7..00000000 Binary files a/src/main/resources/assets/bhc/textures/items/orange_heart.png and /dev/null differ diff --git a/src/main/resources/assets/bhc/textures/items/orange_heart_canister.png b/src/main/resources/assets/bhc/textures/items/orange_heart_canister.png deleted file mode 100644 index c5f9e0e3..00000000 Binary files a/src/main/resources/assets/bhc/textures/items/orange_heart_canister.png and /dev/null differ diff --git a/src/main/resources/assets/bhc/textures/items/red_heart.png b/src/main/resources/assets/bhc/textures/items/red_heart.png deleted file mode 100644 index c7d1c402..00000000 Binary files a/src/main/resources/assets/bhc/textures/items/red_heart.png and /dev/null differ diff --git a/src/main/resources/assets/bhc/textures/items/red_heart_canister.png b/src/main/resources/assets/bhc/textures/items/red_heart_canister.png deleted file mode 100644 index 2d092d99..00000000 Binary files a/src/main/resources/assets/bhc/textures/items/red_heart_canister.png and /dev/null differ diff --git a/src/main/resources/assets/bhc/textures/items/relic_apple.png b/src/main/resources/assets/bhc/textures/items/relic_apple.png deleted file mode 100644 index f7d6011e..00000000 Binary files a/src/main/resources/assets/bhc/textures/items/relic_apple.png and /dev/null differ diff --git a/src/main/resources/assets/bhc/textures/items/wither_bone.png b/src/main/resources/assets/bhc/textures/items/wither_bone.png deleted file mode 100755 index 22896865..00000000 Binary files a/src/main/resources/assets/bhc/textures/items/wither_bone.png and /dev/null differ diff --git a/src/main/resources/assets/bhc/textures/items/yellow_heart.png b/src/main/resources/assets/bhc/textures/items/yellow_heart.png deleted file mode 100644 index a3b66663..00000000 Binary files a/src/main/resources/assets/bhc/textures/items/yellow_heart.png and /dev/null differ diff --git a/src/main/resources/assets/bhc/textures/items/yellow_heart_canister.png b/src/main/resources/assets/bhc/textures/items/yellow_heart_canister.png deleted file mode 100644 index 3e11331d..00000000 Binary files a/src/main/resources/assets/bhc/textures/items/yellow_heart_canister.png and /dev/null differ diff --git a/src/main/resources/assets/bhc/textures/slot/empty_heartamulet.png b/src/main/resources/assets/bhc/textures/slot/empty_heartamulet.png new file mode 100644 index 00000000..3f9232ed Binary files /dev/null and b/src/main/resources/assets/bhc/textures/slot/empty_heartamulet.png differ diff --git a/src/main/resources/assets/bhc/textures/slots/empty_heartamulet.png b/src/main/resources/assets/bhc/textures/slots/empty_heartamulet.png deleted file mode 100644 index 603f6d23..00000000 Binary files a/src/main/resources/assets/bhc/textures/slots/empty_heartamulet.png and /dev/null differ diff --git a/src/main/resources/data/bhc/curios/entities/add_slot_heartamulet.json b/src/main/resources/data/bhc/curios/entities/add_slot_heartamulet.json new file mode 100644 index 00000000..153c5528 --- /dev/null +++ b/src/main/resources/data/bhc/curios/entities/add_slot_heartamulet.json @@ -0,0 +1,4 @@ +{ + "entities": ["player"], + "slots": ["heart_amulet"] +} \ No newline at end of file diff --git a/src/main/resources/data/bhc/curios/slots/heart_amulet.json b/src/main/resources/data/bhc/curios/slots/heart_amulet.json new file mode 100644 index 00000000..9c57519c --- /dev/null +++ b/src/main/resources/data/bhc/curios/slots/heart_amulet.json @@ -0,0 +1,3 @@ +{ + "icon": "bhc:slot/empty_heartamulet" +} \ No newline at end of file diff --git a/src/main/resources/data/bhc/recipes/blade_of_vitality.json b/src/main/resources/data/bhc/recipes/blade_of_vitality.json new file mode 100644 index 00000000..750ce97d --- /dev/null +++ b/src/main/resources/data/bhc/recipes/blade_of_vitality.json @@ -0,0 +1,34 @@ +{ + "type": "crafting_shaped", + "pattern": [ + "RSY", + "GHB", + " I " + ], + "key": { + "R": { + "item": "bhc:red_heart_canister" + }, + "S": { + "item": "bhc:soul_heart_crystal" + }, + "Y": { + "item": "bhc:yellow_heart_canister" + }, + "G": { + "item": "bhc:green_heart_canister" + }, + "H": { + "item": "bhc:heart_amulet" + }, + "B": { + "item": "bhc:blue_heart_canister" + }, + "I": { + "item": "minecraft:stick" + } + }, + "result": { + "item": "bhc:blade_of_vitality" + } +} \ No newline at end of file diff --git a/src/main/resources/data/bhc/recipes/blue_heart.json b/src/main/resources/data/bhc/recipes/blue_heart.json new file mode 100644 index 00000000..d26abbb5 --- /dev/null +++ b/src/main/resources/data/bhc/recipes/blue_heart.json @@ -0,0 +1,19 @@ +{ + "type": "crafting_shaped", + "pattern": [ + "BBB", + "BHB", + "BBB" + ], + "key": { + "B": { + "item": "bhc:blue_heart_melted" + }, + "H": { + "tag": "forge:heart" + } + }, + "result": { + "item": "bhc:blue_heart" + } +} \ No newline at end of file diff --git a/src/main/resources/data/bhc/recipes/blue_heart_canister.json b/src/main/resources/data/bhc/recipes/blue_heart_canister.json index 0a4d34b4..fce2b51f 100644 --- a/src/main/resources/data/bhc/recipes/blue_heart_canister.json +++ b/src/main/resources/data/bhc/recipes/blue_heart_canister.json @@ -8,7 +8,7 @@ "item": "bhc:green_heart_canister" }, { - "item": "minecraft:totem_of_undying" + "item": "minecraft:netherite_block" }, { "tag": "forge:gems/emerald" diff --git a/src/main/resources/data/bhc/recipes/blue_heart_melted.json b/src/main/resources/data/bhc/recipes/blue_heart_melted.json new file mode 100644 index 00000000..8ead0ac0 --- /dev/null +++ b/src/main/resources/data/bhc/recipes/blue_heart_melted.json @@ -0,0 +1,16 @@ +{ + "type": "crafting_shaped", + "pattern": [ + "GGG", + "GGG", + "GGG" + ], + "key": { + "G": { + "item": "bhc:green_heart_melted" + } + }, + "result": { + "item": "bhc:blue_heart_melted" + } +} \ No newline at end of file diff --git a/src/main/resources/data/bhc/recipes/blue_heart_patch.json b/src/main/resources/data/bhc/recipes/blue_heart_patch.json new file mode 100644 index 00000000..9db630eb --- /dev/null +++ b/src/main/resources/data/bhc/recipes/blue_heart_patch.json @@ -0,0 +1,22 @@ +{ + "type": "crafting_shaped", + "pattern": [ + " W ", + "SHS", + " W " + ], + "key": { + "W": { + "tag": "minecraft:wool" + }, + "S": { + "tag": "forge:string" + }, + "H": { + "item": "bhc:blue_heart" + } + }, + "result": { + "item": "bhc:blue_heart_patch" + } +} \ No newline at end of file diff --git a/src/main/resources/data/bhc/recipes/green_heart.json b/src/main/resources/data/bhc/recipes/green_heart.json new file mode 100644 index 00000000..84951eb0 --- /dev/null +++ b/src/main/resources/data/bhc/recipes/green_heart.json @@ -0,0 +1,19 @@ +{ + "type": "crafting_shaped", + "pattern": [ + "GGG", + "GHG", + "GGG" + ], + "key": { + "G": { + "item": "bhc:green_heart_melted" + }, + "H": { + "tag": "forge:heart" + } + }, + "result": { + "item": "bhc:green_heart" + } +} \ No newline at end of file diff --git a/src/main/resources/data/bhc/recipes/green_heart_melted.json b/src/main/resources/data/bhc/recipes/green_heart_melted.json new file mode 100644 index 00000000..1f74f7dd --- /dev/null +++ b/src/main/resources/data/bhc/recipes/green_heart_melted.json @@ -0,0 +1,16 @@ +{ + "type": "crafting_shaped", + "pattern": [ + "YYY", + "YYY", + "YYY" + ], + "key": { + "Y": { + "item": "bhc:yellow_heart_melted" + } + }, + "result": { + "item": "bhc:green_heart_melted" + } +} \ No newline at end of file diff --git a/src/main/resources/data/bhc/recipes/green_heart_melted_reversed.json b/src/main/resources/data/bhc/recipes/green_heart_melted_reversed.json new file mode 100644 index 00000000..58a5b934 --- /dev/null +++ b/src/main/resources/data/bhc/recipes/green_heart_melted_reversed.json @@ -0,0 +1,12 @@ +{ + "type": "crafting_shapeless", + "ingredients": [ + { + "item": "bhc:blue_heart_melted" + } + ], + "result": { + "count": 9, + "item": "bhc:green_heart_melted" + } +} \ No newline at end of file diff --git a/src/main/resources/data/bhc/recipes/green_heart_patch.json b/src/main/resources/data/bhc/recipes/green_heart_patch.json new file mode 100644 index 00000000..b7b89366 --- /dev/null +++ b/src/main/resources/data/bhc/recipes/green_heart_patch.json @@ -0,0 +1,22 @@ +{ + "type": "crafting_shaped", + "pattern": [ + " W ", + "SHS", + " W " + ], + "key": { + "W": { + "tag": "minecraft:wool" + }, + "S": { + "tag": "forge:string" + }, + "H": { + "item": "bhc:green_heart" + } + }, + "result": { + "item": "bhc:green_heart_patch" + } +} \ No newline at end of file diff --git a/src/main/resources/data/bhc/recipes/red_heart.json b/src/main/resources/data/bhc/recipes/red_heart.json new file mode 100644 index 00000000..f19b1806 --- /dev/null +++ b/src/main/resources/data/bhc/recipes/red_heart.json @@ -0,0 +1,19 @@ +{ + "type": "crafting_shaped", + "pattern": [ + "RRR", + "RHR", + "RRR" + ], + "key": { + "R": { + "item": "bhc:red_heart_melted" + }, + "H": { + "tag": "forge:heart" + } + }, + "result": { + "item": "bhc:red_heart" + } +} \ No newline at end of file diff --git a/src/main/resources/data/bhc/recipes/red_heart_melted_reversed.json b/src/main/resources/data/bhc/recipes/red_heart_melted_reversed.json new file mode 100644 index 00000000..e19b550c --- /dev/null +++ b/src/main/resources/data/bhc/recipes/red_heart_melted_reversed.json @@ -0,0 +1,12 @@ +{ + "type": "crafting_shapeless", + "ingredients": [ + { + "item": "bhc:yellow_heart_melted" + } + ], + "result": { + "count": 9, + "item": "bhc:red_heart_melted" + } +} \ No newline at end of file diff --git a/src/main/resources/data/bhc/recipes/red_heart_patch.json b/src/main/resources/data/bhc/recipes/red_heart_patch.json new file mode 100644 index 00000000..09e4df0a --- /dev/null +++ b/src/main/resources/data/bhc/recipes/red_heart_patch.json @@ -0,0 +1,22 @@ +{ + "type": "crafting_shaped", + "pattern": [ + " W ", + "SHS", + " W " + ], + "key": { + "W": { + "tag": "minecraft:wool" + }, + "S": { + "tag": "forge:string" + }, + "H": { + "item": "bhc:red_heart" + } + }, + "result": { + "item": "bhc:red_heart_patch" + } +} \ No newline at end of file diff --git a/src/main/resources/data/bhc/recipes/smelting/blue_heart_melted.json b/src/main/resources/data/bhc/recipes/smelting/blue_heart_melted.json new file mode 100644 index 00000000..8a546f15 --- /dev/null +++ b/src/main/resources/data/bhc/recipes/smelting/blue_heart_melted.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:smelting", + "cookingtime": 20, + "ingredient": { + "item": "bhc:blue_heart" + }, + "result": "bhc:blue_heart_melted" +} \ No newline at end of file diff --git a/src/main/resources/data/bhc/recipes/smelting/green_heart_melted.json b/src/main/resources/data/bhc/recipes/smelting/green_heart_melted.json new file mode 100644 index 00000000..1f079a9a --- /dev/null +++ b/src/main/resources/data/bhc/recipes/smelting/green_heart_melted.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:smelting", + "cookingtime": 20, + "ingredient": { + "item": "bhc:green_heart" + }, + "result": "bhc:green_heart_melted" +} \ No newline at end of file diff --git a/src/main/resources/data/bhc/recipes/smelting/red_heart_melted.json b/src/main/resources/data/bhc/recipes/smelting/red_heart_melted.json new file mode 100644 index 00000000..6f794dcd --- /dev/null +++ b/src/main/resources/data/bhc/recipes/smelting/red_heart_melted.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:smelting", + "cookingtime": 20, + "ingredient": { + "item": "bhc:red_heart" + }, + "result": "bhc:red_heart_melted" +} \ No newline at end of file diff --git a/src/main/resources/data/bhc/recipes/smelting/yellow_heart_melted.json b/src/main/resources/data/bhc/recipes/smelting/yellow_heart_melted.json new file mode 100644 index 00000000..ae47418c --- /dev/null +++ b/src/main/resources/data/bhc/recipes/smelting/yellow_heart_melted.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:smelting", + "cookingtime": 20, + "ingredient": { + "item": "bhc:yellow_heart" + }, + "result": "bhc:yellow_heart_melted" +} \ No newline at end of file diff --git a/src/main/resources/data/bhc/recipes/smithing/soul_heart_canister.json b/src/main/resources/data/bhc/recipes/smithing/soul_heart_canister.json new file mode 100644 index 00000000..b470c997 --- /dev/null +++ b/src/main/resources/data/bhc/recipes/smithing/soul_heart_canister.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:smithing_transform", + "base": { + "item": "bhc:blue_heart_canister" + }, + "addition": { + "item": "minecraft:totem_of_undying" + }, + "result": { + "item": "bhc:soul_heart_canister" + }, + "template": { + "tag": "forge:heart" + } +} \ No newline at end of file diff --git a/src/main/resources/data/bhc/recipes/soul_heart_amulet.json b/src/main/resources/data/bhc/recipes/soul_heart_amulet.json new file mode 100644 index 00000000..0653286b --- /dev/null +++ b/src/main/resources/data/bhc/recipes/soul_heart_amulet.json @@ -0,0 +1,14 @@ +{ + "type": "bhc:amulet_shapeless", + "ingredients": [ + { + "item": "bhc:soul_heart_crystal" + }, + { + "item": "bhc:heart_amulet" + } + ], + "result": { + "item": "bhc:soul_heart_amulet" + } +} \ No newline at end of file diff --git a/src/main/resources/data/bhc/recipes/soul_heart_crystal.json b/src/main/resources/data/bhc/recipes/soul_heart_crystal.json new file mode 100644 index 00000000..c9ac3b7f --- /dev/null +++ b/src/main/resources/data/bhc/recipes/soul_heart_crystal.json @@ -0,0 +1,31 @@ +{ + "type": "crafting_shaped", + "pattern": [ + "ERE", + "YAG", + "EBE" + ], + "key": { + "E": { + "item": "minecraft:echo_shard" + }, + "R": { + "item": "bhc:red_heart" + }, + "A": { + "item": "minecraft:amethyst_shard" + }, + "Y": { + "item": "bhc:yellow_heart" + }, + "G": { + "item": "bhc:green_heart" + }, + "B": { + "item": "bhc:blue_heart" + } + }, + "result": { + "item": "bhc:soul_heart_crystal" + } +} diff --git a/src/main/resources/data/bhc/recipes/yellow_heart.json b/src/main/resources/data/bhc/recipes/yellow_heart.json new file mode 100644 index 00000000..be351153 --- /dev/null +++ b/src/main/resources/data/bhc/recipes/yellow_heart.json @@ -0,0 +1,19 @@ +{ + "type": "crafting_shaped", + "pattern": [ + "YYY", + "YHY", + "YYY" + ], + "key": { + "Y": { + "item": "bhc:yellow_heart_melted" + }, + "H": { + "tag": "forge:heart" + } + }, + "result": { + "item": "bhc:yellow_heart" + } +} \ No newline at end of file diff --git a/src/main/resources/data/bhc/recipes/yellow_heart_melted.json b/src/main/resources/data/bhc/recipes/yellow_heart_melted.json new file mode 100644 index 00000000..9f682898 --- /dev/null +++ b/src/main/resources/data/bhc/recipes/yellow_heart_melted.json @@ -0,0 +1,16 @@ +{ + "type": "crafting_shaped", + "pattern": [ + "RRR", + "RRR", + "RRR" + ], + "key": { + "R": { + "item": "bhc:red_heart_melted" + } + }, + "result": { + "item": "bhc:yellow_heart_melted" + } +} \ No newline at end of file diff --git a/src/main/resources/data/bhc/recipes/yellow_heart_melted_reversed.json b/src/main/resources/data/bhc/recipes/yellow_heart_melted_reversed.json new file mode 100644 index 00000000..c4eb00d3 --- /dev/null +++ b/src/main/resources/data/bhc/recipes/yellow_heart_melted_reversed.json @@ -0,0 +1,12 @@ +{ + "type": "crafting_shapeless", + "ingredients": [ + { + "item": "bhc:green_heart_melted" + } + ], + "result": { + "count": 9, + "item": "bhc:yellow_heart_melted" + } +} \ No newline at end of file diff --git a/src/main/resources/data/bhc/recipes/yellow_heart_patch.json b/src/main/resources/data/bhc/recipes/yellow_heart_patch.json new file mode 100644 index 00000000..675f3511 --- /dev/null +++ b/src/main/resources/data/bhc/recipes/yellow_heart_patch.json @@ -0,0 +1,22 @@ +{ + "type": "crafting_shaped", + "pattern": [ + " W ", + "SHS", + " W " + ], + "key": { + "W": { + "tag": "minecraft:wool" + }, + "S": { + "tag": "forge:string" + }, + "H": { + "item": "bhc:yellow_heart" + } + }, + "result": { + "item": "bhc:yellow_heart_patch" + } +} \ No newline at end of file diff --git a/src/main/resources/data/curios/tags/items/heart_amulet.json b/src/main/resources/data/curios/tags/items/heart_amulet.json new file mode 100644 index 00000000..86b79e6a --- /dev/null +++ b/src/main/resources/data/curios/tags/items/heart_amulet.json @@ -0,0 +1,7 @@ +{ + "replace": "false", + "values": [ + "bhc:heart_amulet", + "bhc:soul_heart_amulet" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/curios/tags/items/heartamulet.json b/src/main/resources/data/curios/tags/items/heartamulet.json deleted file mode 100644 index d0e409cc..00000000 --- a/src/main/resources/data/curios/tags/items/heartamulet.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "replace": "false", - "values": [ - "bhc:heart_amulet" - ] -} \ No newline at end of file