diff --git a/.github/ISSUE_TEMPLATE/1-21-bug-report.md b/.github/ISSUE_TEMPLATE/1-21-bug-report.md new file mode 100644 index 00000000..b56df83c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/1-21-bug-report.md @@ -0,0 +1,15 @@ +--- +name: 1.20 Bug report +about: Create a report to help us improve +title: "[1.21] Issue Title" +labels: 'type: bug, version: 1.21' +assignees: '' + +--- +**DO NOT REPORT AN ISSUE IF YOU HAVEN'T TESTED THE ISSUE WITH THE LATEST VERSION IN CURSEFORGE** + +**Functional Storage Version:** + +**Titanium Version:** + +**Crashlog If Applicable (Upload to pastebin/gist):** diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 9669b54e..718032a6 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -34,9 +34,9 @@ jobs: files-secondary: build/libs/*-@(dev|sources).jar version-type: beta version: ${{ github.ref_name }} - loaders: forge - game-versions: 1.20.1 - java: 17 + loaders: neoforge + game-versions: 1.21 + java: 21 name: "" changelog: "https://github.com/Buuz135/FunctionalStorage/blob/main/CHANGELOG.md" dependencies: | diff --git a/.gitignore b/.gitignore index 97ab8fcc..cab0230c 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ build # other eclipse run +runs classes /includedMods/ diff --git a/build.gradle b/build.gradle index f0252b72..8da7095b 100644 --- a/build.gradle +++ b/build.gradle @@ -1,117 +1,110 @@ -buildscript { - repositories { - // These repositories are only for Gradle plugins, put any other repositories in the repository block further below - maven { url = 'https://maven.minecraftforge.net' } - mavenCentral() +plugins { + id 'net.neoforged.moddev' version '0.1.120' + id 'maven-publish' +} + +final mcVersion = project.neo_version.split('\\.', 3).with { + '1.' + it[0] + '.' + it[1] +} +version = mcVersion + "-" + mod_version +group = modGroup + +sourceSets { + main { + resources.srcDir('src/generated/resources') } - dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true +} + +repositories { + maven { + name = "BlameJared maven" + url = "https://maven.blamejared.com/" + } + maven { + url "https://www.cursemaven.com" + content { + includeGroup "curse.maven" + } } } -apply plugin: 'net.minecraftforge.gradle' +base { + archivesName = modBaseName +} -group = 'com.buuz135' -version = '1.20.1-1.2.11' +java.toolchain.languageVersion = JavaLanguageVersion.of(21) -java { - archivesBaseName = 'functionalstorage' - toolchain.languageVersion = JavaLanguageVersion.of(17) -} +neoForge { + version = "${neo_version}" -minecraft { + parchment { + minecraftVersion = '1.21' + mappingsVersion = '2024.06.23' + } - mappings channel: 'official', version: '1.20.1' - accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') + validateAccessTransformers = true runs { client { - workingDirectory project.file('run') - property 'forge.logging.markers', 'REGISTRIES' - property 'forge.logging.console.level', 'debug' - property 'mixin.env.remapRefMap', 'true' - property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" - - mods { - functionalstorage { - source sourceSets.main - } - } + client() } - server { - property 'forge.logging.markers', 'REGISTRIES' - property 'forge.logging.console.level', 'debug' - property 'mixin.env.remapRefMap', 'true' - property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" - - mods { - functionalstorage { - source sourceSets.main - } - } + server() } - data { - workingDirectory project.file('run') - property 'forge.logging.markers', 'REGISTRIES' - - property 'forge.logging.console.level', 'debug' - property 'mixin.env.remapRefMap', 'true' - property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" - - args '--mod', 'functionalstorage', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') - - mods { - functionalstorage { - source sourceSets.main - } - } + data() + programArguments.addAll '--mod', 'functionalstorage', '--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 { - name 'jared maven' - url "https://maven.blamejared.com/" - } - - maven { - url = "https://www.cursemaven.com" + mods { + functionalstorage { + sourceSet sourceSets.main + } + titanium { + sourceSet sourceSets.main + } } - //maven { url 'https://modmaven.dev/' } } -dependencies { - - minecraft 'net.minecraftforge:forge:1.20.1-47.1.1' - implementation fg.deobf(project.dependencies.create('com.hrznstudio:titanium:1.20.1-3.8.1-9')) - compileOnly fg.deobf("mezz.jei:jei-1.20.1-common-api:15.2.0.23") - compileOnly fg.deobf("mezz.jei:jei-1.20.1-forge-api:15.2.0.23") - // at runtime, use the full JEI jar for Forge - runtimeOnly fg.deobf("mezz.jei:jei-1.20.1-forge:15.2.0.23") - implementation fg.deobf("curse.maven:the-one-probe-245211:4613250") - implementation fg.deobf("curse.maven:mekanism-268560:4866575") - annotationProcessor "org.spongepowered:mixin:0.8.5:processor" +dependencies { + compileOnly "mezz.jei:jei-1.21-common-api:$jei_version" + compileOnly "mezz.jei:jei-1.21-neoforge-api:$jei_version" + runtimeOnly "mezz.jei:jei-1.21-neoforge:$jei_version" + implementation project.dependencies.create('com.hrznstudio:titanium:1.21-4.0.12') + implementation "curse.maven:jade-324717:5444008" + compileOnly "curse.maven:the-one-probe-245211:5475189" } -// Example for how to get properties into the manifest for reading at runtime. jar { manifest { - attributes([ - "Specification-Title" : "functionalstorage", - "Specification-Vendor" : "Buuz135, Rid", - "Specification-Version" : "1", // We are version 1 of ourselves - "Implementation-Title" : project.name, - "Implementation-Version" : project.jar.archiveVersion, - "Implementation-Vendor" : "Buuz135, Rid", - "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") + attributes(["Specification-Title" : project.name, + "Specification-Vendor" : "Buuz135, Rid", + "Specification-Version" : "1.0", + "Implementation-Title" : project.name, + "Implementation-Version" : "${project.version}", + "Implementation-Vendor" : "Buuz135, Rid", + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), + "ModSide" : "BOTH" ]) } } -jar.finalizedBy('reobfJar') +tasks.withType(JavaCompile).configureEach { + options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation + options.compilerArgs << '-Xmaxerrs' << '500' +} + +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + } + } + repositories { + maven { + name 'repo' + url(file('repo')) + } + } +} diff --git a/gradle.properties b/gradle.properties index 01bb4ddc..69833704 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,7 @@ -org.gradle.jvmargs=-Xmx3G -org.gradle.daemon=false -mc_version=1.20.1 -jei_version=11.2.0.254 -mekanism_version=10.3.5.474 \ No newline at end of file +org.gradle.jvmargs=-Xmx2048M +modGroup=com.buuz135 +mod_version=1.3.0 +modBaseName=functionalstorage + +neo_version=21.0.47-beta +jei_version=19.0.0.14 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180f..c1962a79 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 e750102e..20db9ad5 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.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index c53aefaa..744e882e 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/bin/sh +#!/usr/bin/env sh # -# Copyright © 2015-2021 the original authors. +# Copyright 2015 the original author or authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,101 +17,67 @@ # ############################################################################## -# -# 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/master/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/. -# +## +## Gradle start up script for UN*X +## ############################################################################## # Attempt to set APP_HOME - # Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi done - -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null APP_NAME="Gradle" -APP_BASE_NAME=${0##*/} +APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-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 ;; #( - MSYS* | 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 @@ -121,9 +87,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 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 @@ -132,7 +98,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 @@ -140,95 +106,80 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi fi -# 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 Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi # For Cygwin 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" ) - +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; 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 - 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" ) + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" fi - # 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 + i=`expr $i + 1` done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# 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. -# +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' +# 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" exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 107acd32..8a0b282a 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,19 +1,3 @@ -@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 @@ -24,23 +8,20 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal +@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 DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if "%ERRORLEVEL%" == "0" goto init echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -54,7 +35,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto execute +if exist "%JAVA_EXE%" goto init echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -64,14 +45,34 @@ echo location of your Java installation. goto fail +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_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=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +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 %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% :end @rem End local scope for the variables with windows NT shell diff --git a/settings.gradle b/settings.gradle index b31272e1..82707da9 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,3 @@ -rootProject.name = 'FunctionalStorage' +plugins { + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0' +} \ No newline at end of file diff --git a/src/generated/resources/.cache/15b6275091e1d61ba43a63172e99581ffd5ac41e b/src/generated/resources/.cache/15b6275091e1d61ba43a63172e99581ffd5ac41e index 20e72625..bdd2b9c1 100644 --- a/src/generated/resources/.cache/15b6275091e1d61ba43a63172e99581ffd5ac41e +++ b/src/generated/resources/.cache/15b6275091e1d61ba43a63172e99581ffd5ac41e @@ -1,4 +1,4 @@ -// 1.20.1 2024-05-26T12:09:04.2020576 Item Models: functionalstorage +// 1.21 2024-07-03T14:10:47.9983057 Item Models: functionalstorage e0f7b66a84e6588f01abbbce75b1803ffe5d46e2 assets/functionalstorage/models/item/acacia_1.json e0f7b66a84e6588f01abbbce75b1803ffe5d46e2 assets/functionalstorage/models/item/acacia_2.json e0f7b66a84e6588f01abbbce75b1803ffe5d46e2 assets/functionalstorage/models/item/acacia_4.json diff --git a/src/generated/resources/.cache/361def3a0b0e87157892b021be1ddec9d13d5e52 b/src/generated/resources/.cache/361def3a0b0e87157892b021be1ddec9d13d5e52 new file mode 100644 index 00000000..18e8d0c8 --- /dev/null +++ b/src/generated/resources/.cache/361def3a0b0e87157892b021be1ddec9d13d5e52 @@ -0,0 +1,2 @@ +// 1.21 2024-07-03T14:10:47.9813049 Languages: en_us for mod: functionalstorage +420714f8a154b4e1d2b704bd200b1357ac682aa9 assets/functionalstorage/lang/en_us.json diff --git a/src/generated/resources/.cache/424df6c0265e09414e636289f261813cd93f4aa2 b/src/generated/resources/.cache/424df6c0265e09414e636289f261813cd93f4aa2 index 8e5bc9f6..8c20766c 100644 --- a/src/generated/resources/.cache/424df6c0265e09414e636289f261813cd93f4aa2 +++ b/src/generated/resources/.cache/424df6c0265e09414e636289f261813cd93f4aa2 @@ -1,4 +1,4 @@ -// 1.20.1 2024-05-26T12:09:04.1960374 Block States: functionalstorage +// 1.21 2024-07-03T14:10:47.9753077 Block States: functionalstorage b1f76f1b67016350af532beb6de3ffdc4d9a07be assets/functionalstorage/blockstates/acacia_1.json a4e462d9775fd4aefa673952d4d69f9d90b2e823 assets/functionalstorage/blockstates/acacia_2.json ecd77b58fb3d746ab8e2109adf686ea01cf5d96a assets/functionalstorage/blockstates/acacia_4.json diff --git a/src/generated/resources/.cache/58b100d11464fc6de03e6a16617c8d741d90a73a b/src/generated/resources/.cache/58b100d11464fc6de03e6a16617c8d741d90a73a index 979cddf1..62e55291 100644 --- a/src/generated/resources/.cache/58b100d11464fc6de03e6a16617c8d741d90a73a +++ b/src/generated/resources/.cache/58b100d11464fc6de03e6a16617c8d741d90a73a @@ -1,2 +1,2 @@ -// 1.20.1 2024-05-26T12:09:04.1985379 Functional Storage Item Tags -e72c53e88ffb2ff0aed4d46bafae940a49fe9e97 data/functionalstorage/tags/items/drawer.json +// 1.21 2024-07-03T14:10:47.9882992 Functional Storage Item Tags +e72c53e88ffb2ff0aed4d46bafae940a49fe9e97 data/functionalstorage/tags/item/drawer.json diff --git a/src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d b/src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d index f69e52e9..3c5f1a75 100644 --- a/src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d +++ b/src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d @@ -1,47 +1,47 @@ -// 1.20.1 2024-05-26T12:09:04.1985379 Loot Tables -d78cf8442a9d36bff4abc1107f1217f4a4418c8e data/functionalstorage/loot_tables/blocks/acacia_1.json -47f3265cef09634f6f2d136757304488a7cf1c75 data/functionalstorage/loot_tables/blocks/acacia_2.json -769595131ba5623e061d1fada4a22af5fd00cb69 data/functionalstorage/loot_tables/blocks/acacia_4.json -6c1ab49efb00472b3dbc5930626f2b492d1331dd data/functionalstorage/loot_tables/blocks/armory_cabinet.json -4e99e8cc8aa95dc1bc422c198410deae5d205ce4 data/functionalstorage/loot_tables/blocks/birch_1.json -a4f6db831ddd292c1b19d3176a5256b36a8c51a5 data/functionalstorage/loot_tables/blocks/birch_2.json -4899a11badc269283c5946f3d64d020153022d00 data/functionalstorage/loot_tables/blocks/birch_4.json -c7221cb4ac7a7e125178c890e3c8b919d9cce062 data/functionalstorage/loot_tables/blocks/cherry_1.json -fbb515425f7c3aa6f0bab8057bed31e3d7c1172b data/functionalstorage/loot_tables/blocks/cherry_2.json -b0b462916d144cb042acb82dff15f7c161f42bbd data/functionalstorage/loot_tables/blocks/cherry_4.json -e1a426e256e4031a81b983cc537c13b7c4c5c9eb data/functionalstorage/loot_tables/blocks/compacting_drawer.json -5038237c92e4fa2a4fa189f5181040b814213c94 data/functionalstorage/loot_tables/blocks/compacting_framed_drawer.json -a4c2de7cfc3a741dc3a9a8d16399349facca783c data/functionalstorage/loot_tables/blocks/controller_extension.json -e7030950636e53d3b548717566b5d609efd7b8af data/functionalstorage/loot_tables/blocks/crimson_1.json -cdef2c2deb0a26cf9b7b4abaa885b1040510504f data/functionalstorage/loot_tables/blocks/crimson_2.json -1c17ca71dd7de014ce48b007487861b29bf9ffcf data/functionalstorage/loot_tables/blocks/crimson_4.json -e5e3c2e1f3f503ca217ab4379abc3ac500c22fb2 data/functionalstorage/loot_tables/blocks/dark_oak_1.json -984b3ed4a10f2f555796e8e6a84d80a32a7e3001 data/functionalstorage/loot_tables/blocks/dark_oak_2.json -4cd7a0df745215f8fb8464b8689fccbad5bbe85f data/functionalstorage/loot_tables/blocks/dark_oak_4.json -e78f6a5085f22199a5f7e9cf6f7fae5cd6e28c72 data/functionalstorage/loot_tables/blocks/ender_drawer.json -13a7ffa4f1eb9e6b7e28a55a00a0e185c8bd9d94 data/functionalstorage/loot_tables/blocks/fluid_1.json -70da9de9d22aad27439d4eec83e5458da150cd3f data/functionalstorage/loot_tables/blocks/fluid_2.json -8a7887176d5d53872f37c4266ffdc7f2447cd8df data/functionalstorage/loot_tables/blocks/fluid_4.json -0f1467ca25f52412c37908ada40610f8e6a3068a data/functionalstorage/loot_tables/blocks/framed_1.json -799b3dc4a002bbf0ac20a3c8b1827cf42673affb data/functionalstorage/loot_tables/blocks/framed_2.json -2faf0c684a20da3cd731b56685903ca1724f67d7 data/functionalstorage/loot_tables/blocks/framed_4.json -a07bc575d23810ae47f9f157a164302ee728c5f2 data/functionalstorage/loot_tables/blocks/framed_controller_extension.json -cf1bb3214330e19fee50cbc3a71f7704751239d4 data/functionalstorage/loot_tables/blocks/framed_simple_compacting_drawer.json -41acd837bd91f3e02c3ae90b4f632c6b33d8d302 data/functionalstorage/loot_tables/blocks/framed_storage_controller.json -bdef97337c16c1ad48d8a807785621750eace79f data/functionalstorage/loot_tables/blocks/jungle_1.json -5fe236d5c8a7452b050a46afde7c9e6afbd1fc3f data/functionalstorage/loot_tables/blocks/jungle_2.json -663e96081446e9ab71a3485730566d0e34499d46 data/functionalstorage/loot_tables/blocks/jungle_4.json -e31e7f3925fe807816d0aafa5239acd886fd0f0f data/functionalstorage/loot_tables/blocks/mangrove_1.json -df5485a539d62c02b1719592db6c1a563feac255 data/functionalstorage/loot_tables/blocks/mangrove_2.json -38b633e9c9010a14c5804e229298fbe8dd051ff9 data/functionalstorage/loot_tables/blocks/mangrove_4.json -c831cf9282597c417d89244b46765236e74ab034 data/functionalstorage/loot_tables/blocks/oak_1.json -a298d5e03587a92faea300414b114c1790e5d6a6 data/functionalstorage/loot_tables/blocks/oak_2.json -c75ea89f3ba53b515c3e806c88593e20c9a1fa6d data/functionalstorage/loot_tables/blocks/oak_4.json -7388fb11858c77a7e7245cf880be8a79b9d8e815 data/functionalstorage/loot_tables/blocks/simple_compacting_drawer.json -b6c2d6617a8068fda74e545a9a33b2904f6e68a8 data/functionalstorage/loot_tables/blocks/spruce_1.json -84b342defa8a36fd4669b4df2bb9a78f579a3c65 data/functionalstorage/loot_tables/blocks/spruce_2.json -8f66edc8e160b3585bbb456e5561396208315e31 data/functionalstorage/loot_tables/blocks/spruce_4.json -1ff2899a3a1dd9e1bd4fbb2703b3194ae650bb09 data/functionalstorage/loot_tables/blocks/storage_controller.json -da8063c665fce09310b4ef6101b96b88c27dc9b1 data/functionalstorage/loot_tables/blocks/warped_1.json -010107c7ce5d20fb3b210ed6aca4ad64af652bfb data/functionalstorage/loot_tables/blocks/warped_2.json -2dbae762e58071d439419aae8db8486fd906678f data/functionalstorage/loot_tables/blocks/warped_4.json +// 1.21 2024-07-03T14:10:47.9853017 Loot Tables +d78cf8442a9d36bff4abc1107f1217f4a4418c8e data/functionalstorage/loot_table/blocks/acacia_1.json +47f3265cef09634f6f2d136757304488a7cf1c75 data/functionalstorage/loot_table/blocks/acacia_2.json +769595131ba5623e061d1fada4a22af5fd00cb69 data/functionalstorage/loot_table/blocks/acacia_4.json +6c1ab49efb00472b3dbc5930626f2b492d1331dd data/functionalstorage/loot_table/blocks/armory_cabinet.json +4e99e8cc8aa95dc1bc422c198410deae5d205ce4 data/functionalstorage/loot_table/blocks/birch_1.json +a4f6db831ddd292c1b19d3176a5256b36a8c51a5 data/functionalstorage/loot_table/blocks/birch_2.json +4899a11badc269283c5946f3d64d020153022d00 data/functionalstorage/loot_table/blocks/birch_4.json +c7221cb4ac7a7e125178c890e3c8b919d9cce062 data/functionalstorage/loot_table/blocks/cherry_1.json +fbb515425f7c3aa6f0bab8057bed31e3d7c1172b data/functionalstorage/loot_table/blocks/cherry_2.json +b0b462916d144cb042acb82dff15f7c161f42bbd data/functionalstorage/loot_table/blocks/cherry_4.json +e1a426e256e4031a81b983cc537c13b7c4c5c9eb data/functionalstorage/loot_table/blocks/compacting_drawer.json +5038237c92e4fa2a4fa189f5181040b814213c94 data/functionalstorage/loot_table/blocks/compacting_framed_drawer.json +a4c2de7cfc3a741dc3a9a8d16399349facca783c data/functionalstorage/loot_table/blocks/controller_extension.json +e7030950636e53d3b548717566b5d609efd7b8af data/functionalstorage/loot_table/blocks/crimson_1.json +cdef2c2deb0a26cf9b7b4abaa885b1040510504f data/functionalstorage/loot_table/blocks/crimson_2.json +1c17ca71dd7de014ce48b007487861b29bf9ffcf data/functionalstorage/loot_table/blocks/crimson_4.json +e5e3c2e1f3f503ca217ab4379abc3ac500c22fb2 data/functionalstorage/loot_table/blocks/dark_oak_1.json +984b3ed4a10f2f555796e8e6a84d80a32a7e3001 data/functionalstorage/loot_table/blocks/dark_oak_2.json +4cd7a0df745215f8fb8464b8689fccbad5bbe85f data/functionalstorage/loot_table/blocks/dark_oak_4.json +e78f6a5085f22199a5f7e9cf6f7fae5cd6e28c72 data/functionalstorage/loot_table/blocks/ender_drawer.json +13a7ffa4f1eb9e6b7e28a55a00a0e185c8bd9d94 data/functionalstorage/loot_table/blocks/fluid_1.json +70da9de9d22aad27439d4eec83e5458da150cd3f data/functionalstorage/loot_table/blocks/fluid_2.json +8a7887176d5d53872f37c4266ffdc7f2447cd8df data/functionalstorage/loot_table/blocks/fluid_4.json +0f1467ca25f52412c37908ada40610f8e6a3068a data/functionalstorage/loot_table/blocks/framed_1.json +799b3dc4a002bbf0ac20a3c8b1827cf42673affb data/functionalstorage/loot_table/blocks/framed_2.json +2faf0c684a20da3cd731b56685903ca1724f67d7 data/functionalstorage/loot_table/blocks/framed_4.json +a07bc575d23810ae47f9f157a164302ee728c5f2 data/functionalstorage/loot_table/blocks/framed_controller_extension.json +cf1bb3214330e19fee50cbc3a71f7704751239d4 data/functionalstorage/loot_table/blocks/framed_simple_compacting_drawer.json +41acd837bd91f3e02c3ae90b4f632c6b33d8d302 data/functionalstorage/loot_table/blocks/framed_storage_controller.json +bdef97337c16c1ad48d8a807785621750eace79f data/functionalstorage/loot_table/blocks/jungle_1.json +5fe236d5c8a7452b050a46afde7c9e6afbd1fc3f data/functionalstorage/loot_table/blocks/jungle_2.json +663e96081446e9ab71a3485730566d0e34499d46 data/functionalstorage/loot_table/blocks/jungle_4.json +e31e7f3925fe807816d0aafa5239acd886fd0f0f data/functionalstorage/loot_table/blocks/mangrove_1.json +df5485a539d62c02b1719592db6c1a563feac255 data/functionalstorage/loot_table/blocks/mangrove_2.json +38b633e9c9010a14c5804e229298fbe8dd051ff9 data/functionalstorage/loot_table/blocks/mangrove_4.json +c831cf9282597c417d89244b46765236e74ab034 data/functionalstorage/loot_table/blocks/oak_1.json +a298d5e03587a92faea300414b114c1790e5d6a6 data/functionalstorage/loot_table/blocks/oak_2.json +c75ea89f3ba53b515c3e806c88593e20c9a1fa6d data/functionalstorage/loot_table/blocks/oak_4.json +7388fb11858c77a7e7245cf880be8a79b9d8e815 data/functionalstorage/loot_table/blocks/simple_compacting_drawer.json +b6c2d6617a8068fda74e545a9a33b2904f6e68a8 data/functionalstorage/loot_table/blocks/spruce_1.json +84b342defa8a36fd4669b4df2bb9a78f579a3c65 data/functionalstorage/loot_table/blocks/spruce_2.json +8f66edc8e160b3585bbb456e5561396208315e31 data/functionalstorage/loot_table/blocks/spruce_4.json +1ff2899a3a1dd9e1bd4fbb2703b3194ae650bb09 data/functionalstorage/loot_table/blocks/storage_controller.json +da8063c665fce09310b4ef6101b96b88c27dc9b1 data/functionalstorage/loot_table/blocks/warped_1.json +010107c7ce5d20fb3b210ed6aca4ad64af652bfb data/functionalstorage/loot_table/blocks/warped_2.json +2dbae762e58071d439419aae8db8486fd906678f data/functionalstorage/loot_table/blocks/warped_4.json diff --git a/src/generated/resources/.cache/7b7965c95f0313555fafc7c653e689cdb94b8fca b/src/generated/resources/.cache/7b7965c95f0313555fafc7c653e689cdb94b8fca index c8dfc5b4..44637133 100644 --- a/src/generated/resources/.cache/7b7965c95f0313555fafc7c653e689cdb94b8fca +++ b/src/generated/resources/.cache/7b7965c95f0313555fafc7c653e689cdb94b8fca @@ -1 +1 @@ -// 1.20.1 2024-05-26T12:09:04.2010585 Block Model Item Generator (functionalstorage) +// 1.21 2024-07-03T14:10:47.9973039 Block Model Item Generator (functionalstorage) diff --git a/src/generated/resources/.cache/9b4b2fe28e6a198629709c0c8772cb00a8b15d4a b/src/generated/resources/.cache/9b4b2fe28e6a198629709c0c8772cb00a8b15d4a index ff444712..8be39173 100644 --- a/src/generated/resources/.cache/9b4b2fe28e6a198629709c0c8772cb00a8b15d4a +++ b/src/generated/resources/.cache/9b4b2fe28e6a198629709c0c8772cb00a8b15d4a @@ -1,3 +1,3 @@ -// 1.20.1 2024-05-26T12:09:04.1995405 Tags for minecraft:block mod id functionalstorage -e72c53e88ffb2ff0aed4d46bafae940a49fe9e97 data/minecraft/tags/blocks/mineable/axe.json -4b6fc75faca16170a17220f0e301b16866f4bc5c data/minecraft/tags/blocks/mineable/pickaxe.json +// 1.21 2024-07-03T14:10:47.9953066 Tags for minecraft:block mod id functionalstorage +e72c53e88ffb2ff0aed4d46bafae940a49fe9e97 data/minecraft/tags/block/mineable/axe.json +4b6fc75faca16170a17220f0e301b16866f4bc5c data/minecraft/tags/block/mineable/pickaxe.json diff --git a/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e b/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e index 363ef31b..99aa5b55 100644 --- a/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,63 +1,123 @@ -// 1.20.1 2024-05-26T12:09:04.1995405 Recipes -c4487c2009b27c499e810f3097d3213212dcacfd data/functionalstorage/advancements/recipes/misc/netherite_upgrade.json -69b434b12c87949feb9ef15335611c6dd83089c6 data/functionalstorage/recipes/acacia_1.json -c3f04e49ddf3b0bb66802b78df289758a6a7e100 data/functionalstorage/recipes/acacia_2.json -8580ace1fc32c8a2e7691f6a65b97626967cf46e data/functionalstorage/recipes/acacia_4.json -770ea21366fa788977c6b1a2d79ed6a7c5b5fdbe data/functionalstorage/recipes/armory_cabinet.json -9155f29c46311e58b9f7748b33c1fee66f155d4d data/functionalstorage/recipes/birch_1.json -65131c2cfbfc26acfd61bb249289aa46e1213fdb data/functionalstorage/recipes/birch_2.json -3479e33fc685a60fc9a90f0dbabd7ba7b1211679 data/functionalstorage/recipes/birch_4.json -259b02fa4a8f385fd32716be96015579f4d4d71c data/functionalstorage/recipes/cherry_1.json -d8a8c500fe125b591bed76930566c0c69086a49d data/functionalstorage/recipes/cherry_2.json -d5a2f61480f951fbc7219f44b47eb48ba3591971 data/functionalstorage/recipes/cherry_4.json -20b07aed4dd4c28904c261384289e58e3bacf02b data/functionalstorage/recipes/collector_upgrade.json -0b75fe99e9fddc155ad8f1074c5997a77472886f data/functionalstorage/recipes/compacting_drawer.json -4681fc7981b54bbdc8b7416b09ce0ab7eb4051cf data/functionalstorage/recipes/compacting_framed_drawer.json -68b9b8763274fbb2e7d014764953e2977e25147e data/functionalstorage/recipes/configuration_tool.json -b61cf03d171bdc0ae7bbb4d8207593ea2d6a7535 data/functionalstorage/recipes/controller_extension.json -638b8b85d6875d0d8062105e4091c9c7aa01fd91 data/functionalstorage/recipes/copper_upgrade.json -29b64fcede6507b1efefc9f0fcdcd66c00fb28e3 data/functionalstorage/recipes/crimson_1.json -a51774abecca696b732db067dc3de24e1c7766e5 data/functionalstorage/recipes/crimson_2.json -544deb7fcc561d6de9cc5c7bf47c46c90007f009 data/functionalstorage/recipes/crimson_4.json -531fc41c9356c0c0331446da71ab4aa2f0022659 data/functionalstorage/recipes/dark_oak_1.json -8b81ae74138455c0726689186d7a057b6203096d data/functionalstorage/recipes/dark_oak_2.json -eed3129867662705e188882566554f627a665183 data/functionalstorage/recipes/dark_oak_4.json -5d104d1ace8d22251e32ed78b15d5d5e9f1e9613 data/functionalstorage/recipes/diamond_upgrade.json -2404e399e052ce6c83c49eaf1c2810ef80243058 data/functionalstorage/recipes/ender_drawer.json -416f5b09ec636dea47705d7c959ac7860155f66c data/functionalstorage/recipes/fluid_1.json -ed08096d238440468414a0f483f55c6b07c141c7 data/functionalstorage/recipes/fluid_2.json -5d21d0a6f30efb5382645279da3de4ead9c38eff data/functionalstorage/recipes/fluid_4.json -daf2bb7d5e86b83a5a659caa134168079abe1e78 data/functionalstorage/recipes/framed_1.json -f4d167cda5372fc89da838a396f0a4ceb080a94e data/functionalstorage/recipes/framed_2.json -29e682a603c598b26487368d22b69e6ca8d8386a data/functionalstorage/recipes/framed_4.json -934f6149f0db5c56c4ed1b82fb4b3e13569ecfa2 data/functionalstorage/recipes/framed_controller_extension.json -876d55518878937f6426fa20c99542516cc98ac1 data/functionalstorage/recipes/framed_simple_compacting_drawer.json -b0527bad8d11a398f273e45abdc681fee588d200 data/functionalstorage/recipes/framed_storage_controller.json -efc3785a4d1ff872f689a5546580177081c3d2a2 data/functionalstorage/recipes/gold_upgrade.json -76a6b5e3e1fbc61f8b737da5648cde72ca5e6691 data/functionalstorage/recipes/iron_downgrade.json -ad874a5d12d64a12e88d57b02193178341de722c data/functionalstorage/recipes/jungle_1.json -337ff512bcdb74bb52f29edcf29a1f44e36ef734 data/functionalstorage/recipes/jungle_2.json -365af235ba1643d867c94c253d7e2612eeb69a7d data/functionalstorage/recipes/jungle_4.json -4599441ae6f74ef6c3457edff933ed5957e08574 data/functionalstorage/recipes/linking_tool.json -de695200bf3892214c18d8c8dcce6b1203837b13 data/functionalstorage/recipes/mangrove_1.json -81ba6073ed47d6659b0d7c6152ca89939119a090 data/functionalstorage/recipes/mangrove_2.json -75c4958854b7b739017a753094e096b733afb6b0 data/functionalstorage/recipes/mangrove_4.json -263afed3953c17b4a3940302e788b36b9fbe76eb data/functionalstorage/recipes/netherite_upgrade.json -56a4bb31e934fa7ad3aa60bdded1144743959a02 data/functionalstorage/recipes/oak_1.json -a685ca7980412cefff9e0d6219857b56210bed10 data/functionalstorage/recipes/oak_2.json -67aa8ac1ba957a5f62c70daabaa4bec8f9e6f612 data/functionalstorage/recipes/oak_4.json -f6534beab44ed517cf850785ed9fa858eae7a99d data/functionalstorage/recipes/oak_drawer_alternate_x1.json -9c96371ec87218a24095301e6f9c9f72c056e008 data/functionalstorage/recipes/oak_drawer_alternate_x2.json -3211363e1989533daa944f3100d88614e4d45f71 data/functionalstorage/recipes/oak_drawer_alternate_x4.json -9dc5d4bde3a00f4c8b4ae91872964777e9c376c5 data/functionalstorage/recipes/puller_upgrade.json -b51f0c8e0476412d6ae6e162d041c8dfb8bc2a2b data/functionalstorage/recipes/pusher_upgrade.json -658244426ae95804e2efeee6ad94f90d0aadea4d data/functionalstorage/recipes/redstone_upgrade.json -1e4f2dc5edc5388e3f3527df271c6b5fed41de90 data/functionalstorage/recipes/simple_compacting_drawer.json -c4e539d0a82d1864a28e423c3de10e051a8134db data/functionalstorage/recipes/spruce_1.json -1a444eabc46341d8d7bfb73afddb9e46a3a25e4d data/functionalstorage/recipes/spruce_2.json -73c3c31706b5c19a35d7823dae93eaafac7e3f6d data/functionalstorage/recipes/spruce_4.json -77d9d1293a6243491f0683c46c682246a8d38451 data/functionalstorage/recipes/storage_controller.json -2cc8c0ba9b5e4071f6f7f70516561944f9a796ca data/functionalstorage/recipes/void_upgrade.json -652ed891ef481549320c65bead5d0333d2b22dc2 data/functionalstorage/recipes/warped_1.json -24935bdc28cf8c708e81ab82f04bfb9581d13c83 data/functionalstorage/recipes/warped_2.json -c85f69d876ab9233234c63fd075e89b1b2968b75 data/functionalstorage/recipes/warped_4.json +// 1.21 2024-07-03T14:10:47.9892979 Recipes +f07485f3ee5257c2b12fcf149c60ddd20ed73fe1 data/functionalstorage/advancement/recipes/misc/acacia_1.json +8cce3aada48266b5e41df6e04b01ab1fd2224a4c data/functionalstorage/advancement/recipes/misc/acacia_2.json +8bc6f134a188d7ec701a472feeb93bccc9a115f3 data/functionalstorage/advancement/recipes/misc/acacia_4.json +013bebba212e7c910b2120b4cd0cb0aa0a51296c data/functionalstorage/advancement/recipes/misc/armory_cabinet.json +7148349418a85e1f5211f02fdb50dedb98530b5c data/functionalstorage/advancement/recipes/misc/birch_1.json +7dccbffdca9d47b36d270adcd7d4c77436aa3730 data/functionalstorage/advancement/recipes/misc/birch_2.json +642b7744641842a7f762db59fc60f8e511cd5539 data/functionalstorage/advancement/recipes/misc/birch_4.json +f1a02965cbbb75de65bf74b3def4ea4e99f19098 data/functionalstorage/advancement/recipes/misc/cherry_1.json +84dd9c2a2ce80d0202244736248fc9afbff62a6c data/functionalstorage/advancement/recipes/misc/cherry_2.json +1135382d815395682324be184d9731a9a249e762 data/functionalstorage/advancement/recipes/misc/cherry_4.json +7def510128aa7c74f9cd7e39e91c3bec38e9d2b7 data/functionalstorage/advancement/recipes/misc/collector_upgrade.json +828e38e02e5a1eef9d8d58c33827592b42842d5e data/functionalstorage/advancement/recipes/misc/compacting_drawer.json +c8ff800f9821ed035b4eb03495924f444dc75602 data/functionalstorage/advancement/recipes/misc/compacting_framed_drawer.json +1125f812821fc93d03e8a63830486db9424bf649 data/functionalstorage/advancement/recipes/misc/configuration_tool.json +cf7785b44d3d9cb244c47b3d417ecd055f590f6e data/functionalstorage/advancement/recipes/misc/controller_extension.json +56f463f83a921e41ffeab0b9be620138e00af1c2 data/functionalstorage/advancement/recipes/misc/copper_upgrade.json +abfc232bfd307176bbe414ca37fb04ccabb12bed data/functionalstorage/advancement/recipes/misc/crimson_1.json +bb70c322af1d6b3e3ec07986a44254c50765e555 data/functionalstorage/advancement/recipes/misc/crimson_2.json +1a27de3204d8db8c30af32a80a91a538fe0c7443 data/functionalstorage/advancement/recipes/misc/crimson_4.json +17715b6070438a52f941a75a7b8ba91717f065c6 data/functionalstorage/advancement/recipes/misc/dark_oak_1.json +3fcad0306dbd6448f295c94309e821a418087a13 data/functionalstorage/advancement/recipes/misc/dark_oak_2.json +9a84c01eead337a91820d2a551a7d340622a93d0 data/functionalstorage/advancement/recipes/misc/dark_oak_4.json +cb3d2919446edf0ecaf1125f50af2c4dc52e05c0 data/functionalstorage/advancement/recipes/misc/diamond_upgrade.json +bc6997ceddce44e90b4dbfbab14e384178f5ad05 data/functionalstorage/advancement/recipes/misc/ender_drawer.json +ee349f295d4714c2f996212567d30b696e5492b1 data/functionalstorage/advancement/recipes/misc/fluid_1.json +50ae74dd40b20e288ca6db3b4cac054f14548098 data/functionalstorage/advancement/recipes/misc/fluid_2.json +9f4d6ab4cf507f97c077f26d28e7b09c2fddd923 data/functionalstorage/advancement/recipes/misc/fluid_4.json +98655bc5e690915708d3a6ac474c8e8d3f5cc50f data/functionalstorage/advancement/recipes/misc/framed_1.json +beda8db0912170145812269375f1abe2e38d6c73 data/functionalstorage/advancement/recipes/misc/framed_2.json +30dec1e9937d7dcd466e6026a49db03794d4eb4f data/functionalstorage/advancement/recipes/misc/framed_4.json +9bcb372069e1ad2199677ff729dc56e8e42261ee data/functionalstorage/advancement/recipes/misc/framed_controller_extension.json +ee985bc4600ef7e2bc06a76147082b77fd7b8070 data/functionalstorage/advancement/recipes/misc/framed_simple_compacting_drawer.json +7b0f8e3b385abe93146af415949548caadf5cbda data/functionalstorage/advancement/recipes/misc/framed_storage_controller.json +435d0e125a24ebcf07e67f6cb104785fec479c16 data/functionalstorage/advancement/recipes/misc/gold_upgrade.json +23115c9f93a3bf8fe45b0bee672cfa2b1704ed11 data/functionalstorage/advancement/recipes/misc/iron_downgrade.json +262dc3b4cf1c8f20550fecd05341410bc9925a25 data/functionalstorage/advancement/recipes/misc/jungle_1.json +00d995b7658e32e7935a8a125c429bfe8a9aae18 data/functionalstorage/advancement/recipes/misc/jungle_2.json +f602b5069bd4113e5d6aeb602a03bf423930ba43 data/functionalstorage/advancement/recipes/misc/jungle_4.json +25d84daa7aecaa238c75d8b54cea885a70593285 data/functionalstorage/advancement/recipes/misc/linking_tool.json +4963b81b82fa9db96330ac1dc81f6a8571889ed8 data/functionalstorage/advancement/recipes/misc/mangrove_1.json +fda8a3b6b2a999e4aac7c87a61fd6aed8b0fa7c1 data/functionalstorage/advancement/recipes/misc/mangrove_2.json +e46defd4894df5a4afaafffe0ff81b9534b7b443 data/functionalstorage/advancement/recipes/misc/mangrove_4.json +b0c69118acd0443bcbbfb48e430649cace0f5da4 data/functionalstorage/advancement/recipes/misc/netherite_upgrade.json +f74f098ece5a237a77167ea8a8e21adad7eb0ea8 data/functionalstorage/advancement/recipes/misc/oak_1.json +9b119c96262b977f9392a974a00bdd1599f3ab4b data/functionalstorage/advancement/recipes/misc/oak_2.json +c80f7e9dd1b842064a6022ca70252e014bcbe78d data/functionalstorage/advancement/recipes/misc/oak_4.json +6ff3017bd51bb87d785d65a23659e9e94205e0ec data/functionalstorage/advancement/recipes/misc/puller_upgrade.json +d9c6f6b3bd529a8f95e58142803ea6bb0dd3972e data/functionalstorage/advancement/recipes/misc/pusher_upgrade.json +2c2a6f2849c070210a0a6f8d5c311b30b20203da data/functionalstorage/advancement/recipes/misc/redstone_upgrade.json +47310c768d3dedd3ba4d36d482ea080f11300a4b data/functionalstorage/advancement/recipes/misc/simple_compacting_drawer.json +7d2e55897afc7c855c4c7628458704b6c10f4d91 data/functionalstorage/advancement/recipes/misc/spruce_1.json +95a09bac35651fa109765c17f8094969a24afb03 data/functionalstorage/advancement/recipes/misc/spruce_2.json +f027778cf8a284a14c37206d901a52505afa850f data/functionalstorage/advancement/recipes/misc/spruce_4.json +65fe1f437f206861cfee431e0deae8731c02d996 data/functionalstorage/advancement/recipes/misc/storage_controller.json +09f46709d86b97003bdfed3709430451bf59367d data/functionalstorage/advancement/recipes/misc/void_upgrade.json +8c783bd51358da44000a9ff76926f571e2cea6c4 data/functionalstorage/advancement/recipes/misc/warped_1.json +daddde4854e12f609b8978359fee6bd4a01c632d data/functionalstorage/advancement/recipes/misc/warped_2.json +cb190e17de37c04d062208b29909c3dfef672896 data/functionalstorage/advancement/recipes/misc/warped_4.json +bdc03a25608cf678230392d53e0976692728adca data/functionalstorage/recipe/acacia_1.json +a44a7f2f4eaf7543c623f5dfdbe06739365cc347 data/functionalstorage/recipe/acacia_2.json +0921e7c354a8f9b028371313ae49bf6cfb864aaa data/functionalstorage/recipe/acacia_4.json +3c81bb03b3e428c2b6ecd247e82cb548290523a5 data/functionalstorage/recipe/armory_cabinet.json +a00048cee88ed3b56c964639f356a61293bb6feb data/functionalstorage/recipe/birch_1.json +234cf5f9c2441a9d0541298de146a0da1e5f7e03 data/functionalstorage/recipe/birch_2.json +90def2b50fb81317d0304a38be8ca6878857035e data/functionalstorage/recipe/birch_4.json +dd7232feb8b5861f983c3e8ab764b8451c00d86e data/functionalstorage/recipe/cherry_1.json +7993db743da0bf8eff4d532e3b8e8a02eee3ec6a data/functionalstorage/recipe/cherry_2.json +908796ef8c4b9ccf5c6c4c6a2c46d745785902b7 data/functionalstorage/recipe/cherry_4.json +aa6bc43b316c906bb4bed3a937cd741e96707e6c data/functionalstorage/recipe/collector_upgrade.json +d7986db2e81bdf1203fe73d2e712c8a6b0f4a025 data/functionalstorage/recipe/compacting_drawer.json +54fbb1148b251b50152f8a8b25e8ec0df9a34f48 data/functionalstorage/recipe/compacting_framed_drawer.json +6f30ad4d6db3f4506bbfb30b341bc5da439f0d85 data/functionalstorage/recipe/configuration_tool.json +6adce5bd8278fa8018bbb480b0c0e72218ffd8fe data/functionalstorage/recipe/controller_extension.json +64fa161bc6136f1a951976aa1fba4fc14b9760b3 data/functionalstorage/recipe/copper_upgrade.json +3229c19689f1d3fb9c40dd5f4d012712a4eacfea data/functionalstorage/recipe/crimson_1.json +6aa18d21efde5ec54ca7a281df632e995a035e11 data/functionalstorage/recipe/crimson_2.json +62ab9b7e039d30e1aabfab262213b8555815f046 data/functionalstorage/recipe/crimson_4.json +b427e0cd3febda66f9b4d62889e612219abde33e data/functionalstorage/recipe/dark_oak_1.json +452ae9131d5e4a4f2ebac6856d29f4fd62610a40 data/functionalstorage/recipe/dark_oak_2.json +6f321ccd0e4de78db193c8c8d57ead3fa59f3b5f data/functionalstorage/recipe/dark_oak_4.json +eb9bb377de509179bbd58d99addcfdc425a2eb85 data/functionalstorage/recipe/diamond_upgrade.json +cf34adf45409fde2b3aaeeeb8176787c6dd04cd0 data/functionalstorage/recipe/ender_drawer.json +203dd43c2f6fa43a2b6259c42450b1435ef6c677 data/functionalstorage/recipe/fluid_1.json +753d4bfc05e095a35b3a042f9b4dbeedb77797d3 data/functionalstorage/recipe/fluid_2.json +ebaaf06047c1c3ccb1501983f517213f8ea5c8a3 data/functionalstorage/recipe/fluid_4.json +2dfab75c50e1901ff08b551c23b36494b1229772 data/functionalstorage/recipe/framed_1.json +927c676cd49b94924dab7be23df9125785569791 data/functionalstorage/recipe/framed_2.json +7386d0afa41e8822972d33e71ae8b2ea9bce381c data/functionalstorage/recipe/framed_4.json +87373fc820c0f2f7a44aeaf87a10f4a36467271c data/functionalstorage/recipe/framed_controller_extension.json +5ae168463c2b7c87be1c8f0e256a63db968c5526 data/functionalstorage/recipe/framed_simple_compacting_drawer.json +87673337c2a857220dc59a961a11e61bcd362e94 data/functionalstorage/recipe/framed_storage_controller.json +2fe7733f81bfed2bf87d9e723af4c2e7b0a90f25 data/functionalstorage/recipe/gold_upgrade.json +fe108defd4502878ea2e744712c8beacededdf7b data/functionalstorage/recipe/iron_downgrade.json +aa10f7d47d0750e1e8eaaa6b8b0f72142b85f724 data/functionalstorage/recipe/jungle_1.json +70655d34741529d017efd962e4553215dbeae8c8 data/functionalstorage/recipe/jungle_2.json +f44e1d52e46d52e1ebbb1f261870d30ab6af4691 data/functionalstorage/recipe/jungle_4.json +d048d2588452bf51bd73f777282a27905f27fe4c data/functionalstorage/recipe/linking_tool.json +1483eea337c0c588311efecb02cd15518ff27c78 data/functionalstorage/recipe/mangrove_1.json +40c7731174402803808953a36c366aeefd3adc41 data/functionalstorage/recipe/mangrove_2.json +1c40593391bd4214bfd0c7c92fd932715bccfac6 data/functionalstorage/recipe/mangrove_4.json +3eb5787d82246de2020ee88db277f8beff8b92a0 data/functionalstorage/recipe/netherite_upgrade.json +5a6cf085d8d0de5e740121594a58275be75194dc data/functionalstorage/recipe/oak_1.json +313ba2b13a47f15bade3eeb606ef5a3b74a449ba data/functionalstorage/recipe/oak_2.json +863b7345eb9d872144eb49ee2f0d3a740e972990 data/functionalstorage/recipe/oak_4.json +a7ec2fd7e409c9fe329a972f8caf8a2f74e31e9e data/functionalstorage/recipe/puller_upgrade.json +0f54ff3aa2caa38c35c467783e2c6c7a449c6785 data/functionalstorage/recipe/pusher_upgrade.json +7cf0ad077a5a1872fdd04c5b3218b8d71a6e90d8 data/functionalstorage/recipe/redstone_upgrade.json +a6d66aa0d1ffc4d10f6f695573708948ec0c077b data/functionalstorage/recipe/simple_compacting_drawer.json +0b8fa429a17312ccdc2c90a4dc4ba5dd44ab06c9 data/functionalstorage/recipe/spruce_1.json +7b796d2070a9d994e52da67e9bb4eb5e57f9504d data/functionalstorage/recipe/spruce_2.json +6a5225220f58da38911a5350a42e32ab4afd6e47 data/functionalstorage/recipe/spruce_4.json +5a8828f8b555da83872fac8c504ae09696b34da1 data/functionalstorage/recipe/storage_controller.json +8abc2a8c37fb32f2d9818f5409d4cbad4f51cebc data/functionalstorage/recipe/void_upgrade.json +ded5cf48ed485115fc2eec2d9f680177ebeb4d5b data/functionalstorage/recipe/warped_1.json +1496ac044b8b31511ee9485c8c646ec8a1770410 data/functionalstorage/recipe/warped_2.json +5594b0b140f29bea952395137cf4dfbd5f4d1154 data/functionalstorage/recipe/warped_4.json +74158cbf025bacbd94985a450dac448945a3adda data/minecraft/recipe/functionalstorage/compacting/amethyst.json +b67f9d3568b5f9fde9b6b5b40cc88b2b1e1de9ac data/minecraft/recipe/functionalstorage/compacting/glowstone.json +f9faeb313babf7bea8ec73a9c72ca8d14d1604e3 data/minecraft/recipe/functionalstorage/compacting/ice.json +ddace85b911eb7a522bc5f6444de4206c282ee41 data/minecraft/recipe/functionalstorage/compacting/melon.json +bc213e06291806eb868ac59de071fb1b639aff05 data/minecraft/recipe/functionalstorage/compacting/packed_ice.json +094ef87e936be9fe3c790a22a023ca641c092a70 data/minecraft/recipe/functionalstorage/compacting/quartz.json diff --git a/src/generated/resources/.cache/b3b48c10570c424437115253c982ed89e6bd5ccb b/src/generated/resources/.cache/b3b48c10570c424437115253c982ed89e6bd5ccb deleted file mode 100644 index 0617b5d4..00000000 --- a/src/generated/resources/.cache/b3b48c10570c424437115253c982ed89e6bd5ccb +++ /dev/null @@ -1,8 +0,0 @@ -// 1.20.1 2024-05-26T12:09:04.2015584 Titanium Serializable (functionalstorage) -35cd7d63477caf5ea93cae6c81984fd4d7992fc3 data/functionalstorage/recipes/custom_compacting/amethyst.json -d24028ec840b0e7b4d100b43144e7a3f5a70283c data/functionalstorage/recipes/custom_compacting/clay.json -b3d11532f966981fbe0349b89e09cc691e8f68e4 data/functionalstorage/recipes/custom_compacting/glowstone.json -6847d92c8055493634aed84c9de6de4835aab167 data/functionalstorage/recipes/custom_compacting/ice.json -266466efff4179eae51a2ce4c4541d65ebd9bb60 data/functionalstorage/recipes/custom_compacting/melon.json -b56c50e4b97f0af81f6019e3d306b24d235945ca data/functionalstorage/recipes/custom_compacting/packed_ice.json -4d0c7b7ed927a92cef2cdb9814ca086287a363ac data/functionalstorage/recipes/custom_compacting/quartz.json diff --git a/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 b/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 deleted file mode 100644 index 7de34300..00000000 --- a/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 +++ /dev/null @@ -1,2 +0,0 @@ -// 1.20.1 2024-05-26T12:09:04.2005486 Languages: en_us -de205b7d29b9c0034ba2a2cdd6bd5f795679ab22 assets/functionalstorage/lang/en_us.json diff --git a/src/generated/resources/.cache/f4bc6a534340ffb17710ab19bf013aa0d2f1f9d9 b/src/generated/resources/.cache/f4bc6a534340ffb17710ab19bf013aa0d2f1f9d9 index 27470ba5..d6725326 100644 --- a/src/generated/resources/.cache/f4bc6a534340ffb17710ab19bf013aa0d2f1f9d9 +++ b/src/generated/resources/.cache/f4bc6a534340ffb17710ab19bf013aa0d2f1f9d9 @@ -1,4 +1,4 @@ -// 1.20.1 2024-05-26T12:09:04.1975366 Block Models: functionalstorage +// 1.21 2024-07-03T14:10:47.9822996 Block Models: functionalstorage 9a3565a126dac6771b78fa3f5f3f2b6e3c858dd8 assets/functionalstorage/models/block/acacia_1_locked.json fb054b9a925853b52f05fc4402de2b58b2d3a72f assets/functionalstorage/models/block/acacia_2_locked.json b8c2c3e1a316d39c881a4532b04a18d19d6d9c55 assets/functionalstorage/models/block/acacia_4_locked.json diff --git a/src/generated/resources/assets/functionalstorage/lang/en_us.json b/src/generated/resources/assets/functionalstorage/lang/en_us.json index d89100de..11e3e15b 100644 --- a/src/generated/resources/assets/functionalstorage/lang/en_us.json +++ b/src/generated/resources/assets/functionalstorage/lang/en_us.json @@ -45,6 +45,7 @@ "block.functionalstorage.warped_1": "Warped Drawer (1x1)", "block.functionalstorage.warped_2": "Warped Drawer (1x2)", "block.functionalstorage.warped_4": "Warped Drawer (2x2)", + "config.jade.plugin_functionalstorage.drawer": "Functional Storage Drawers", "configurationtool.configmode": "Config Mode: ", "configurationtool.configmode.indicator": "Swap indicator modes", "configurationtool.configmode.indicator.mode_0": "Hidden", @@ -57,6 +58,23 @@ "configurationtool.configmode.toggle_upgrades": "Hide/Show Upgrade Renders", "configurationtool.use": "Sneak + Right Click in the air to change modes. Right click a drawer to toggle the option.", "drawer.block.contents": "Contents: ", + "drawer.block.multiplier": "Storage multiplier: %s", + "drawer_upgrade.functionalstorage.collect.fluid": "Picks up fluids: %s", + "drawer_upgrade.functionalstorage.collect.item": "Collects item entities: %s", + "drawer_upgrade.functionalstorage.pull.fluid": "Pulls fluids: %s", + "drawer_upgrade.functionalstorage.pull.item": "Pulls items: %s", + "drawer_upgrade.functionalstorage.push.fluid": "Pushes fluids: %s", + "drawer_upgrade.functionalstorage.push.item": "Pushes items: %s", + "drawer_upgrade.functionalstorage.redstone": "Emitting redstone signal for slot %s", + "drawer_upgrade.functionalstorage.relative_direction": "Relative direction: %s", + "drawer_upgrade.functionalstorage.sides.back": "back", + "drawer_upgrade.functionalstorage.sides.down": "down", + "drawer_upgrade.functionalstorage.sides.front": "front", + "drawer_upgrade.functionalstorage.sides.left": "left", + "drawer_upgrade.functionalstorage.sides.right": "right", + "drawer_upgrade.functionalstorage.sides.up": "up", + "drawer_upgrade.functionalstorage.void.fluid": "Voids excess fluids", + "drawer_upgrade.functionalstorage.void.item": "Voids excess items", "frameddrawer.use": "How 2 Change Texture: \nInside a crafting window place the block you want use the texture of for the outside of the drawer in the first slot of the crafting window, on the second slot put the block that will be used for the texture on the inside of the framed drawer and on the third slot put a framed drawer. You can change the drawer divider texture by adding a block into the 4th slot\n", "gui.functionalstorage.amount": "Amount: ", "gui.functionalstorage.fluid": "Fluid: ", diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/acacia_1.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/acacia_1.json new file mode 100644 index 00000000..3128091a --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/acacia_1.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:acacia_1" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:acacia_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:acacia_1" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:acacia_1" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/acacia_2.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/acacia_2.json new file mode 100644 index 00000000..05bcc827 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/acacia_2.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:acacia_2" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:acacia_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:acacia_2" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:acacia_2" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/acacia_4.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/acacia_4.json new file mode 100644 index 00000000..09c9e27d --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/acacia_4.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:acacia_4" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:acacia_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:acacia_4" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:acacia_4" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/armory_cabinet.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/armory_cabinet.json new file mode 100644 index 00000000..f98b9366 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/armory_cabinet.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:armory_cabinet" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "#c:stones" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:armory_cabinet" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:armory_cabinet" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/birch_1.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/birch_1.json new file mode 100644 index 00000000..c5a08657 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/birch_1.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:birch_1" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:birch_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:birch_1" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:birch_1" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/birch_2.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/birch_2.json new file mode 100644 index 00000000..046cff79 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/birch_2.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:birch_2" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:birch_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:birch_2" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:birch_2" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/birch_4.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/birch_4.json new file mode 100644 index 00000000..94870f91 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/birch_4.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:birch_4" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:birch_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:birch_4" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:birch_4" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/cherry_1.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/cherry_1.json new file mode 100644 index 00000000..47c0bc6e --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/cherry_1.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:cherry_1" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:cherry_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:cherry_1" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:cherry_1" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/cherry_2.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/cherry_2.json new file mode 100644 index 00000000..c590e353 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/cherry_2.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:cherry_2" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:cherry_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:cherry_2" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:cherry_2" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/cherry_4.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/cherry_4.json new file mode 100644 index 00000000..4ffa3950 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/cherry_4.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:cherry_4" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:cherry_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:cherry_4" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:cherry_4" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/collector_upgrade.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/collector_upgrade.json new file mode 100644 index 00000000..9a2c3a46 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/collector_upgrade.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:collector_upgrade" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "#c:stones" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:collector_upgrade" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:collector_upgrade" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/compacting_drawer.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/compacting_drawer.json new file mode 100644 index 00000000..e1c17ed1 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/compacting_drawer.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:compacting_drawer" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:stone" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:compacting_drawer" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:compacting_drawer" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/compacting_framed_drawer.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/compacting_framed_drawer.json new file mode 100644 index 00000000..84f0a63b --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/compacting_framed_drawer.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:compacting_framed_drawer" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:iron_nugget" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:compacting_framed_drawer" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:compacting_framed_drawer" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/configuration_tool.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/configuration_tool.json new file mode 100644 index 00000000..e8c8d69f --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/configuration_tool.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:configuration_tool" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:paper" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:configuration_tool" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:configuration_tool" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/controller_extension.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/controller_extension.json new file mode 100644 index 00000000..910fbca4 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/controller_extension.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:controller_extension" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "#c:stones" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:controller_extension" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:controller_extension" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/copper_upgrade.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/copper_upgrade.json new file mode 100644 index 00000000..c0c45f49 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/copper_upgrade.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:copper_upgrade" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:copper_ingot" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:copper_upgrade" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:copper_upgrade" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/crimson_1.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/crimson_1.json new file mode 100644 index 00000000..4e4670bd --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/crimson_1.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:crimson_1" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:crimson_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:crimson_1" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:crimson_1" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/crimson_2.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/crimson_2.json new file mode 100644 index 00000000..a5302753 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/crimson_2.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:crimson_2" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:crimson_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:crimson_2" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:crimson_2" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/crimson_4.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/crimson_4.json new file mode 100644 index 00000000..977dd828 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/crimson_4.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:crimson_4" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:crimson_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:crimson_4" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:crimson_4" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/dark_oak_1.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/dark_oak_1.json new file mode 100644 index 00000000..3ebb2687 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/dark_oak_1.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:dark_oak_1" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:dark_oak_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:dark_oak_1" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:dark_oak_1" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/dark_oak_2.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/dark_oak_2.json new file mode 100644 index 00000000..07998e6c --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/dark_oak_2.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:dark_oak_2" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:dark_oak_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:dark_oak_2" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:dark_oak_2" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/dark_oak_4.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/dark_oak_4.json new file mode 100644 index 00000000..43b99978 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/dark_oak_4.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:dark_oak_4" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:dark_oak_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:dark_oak_4" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:dark_oak_4" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/diamond_upgrade.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/diamond_upgrade.json new file mode 100644 index 00000000..d740b21d --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/diamond_upgrade.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:diamond_upgrade" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "#c:gems/diamond" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:diamond_upgrade" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:diamond_upgrade" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/ender_drawer.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/ender_drawer.json new file mode 100644 index 00000000..85d3f007 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/ender_drawer.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:ender_drawer" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "#minecraft:planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:ender_drawer" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:ender_drawer" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/fluid_1.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/fluid_1.json new file mode 100644 index 00000000..688d24f8 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/fluid_1.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:fluid_1" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "#minecraft:planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:fluid_1" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:fluid_1" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/fluid_2.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/fluid_2.json new file mode 100644 index 00000000..2489635d --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/fluid_2.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:fluid_2" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "#minecraft:planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:fluid_2" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:fluid_2" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/fluid_4.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/fluid_4.json new file mode 100644 index 00000000..55fd5930 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/fluid_4.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:fluid_4" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "#minecraft:planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:fluid_4" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:fluid_4" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/framed_1.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/framed_1.json new file mode 100644 index 00000000..48f37d68 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/framed_1.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:framed_1" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:iron_nugget" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:framed_1" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:framed_1" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/framed_2.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/framed_2.json new file mode 100644 index 00000000..cf6ffb8f --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/framed_2.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:framed_2" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:iron_nugget" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:framed_2" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:framed_2" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/framed_4.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/framed_4.json new file mode 100644 index 00000000..55c7b115 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/framed_4.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:framed_4" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:iron_nugget" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:framed_4" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:framed_4" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/framed_controller_extension.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/framed_controller_extension.json new file mode 100644 index 00000000..790a2a6a --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/framed_controller_extension.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:framed_controller_extension" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:iron_nugget" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:framed_controller_extension" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:framed_controller_extension" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/framed_simple_compacting_drawer.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/framed_simple_compacting_drawer.json new file mode 100644 index 00000000..4738ddf0 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/framed_simple_compacting_drawer.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:framed_simple_compacting_drawer" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:iron_nugget" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:framed_simple_compacting_drawer" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:framed_simple_compacting_drawer" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/framed_storage_controller.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/framed_storage_controller.json new file mode 100644 index 00000000..0ef9daee --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/framed_storage_controller.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:framed_storage_controller" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:iron_nugget" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:framed_storage_controller" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:framed_storage_controller" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/gold_upgrade.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/gold_upgrade.json new file mode 100644 index 00000000..cbd0c6d4 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/gold_upgrade.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:gold_upgrade" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "#c:ingots/gold" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:gold_upgrade" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:gold_upgrade" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/iron_downgrade.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/iron_downgrade.json new file mode 100644 index 00000000..5b6b2fbe --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/iron_downgrade.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:iron_downgrade" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "#c:ingots/iron" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:iron_downgrade" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:iron_downgrade" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/jungle_1.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/jungle_1.json new file mode 100644 index 00000000..3af43096 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/jungle_1.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:jungle_1" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:jungle_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:jungle_1" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:jungle_1" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/jungle_2.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/jungle_2.json new file mode 100644 index 00000000..08faa312 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/jungle_2.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:jungle_2" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:jungle_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:jungle_2" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:jungle_2" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/jungle_4.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/jungle_4.json new file mode 100644 index 00000000..541992f4 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/jungle_4.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:jungle_4" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:jungle_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:jungle_4" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:jungle_4" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/linking_tool.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/linking_tool.json new file mode 100644 index 00000000..d5a90a62 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/linking_tool.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:linking_tool" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:paper" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:linking_tool" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:linking_tool" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/mangrove_1.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/mangrove_1.json new file mode 100644 index 00000000..0a2e62db --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/mangrove_1.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:mangrove_1" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:mangrove_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:mangrove_1" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:mangrove_1" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/mangrove_2.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/mangrove_2.json new file mode 100644 index 00000000..fbed13bb --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/mangrove_2.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:mangrove_2" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:mangrove_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:mangrove_2" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:mangrove_2" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/mangrove_4.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/mangrove_4.json new file mode 100644 index 00000000..007be9f3 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/mangrove_4.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:mangrove_4" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:mangrove_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:mangrove_4" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:mangrove_4" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancements/recipes/misc/netherite_upgrade.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/netherite_upgrade.json similarity index 75% rename from src/generated/resources/data/functionalstorage/advancements/recipes/misc/netherite_upgrade.json rename to src/generated/resources/data/functionalstorage/advancement/recipes/misc/netherite_upgrade.json index 07a67538..862f5633 100644 --- a/src/generated/resources/data/functionalstorage/advancements/recipes/misc/netherite_upgrade.json +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/netherite_upgrade.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "minecraft:netherite_ingot" - ] + "items": "minecraft:netherite_ingot" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_netherite_ingot", - "has_the_recipe" + "has_the_recipe", + "has_netherite_ingot" ] ], "rewards": { "recipes": [ "functionalstorage:netherite_upgrade" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/oak_1.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/oak_1.json new file mode 100644 index 00000000..c5ada276 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/oak_1.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:oak_1" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:oak_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:oak_1" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:oak_1" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/oak_2.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/oak_2.json new file mode 100644 index 00000000..bda44746 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/oak_2.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:oak_2" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:oak_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:oak_2" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:oak_2" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/oak_4.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/oak_4.json new file mode 100644 index 00000000..e5d1839b --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/oak_4.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:oak_4" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:oak_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:oak_4" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:oak_4" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/puller_upgrade.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/puller_upgrade.json new file mode 100644 index 00000000..f238aaed --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/puller_upgrade.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:puller_upgrade" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "#c:stones" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:puller_upgrade" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:puller_upgrade" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/pusher_upgrade.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/pusher_upgrade.json new file mode 100644 index 00000000..f092bdf0 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/pusher_upgrade.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:pusher_upgrade" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "#c:stones" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:pusher_upgrade" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:pusher_upgrade" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/redstone_upgrade.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/redstone_upgrade.json new file mode 100644 index 00000000..f4f6bd46 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/redstone_upgrade.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:redstone_upgrade" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:redstone" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:redstone_upgrade" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:redstone_upgrade" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/simple_compacting_drawer.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/simple_compacting_drawer.json new file mode 100644 index 00000000..b3f50f9a --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/simple_compacting_drawer.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:simple_compacting_drawer" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:stone" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:simple_compacting_drawer" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:simple_compacting_drawer" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/spruce_1.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/spruce_1.json new file mode 100644 index 00000000..e47fba2f --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/spruce_1.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:spruce_1" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:spruce_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:spruce_1" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:spruce_1" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/spruce_2.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/spruce_2.json new file mode 100644 index 00000000..d811f952 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/spruce_2.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:spruce_2" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:spruce_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:spruce_2" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:spruce_2" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/spruce_4.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/spruce_4.json new file mode 100644 index 00000000..fa43064e --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/spruce_4.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:spruce_4" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:spruce_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:spruce_4" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:spruce_4" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/storage_controller.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/storage_controller.json new file mode 100644 index 00000000..23d7a1b3 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/storage_controller.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:storage_controller" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "#c:stones" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:storage_controller" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:storage_controller" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/void_upgrade.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/void_upgrade.json new file mode 100644 index 00000000..c114897f --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/void_upgrade.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:void_upgrade" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "#c:obsidians" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:void_upgrade" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:void_upgrade" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/warped_1.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/warped_1.json new file mode 100644 index 00000000..3f63c209 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/warped_1.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:warped_1" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:warped_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:warped_1" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:warped_1" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/warped_2.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/warped_2.json new file mode 100644 index 00000000..3ef46459 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/warped_2.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:warped_2" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:warped_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:warped_2" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:warped_2" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/advancement/recipes/misc/warped_4.json b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/warped_4.json new file mode 100644 index 00000000..ca0eaf35 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/advancement/recipes/misc/warped_4.json @@ -0,0 +1,38 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:warped_4" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": "minecraft:warped_planks" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "functionalstorage:warped_4" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_item" + ] + ], + "rewards": { + "recipes": [ + "functionalstorage:warped_4" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/acacia_1.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/acacia_1.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/acacia_1.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/acacia_1.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/acacia_2.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/acacia_2.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/acacia_2.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/acacia_2.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/acacia_4.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/acacia_4.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/acacia_4.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/acacia_4.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/armory_cabinet.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/armory_cabinet.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/armory_cabinet.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/armory_cabinet.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/birch_1.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/birch_1.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/birch_1.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/birch_1.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/birch_2.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/birch_2.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/birch_2.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/birch_2.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/birch_4.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/birch_4.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/birch_4.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/birch_4.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/cherry_1.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/cherry_1.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/cherry_1.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/cherry_1.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/cherry_2.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/cherry_2.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/cherry_2.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/cherry_2.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/cherry_4.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/cherry_4.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/cherry_4.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/cherry_4.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/compacting_drawer.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/compacting_drawer.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/compacting_drawer.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/compacting_drawer.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/compacting_framed_drawer.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/compacting_framed_drawer.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/compacting_framed_drawer.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/compacting_framed_drawer.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/controller_extension.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/controller_extension.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/controller_extension.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/controller_extension.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/crimson_1.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/crimson_1.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/crimson_1.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/crimson_1.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/crimson_2.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/crimson_2.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/crimson_2.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/crimson_2.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/crimson_4.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/crimson_4.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/crimson_4.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/crimson_4.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/dark_oak_1.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/dark_oak_1.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/dark_oak_1.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/dark_oak_1.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/dark_oak_2.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/dark_oak_2.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/dark_oak_2.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/dark_oak_2.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/dark_oak_4.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/dark_oak_4.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/dark_oak_4.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/dark_oak_4.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/ender_drawer.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/ender_drawer.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/ender_drawer.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/ender_drawer.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/fluid_1.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/fluid_1.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/fluid_1.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/fluid_1.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/fluid_2.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/fluid_2.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/fluid_2.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/fluid_2.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/fluid_4.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/fluid_4.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/fluid_4.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/fluid_4.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/framed_1.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/framed_1.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/framed_1.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/framed_1.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/framed_2.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/framed_2.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/framed_2.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/framed_2.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/framed_4.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/framed_4.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/framed_4.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/framed_4.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/framed_controller_extension.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/framed_controller_extension.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/framed_controller_extension.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/framed_controller_extension.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/framed_simple_compacting_drawer.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/framed_simple_compacting_drawer.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/framed_simple_compacting_drawer.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/framed_simple_compacting_drawer.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/framed_storage_controller.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/framed_storage_controller.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/framed_storage_controller.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/framed_storage_controller.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/jungle_1.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/jungle_1.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/jungle_1.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/jungle_1.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/jungle_2.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/jungle_2.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/jungle_2.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/jungle_2.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/jungle_4.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/jungle_4.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/jungle_4.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/jungle_4.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/mangrove_1.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/mangrove_1.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/mangrove_1.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/mangrove_1.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/mangrove_2.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/mangrove_2.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/mangrove_2.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/mangrove_2.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/mangrove_4.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/mangrove_4.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/mangrove_4.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/mangrove_4.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/oak_1.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/oak_1.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/oak_1.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/oak_1.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/oak_2.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/oak_2.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/oak_2.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/oak_2.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/oak_4.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/oak_4.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/oak_4.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/oak_4.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/simple_compacting_drawer.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/simple_compacting_drawer.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/simple_compacting_drawer.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/simple_compacting_drawer.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/spruce_1.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/spruce_1.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/spruce_1.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/spruce_1.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/spruce_2.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/spruce_2.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/spruce_2.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/spruce_2.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/spruce_4.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/spruce_4.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/spruce_4.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/spruce_4.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/storage_controller.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/storage_controller.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/storage_controller.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/storage_controller.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/warped_1.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/warped_1.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/warped_1.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/warped_1.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/warped_2.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/warped_2.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/warped_2.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/warped_2.json diff --git a/src/generated/resources/data/functionalstorage/loot_tables/blocks/warped_4.json b/src/generated/resources/data/functionalstorage/loot_table/blocks/warped_4.json similarity index 100% rename from src/generated/resources/data/functionalstorage/loot_tables/blocks/warped_4.json rename to src/generated/resources/data/functionalstorage/loot_table/blocks/warped_4.json diff --git a/src/generated/resources/data/functionalstorage/recipe/acacia_1.json b/src/generated/resources/data/functionalstorage/recipe/acacia_1.json new file mode 100644 index 00000000..7ef135b4 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/acacia_1.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:acacia_1" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:acacia_planks" + } + }, + "pattern": [ + "PPP", + "PCP", + "PPP" + ], + "result": { + "count": 1, + "id": "functionalstorage:acacia_1" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/acacia_2.json b/src/generated/resources/data/functionalstorage/recipe/acacia_2.json new file mode 100644 index 00000000..644b3996 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/acacia_2.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:acacia_2" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:acacia_planks" + } + }, + "pattern": [ + "PCP", + "PPP", + "PCP" + ], + "result": { + "count": 2, + "id": "functionalstorage:acacia_2" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/acacia_4.json b/src/generated/resources/data/functionalstorage/recipe/acacia_4.json new file mode 100644 index 00000000..39ff5432 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/acacia_4.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:acacia_4" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:acacia_planks" + } + }, + "pattern": [ + "CPC", + "PPP", + "CPC" + ], + "result": { + "count": 4, + "id": "functionalstorage:acacia_4" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/armory_cabinet.json b/src/generated/resources/data/functionalstorage/recipe/armory_cabinet.json new file mode 100644 index 00000000..7699655e --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/armory_cabinet.json @@ -0,0 +1,33 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:armory_cabinet" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "B": { + "tag": "c:ingots/netherite" + }, + "C": { + "tag": "functionalstorage:drawer" + }, + "D": { + "item": "minecraft:comparator" + }, + "I": { + "tag": "c:stones" + } + }, + "pattern": [ + "ICI", + "CDC", + "IBI" + ], + "result": { + "count": 1, + "id": "functionalstorage:armory_cabinet" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/birch_1.json b/src/generated/resources/data/functionalstorage/recipe/birch_1.json new file mode 100644 index 00000000..f83f67a6 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/birch_1.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:birch_1" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:birch_planks" + } + }, + "pattern": [ + "PPP", + "PCP", + "PPP" + ], + "result": { + "count": 1, + "id": "functionalstorage:birch_1" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/birch_2.json b/src/generated/resources/data/functionalstorage/recipe/birch_2.json new file mode 100644 index 00000000..dc3c78bb --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/birch_2.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:birch_2" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:birch_planks" + } + }, + "pattern": [ + "PCP", + "PPP", + "PCP" + ], + "result": { + "count": 2, + "id": "functionalstorage:birch_2" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/birch_4.json b/src/generated/resources/data/functionalstorage/recipe/birch_4.json new file mode 100644 index 00000000..5f89b3c4 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/birch_4.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:birch_4" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:birch_planks" + } + }, + "pattern": [ + "CPC", + "PPP", + "CPC" + ], + "result": { + "count": 4, + "id": "functionalstorage:birch_4" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/cherry_1.json b/src/generated/resources/data/functionalstorage/recipe/cherry_1.json new file mode 100644 index 00000000..eaf7423f --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/cherry_1.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:cherry_1" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:cherry_planks" + } + }, + "pattern": [ + "PPP", + "PCP", + "PPP" + ], + "result": { + "count": 1, + "id": "functionalstorage:cherry_1" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/cherry_2.json b/src/generated/resources/data/functionalstorage/recipe/cherry_2.json new file mode 100644 index 00000000..d695eff5 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/cherry_2.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:cherry_2" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:cherry_planks" + } + }, + "pattern": [ + "PCP", + "PPP", + "PCP" + ], + "result": { + "count": 2, + "id": "functionalstorage:cherry_2" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/cherry_4.json b/src/generated/resources/data/functionalstorage/recipe/cherry_4.json new file mode 100644 index 00000000..13ef4fd7 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/cherry_4.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:cherry_4" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:cherry_planks" + } + }, + "pattern": [ + "CPC", + "PPP", + "CPC" + ], + "result": { + "count": 4, + "id": "functionalstorage:cherry_4" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/collector_upgrade.json b/src/generated/resources/data/functionalstorage/recipe/collector_upgrade.json new file mode 100644 index 00000000..43d6d997 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/collector_upgrade.json @@ -0,0 +1,33 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:collector_upgrade" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "B": { + "item": "minecraft:hopper" + }, + "D": { + "tag": "functionalstorage:drawer" + }, + "I": { + "tag": "c:stones" + }, + "R": { + "tag": "c:dusts/redstone" + } + }, + "pattern": [ + "IBI", + "RDR", + "IBI" + ], + "result": { + "count": 1, + "id": "functionalstorage:collector_upgrade" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/compacting_drawer.json b/src/generated/resources/data/functionalstorage/recipe/compacting_drawer.json new file mode 100644 index 00000000..3e935269 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/compacting_drawer.json @@ -0,0 +1,33 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:compacting_drawer" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "D": { + "tag": "functionalstorage:drawer" + }, + "I": { + "tag": "c:ingots/iron" + }, + "P": { + "item": "minecraft:piston" + }, + "S": { + "item": "minecraft:stone" + } + }, + "pattern": [ + "SSS", + "PDP", + "SIS" + ], + "result": { + "count": 1, + "id": "functionalstorage:compacting_drawer" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/compacting_framed_drawer.json b/src/generated/resources/data/functionalstorage/recipe/compacting_framed_drawer.json new file mode 100644 index 00000000..4af1a6e1 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/compacting_framed_drawer.json @@ -0,0 +1,33 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:compacting_framed_drawer" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "D": { + "tag": "functionalstorage:drawer" + }, + "I": { + "tag": "c:ingots/iron" + }, + "P": { + "item": "minecraft:piston" + }, + "S": { + "item": "minecraft:iron_nugget" + } + }, + "pattern": [ + "SSS", + "PDP", + "SIS" + ], + "result": { + "count": 1, + "id": "functionalstorage:compacting_framed_drawer" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/configuration_tool.json b/src/generated/resources/data/functionalstorage/recipe/configuration_tool.json new file mode 100644 index 00000000..0b156c3f --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/configuration_tool.json @@ -0,0 +1,33 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:configuration_tool" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "D": { + "tag": "functionalstorage:drawer" + }, + "E": { + "item": "minecraft:emerald" + }, + "G": { + "tag": "c:ingots/gold" + }, + "P": { + "item": "minecraft:paper" + } + }, + "pattern": [ + "PPG", + "PDG", + "PEP" + ], + "result": { + "count": 1, + "id": "functionalstorage:configuration_tool" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/controller_extension.json b/src/generated/resources/data/functionalstorage/recipe/controller_extension.json new file mode 100644 index 00000000..5054767e --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/controller_extension.json @@ -0,0 +1,33 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:controller_extension" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "B": { + "item": "minecraft:quartz_block" + }, + "C": { + "tag": "functionalstorage:drawer" + }, + "D": { + "item": "minecraft:repeater" + }, + "I": { + "tag": "c:stones" + } + }, + "pattern": [ + "IBI", + "CDC", + "IBI" + ], + "result": { + "count": 1, + "id": "functionalstorage:controller_extension" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/copper_upgrade.json b/src/generated/resources/data/functionalstorage/recipe/copper_upgrade.json new file mode 100644 index 00000000..b0cfcd1f --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/copper_upgrade.json @@ -0,0 +1,33 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:copper_upgrade" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "B": { + "item": "minecraft:copper_block" + }, + "C": { + "tag": "c:chests/wooden" + }, + "D": { + "tag": "functionalstorage:drawer" + }, + "I": { + "item": "minecraft:copper_ingot" + } + }, + "pattern": [ + "IBI", + "CDC", + "IBI" + ], + "result": { + "count": 1, + "id": "functionalstorage:copper_upgrade" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/crimson_1.json b/src/generated/resources/data/functionalstorage/recipe/crimson_1.json new file mode 100644 index 00000000..c4c72594 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/crimson_1.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:crimson_1" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:crimson_planks" + } + }, + "pattern": [ + "PPP", + "PCP", + "PPP" + ], + "result": { + "count": 1, + "id": "functionalstorage:crimson_1" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/crimson_2.json b/src/generated/resources/data/functionalstorage/recipe/crimson_2.json new file mode 100644 index 00000000..6bbe07b6 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/crimson_2.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:crimson_2" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:crimson_planks" + } + }, + "pattern": [ + "PCP", + "PPP", + "PCP" + ], + "result": { + "count": 2, + "id": "functionalstorage:crimson_2" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/crimson_4.json b/src/generated/resources/data/functionalstorage/recipe/crimson_4.json new file mode 100644 index 00000000..eebebb13 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/crimson_4.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:crimson_4" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:crimson_planks" + } + }, + "pattern": [ + "CPC", + "PPP", + "CPC" + ], + "result": { + "count": 4, + "id": "functionalstorage:crimson_4" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/dark_oak_1.json b/src/generated/resources/data/functionalstorage/recipe/dark_oak_1.json new file mode 100644 index 00000000..abe37a6f --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/dark_oak_1.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:dark_oak_1" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:dark_oak_planks" + } + }, + "pattern": [ + "PPP", + "PCP", + "PPP" + ], + "result": { + "count": 1, + "id": "functionalstorage:dark_oak_1" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/dark_oak_2.json b/src/generated/resources/data/functionalstorage/recipe/dark_oak_2.json new file mode 100644 index 00000000..00bf89fc --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/dark_oak_2.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:dark_oak_2" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:dark_oak_planks" + } + }, + "pattern": [ + "PCP", + "PPP", + "PCP" + ], + "result": { + "count": 2, + "id": "functionalstorage:dark_oak_2" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/dark_oak_4.json b/src/generated/resources/data/functionalstorage/recipe/dark_oak_4.json new file mode 100644 index 00000000..5aed907a --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/dark_oak_4.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:dark_oak_4" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:dark_oak_planks" + } + }, + "pattern": [ + "CPC", + "PPP", + "CPC" + ], + "result": { + "count": 4, + "id": "functionalstorage:dark_oak_4" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/diamond_upgrade.json b/src/generated/resources/data/functionalstorage/recipe/diamond_upgrade.json new file mode 100644 index 00000000..53201235 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/diamond_upgrade.json @@ -0,0 +1,33 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:diamond_upgrade" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "B": { + "tag": "c:storage_blocks/diamond" + }, + "C": { + "tag": "c:chests/wooden" + }, + "D": { + "item": "functionalstorage:gold_upgrade" + }, + "I": { + "tag": "c:gems/diamond" + } + }, + "pattern": [ + "IBI", + "CDC", + "IBI" + ], + "result": { + "count": 1, + "id": "functionalstorage:diamond_upgrade" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/ender_drawer.json b/src/generated/resources/data/functionalstorage/recipe/ender_drawer.json new file mode 100644 index 00000000..ee1e5bd4 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/ender_drawer.json @@ -0,0 +1,30 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:ender_drawer" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/ender" + }, + "L": { + "tag": "functionalstorage:drawer" + }, + "P": { + "tag": "minecraft:planks" + } + }, + "pattern": [ + "PPP", + "LCL", + "PPP" + ], + "result": { + "count": 1, + "id": "functionalstorage:ender_drawer" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/fluid_1.json b/src/generated/resources/data/functionalstorage/recipe/fluid_1.json new file mode 100644 index 00000000..bd6c7ef1 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/fluid_1.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:fluid_1" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "item": "minecraft:bucket" + }, + "P": { + "tag": "minecraft:planks" + } + }, + "pattern": [ + "PPP", + "PCP", + "PPP" + ], + "result": { + "count": 1, + "id": "functionalstorage:fluid_1" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/fluid_2.json b/src/generated/resources/data/functionalstorage/recipe/fluid_2.json new file mode 100644 index 00000000..355d5a41 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/fluid_2.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:fluid_2" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "item": "minecraft:bucket" + }, + "P": { + "tag": "minecraft:planks" + } + }, + "pattern": [ + "PCP", + "PPP", + "PCP" + ], + "result": { + "count": 2, + "id": "functionalstorage:fluid_2" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/fluid_4.json b/src/generated/resources/data/functionalstorage/recipe/fluid_4.json new file mode 100644 index 00000000..ff4c763d --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/fluid_4.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:fluid_4" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "item": "minecraft:bucket" + }, + "P": { + "tag": "minecraft:planks" + } + }, + "pattern": [ + "CPC", + "PPP", + "CPC" + ], + "result": { + "count": 4, + "id": "functionalstorage:fluid_4" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/framed_1.json b/src/generated/resources/data/functionalstorage/recipe/framed_1.json new file mode 100644 index 00000000..688c8626 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/framed_1.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:framed_1" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:iron_nugget" + } + }, + "pattern": [ + "PPP", + "PCP", + "PPP" + ], + "result": { + "count": 1, + "id": "functionalstorage:framed_1" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/framed_2.json b/src/generated/resources/data/functionalstorage/recipe/framed_2.json new file mode 100644 index 00000000..cf3bfb56 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/framed_2.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:framed_2" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:iron_nugget" + } + }, + "pattern": [ + "PCP", + "PPP", + "PCP" + ], + "result": { + "count": 2, + "id": "functionalstorage:framed_2" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/framed_4.json b/src/generated/resources/data/functionalstorage/recipe/framed_4.json new file mode 100644 index 00000000..6571abc2 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/framed_4.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:framed_4" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:iron_nugget" + } + }, + "pattern": [ + "CPC", + "PPP", + "CPC" + ], + "result": { + "count": 4, + "id": "functionalstorage:framed_4" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/framed_controller_extension.json b/src/generated/resources/data/functionalstorage/recipe/framed_controller_extension.json new file mode 100644 index 00000000..050cadc2 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/framed_controller_extension.json @@ -0,0 +1,33 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:framed_controller_extension" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "B": { + "item": "minecraft:quartz_block" + }, + "C": { + "tag": "functionalstorage:drawer" + }, + "D": { + "item": "minecraft:repeater" + }, + "I": { + "item": "minecraft:iron_nugget" + } + }, + "pattern": [ + "IBI", + "CDC", + "IBI" + ], + "result": { + "count": 1, + "id": "functionalstorage:framed_controller_extension" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/framed_simple_compacting_drawer.json b/src/generated/resources/data/functionalstorage/recipe/framed_simple_compacting_drawer.json new file mode 100644 index 00000000..5a5dc258 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/framed_simple_compacting_drawer.json @@ -0,0 +1,33 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:framed_simple_compacting_drawer" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "D": { + "tag": "functionalstorage:drawer" + }, + "I": { + "tag": "c:ingots/iron" + }, + "P": { + "item": "minecraft:piston" + }, + "S": { + "item": "minecraft:iron_nugget" + } + }, + "pattern": [ + "SSS", + "SDP", + "SIS" + ], + "result": { + "count": 1, + "id": "functionalstorage:framed_simple_compacting_drawer" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/framed_storage_controller.json b/src/generated/resources/data/functionalstorage/recipe/framed_storage_controller.json new file mode 100644 index 00000000..fc920baa --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/framed_storage_controller.json @@ -0,0 +1,33 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:framed_storage_controller" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "B": { + "item": "minecraft:quartz_block" + }, + "C": { + "tag": "functionalstorage:drawer" + }, + "D": { + "item": "minecraft:comparator" + }, + "I": { + "item": "minecraft:iron_nugget" + } + }, + "pattern": [ + "IBI", + "CDC", + "IBI" + ], + "result": { + "count": 1, + "id": "functionalstorage:framed_storage_controller" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/gold_upgrade.json b/src/generated/resources/data/functionalstorage/recipe/gold_upgrade.json new file mode 100644 index 00000000..04bc75c2 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/gold_upgrade.json @@ -0,0 +1,33 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:gold_upgrade" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "B": { + "tag": "c:storage_blocks/gold" + }, + "C": { + "tag": "c:chests/wooden" + }, + "D": { + "item": "functionalstorage:copper_upgrade" + }, + "I": { + "tag": "c:ingots/gold" + } + }, + "pattern": [ + "IBI", + "CDC", + "BIB" + ], + "result": { + "count": 1, + "id": "functionalstorage:gold_upgrade" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/iron_downgrade.json b/src/generated/resources/data/functionalstorage/recipe/iron_downgrade.json new file mode 100644 index 00000000..3192a56c --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/iron_downgrade.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:iron_downgrade" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "D": { + "tag": "functionalstorage:drawer" + }, + "I": { + "tag": "c:ingots/iron" + } + }, + "pattern": [ + "III", + "IDI", + "III" + ], + "result": { + "count": 1, + "id": "functionalstorage:iron_downgrade" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/jungle_1.json b/src/generated/resources/data/functionalstorage/recipe/jungle_1.json new file mode 100644 index 00000000..00be3917 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/jungle_1.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:jungle_1" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:jungle_planks" + } + }, + "pattern": [ + "PPP", + "PCP", + "PPP" + ], + "result": { + "count": 1, + "id": "functionalstorage:jungle_1" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/jungle_2.json b/src/generated/resources/data/functionalstorage/recipe/jungle_2.json new file mode 100644 index 00000000..5b249f30 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/jungle_2.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:jungle_2" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:jungle_planks" + } + }, + "pattern": [ + "PCP", + "PPP", + "PCP" + ], + "result": { + "count": 2, + "id": "functionalstorage:jungle_2" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/jungle_4.json b/src/generated/resources/data/functionalstorage/recipe/jungle_4.json new file mode 100644 index 00000000..c8725d2f --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/jungle_4.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:jungle_4" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:jungle_planks" + } + }, + "pattern": [ + "CPC", + "PPP", + "CPC" + ], + "result": { + "count": 4, + "id": "functionalstorage:jungle_4" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/linking_tool.json b/src/generated/resources/data/functionalstorage/recipe/linking_tool.json new file mode 100644 index 00000000..59526cdf --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/linking_tool.json @@ -0,0 +1,33 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:linking_tool" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "D": { + "tag": "functionalstorage:drawer" + }, + "E": { + "item": "minecraft:diamond" + }, + "G": { + "tag": "c:ingots/gold" + }, + "P": { + "item": "minecraft:paper" + } + }, + "pattern": [ + "PPG", + "PDG", + "PEP" + ], + "result": { + "count": 1, + "id": "functionalstorage:linking_tool" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/mangrove_1.json b/src/generated/resources/data/functionalstorage/recipe/mangrove_1.json new file mode 100644 index 00000000..fc51b827 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/mangrove_1.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:mangrove_1" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:mangrove_planks" + } + }, + "pattern": [ + "PPP", + "PCP", + "PPP" + ], + "result": { + "count": 1, + "id": "functionalstorage:mangrove_1" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/mangrove_2.json b/src/generated/resources/data/functionalstorage/recipe/mangrove_2.json new file mode 100644 index 00000000..9c7352e3 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/mangrove_2.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:mangrove_2" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:mangrove_planks" + } + }, + "pattern": [ + "PCP", + "PPP", + "PCP" + ], + "result": { + "count": 2, + "id": "functionalstorage:mangrove_2" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/mangrove_4.json b/src/generated/resources/data/functionalstorage/recipe/mangrove_4.json new file mode 100644 index 00000000..0de333d6 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/mangrove_4.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:mangrove_4" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:mangrove_planks" + } + }, + "pattern": [ + "CPC", + "PPP", + "CPC" + ], + "result": { + "count": 4, + "id": "functionalstorage:mangrove_4" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/netherite_upgrade.json b/src/generated/resources/data/functionalstorage/recipe/netherite_upgrade.json similarity index 80% rename from src/generated/resources/data/functionalstorage/recipes/netherite_upgrade.json rename to src/generated/resources/data/functionalstorage/recipe/netherite_upgrade.json index 79c358cf..282abe86 100644 --- a/src/generated/resources/data/functionalstorage/recipes/netherite_upgrade.json +++ b/src/generated/resources/data/functionalstorage/recipe/netherite_upgrade.json @@ -7,7 +7,8 @@ "item": "functionalstorage:diamond_upgrade" }, "result": { - "item": "functionalstorage:netherite_upgrade" + "count": 1, + "id": "functionalstorage:netherite_upgrade" }, "template": { "item": "minecraft:netherite_upgrade_smithing_template" diff --git a/src/generated/resources/data/functionalstorage/recipe/oak_1.json b/src/generated/resources/data/functionalstorage/recipe/oak_1.json new file mode 100644 index 00000000..5b6ac581 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/oak_1.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:oak_1" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "type": "functionalstorage:woodless" + } + }, + "pattern": [ + "PPP", + "PCP", + "PPP" + ], + "result": { + "count": 1, + "id": "functionalstorage:oak_1" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/oak_2.json b/src/generated/resources/data/functionalstorage/recipe/oak_2.json new file mode 100644 index 00000000..04699006 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/oak_2.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:oak_2" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "type": "functionalstorage:woodless" + } + }, + "pattern": [ + "PCP", + "PPP", + "PCP" + ], + "result": { + "count": 2, + "id": "functionalstorage:oak_2" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/oak_4.json b/src/generated/resources/data/functionalstorage/recipe/oak_4.json new file mode 100644 index 00000000..4994d2b4 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/oak_4.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:oak_4" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "type": "functionalstorage:woodless" + } + }, + "pattern": [ + "CPC", + "PPP", + "CPC" + ], + "result": { + "count": 4, + "id": "functionalstorage:oak_4" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/puller_upgrade.json b/src/generated/resources/data/functionalstorage/recipe/puller_upgrade.json new file mode 100644 index 00000000..c4af841c --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/puller_upgrade.json @@ -0,0 +1,33 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:puller_upgrade" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "B": { + "tag": "c:dusts/redstone" + }, + "C": { + "item": "minecraft:hopper" + }, + "D": { + "tag": "functionalstorage:drawer" + }, + "I": { + "tag": "c:stones" + } + }, + "pattern": [ + "ICI", + "IDI", + "IBI" + ], + "result": { + "count": 1, + "id": "functionalstorage:puller_upgrade" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/pusher_upgrade.json b/src/generated/resources/data/functionalstorage/recipe/pusher_upgrade.json new file mode 100644 index 00000000..cc0c76bb --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/pusher_upgrade.json @@ -0,0 +1,33 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:pusher_upgrade" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "B": { + "tag": "c:dusts/redstone" + }, + "D": { + "tag": "functionalstorage:drawer" + }, + "I": { + "tag": "c:stones" + }, + "R": { + "item": "minecraft:hopper" + } + }, + "pattern": [ + "IBI", + "IDI", + "IRI" + ], + "result": { + "count": 1, + "id": "functionalstorage:pusher_upgrade" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/redstone_upgrade.json b/src/generated/resources/data/functionalstorage/recipe/redstone_upgrade.json new file mode 100644 index 00000000..a014a25c --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/redstone_upgrade.json @@ -0,0 +1,33 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:redstone_upgrade" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "B": { + "item": "minecraft:redstone_block" + }, + "C": { + "item": "minecraft:comparator" + }, + "D": { + "tag": "functionalstorage:drawer" + }, + "I": { + "item": "minecraft:redstone" + } + }, + "pattern": [ + "IBI", + "CDC", + "IBI" + ], + "result": { + "count": 1, + "id": "functionalstorage:redstone_upgrade" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/simple_compacting_drawer.json b/src/generated/resources/data/functionalstorage/recipe/simple_compacting_drawer.json new file mode 100644 index 00000000..ce8446a1 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/simple_compacting_drawer.json @@ -0,0 +1,33 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:simple_compacting_drawer" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "D": { + "tag": "functionalstorage:drawer" + }, + "I": { + "tag": "c:ingots/iron" + }, + "P": { + "item": "minecraft:piston" + }, + "S": { + "item": "minecraft:stone" + } + }, + "pattern": [ + "SSS", + "SDP", + "SIS" + ], + "result": { + "count": 1, + "id": "functionalstorage:simple_compacting_drawer" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/spruce_1.json b/src/generated/resources/data/functionalstorage/recipe/spruce_1.json new file mode 100644 index 00000000..2dd2ef29 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/spruce_1.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:spruce_1" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:spruce_planks" + } + }, + "pattern": [ + "PPP", + "PCP", + "PPP" + ], + "result": { + "count": 1, + "id": "functionalstorage:spruce_1" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/spruce_2.json b/src/generated/resources/data/functionalstorage/recipe/spruce_2.json new file mode 100644 index 00000000..58e399a2 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/spruce_2.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:spruce_2" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:spruce_planks" + } + }, + "pattern": [ + "PCP", + "PPP", + "PCP" + ], + "result": { + "count": 2, + "id": "functionalstorage:spruce_2" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/spruce_4.json b/src/generated/resources/data/functionalstorage/recipe/spruce_4.json new file mode 100644 index 00000000..fa7cd71e --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/spruce_4.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:spruce_4" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:spruce_planks" + } + }, + "pattern": [ + "CPC", + "PPP", + "CPC" + ], + "result": { + "count": 4, + "id": "functionalstorage:spruce_4" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/storage_controller.json b/src/generated/resources/data/functionalstorage/recipe/storage_controller.json new file mode 100644 index 00000000..ca1ba35e --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/storage_controller.json @@ -0,0 +1,33 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:storage_controller" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "B": { + "item": "minecraft:quartz_block" + }, + "C": { + "tag": "functionalstorage:drawer" + }, + "D": { + "item": "minecraft:comparator" + }, + "I": { + "tag": "c:stones" + } + }, + "pattern": [ + "IBI", + "CDC", + "IBI" + ], + "result": { + "count": 1, + "id": "functionalstorage:storage_controller" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/void_upgrade.json b/src/generated/resources/data/functionalstorage/recipe/void_upgrade.json new file mode 100644 index 00000000..1cd309d2 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/void_upgrade.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:void_upgrade" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "D": { + "tag": "functionalstorage:drawer" + }, + "I": { + "tag": "c:obsidians" + } + }, + "pattern": [ + "III", + "IDI", + "III" + ], + "result": { + "count": 1, + "id": "functionalstorage:void_upgrade" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/warped_1.json b/src/generated/resources/data/functionalstorage/recipe/warped_1.json new file mode 100644 index 00000000..fc9968c9 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/warped_1.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:warped_1" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:warped_planks" + } + }, + "pattern": [ + "PPP", + "PCP", + "PPP" + ], + "result": { + "count": 1, + "id": "functionalstorage:warped_1" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/warped_2.json b/src/generated/resources/data/functionalstorage/recipe/warped_2.json new file mode 100644 index 00000000..5ec94d18 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/warped_2.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:warped_2" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:warped_planks" + } + }, + "pattern": [ + "PCP", + "PPP", + "PCP" + ], + "result": { + "count": 2, + "id": "functionalstorage:warped_2" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipe/warped_4.json b/src/generated/resources/data/functionalstorage/recipe/warped_4.json new file mode 100644 index 00000000..44264630 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipe/warped_4.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:item_exists", + "item": "functionalstorage:warped_4" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "tag": "c:chests/wooden" + }, + "P": { + "item": "minecraft:warped_planks" + } + }, + "pattern": [ + "CPC", + "PPP", + "CPC" + ], + "result": { + "count": 4, + "id": "functionalstorage:warped_4" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/acacia_1.json b/src/generated/resources/data/functionalstorage/recipes/acacia_1.json deleted file mode 100644 index 20f139fc..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/acacia_1.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:acacia_1" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:acacia_planks" - } - }, - "pattern": [ - "PPP", - "PCP", - "PPP" - ], - "result": { - "item": "functionalstorage:acacia_1" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/acacia_2.json b/src/generated/resources/data/functionalstorage/recipes/acacia_2.json deleted file mode 100644 index f042130f..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/acacia_2.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:acacia_2" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:acacia_planks" - } - }, - "pattern": [ - "PCP", - "PPP", - "PCP" - ], - "result": { - "count": 2, - "item": "functionalstorage:acacia_2" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/acacia_4.json b/src/generated/resources/data/functionalstorage/recipes/acacia_4.json deleted file mode 100644 index 4f7d5c29..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/acacia_4.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:acacia_4" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:acacia_planks" - } - }, - "pattern": [ - "CPC", - "PPP", - "CPC" - ], - "result": { - "count": 4, - "item": "functionalstorage:acacia_4" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/armory_cabinet.json b/src/generated/resources/data/functionalstorage/recipes/armory_cabinet.json deleted file mode 100644 index 6e0e045c..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/armory_cabinet.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:armory_cabinet" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "B": { - "tag": "forge:ingots/netherite" - }, - "C": { - "tag": "functionalstorage:drawer" - }, - "D": { - "item": "minecraft:comparator" - }, - "I": { - "tag": "forge:stone" - } - }, - "pattern": [ - "ICI", - "CDC", - "IBI" - ], - "result": { - "item": "functionalstorage:armory_cabinet" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/birch_1.json b/src/generated/resources/data/functionalstorage/recipes/birch_1.json deleted file mode 100644 index 3b547bef..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/birch_1.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:birch_1" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:birch_planks" - } - }, - "pattern": [ - "PPP", - "PCP", - "PPP" - ], - "result": { - "item": "functionalstorage:birch_1" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/birch_2.json b/src/generated/resources/data/functionalstorage/recipes/birch_2.json deleted file mode 100644 index 9c0878e9..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/birch_2.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:birch_2" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:birch_planks" - } - }, - "pattern": [ - "PCP", - "PPP", - "PCP" - ], - "result": { - "count": 2, - "item": "functionalstorage:birch_2" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/birch_4.json b/src/generated/resources/data/functionalstorage/recipes/birch_4.json deleted file mode 100644 index 373ada50..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/birch_4.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:birch_4" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:birch_planks" - } - }, - "pattern": [ - "CPC", - "PPP", - "CPC" - ], - "result": { - "count": 4, - "item": "functionalstorage:birch_4" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/cherry_1.json b/src/generated/resources/data/functionalstorage/recipes/cherry_1.json deleted file mode 100644 index 2a960f5d..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/cherry_1.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:cherry_1" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:cherry_planks" - } - }, - "pattern": [ - "PPP", - "PCP", - "PPP" - ], - "result": { - "item": "functionalstorage:cherry_1" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/cherry_2.json b/src/generated/resources/data/functionalstorage/recipes/cherry_2.json deleted file mode 100644 index 8de7a0c8..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/cherry_2.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:cherry_2" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:cherry_planks" - } - }, - "pattern": [ - "PCP", - "PPP", - "PCP" - ], - "result": { - "count": 2, - "item": "functionalstorage:cherry_2" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/cherry_4.json b/src/generated/resources/data/functionalstorage/recipes/cherry_4.json deleted file mode 100644 index e98dba35..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/cherry_4.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:cherry_4" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:cherry_planks" - } - }, - "pattern": [ - "CPC", - "PPP", - "CPC" - ], - "result": { - "count": 4, - "item": "functionalstorage:cherry_4" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/collector_upgrade.json b/src/generated/resources/data/functionalstorage/recipes/collector_upgrade.json deleted file mode 100644 index 7be0e591..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/collector_upgrade.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:collector_upgrade" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "B": { - "item": "minecraft:hopper" - }, - "D": { - "tag": "functionalstorage:drawer" - }, - "I": { - "tag": "forge:stone" - }, - "R": { - "tag": "forge:dusts/redstone" - } - }, - "pattern": [ - "IBI", - "RDR", - "IBI" - ], - "result": { - "item": "functionalstorage:collector_upgrade" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/compacting_drawer.json b/src/generated/resources/data/functionalstorage/recipes/compacting_drawer.json deleted file mode 100644 index 4f906313..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/compacting_drawer.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:compacting_drawer" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "tag": "functionalstorage:drawer" - }, - "I": { - "tag": "forge:ingots/iron" - }, - "P": { - "item": "minecraft:piston" - }, - "S": { - "item": "minecraft:stone" - } - }, - "pattern": [ - "SSS", - "PDP", - "SIS" - ], - "result": { - "item": "functionalstorage:compacting_drawer" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/compacting_framed_drawer.json b/src/generated/resources/data/functionalstorage/recipes/compacting_framed_drawer.json deleted file mode 100644 index 5c58e9fb..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/compacting_framed_drawer.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:compacting_framed_drawer" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "tag": "functionalstorage:drawer" - }, - "I": { - "tag": "forge:ingots/iron" - }, - "P": { - "item": "minecraft:piston" - }, - "S": { - "item": "minecraft:iron_nugget" - } - }, - "pattern": [ - "SSS", - "PDP", - "SIS" - ], - "result": { - "item": "functionalstorage:compacting_framed_drawer" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/configuration_tool.json b/src/generated/resources/data/functionalstorage/recipes/configuration_tool.json deleted file mode 100644 index 4405a060..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/configuration_tool.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:configuration_tool" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "tag": "functionalstorage:drawer" - }, - "E": { - "item": "minecraft:emerald" - }, - "G": { - "tag": "forge:ingots/gold" - }, - "P": { - "item": "minecraft:paper" - } - }, - "pattern": [ - "PPG", - "PDG", - "PEP" - ], - "result": { - "item": "functionalstorage:configuration_tool" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/controller_extension.json b/src/generated/resources/data/functionalstorage/recipes/controller_extension.json deleted file mode 100644 index c33eb9cc..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/controller_extension.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:controller_extension" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "B": { - "tag": "forge:storage_blocks/quartz" - }, - "C": { - "tag": "functionalstorage:drawer" - }, - "D": { - "item": "minecraft:repeater" - }, - "I": { - "tag": "forge:stone" - } - }, - "pattern": [ - "IBI", - "CDC", - "IBI" - ], - "result": { - "item": "functionalstorage:controller_extension" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/copper_upgrade.json b/src/generated/resources/data/functionalstorage/recipes/copper_upgrade.json deleted file mode 100644 index 0ed9cee6..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/copper_upgrade.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:copper_upgrade" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "B": { - "item": "minecraft:copper_block" - }, - "C": { - "tag": "forge:chests/wooden" - }, - "D": { - "tag": "functionalstorage:drawer" - }, - "I": { - "item": "minecraft:copper_ingot" - } - }, - "pattern": [ - "IBI", - "CDC", - "IBI" - ], - "result": { - "item": "functionalstorage:copper_upgrade" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/crimson_1.json b/src/generated/resources/data/functionalstorage/recipes/crimson_1.json deleted file mode 100644 index be8f62c2..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/crimson_1.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:crimson_1" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:crimson_planks" - } - }, - "pattern": [ - "PPP", - "PCP", - "PPP" - ], - "result": { - "item": "functionalstorage:crimson_1" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/crimson_2.json b/src/generated/resources/data/functionalstorage/recipes/crimson_2.json deleted file mode 100644 index a56ef6f6..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/crimson_2.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:crimson_2" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:crimson_planks" - } - }, - "pattern": [ - "PCP", - "PPP", - "PCP" - ], - "result": { - "count": 2, - "item": "functionalstorage:crimson_2" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/crimson_4.json b/src/generated/resources/data/functionalstorage/recipes/crimson_4.json deleted file mode 100644 index 5ddbd705..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/crimson_4.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:crimson_4" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:crimson_planks" - } - }, - "pattern": [ - "CPC", - "PPP", - "CPC" - ], - "result": { - "count": 4, - "item": "functionalstorage:crimson_4" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/custom_compacting/amethyst.json b/src/generated/resources/data/functionalstorage/recipes/custom_compacting/amethyst.json deleted file mode 100644 index f7fd2685..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/custom_compacting/amethyst.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "type": "functionalstorage:custom_compacting", - "higher_input": { - "count": 1, - "item": "minecraft:amethyst_block" - }, - "lower_input": { - "count": 4, - "item": "minecraft:amethyst_shard" - } -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/dark_oak_1.json b/src/generated/resources/data/functionalstorage/recipes/dark_oak_1.json deleted file mode 100644 index 717797a6..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/dark_oak_1.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:dark_oak_1" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:dark_oak_planks" - } - }, - "pattern": [ - "PPP", - "PCP", - "PPP" - ], - "result": { - "item": "functionalstorage:dark_oak_1" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/dark_oak_2.json b/src/generated/resources/data/functionalstorage/recipes/dark_oak_2.json deleted file mode 100644 index e9a7b95b..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/dark_oak_2.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:dark_oak_2" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:dark_oak_planks" - } - }, - "pattern": [ - "PCP", - "PPP", - "PCP" - ], - "result": { - "count": 2, - "item": "functionalstorage:dark_oak_2" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/dark_oak_4.json b/src/generated/resources/data/functionalstorage/recipes/dark_oak_4.json deleted file mode 100644 index cfa43d4a..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/dark_oak_4.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:dark_oak_4" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:dark_oak_planks" - } - }, - "pattern": [ - "CPC", - "PPP", - "CPC" - ], - "result": { - "count": 4, - "item": "functionalstorage:dark_oak_4" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/diamond_upgrade.json b/src/generated/resources/data/functionalstorage/recipes/diamond_upgrade.json deleted file mode 100644 index 4980fd3c..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/diamond_upgrade.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:diamond_upgrade" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "B": { - "tag": "forge:storage_blocks/diamond" - }, - "C": { - "tag": "forge:chests/wooden" - }, - "D": { - "item": "functionalstorage:gold_upgrade" - }, - "I": { - "tag": "forge:gems/diamond" - } - }, - "pattern": [ - "IBI", - "CDC", - "IBI" - ], - "result": { - "item": "functionalstorage:diamond_upgrade" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/ender_drawer.json b/src/generated/resources/data/functionalstorage/recipes/ender_drawer.json deleted file mode 100644 index 8bcf18de..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/ender_drawer.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:ender_drawer" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/ender" - }, - "L": { - "tag": "functionalstorage:drawer" - }, - "P": { - "tag": "minecraft:planks" - } - }, - "pattern": [ - "PPP", - "LCL", - "PPP" - ], - "result": { - "item": "functionalstorage:ender_drawer" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/fluid_1.json b/src/generated/resources/data/functionalstorage/recipes/fluid_1.json deleted file mode 100644 index 93600515..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/fluid_1.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:fluid_1" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "item": "minecraft:bucket" - }, - "P": { - "tag": "minecraft:planks" - } - }, - "pattern": [ - "PPP", - "PCP", - "PPP" - ], - "result": { - "item": "functionalstorage:fluid_1" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/fluid_2.json b/src/generated/resources/data/functionalstorage/recipes/fluid_2.json deleted file mode 100644 index 820214ed..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/fluid_2.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:fluid_2" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "item": "minecraft:bucket" - }, - "P": { - "tag": "minecraft:planks" - } - }, - "pattern": [ - "PCP", - "PPP", - "PCP" - ], - "result": { - "count": 2, - "item": "functionalstorage:fluid_2" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/fluid_4.json b/src/generated/resources/data/functionalstorage/recipes/fluid_4.json deleted file mode 100644 index d464e183..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/fluid_4.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:fluid_4" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "item": "minecraft:bucket" - }, - "P": { - "tag": "minecraft:planks" - } - }, - "pattern": [ - "CPC", - "PPP", - "CPC" - ], - "result": { - "count": 4, - "item": "functionalstorage:fluid_4" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/framed_1.json b/src/generated/resources/data/functionalstorage/recipes/framed_1.json deleted file mode 100644 index 67c60ead..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/framed_1.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:framed_1" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:iron_nugget" - } - }, - "pattern": [ - "PPP", - "PCP", - "PPP" - ], - "result": { - "item": "functionalstorage:framed_1" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/framed_2.json b/src/generated/resources/data/functionalstorage/recipes/framed_2.json deleted file mode 100644 index 55720fb0..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/framed_2.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:framed_2" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:iron_nugget" - } - }, - "pattern": [ - "PCP", - "PPP", - "PCP" - ], - "result": { - "count": 2, - "item": "functionalstorage:framed_2" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/framed_4.json b/src/generated/resources/data/functionalstorage/recipes/framed_4.json deleted file mode 100644 index 578b3e3a..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/framed_4.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:framed_4" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:iron_nugget" - } - }, - "pattern": [ - "CPC", - "PPP", - "CPC" - ], - "result": { - "count": 4, - "item": "functionalstorage:framed_4" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/framed_controller_extension.json b/src/generated/resources/data/functionalstorage/recipes/framed_controller_extension.json deleted file mode 100644 index 25b69069..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/framed_controller_extension.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:framed_controller_extension" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "B": { - "tag": "forge:storage_blocks/quartz" - }, - "C": { - "tag": "functionalstorage:drawer" - }, - "D": { - "item": "minecraft:repeater" - }, - "I": { - "item": "minecraft:iron_nugget" - } - }, - "pattern": [ - "IBI", - "CDC", - "IBI" - ], - "result": { - "item": "functionalstorage:framed_controller_extension" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/framed_simple_compacting_drawer.json b/src/generated/resources/data/functionalstorage/recipes/framed_simple_compacting_drawer.json deleted file mode 100644 index dd960697..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/framed_simple_compacting_drawer.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:framed_simple_compacting_drawer" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "tag": "functionalstorage:drawer" - }, - "I": { - "tag": "forge:ingots/iron" - }, - "P": { - "item": "minecraft:piston" - }, - "S": { - "item": "minecraft:iron_nugget" - } - }, - "pattern": [ - "SSS", - "SDP", - "SIS" - ], - "result": { - "item": "functionalstorage:framed_simple_compacting_drawer" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/framed_storage_controller.json b/src/generated/resources/data/functionalstorage/recipes/framed_storage_controller.json deleted file mode 100644 index 75aeb358..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/framed_storage_controller.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:framed_storage_controller" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "B": { - "tag": "forge:storage_blocks/quartz" - }, - "C": { - "tag": "functionalstorage:drawer" - }, - "D": { - "item": "minecraft:comparator" - }, - "I": { - "item": "minecraft:iron_nugget" - } - }, - "pattern": [ - "IBI", - "CDC", - "IBI" - ], - "result": { - "item": "functionalstorage:framed_storage_controller" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/gold_upgrade.json b/src/generated/resources/data/functionalstorage/recipes/gold_upgrade.json deleted file mode 100644 index 1d289796..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/gold_upgrade.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:gold_upgrade" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "B": { - "tag": "forge:storage_blocks/gold" - }, - "C": { - "tag": "forge:chests/wooden" - }, - "D": { - "item": "functionalstorage:copper_upgrade" - }, - "I": { - "tag": "forge:ingots/gold" - } - }, - "pattern": [ - "IBI", - "CDC", - "BIB" - ], - "result": { - "item": "functionalstorage:gold_upgrade" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/iron_downgrade.json b/src/generated/resources/data/functionalstorage/recipes/iron_downgrade.json deleted file mode 100644 index e780272d..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/iron_downgrade.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:iron_downgrade" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "tag": "functionalstorage:drawer" - }, - "I": { - "tag": "forge:ingots/iron" - } - }, - "pattern": [ - "III", - "IDI", - "III" - ], - "result": { - "item": "functionalstorage:iron_downgrade" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/jungle_1.json b/src/generated/resources/data/functionalstorage/recipes/jungle_1.json deleted file mode 100644 index 6b37be4d..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/jungle_1.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:jungle_1" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:jungle_planks" - } - }, - "pattern": [ - "PPP", - "PCP", - "PPP" - ], - "result": { - "item": "functionalstorage:jungle_1" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/jungle_2.json b/src/generated/resources/data/functionalstorage/recipes/jungle_2.json deleted file mode 100644 index 4690a3c8..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/jungle_2.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:jungle_2" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:jungle_planks" - } - }, - "pattern": [ - "PCP", - "PPP", - "PCP" - ], - "result": { - "count": 2, - "item": "functionalstorage:jungle_2" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/jungle_4.json b/src/generated/resources/data/functionalstorage/recipes/jungle_4.json deleted file mode 100644 index c983298f..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/jungle_4.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:jungle_4" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:jungle_planks" - } - }, - "pattern": [ - "CPC", - "PPP", - "CPC" - ], - "result": { - "count": 4, - "item": "functionalstorage:jungle_4" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/linking_tool.json b/src/generated/resources/data/functionalstorage/recipes/linking_tool.json deleted file mode 100644 index 6d269f9d..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/linking_tool.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:linking_tool" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "tag": "functionalstorage:drawer" - }, - "E": { - "item": "minecraft:diamond" - }, - "G": { - "tag": "forge:ingots/gold" - }, - "P": { - "item": "minecraft:paper" - } - }, - "pattern": [ - "PPG", - "PDG", - "PEP" - ], - "result": { - "item": "functionalstorage:linking_tool" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/mangrove_1.json b/src/generated/resources/data/functionalstorage/recipes/mangrove_1.json deleted file mode 100644 index 51beba7d..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/mangrove_1.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:mangrove_1" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:mangrove_planks" - } - }, - "pattern": [ - "PPP", - "PCP", - "PPP" - ], - "result": { - "item": "functionalstorage:mangrove_1" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/mangrove_2.json b/src/generated/resources/data/functionalstorage/recipes/mangrove_2.json deleted file mode 100644 index 7cb544bc..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/mangrove_2.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:mangrove_2" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:mangrove_planks" - } - }, - "pattern": [ - "PCP", - "PPP", - "PCP" - ], - "result": { - "count": 2, - "item": "functionalstorage:mangrove_2" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/mangrove_4.json b/src/generated/resources/data/functionalstorage/recipes/mangrove_4.json deleted file mode 100644 index df47a6ca..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/mangrove_4.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:mangrove_4" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:mangrove_planks" - } - }, - "pattern": [ - "CPC", - "PPP", - "CPC" - ], - "result": { - "count": 4, - "item": "functionalstorage:mangrove_4" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/oak_1.json b/src/generated/resources/data/functionalstorage/recipes/oak_1.json deleted file mode 100644 index 972eeaa6..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/oak_1.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:oak_1" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:oak_planks" - } - }, - "pattern": [ - "PPP", - "PCP", - "PPP" - ], - "result": { - "item": "functionalstorage:oak_1" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/oak_2.json b/src/generated/resources/data/functionalstorage/recipes/oak_2.json deleted file mode 100644 index cd471f21..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/oak_2.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:oak_2" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:oak_planks" - } - }, - "pattern": [ - "PCP", - "PPP", - "PCP" - ], - "result": { - "count": 2, - "item": "functionalstorage:oak_2" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/oak_4.json b/src/generated/resources/data/functionalstorage/recipes/oak_4.json deleted file mode 100644 index 9cfd9364..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/oak_4.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:oak_4" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:oak_planks" - } - }, - "pattern": [ - "CPC", - "PPP", - "CPC" - ], - "result": { - "count": 4, - "item": "functionalstorage:oak_4" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/oak_drawer_alternate_x1.json b/src/generated/resources/data/functionalstorage/recipes/oak_drawer_alternate_x1.json deleted file mode 100644 index d91c8733..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/oak_drawer_alternate_x1.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:oak_1" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "type": "functionalstorage:woodless" - } - }, - "pattern": [ - "PPP", - "PCP", - "PPP" - ], - "result": { - "item": "functionalstorage:oak_1" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/oak_drawer_alternate_x2.json b/src/generated/resources/data/functionalstorage/recipes/oak_drawer_alternate_x2.json deleted file mode 100644 index 46a82bd7..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/oak_drawer_alternate_x2.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:oak_2" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "type": "functionalstorage:woodless" - } - }, - "pattern": [ - "PCP", - "PPP", - "PCP" - ], - "result": { - "count": 2, - "item": "functionalstorage:oak_2" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/oak_drawer_alternate_x4.json b/src/generated/resources/data/functionalstorage/recipes/oak_drawer_alternate_x4.json deleted file mode 100644 index a9629e56..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/oak_drawer_alternate_x4.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:oak_4" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "type": "functionalstorage:woodless" - } - }, - "pattern": [ - "CPC", - "PPP", - "CPC" - ], - "result": { - "count": 4, - "item": "functionalstorage:oak_4" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/puller_upgrade.json b/src/generated/resources/data/functionalstorage/recipes/puller_upgrade.json deleted file mode 100644 index 6eb464bc..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/puller_upgrade.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:puller_upgrade" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "B": { - "tag": "forge:dusts/redstone" - }, - "C": { - "item": "minecraft:hopper" - }, - "D": { - "tag": "functionalstorage:drawer" - }, - "I": { - "tag": "forge:stone" - } - }, - "pattern": [ - "ICI", - "IDI", - "IBI" - ], - "result": { - "item": "functionalstorage:puller_upgrade" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/pusher_upgrade.json b/src/generated/resources/data/functionalstorage/recipes/pusher_upgrade.json deleted file mode 100644 index 8504461d..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/pusher_upgrade.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:pusher_upgrade" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "B": { - "tag": "forge:dusts/redstone" - }, - "D": { - "tag": "functionalstorage:drawer" - }, - "I": { - "tag": "forge:stone" - }, - "R": { - "item": "minecraft:hopper" - } - }, - "pattern": [ - "IBI", - "IDI", - "IRI" - ], - "result": { - "item": "functionalstorage:pusher_upgrade" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/redstone_upgrade.json b/src/generated/resources/data/functionalstorage/recipes/redstone_upgrade.json deleted file mode 100644 index cc739a8c..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/redstone_upgrade.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:redstone_upgrade" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "B": { - "item": "minecraft:redstone_block" - }, - "C": { - "item": "minecraft:comparator" - }, - "D": { - "tag": "functionalstorage:drawer" - }, - "I": { - "item": "minecraft:redstone" - } - }, - "pattern": [ - "IBI", - "CDC", - "IBI" - ], - "result": { - "item": "functionalstorage:redstone_upgrade" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/simple_compacting_drawer.json b/src/generated/resources/data/functionalstorage/recipes/simple_compacting_drawer.json deleted file mode 100644 index 342cc6e2..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/simple_compacting_drawer.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:simple_compacting_drawer" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "tag": "functionalstorage:drawer" - }, - "I": { - "tag": "forge:ingots/iron" - }, - "P": { - "item": "minecraft:piston" - }, - "S": { - "item": "minecraft:stone" - } - }, - "pattern": [ - "SSS", - "SDP", - "SIS" - ], - "result": { - "item": "functionalstorage:simple_compacting_drawer" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/spruce_1.json b/src/generated/resources/data/functionalstorage/recipes/spruce_1.json deleted file mode 100644 index 2848d38a..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/spruce_1.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:spruce_1" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:spruce_planks" - } - }, - "pattern": [ - "PPP", - "PCP", - "PPP" - ], - "result": { - "item": "functionalstorage:spruce_1" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/spruce_2.json b/src/generated/resources/data/functionalstorage/recipes/spruce_2.json deleted file mode 100644 index 4e5cc9d6..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/spruce_2.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:spruce_2" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:spruce_planks" - } - }, - "pattern": [ - "PCP", - "PPP", - "PCP" - ], - "result": { - "count": 2, - "item": "functionalstorage:spruce_2" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/spruce_4.json b/src/generated/resources/data/functionalstorage/recipes/spruce_4.json deleted file mode 100644 index 06839516..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/spruce_4.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:spruce_4" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:spruce_planks" - } - }, - "pattern": [ - "CPC", - "PPP", - "CPC" - ], - "result": { - "count": 4, - "item": "functionalstorage:spruce_4" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/storage_controller.json b/src/generated/resources/data/functionalstorage/recipes/storage_controller.json deleted file mode 100644 index 390ad4f9..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/storage_controller.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:storage_controller" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "B": { - "tag": "forge:storage_blocks/quartz" - }, - "C": { - "tag": "functionalstorage:drawer" - }, - "D": { - "item": "minecraft:comparator" - }, - "I": { - "tag": "forge:stone" - } - }, - "pattern": [ - "IBI", - "CDC", - "IBI" - ], - "result": { - "item": "functionalstorage:storage_controller" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/void_upgrade.json b/src/generated/resources/data/functionalstorage/recipes/void_upgrade.json deleted file mode 100644 index 2c03ed46..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/void_upgrade.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:void_upgrade" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "tag": "functionalstorage:drawer" - }, - "I": { - "tag": "forge:obsidian" - } - }, - "pattern": [ - "III", - "IDI", - "III" - ], - "result": { - "item": "functionalstorage:void_upgrade" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/warped_1.json b/src/generated/resources/data/functionalstorage/recipes/warped_1.json deleted file mode 100644 index d08394da..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/warped_1.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:warped_1" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:warped_planks" - } - }, - "pattern": [ - "PPP", - "PCP", - "PPP" - ], - "result": { - "item": "functionalstorage:warped_1" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/warped_2.json b/src/generated/resources/data/functionalstorage/recipes/warped_2.json deleted file mode 100644 index 0ba3ae18..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/warped_2.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:warped_2" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:warped_planks" - } - }, - "pattern": [ - "PCP", - "PPP", - "PCP" - ], - "result": { - "count": 2, - "item": "functionalstorage:warped_2" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/warped_4.json b/src/generated/resources/data/functionalstorage/recipes/warped_4.json deleted file mode 100644 index 353cdf26..00000000 --- a/src/generated/resources/data/functionalstorage/recipes/warped_4.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "forge:and", - "values": [ - { - "type": "forge:item_exists", - "item": "functionalstorage:warped_4" - } - ] - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "tag": "forge:chests/wooden" - }, - "P": { - "item": "minecraft:warped_planks" - } - }, - "pattern": [ - "CPC", - "PPP", - "CPC" - ], - "result": { - "count": 4, - "item": "functionalstorage:warped_4" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/tags/items/drawer.json b/src/generated/resources/data/functionalstorage/tags/item/drawer.json similarity index 100% rename from src/generated/resources/data/functionalstorage/tags/items/drawer.json rename to src/generated/resources/data/functionalstorage/tags/item/drawer.json diff --git a/src/generated/resources/data/functionalstorage/recipes/custom_compacting/glowstone.json b/src/generated/resources/data/minecraft/recipe/functionalstorage/compacting/amethyst.json similarity index 64% rename from src/generated/resources/data/functionalstorage/recipes/custom_compacting/glowstone.json rename to src/generated/resources/data/minecraft/recipe/functionalstorage/compacting/amethyst.json index ad792d87..35b2b498 100644 --- a/src/generated/resources/data/functionalstorage/recipes/custom_compacting/glowstone.json +++ b/src/generated/resources/data/minecraft/recipe/functionalstorage/compacting/amethyst.json @@ -2,10 +2,10 @@ "type": "functionalstorage:custom_compacting", "higher_input": { "count": 1, - "item": "minecraft:glowstone" + "id": "minecraft:amethyst_block" }, "lower_input": { "count": 4, - "item": "minecraft:glowstone_dust" + "id": "minecraft:amethyst_shard" } } \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/custom_compacting/quartz.json b/src/generated/resources/data/minecraft/recipe/functionalstorage/compacting/glowstone.json similarity index 65% rename from src/generated/resources/data/functionalstorage/recipes/custom_compacting/quartz.json rename to src/generated/resources/data/minecraft/recipe/functionalstorage/compacting/glowstone.json index a2057b77..3890a5b8 100644 --- a/src/generated/resources/data/functionalstorage/recipes/custom_compacting/quartz.json +++ b/src/generated/resources/data/minecraft/recipe/functionalstorage/compacting/glowstone.json @@ -2,10 +2,10 @@ "type": "functionalstorage:custom_compacting", "higher_input": { "count": 1, - "item": "minecraft:quartz_block" + "id": "minecraft:glowstone" }, "lower_input": { "count": 4, - "item": "minecraft:quartz" + "id": "minecraft:glowstone_dust" } } \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/custom_compacting/ice.json b/src/generated/resources/data/minecraft/recipe/functionalstorage/compacting/ice.json similarity index 67% rename from src/generated/resources/data/functionalstorage/recipes/custom_compacting/ice.json rename to src/generated/resources/data/minecraft/recipe/functionalstorage/compacting/ice.json index 4b13a104..c978d3d0 100644 --- a/src/generated/resources/data/functionalstorage/recipes/custom_compacting/ice.json +++ b/src/generated/resources/data/minecraft/recipe/functionalstorage/compacting/ice.json @@ -2,10 +2,10 @@ "type": "functionalstorage:custom_compacting", "higher_input": { "count": 1, - "item": "minecraft:packed_ice" + "id": "minecraft:packed_ice" }, "lower_input": { "count": 9, - "item": "minecraft:ice" + "id": "minecraft:ice" } } \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/custom_compacting/melon.json b/src/generated/resources/data/minecraft/recipe/functionalstorage/compacting/melon.json similarity index 66% rename from src/generated/resources/data/functionalstorage/recipes/custom_compacting/melon.json rename to src/generated/resources/data/minecraft/recipe/functionalstorage/compacting/melon.json index 71eb8163..51ba76c3 100644 --- a/src/generated/resources/data/functionalstorage/recipes/custom_compacting/melon.json +++ b/src/generated/resources/data/minecraft/recipe/functionalstorage/compacting/melon.json @@ -2,10 +2,10 @@ "type": "functionalstorage:custom_compacting", "higher_input": { "count": 1, - "item": "minecraft:melon" + "id": "minecraft:melon" }, "lower_input": { "count": 9, - "item": "minecraft:melon_slice" + "id": "minecraft:melon_slice" } } \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/custom_compacting/packed_ice.json b/src/generated/resources/data/minecraft/recipe/functionalstorage/compacting/packed_ice.json similarity index 66% rename from src/generated/resources/data/functionalstorage/recipes/custom_compacting/packed_ice.json rename to src/generated/resources/data/minecraft/recipe/functionalstorage/compacting/packed_ice.json index 9ff67aad..04936133 100644 --- a/src/generated/resources/data/functionalstorage/recipes/custom_compacting/packed_ice.json +++ b/src/generated/resources/data/minecraft/recipe/functionalstorage/compacting/packed_ice.json @@ -2,10 +2,10 @@ "type": "functionalstorage:custom_compacting", "higher_input": { "count": 1, - "item": "minecraft:blue_ice" + "id": "minecraft:blue_ice" }, "lower_input": { "count": 9, - "item": "minecraft:packed_ice" + "id": "minecraft:packed_ice" } } \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/custom_compacting/clay.json b/src/generated/resources/data/minecraft/recipe/functionalstorage/compacting/quartz.json similarity index 67% rename from src/generated/resources/data/functionalstorage/recipes/custom_compacting/clay.json rename to src/generated/resources/data/minecraft/recipe/functionalstorage/compacting/quartz.json index 892ee345..44f3a38d 100644 --- a/src/generated/resources/data/functionalstorage/recipes/custom_compacting/clay.json +++ b/src/generated/resources/data/minecraft/recipe/functionalstorage/compacting/quartz.json @@ -2,10 +2,10 @@ "type": "functionalstorage:custom_compacting", "higher_input": { "count": 1, - "item": "minecraft:clay" + "id": "minecraft:quartz_block" }, "lower_input": { "count": 4, - "item": "minecraft:clay_ball" + "id": "minecraft:quartz" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/tags/blocks/mineable/axe.json b/src/generated/resources/data/minecraft/tags/block/mineable/axe.json similarity index 100% rename from src/generated/resources/data/minecraft/tags/blocks/mineable/axe.json rename to src/generated/resources/data/minecraft/tags/block/mineable/axe.json diff --git a/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json b/src/generated/resources/data/minecraft/tags/block/mineable/pickaxe.json similarity index 100% rename from src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json rename to src/generated/resources/data/minecraft/tags/block/mineable/pickaxe.json diff --git a/src/main/java/com/buuz135/functionalstorage/FunctionalStorage.java b/src/main/java/com/buuz135/functionalstorage/FunctionalStorage.java index 77bb76e3..57eb1eee 100644 --- a/src/main/java/com/buuz135/functionalstorage/FunctionalStorage.java +++ b/src/main/java/com/buuz135/functionalstorage/FunctionalStorage.java @@ -1,14 +1,48 @@ package com.buuz135.functionalstorage; -import com.buuz135.functionalstorage.block.*; -import com.buuz135.functionalstorage.block.tile.*; -import com.buuz135.functionalstorage.client.*; +import com.buuz135.functionalstorage.block.ArmoryCabinetBlock; +import com.buuz135.functionalstorage.block.CompactingDrawerBlock; +import com.buuz135.functionalstorage.block.CompactingFramedDrawerBlock; +import com.buuz135.functionalstorage.block.ControllerExtensionBlock; +import com.buuz135.functionalstorage.block.Drawer; +import com.buuz135.functionalstorage.block.DrawerBlock; +import com.buuz135.functionalstorage.block.DrawerControllerBlock; +import com.buuz135.functionalstorage.block.EnderDrawerBlock; +import com.buuz135.functionalstorage.block.FluidDrawerBlock; +import com.buuz135.functionalstorage.block.FramedBlock; +import com.buuz135.functionalstorage.block.FramedControllerExtensionBlock; +import com.buuz135.functionalstorage.block.FramedDrawerBlock; +import com.buuz135.functionalstorage.block.FramedDrawerControllerBlock; +import com.buuz135.functionalstorage.block.FramedSimpleCompactingDrawerBlock; +import com.buuz135.functionalstorage.block.SimpleCompactingDrawerBlock; +import com.buuz135.functionalstorage.block.tile.CompactingDrawerTile; +import com.buuz135.functionalstorage.block.tile.CompactingFramedDrawerTile; +import com.buuz135.functionalstorage.block.tile.DrawerControllerTile; +import com.buuz135.functionalstorage.block.tile.DrawerTile; +import com.buuz135.functionalstorage.block.tile.EnderDrawerTile; +import com.buuz135.functionalstorage.block.tile.FluidDrawerTile; +import com.buuz135.functionalstorage.block.tile.FramedDrawerControllerTile; +import com.buuz135.functionalstorage.block.tile.FramedDrawerTile; +import com.buuz135.functionalstorage.block.tile.FramedSimpleCompactingDrawerTile; +import com.buuz135.functionalstorage.block.tile.SimpleCompactingDrawerTile; +import com.buuz135.functionalstorage.client.ClientSetup; +import com.buuz135.functionalstorage.client.CompactingDrawerRenderer; +import com.buuz135.functionalstorage.client.ControllerRenderer; +import com.buuz135.functionalstorage.client.DrawerRenderer; +import com.buuz135.functionalstorage.client.EnderDrawerRenderer; +import com.buuz135.functionalstorage.client.FluidDrawerRenderer; +import com.buuz135.functionalstorage.client.SimpleCompactingDrawerRenderer; import com.buuz135.functionalstorage.client.loader.FramedModel; -import com.buuz135.functionalstorage.data.*; +import com.buuz135.functionalstorage.data.FunctionalStorageBlockTagsProvider; +import com.buuz135.functionalstorage.data.FunctionalStorageBlockstateProvider; +import com.buuz135.functionalstorage.data.FunctionalStorageItemTagsProvider; +import com.buuz135.functionalstorage.data.FunctionalStorageLangProvider; +import com.buuz135.functionalstorage.data.FunctionalStorageRecipesProvider; import com.buuz135.functionalstorage.inventory.BigInventoryHandler; import com.buuz135.functionalstorage.inventory.item.CompactingStackItemHandler; import com.buuz135.functionalstorage.inventory.item.DrawerStackItemHandler; import com.buuz135.functionalstorage.item.ConfigurationToolItem; +import com.buuz135.functionalstorage.item.FSAttachments; import com.buuz135.functionalstorage.item.LinkingToolItem; import com.buuz135.functionalstorage.item.StorageUpgradeItem; import com.buuz135.functionalstorage.item.UpgradeItem; @@ -16,68 +50,74 @@ import com.buuz135.functionalstorage.recipe.CustomCompactingRecipe; import com.buuz135.functionalstorage.recipe.DrawerlessWoodIngredient; import com.buuz135.functionalstorage.recipe.FramedDrawerRecipe; -import com.buuz135.functionalstorage.util.*; -import com.hrznstudio.titanium.block.BasicBlock; +import com.buuz135.functionalstorage.util.DrawerWoodType; +import com.buuz135.functionalstorage.util.IWoodType; +import com.buuz135.functionalstorage.util.NumberUtils; +import com.buuz135.functionalstorage.util.TooltipUtil; import com.hrznstudio.titanium.datagenerator.loot.TitaniumLootTableProvider; import com.hrznstudio.titanium.datagenerator.model.BlockItemModelGeneratorProvider; import com.hrznstudio.titanium.event.handler.EventManager; +import com.hrznstudio.titanium.module.BlockWithTile; import com.hrznstudio.titanium.module.ModuleController; import com.hrznstudio.titanium.nbthandler.NBTManager; import com.hrznstudio.titanium.network.NetworkHandler; -import com.hrznstudio.titanium.recipe.generator.TitaniumRecipeProvider; -import com.hrznstudio.titanium.recipe.generator.TitaniumShapedRecipeBuilder; -import com.hrznstudio.titanium.tab.TitaniumTab; -import com.hrznstudio.titanium.recipe.generator.IJSONGenerator; -import com.hrznstudio.titanium.recipe.generator.IJsonFile; -import com.hrznstudio.titanium.recipe.generator.TitaniumSerializableProvider; import com.hrznstudio.titanium.recipe.serializer.GenericSerializer; +import com.hrznstudio.titanium.tab.TitaniumTab; import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.client.renderer.RenderType; -import net.minecraft.data.recipes.FinishedRecipe; -import net.minecraft.data.recipes.RecipeCategory; -import net.minecraft.data.recipes.SmithingTransformRecipeBuilder; -import net.minecraft.nbt.CompoundTag; +import net.minecraft.core.Holder; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.ItemTags; -import net.minecraft.world.inventory.InventoryMenu; +import net.minecraft.util.FastColor; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.item.crafting.SimpleCraftingRecipeSerializer; +import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockBehaviour; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.client.event.*; -import net.minecraftforge.client.model.generators.BlockModelProvider; -import net.minecraftforge.client.model.generators.ItemModelBuilder; -import net.minecraftforge.client.model.generators.ItemModelProvider; -import net.minecraftforge.client.model.generators.ModelFile; -import net.minecraftforge.common.ForgeMod; -import net.minecraftforge.common.Tags; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.crafting.CraftingHelper; -import net.minecraftforge.common.util.NonNullLazy; -import net.minecraftforge.data.event.GatherDataEvent; -import net.minecraftforge.event.level.BlockEvent; -import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; -import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegistryObject; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; +import net.neoforged.bus.api.EventPriority; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.ModContainer; +import net.neoforged.fml.ModLoadingContext; +import net.neoforged.fml.common.Mod; +import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent; +import net.neoforged.neoforge.capabilities.Capabilities; +import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent; +import net.neoforged.neoforge.client.event.EntityRenderersEvent; +import net.neoforged.neoforge.client.event.ModelEvent; +import net.neoforged.neoforge.client.event.RegisterColorHandlersEvent; +import net.neoforged.neoforge.client.event.RenderTooltipEvent; +import net.neoforged.neoforge.client.model.generators.BlockModelProvider; +import net.neoforged.neoforge.client.model.generators.ItemModelBuilder; +import net.neoforged.neoforge.client.model.generators.ItemModelProvider; +import net.neoforged.neoforge.client.model.generators.ModelFile; +import net.neoforged.neoforge.common.NeoForgeMod; +import net.neoforged.neoforge.common.crafting.IngredientType; +import net.neoforged.neoforge.common.util.Lazy; +import net.neoforged.neoforge.data.event.GatherDataEvent; +import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent; +import net.neoforged.neoforge.registries.DeferredHolder; +import net.neoforged.neoforge.registries.NeoForgeRegistries; +import net.neoforged.neoforge.registries.RegisterEvent; import org.apache.commons.lang3.tuple.Pair; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import java.awt.*; +import java.awt.Color; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; -import java.util.*; +import java.util.Locale; +import java.util.Optional; import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.function.Consumer; import java.util.function.Function; import java.util.stream.Collectors; @@ -89,95 +129,93 @@ public class FunctionalStorage extends ModuleController { public static NetworkHandler NETWORK = new NetworkHandler(MOD_ID); static { - NETWORK.registerMessage(EnderDrawerSyncMessage.class); + NETWORK.registerMessage("ender_drawer_sync", EnderDrawerSyncMessage.class); } // Directly reference a log4j logger. - public static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogManager.getLogger(); public static ConcurrentLinkedQueue WOOD_TYPES = new ConcurrentLinkedQueue<>(); - public static HashMap, RegistryObject>>>> DRAWER_TYPES = new HashMap<>(); - public static Pair, RegistryObject>> COMPACTING_DRAWER; - public static Pair, RegistryObject>> DRAWER_CONTROLLER; - public static Pair, RegistryObject>> ARMORY_CABINET; - public static Pair, RegistryObject>> ENDER_DRAWER; - public static Pair, RegistryObject>> FRAMED_COMPACTING_DRAWER; - public static Pair, RegistryObject>> FLUID_DRAWER_1; - public static Pair, RegistryObject>> FLUID_DRAWER_2; - public static Pair, RegistryObject>> FLUID_DRAWER_4; - public static Pair, RegistryObject>> CONTROLLER_EXTENSION; - public static Pair, RegistryObject>> SIMPLE_COMPACTING_DRAWER; - public static Pair, RegistryObject>> FRAMED_DRAWER_CONTROLLER; - public static Pair, RegistryObject>> FRAMED_CONTROLLER_EXTENSION; - public static Pair, RegistryObject>> FRAMED_SIMPLE_COMPACTING_DRAWER; - - - public static RegistryObject LINKING_TOOL; - public static HashMap> STORAGE_UPGRADES = new HashMap<>(); - public static RegistryObject COLLECTOR_UPGRADE; - public static RegistryObject PULLING_UPGRADE; - public static RegistryObject PUSHING_UPGRADE; - public static RegistryObject VOID_UPGRADE; - public static RegistryObject CONFIGURATION_TOOL; - public static RegistryObject REDSTONE_UPGRADE; - public static RegistryObject CREATIVE_UPGRADE; - - public static TitaniumTab TAB = new TitaniumTab(new ResourceLocation(MOD_ID, "main")); - public static RegistryObject> CUSTOM_COMPACTING_RECIPE_SERIALIZER; - public static RegistryObject> CUSTOM_COMPACTING_RECIPE_TYPE; - - - public FunctionalStorage() { - ForgeMod.enableMilkFluid(); - DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> this::onClient); - EventManager.forge(BlockEvent.BreakEvent.class).process(breakEvent -> { - if (breakEvent.getPlayer().isCreative()) { - if (breakEvent.getState().getBlock() instanceof DrawerBlock) { - int hit = ((DrawerBlock) breakEvent.getState().getBlock()).getHit(breakEvent.getState(), breakEvent.getPlayer().getCommandSenderWorld(), breakEvent.getPos(), breakEvent.getPlayer()); - if (hit != -1) { - breakEvent.setCanceled(true); - ((DrawerBlock) breakEvent.getState().getBlock()).attack(breakEvent.getState(), breakEvent.getPlayer().getCommandSenderWorld(), breakEvent.getPos(), breakEvent.getPlayer()); - } - } - if (breakEvent.getState().getBlock() instanceof CompactingDrawerBlock) { - int hit = ((CompactingDrawerBlock) breakEvent.getState().getBlock()).getHit(breakEvent.getState(), breakEvent.getPlayer().getCommandSenderWorld(), breakEvent.getPos(), breakEvent.getPlayer()); - if (hit != -1) { - breakEvent.setCanceled(true); - ((CompactingDrawerBlock) breakEvent.getState().getBlock()).attack(breakEvent.getState(), breakEvent.getPlayer().getCommandSenderWorld(), breakEvent.getPos(), breakEvent.getPlayer()); - } - } - if (breakEvent.getState().getBlock() instanceof EnderDrawerBlock) { - int hit = ((EnderDrawerBlock) breakEvent.getState().getBlock()).getHit(breakEvent.getState(), breakEvent.getPlayer().getCommandSenderWorld(), breakEvent.getPos(), breakEvent.getPlayer()); - if (hit != -1) { - breakEvent.setCanceled(true); - ((EnderDrawerBlock) breakEvent.getState().getBlock()).attack(breakEvent.getState(), breakEvent.getPlayer().getCommandSenderWorld(), breakEvent.getPos(), breakEvent.getPlayer()); - } - } - if (breakEvent.getState().getBlock() instanceof FluidDrawerBlock) { - int hit = ((FluidDrawerBlock) breakEvent.getState().getBlock()).getHit(breakEvent.getState(), breakEvent.getPlayer().getCommandSenderWorld(), breakEvent.getPos(), breakEvent.getPlayer()); - if (hit != -1) { - breakEvent.setCanceled(true); - ((FluidDrawerBlock) breakEvent.getState().getBlock()).attack(breakEvent.getState(), breakEvent.getPlayer().getCommandSenderWorld(), breakEvent.getPos(), breakEvent.getPlayer()); - } - } - if (breakEvent.getState().getBlock() instanceof SimpleCompactingDrawerBlock) { - int hit = ((SimpleCompactingDrawerBlock) breakEvent.getState().getBlock()).getHit(breakEvent.getState(), breakEvent.getPlayer().level(), breakEvent.getPos(), breakEvent.getPlayer()); - if (hit != -1) { - breakEvent.setCanceled(true); - ((SimpleCompactingDrawerBlock) breakEvent.getState().getBlock()).attack(breakEvent.getState(), breakEvent.getPlayer().level(), breakEvent.getPos(), breakEvent.getPlayer()); - } - } - } - }).subscribe(); - EventManager.mod(FMLCommonSetupEvent.class).process(fmlCommonSetupEvent -> { - CraftingHelper.register(DrawerlessWoodIngredient.NAME, DrawerlessWoodIngredient.SERIALIZER); - }).subscribe(); + public static HashMap> DRAWER_TYPES = new HashMap<>(); + public static List FRAMED_BLOCKS; + public static BlockWithTile COMPACTING_DRAWER; + public static BlockWithTile DRAWER_CONTROLLER; + public static BlockWithTile ARMORY_CABINET; + public static BlockWithTile ENDER_DRAWER; + public static BlockWithTile FRAMED_COMPACTING_DRAWER; + public static BlockWithTile FLUID_DRAWER_1; + public static BlockWithTile FLUID_DRAWER_2; + public static BlockWithTile FLUID_DRAWER_4; + public static BlockWithTile CONTROLLER_EXTENSION; + public static BlockWithTile SIMPLE_COMPACTING_DRAWER; + public static BlockWithTile FRAMED_DRAWER_CONTROLLER; + public static BlockWithTile FRAMED_CONTROLLER_EXTENSION; + public static BlockWithTile FRAMED_SIMPLE_COMPACTING_DRAWER; + + + public static DeferredHolder LINKING_TOOL; + public static HashMap> STORAGE_UPGRADES = new HashMap<>(); + public static DeferredHolder COLLECTOR_UPGRADE; + public static DeferredHolder PULLING_UPGRADE; + public static DeferredHolder PUSHING_UPGRADE; + public static DeferredHolder VOID_UPGRADE; + public static DeferredHolder CONFIGURATION_TOOL; + public static DeferredHolder REDSTONE_UPGRADE; + public static DeferredHolder CREATIVE_UPGRADE; + + public static TitaniumTab TAB = new TitaniumTab(com.buuz135.functionalstorage.util.Utils.resourceLocation(MOD_ID, "main")); + + public static Holder> CUSTOM_COMPACTING_RECIPE_SERIALIZER; + public static Holder> CUSTOM_COMPACTING_RECIPE_TYPE; + public static Holder> FRAMED_RECIPE_SERIALIZER; + public static Holder> FRAMED_RECIPE_TYPE; + + public FunctionalStorage(Dist dist, IEventBus modBus, ModContainer container) { + super(container); + NeoForgeMod.enableMilkFluid(); + FSAttachments.DR.register(modBus); + if (dist.isClient()) { + Runnable runnable = this::onClient; + runnable.run(); + } NBTManager.getInstance().scanTileClassForAnnotations(FramedDrawerTile.class); NBTManager.getInstance().scanTileClassForAnnotations(CompactingFramedDrawerTile.class); NBTManager.getInstance().scanTileClassForAnnotations(FluidDrawerTile.class); NBTManager.getInstance().scanTileClassForAnnotations(SimpleCompactingDrawerTile.class); NBTManager.getInstance().scanTileClassForAnnotations(FramedSimpleCompactingDrawerTile.class); + + EventManager.forge(PlayerInteractEvent.LeftClickBlock.class) + .process(event -> { + var state = event.getLevel().getBlockState(event.getPos()); + if (event.getLevel().getBlockState(event.getPos()).getBlock() instanceof Drawer drawer) { + final int hit = drawer.getHit(state, event.getLevel(), event.getEntity()); + if (hit != -1) { + var be = drawer.getBlockEntityAt(event.getLevel(), event.getPos()); + if (be != null) { + be.onClicked(event.getEntity(), hit); + event.setCanceled(true); + } + } + } + }) + .subscribe(); + + modBus.addListener((final RegisterCapabilitiesEvent event) -> { + event.registerItem(Capabilities.ItemHandler.ITEM, (object, context) -> { + if (object.getItem() instanceof DrawerBlock.DrawerItem di) { + return di.initCapabilities(object); + } + return null; + }, DRAWER_TYPES.values().stream().flatMap(List::stream).map(bl -> (ItemLike)bl.block().get()).toArray(ItemLike[]::new)); + + event.registerItem(Capabilities.ItemHandler.ITEM, (object, context) -> { + if (object.getItem() instanceof CompactingDrawerBlock.CompactingDrawerItem di) { + return di.initCapabilities(object); + } + return null; + }, COMPACTING_DRAWER.asItem(), SIMPLE_COMPACTING_DRAWER.asItem(), FRAMED_COMPACTING_DRAWER.asItem(), FRAMED_SIMPLE_COMPACTING_DRAWER.asItem()); + }); } @@ -192,18 +230,18 @@ protected void initModules() { new DrawerBlock.DrawerItem((DrawerBlock) blockRegistryObject.get(), new Item.Properties(), TAB),TAB); DRAWER_TYPES.computeIfAbsent(value, drawerType -> new ArrayList<>()).add(pair); } else { - DRAWER_TYPES.computeIfAbsent(value, drawerType -> new ArrayList<>()).add(getRegistries().registerBlockWithTileItem(name, () -> new DrawerBlock(woodType, value, BlockBehaviour.Properties.copy(woodType.getPlanks())), blockRegistryObject -> () -> + DRAWER_TYPES.computeIfAbsent(value, drawerType -> new ArrayList<>()).add(getRegistries().registerBlockWithTileItem(name, () -> new DrawerBlock(woodType, value, BlockBehaviour.Properties.ofFullCopy(woodType.getPlanks())), blockRegistryObject -> () -> new DrawerBlock.DrawerItem((DrawerBlock) blockRegistryObject.get(), new Item.Properties(), TAB),TAB)); } } } - FLUID_DRAWER_1 = getRegistries().registerBlockWithTileItem("fluid_1", () -> new FluidDrawerBlock(DrawerType.X_1, BlockBehaviour.Properties.copy(Blocks.STONE_BRICKS)), + FLUID_DRAWER_1 = getRegistries().registerBlockWithTileItem("fluid_1", () -> new FluidDrawerBlock(DrawerType.X_1, BlockBehaviour.Properties.ofFullCopy(Blocks.STONE_BRICKS)), blockRegistryObject -> () -> new FluidDrawerBlock.FluidDrawerItem((FluidDrawerBlock) blockRegistryObject.get(), new Item.Properties(), TAB),TAB); - FLUID_DRAWER_2 = getRegistries().registerBlockWithTileItem("fluid_2", () -> new FluidDrawerBlock(DrawerType.X_2, BlockBehaviour.Properties.copy(Blocks.STONE_BRICKS)), + FLUID_DRAWER_2 = getRegistries().registerBlockWithTileItem("fluid_2", () -> new FluidDrawerBlock(DrawerType.X_2, BlockBehaviour.Properties.ofFullCopy(Blocks.STONE_BRICKS)), blockRegistryObject -> () -> new FluidDrawerBlock.FluidDrawerItem((FluidDrawerBlock) blockRegistryObject.get(), new Item.Properties(), TAB),TAB); - FLUID_DRAWER_4 = getRegistries().registerBlockWithTileItem("fluid_4", () -> new FluidDrawerBlock(DrawerType.X_4, BlockBehaviour.Properties.copy(Blocks.STONE_BRICKS)), + FLUID_DRAWER_4 = getRegistries().registerBlockWithTileItem("fluid_4", () -> new FluidDrawerBlock(DrawerType.X_4, BlockBehaviour.Properties.ofFullCopy(Blocks.STONE_BRICKS)), blockRegistryObject -> () -> new FluidDrawerBlock.FluidDrawerItem((FluidDrawerBlock) blockRegistryObject.get(), new Item.Properties(), TAB),TAB); - COMPACTING_DRAWER = getRegistries().registerBlockWithTileItem("compacting_drawer", () -> new CompactingDrawerBlock("compacting_drawer", BlockBehaviour.Properties.copy(Blocks.STONE_BRICKS)), + COMPACTING_DRAWER = getRegistries().registerBlockWithTileItem("compacting_drawer", () -> new CompactingDrawerBlock("compacting_drawer", BlockBehaviour.Properties.ofFullCopy(Blocks.STONE_BRICKS)), blockRegistryObject -> () -> new CompactingDrawerBlock.CompactingDrawerItem(blockRegistryObject.get(), new Item.Properties(), 3), TAB); FRAMED_COMPACTING_DRAWER = getRegistries().registerBlockWithTileItem("compacting_framed_drawer", () -> new CompactingFramedDrawerBlock("compacting_framed_drawer"), @@ -213,39 +251,53 @@ protected void initModules() { FRAMED_DRAWER_CONTROLLER = getRegistries().registerBlockWithTile("framed_storage_controller", FramedDrawerControllerBlock::new, TAB); CONTROLLER_EXTENSION = getRegistries().registerBlockWithTile("controller_extension", ControllerExtensionBlock::new, TAB); FRAMED_CONTROLLER_EXTENSION = getRegistries().registerBlockWithTile("framed_controller_extension", FramedControllerExtensionBlock::new, TAB); - LINKING_TOOL = getRegistries().registerGeneric(ForgeRegistries.ITEMS.getRegistryKey(), "linking_tool", LinkingToolItem::new); - CONFIGURATION_TOOL = getRegistries().registerGeneric(ForgeRegistries.ITEMS.getRegistryKey(), "configuration_tool", ConfigurationToolItem::new); + LINKING_TOOL = getRegistries().registerGeneric(Registries.ITEM, "linking_tool", LinkingToolItem::new); + CONFIGURATION_TOOL = getRegistries().registerGeneric(Registries.ITEM, "configuration_tool", ConfigurationToolItem::new); for (StorageUpgradeItem.StorageTier value : StorageUpgradeItem.StorageTier.values()) { - STORAGE_UPGRADES.put(value, getRegistries().registerGeneric(ForgeRegistries.ITEMS.getRegistryKey(), value.name().toLowerCase(Locale.ROOT) + (value == StorageUpgradeItem.StorageTier.IRON ? "_downgrade" : "_upgrade"), () -> new StorageUpgradeItem(value))); + STORAGE_UPGRADES.put(value, getRegistries().registerGeneric(Registries.ITEM, value.name().toLowerCase(Locale.ROOT) + (value == StorageUpgradeItem.StorageTier.IRON ? "_downgrade" : "_upgrade"), () -> new StorageUpgradeItem(value))); } - SIMPLE_COMPACTING_DRAWER = getRegistries().registerBlockWithTileItem("simple_compacting_drawer", () -> new SimpleCompactingDrawerBlock("simple_compacting_drawer", BlockBehaviour.Properties.copy(Blocks.STONE_BRICKS)), + SIMPLE_COMPACTING_DRAWER = getRegistries().registerBlockWithTileItem("simple_compacting_drawer", () -> new SimpleCompactingDrawerBlock("simple_compacting_drawer", BlockBehaviour.Properties.ofFullCopy(Blocks.STONE_BRICKS)), blockRegistryObject -> () -> new CompactingDrawerBlock.CompactingDrawerItem(blockRegistryObject.get(), new Item.Properties(), 2), TAB); FRAMED_SIMPLE_COMPACTING_DRAWER = getRegistries().registerBlockWithTileItem("framed_simple_compacting_drawer", () -> new FramedSimpleCompactingDrawerBlock("framed_simple_compacting_drawer"), blockRegistryObject -> () -> new CompactingDrawerBlock.CompactingDrawerItem(blockRegistryObject.get(), new Item.Properties(), 2), TAB); - COLLECTOR_UPGRADE = getRegistries().registerGeneric(ForgeRegistries.ITEMS.getRegistryKey(), "collector_upgrade", () -> new UpgradeItem(new Item.Properties(), UpgradeItem.Type.UTILITY)); - PULLING_UPGRADE = getRegistries().registerGeneric(ForgeRegistries.ITEMS.getRegistryKey(), "puller_upgrade", () -> new UpgradeItem(new Item.Properties(), UpgradeItem.Type.UTILITY)); - PUSHING_UPGRADE = getRegistries().registerGeneric(ForgeRegistries.ITEMS.getRegistryKey(), "pusher_upgrade", () -> new UpgradeItem(new Item.Properties(), UpgradeItem.Type.UTILITY)); - VOID_UPGRADE = getRegistries().registerGeneric(ForgeRegistries.ITEMS.getRegistryKey(), "void_upgrade", () -> new UpgradeItem(new Item.Properties(), UpgradeItem.Type.UTILITY)); + COLLECTOR_UPGRADE = getRegistries().registerGeneric(Registries.ITEM, "collector_upgrade", () -> new UpgradeItem(new Item.Properties(), UpgradeItem.Type.UTILITY)); + PULLING_UPGRADE = getRegistries().registerGeneric(Registries.ITEM, "puller_upgrade", () -> new UpgradeItem(new Item.Properties(), UpgradeItem.Type.UTILITY)); + PUSHING_UPGRADE = getRegistries().registerGeneric(Registries.ITEM, "pusher_upgrade", () -> new UpgradeItem(new Item.Properties(), UpgradeItem.Type.UTILITY)); + VOID_UPGRADE = getRegistries().registerGeneric(Registries.ITEM, "void_upgrade", () -> new UpgradeItem(new Item.Properties(), UpgradeItem.Type.UTILITY)); ARMORY_CABINET = getRegistries().registerBlockWithTile("armory_cabinet", ArmoryCabinetBlock::new, TAB); ENDER_DRAWER = getRegistries().registerBlockWithTile("ender_drawer", EnderDrawerBlock::new, TAB); - REDSTONE_UPGRADE = getRegistries().registerGeneric(ForgeRegistries.ITEMS.getRegistryKey(), "redstone_upgrade", () -> new UpgradeItem(new Item.Properties(), UpgradeItem.Type.UTILITY)); - CREATIVE_UPGRADE = getRegistries().registerGeneric(ForgeRegistries.ITEMS.getRegistryKey(), "creative_vending_upgrade", () -> new UpgradeItem(new Item.Properties(), UpgradeItem.Type.STORAGE) { + REDSTONE_UPGRADE = getRegistries().registerGeneric(Registries.ITEM, "redstone_upgrade", () -> new UpgradeItem(new Item.Properties(), UpgradeItem.Type.UTILITY)); + CREATIVE_UPGRADE = getRegistries().registerGeneric(Registries.ITEM, "creative_vending_upgrade", () -> new UpgradeItem(new Item.Properties(), UpgradeItem.Type.STORAGE) { @Override public boolean isFoil(ItemStack p_41453_) { return true; } }); + DrawerlessWoodIngredient.TYPE = getRegistries().registerGeneric(NeoForgeRegistries.Keys.INGREDIENT_TYPES, DrawerlessWoodIngredient.NAME.getPath(), () -> new IngredientType<>(DrawerlessWoodIngredient.CODEC)); + + + this.addCreativeTab("main", () -> new ItemStack(DRAWER_CONTROLLER), MOD_ID, TAB); + CUSTOM_COMPACTING_RECIPE_TYPE = getRegistries().registerGeneric(Registries.RECIPE_TYPE, "custom_compacting", () -> RecipeType.simple(com.buuz135.functionalstorage.util.Utils.resourceLocation(MOD_ID, "custom_compacting"))); - getRegistries().registerGeneric(ForgeRegistries.RECIPE_SERIALIZERS.getRegistryKey(), "framed_recipe", () -> FramedDrawerRecipe.SERIALIZER); + CUSTOM_COMPACTING_RECIPE_SERIALIZER = getRegistries().registerGeneric(Registries.RECIPE_SERIALIZER, "custom_compacting", () -> new GenericSerializer<>(CustomCompactingRecipe.class, CUSTOM_COMPACTING_RECIPE_TYPE::value, CustomCompactingRecipe.CODEC)); - this.addCreativeTab("main", () -> new ItemStack(DRAWER_CONTROLLER.getLeft().get()), MOD_ID, TAB); + FRAMED_RECIPE_TYPE = getRegistries().registerGeneric(Registries.RECIPE_TYPE, "framed_recipe", () -> RecipeType.simple(com.buuz135.functionalstorage.util.Utils.resourceLocation(MOD_ID, "framed_recipe"))); - CUSTOM_COMPACTING_RECIPE_TYPE = getRegistries().registerGeneric(ForgeRegistries.RECIPE_TYPES.getRegistryKey(), "custom_compacting", () -> RecipeType.simple(new ResourceLocation(MOD_ID, "custom_compacting"))); + FRAMED_RECIPE_SERIALIZER = getRegistries().registerGeneric(Registries.RECIPE_SERIALIZER, "framed_recipe", () -> new SimpleCraftingRecipeSerializer<>((c) -> new FramedDrawerRecipe())); - CUSTOM_COMPACTING_RECIPE_SERIALIZER = getRegistries().registerGeneric(ForgeRegistries.RECIPE_SERIALIZERS.getRegistryKey(), "custom_compacting", () -> new GenericSerializer<>(CustomCompactingRecipe.class, CUSTOM_COMPACTING_RECIPE_TYPE)); + ModLoadingContext.get().getActiveContainer().getEventBus() + .addListener(EventPriority.LOWEST, (final RegisterEvent regEvent) -> { + if (regEvent.getRegistryKey() == Registries.BLOCK) { + FRAMED_BLOCKS = getRegistries().getRegistry(Registries.BLOCK) + .getEntries().stream() + .filter(bl -> bl.value() instanceof FramedBlock) + .map(Holder::value) + .toList(); + } + }); } public enum DrawerType { @@ -295,81 +347,80 @@ public void onClient() { EventManager.mod(EntityRenderersEvent.RegisterRenderers.class).process(registerRenderers -> { for (DrawerType value : DrawerType.values()) { DRAWER_TYPES.get(value).forEach(blockRegistryObject -> { - registerRenderers.registerBlockEntityRenderer((BlockEntityType) blockRegistryObject.getRight().get(), p_173571_ -> new DrawerRenderer()); + registerRenderers.registerBlockEntityRenderer((BlockEntityType) blockRegistryObject.type().get(), p_173571_ -> new DrawerRenderer()); }); } - registerRenderers.registerBlockEntityRenderer((BlockEntityType) COMPACTING_DRAWER.getRight().get(), p_173571_ -> new CompactingDrawerRenderer()); - registerRenderers.registerBlockEntityRenderer((BlockEntityType) FRAMED_COMPACTING_DRAWER.getRight().get(), p_173571_ -> new CompactingDrawerRenderer()); - registerRenderers.registerBlockEntityRenderer((BlockEntityType) DRAWER_CONTROLLER.getRight().get(), p -> new ControllerRenderer()); - registerRenderers.registerBlockEntityRenderer((BlockEntityType) ENDER_DRAWER.getRight().get(), p_173571_ -> new EnderDrawerRenderer()); - registerRenderers.registerBlockEntityRenderer((BlockEntityType) FLUID_DRAWER_1.getRight().get(), p_173571_ -> new FluidDrawerRenderer()); - registerRenderers.registerBlockEntityRenderer((BlockEntityType) FLUID_DRAWER_2.getRight().get(), p_173571_ -> new FluidDrawerRenderer()); - registerRenderers.registerBlockEntityRenderer((BlockEntityType) FLUID_DRAWER_4.getRight().get(), p_173571_ -> new FluidDrawerRenderer()); - registerRenderers.registerBlockEntityRenderer((BlockEntityType) SIMPLE_COMPACTING_DRAWER.getRight().get(), p_173571_ -> new SimpleCompactingDrawerRenderer()); - - registerRenderers.registerBlockEntityRenderer((BlockEntityType) FRAMED_DRAWER_CONTROLLER.getRight().get(), p -> new ControllerRenderer()); - registerRenderers.registerBlockEntityRenderer((BlockEntityType) FRAMED_SIMPLE_COMPACTING_DRAWER.getRight().get(), p_173571_ -> new SimpleCompactingDrawerRenderer()); + registerRenderers.registerBlockEntityRenderer((BlockEntityType) COMPACTING_DRAWER.type().get(), p_173571_ -> new CompactingDrawerRenderer()); + registerRenderers.registerBlockEntityRenderer((BlockEntityType) FRAMED_COMPACTING_DRAWER.type().get(), p_173571_ -> new CompactingDrawerRenderer()); + registerRenderers.registerBlockEntityRenderer((BlockEntityType) DRAWER_CONTROLLER.type().get(), p -> new ControllerRenderer()); + registerRenderers.registerBlockEntityRenderer((BlockEntityType) ENDER_DRAWER.type().get(), p_173571_ -> new EnderDrawerRenderer()); + registerRenderers.registerBlockEntityRenderer((BlockEntityType) FLUID_DRAWER_1.type().get(), p_173571_ -> new FluidDrawerRenderer()); + registerRenderers.registerBlockEntityRenderer((BlockEntityType) FLUID_DRAWER_2.type().get(), p_173571_ -> new FluidDrawerRenderer()); + registerRenderers.registerBlockEntityRenderer((BlockEntityType) FLUID_DRAWER_4.type().get(), p_173571_ -> new FluidDrawerRenderer()); + registerRenderers.registerBlockEntityRenderer((BlockEntityType) SIMPLE_COMPACTING_DRAWER.type().get(), p_173571_ -> new SimpleCompactingDrawerRenderer()); + + registerRenderers.registerBlockEntityRenderer((BlockEntityType) FRAMED_DRAWER_CONTROLLER.type().get(), p -> new ControllerRenderer()); + registerRenderers.registerBlockEntityRenderer((BlockEntityType) FRAMED_SIMPLE_COMPACTING_DRAWER.type().get(), p_173571_ -> new SimpleCompactingDrawerRenderer()); }).subscribe(); EventManager.mod(RegisterColorHandlersEvent.Item.class).process(item -> { item.getItemColors().register((stack, tint) -> { - CompoundTag tag = stack.getOrCreateTag(); LinkingToolItem.LinkingMode linkingMode = LinkingToolItem.getLinkingMode(stack); LinkingToolItem.ActionMode linkingAction = LinkingToolItem.getActionMode(stack); - if (tint != 0 && stack.getOrCreateTag().contains(LinkingToolItem.NBT_ENDER)) { - return new Color(44, 150, 88).getRGB(); + if (tint != 0 && stack.has(FSAttachments.ENDER_FREQUENCY)) { + return FastColor.ARGB32.opaque(new Color(44, 150, 88).getRGB()); } - if (tint == 3 && tag.contains(LinkingToolItem.NBT_CONTROLLER)) { - return Color.RED.getRGB(); + if (tint == 3 && stack.has(FSAttachments.CONTROLLER)) { + return FastColor.ARGB32.opaque(Color.RED.getRGB()); } if (tint == 1) { - return linkingMode.getColor().getValue(); + return FastColor.ARGB32.opaque(linkingMode.getColor().getValue()); } if (tint == 2) { - return linkingAction.getColor().getValue(); + return FastColor.ARGB32.opaque(linkingAction.getColor().getValue()); } - return 0xffffff; + return -1; }, LINKING_TOOL.get()); item.getItemColors().register((stack, tint) -> { ConfigurationToolItem.ConfigurationAction action = ConfigurationToolItem.getAction(stack); if (tint == 1) { - return action.getColor().getValue(); + return FastColor.ARGB32.opaque(action.getColor().getValue()); } - return 0xffffff; + return -1; }, CONFIGURATION_TOOL.get()); }).subscribe(); EventManager.mod(FMLClientSetupEvent.class).process(event -> { for (DrawerType value : DrawerType.values()) { - for (RegistryObject blockRegistryObject : DRAWER_TYPES.get(value).stream().map(Pair::getLeft).collect(Collectors.toList())) { - ItemBlockRenderTypes.setRenderLayer(blockRegistryObject.get(), RenderType.cutout()); - } + DRAWER_TYPES.get(value).stream().map(BlockWithTile::getBlock).forEach(bl -> ItemBlockRenderTypes.setRenderLayer(bl, RenderType.cutout())); } - ItemBlockRenderTypes.setRenderLayer(COMPACTING_DRAWER.getLeft().get(), RenderType.cutout()); - ItemBlockRenderTypes.setRenderLayer(FRAMED_COMPACTING_DRAWER.getLeft().get(), RenderType.cutout()); - ItemBlockRenderTypes.setRenderLayer(ENDER_DRAWER.getLeft().get(), RenderType.cutout()); - ItemBlockRenderTypes.setRenderLayer(FLUID_DRAWER_1.getLeft().get(), RenderType.cutout()); - ItemBlockRenderTypes.setRenderLayer(FLUID_DRAWER_2.getLeft().get(), RenderType.cutout()); - ItemBlockRenderTypes.setRenderLayer(FLUID_DRAWER_4.getLeft().get(), RenderType.cutout()); - ItemBlockRenderTypes.setRenderLayer(SIMPLE_COMPACTING_DRAWER.getLeft().get(), RenderType.cutout()); - - ItemBlockRenderTypes.setRenderLayer(FRAMED_DRAWER_CONTROLLER.getLeft().get(), RenderType.cutout()); - ItemBlockRenderTypes.setRenderLayer(FRAMED_CONTROLLER_EXTENSION.getLeft().get(), RenderType.cutout()); - ItemBlockRenderTypes.setRenderLayer(FRAMED_SIMPLE_COMPACTING_DRAWER.getLeft().get(), RenderType.cutout()); - + ItemBlockRenderTypes.setRenderLayer(COMPACTING_DRAWER.getBlock(), RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(FRAMED_COMPACTING_DRAWER.getBlock(), RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ENDER_DRAWER.getBlock(), RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(FLUID_DRAWER_1.getBlock(), RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(FLUID_DRAWER_2.getBlock(), RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(FLUID_DRAWER_4.getBlock(), RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(SIMPLE_COMPACTING_DRAWER.getBlock(), RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(FRAMED_DRAWER_CONTROLLER.getBlock(), RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(FRAMED_CONTROLLER_EXTENSION.getBlock(), RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(FRAMED_SIMPLE_COMPACTING_DRAWER.getBlock(), RenderType.cutout()); }).subscribe(); EventManager.forge(RenderTooltipEvent.Pre.class).process(itemTooltipEvent -> { - if (itemTooltipEvent.getItemStack().getItem().equals(FunctionalStorage.ENDER_DRAWER.getLeft().get().asItem()) && itemTooltipEvent.getItemStack().hasTag()) { - TooltipUtil.renderItems(itemTooltipEvent.getGraphics(), EnderDrawerBlock.getFrequencyDisplay(itemTooltipEvent.getItemStack().getTag().getCompound("Tile").getString("frequency")), itemTooltipEvent.getX() + 14, itemTooltipEvent.getY() + 11); + if (itemTooltipEvent.getItemStack().getItem().equals(FunctionalStorage.ENDER_DRAWER.getBlock().asItem()) && itemTooltipEvent.getItemStack().has(FSAttachments.TILE)) { + TooltipUtil.renderItems(itemTooltipEvent.getGraphics(), EnderDrawerBlock.getFrequencyDisplay(itemTooltipEvent.getItemStack().get(FSAttachments.TILE).getString("frequency")), itemTooltipEvent.getX() + 14, itemTooltipEvent.getY() + 11); } - if (itemTooltipEvent.getItemStack().is(FunctionalStorage.LINKING_TOOL.get()) && itemTooltipEvent.getItemStack().getOrCreateTag().contains(LinkingToolItem.NBT_ENDER)) { - TooltipUtil.renderItems(itemTooltipEvent.getGraphics(), EnderDrawerBlock.getFrequencyDisplay(itemTooltipEvent.getItemStack().getOrCreateTag().getString(LinkingToolItem.NBT_ENDER)), itemTooltipEvent.getX() + 14, itemTooltipEvent.getY() + 11); + if (itemTooltipEvent.getItemStack().is(FunctionalStorage.LINKING_TOOL.get()) && itemTooltipEvent.getItemStack().has(FSAttachments.ENDER_FREQUENCY)) { + TooltipUtil.renderItems(itemTooltipEvent.getGraphics(), EnderDrawerBlock.getFrequencyDisplay(itemTooltipEvent.getItemStack().get(FSAttachments.ENDER_FREQUENCY)), itemTooltipEvent.getX() + 14, itemTooltipEvent.getY() + 11); } - itemTooltipEvent.getItemStack().getCapability(ForgeCapabilities.ITEM_HANDLER).ifPresent(iItemHandler -> { + var iItemHandler = itemTooltipEvent.getItemStack().getCapability(Capabilities.ItemHandler.ITEM); + if (iItemHandler != null) { if (iItemHandler instanceof DrawerStackItemHandler) { int i = 0; for (BigInventoryHandler.BigStack storedStack : ((DrawerStackItemHandler) iItemHandler).getStoredStacks()) { - TooltipUtil.renderItemAdvanced(itemTooltipEvent.getGraphics(), storedStack.getStack(), itemTooltipEvent.getX() + 20 + 26 * i, itemTooltipEvent.getY() + 11, 512, NumberUtils.getFormatedBigNumber(storedStack.getAmount()) + "/" + NumberUtils.getFormatedBigNumber(iItemHandler.getSlotLimit(i))); - ++i; + if (storedStack.getStack().getItem() != Items.AIR) { + TooltipUtil.renderItemAdvanced(itemTooltipEvent.getGraphics(), storedStack.getStack(), itemTooltipEvent.getX() + 20 + 32 * i, itemTooltipEvent.getY() + 11, 512, NumberUtils.getFormatedBigNumber(storedStack.getAmount()) + "/" + NumberUtils.getFormatedBigNumber(iItemHandler.getSlotLimit(i))); + ++i; + } } } if (iItemHandler instanceof CompactingStackItemHandler compactingStackItemHandler) { @@ -383,19 +434,19 @@ public void onClient() { } } } - }); + } }).subscribe(); EventManager.mod(ModelEvent.RegisterGeometryLoaders.class).process(modelRegistryEvent -> { - modelRegistryEvent.register("framedblock", FramedModel.Loader.INSTANCE); + modelRegistryEvent.register(com.buuz135.functionalstorage.util.Utils.resourceLocation(MOD_ID, "framedblock"), FramedModel.Loader.INSTANCE); }).subscribe(); + ClientSetup.init(); } @Override public void addDataProvider(GatherDataEvent event) { - NonNullLazy> blocksToProcess = NonNullLazy.of(() -> - ForgeRegistries.BLOCKS.getValues() - .stream() - .filter(basicBlock -> Optional.ofNullable(ForgeRegistries.BLOCKS.getKey(basicBlock)) + Lazy> blocksToProcess = Lazy.of(() -> + BuiltInRegistries.BLOCK.stream() + .filter(basicBlock -> Optional.of(BuiltInRegistries.BLOCK.getKey(basicBlock)) .map(ResourceLocation::getNamespace) .filter(MOD_ID::equalsIgnoreCase) .isPresent()) @@ -404,7 +455,7 @@ public void addDataProvider(GatherDataEvent event) { if (true) { event.getGenerator().addProvider(true, new BlockItemModelGeneratorProvider(event.getGenerator(), MOD_ID, blocksToProcess)); event.getGenerator().addProvider(true, new FunctionalStorageBlockstateProvider(event.getGenerator(), event.getExistingFileHelper(), blocksToProcess)); - event.getGenerator().addProvider(true, new TitaniumLootTableProvider(event.getGenerator(), blocksToProcess)); + event.getGenerator().addProvider(true, new TitaniumLootTableProvider(event.getGenerator(), blocksToProcess, event.getLookupProvider())); var blockTags = new FunctionalStorageBlockTagsProvider(event.getGenerator(), event.getLookupProvider(), MOD_ID, event.getExistingFileHelper()); event.getGenerator().addProvider(true, blockTags); @@ -416,9 +467,9 @@ public void addDataProvider(GatherDataEvent event) { protected void registerModels() { blocksToProcess.get().forEach(block -> { if ((block instanceof DrawerBlock) || (block instanceof CompactingDrawerBlock) || (block instanceof SimpleCompactingDrawerBlock) || (block instanceof FluidDrawerBlock)){ - withUnchecked(ForgeRegistries.BLOCKS.getKey(block).getPath(), new ResourceLocation("minecraft", "builtin/entity")); + withUnchecked(BuiltInRegistries.BLOCK.getKey(block).getPath(), ResourceLocation.fromNamespaceAndPath("minecraft", "builtin/entity")); } else { - withUnchecked(ForgeRegistries.BLOCKS.getKey(block).getPath(), new ResourceLocation(FunctionalStorage.MOD_ID, "block/" + ForgeRegistries.BLOCKS.getKey(block).getPath())); + withUnchecked(BuiltInRegistries.BLOCK.getKey(block).getPath(), ResourceLocation.fromNamespaceAndPath(FunctionalStorage.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(block).getPath())); } }); for (StorageUpgradeItem.StorageTier storageTier : STORAGE_UPGRADES.keySet()) { @@ -433,7 +484,7 @@ protected void registerModels() { } private void item(Item item) { - withUnchecked(ForgeRegistries.ITEMS.getKey(item).getPath(), new ResourceLocation("minecraft:item/generated")).texture( "layer0", new ResourceLocation(MOD_ID, "item/" + ForgeRegistries.ITEMS.getKey(item).getPath())); + withUnchecked(BuiltInRegistries.ITEM.getKey(item).getPath(), com.buuz135.functionalstorage.util.Utils.resourceLocation("minecraft:item/generated")).texture( "layer0", com.buuz135.functionalstorage.util.Utils.resourceLocation(MOD_ID, "item/" + BuiltInRegistries.ITEM.getKey(item).getPath())); } private ItemModelBuilder withUnchecked(String name, ResourceLocation parent){ @@ -444,45 +495,31 @@ private ItemModelBuilder withUnchecked(String name, ResourceLocation parent){ @Override protected void registerModels() { for (DrawerType value : DrawerType.values()) { - for (RegistryObject blockRegistryObject : DRAWER_TYPES.get(value).stream().map(Pair::getLeft).collect(Collectors.toList())) { + for (var blockRegistryObject : DRAWER_TYPES.get(value).stream().map(BlockWithTile::block).toList()) { if (blockRegistryObject.get() instanceof FramedDrawerBlock) { continue; } - withExistingParent(ForgeRegistries.BLOCKS.getKey(blockRegistryObject.get()).getPath() + "_locked", modLoc(ForgeRegistries.BLOCKS.getKey(blockRegistryObject.get()).getPath())) + withExistingParent(BuiltInRegistries.BLOCK.getKey(blockRegistryObject.get()).getPath() + "_locked", modLoc(BuiltInRegistries.BLOCK.getKey(blockRegistryObject.get()).getPath())) .texture("lock_icon", modLoc("block/lock")); } } - withExistingParent(ForgeRegistries.BLOCKS.getKey(COMPACTING_DRAWER.getLeft().get()).getPath() + "_locked", modLoc(ForgeRegistries.BLOCKS.getKey(COMPACTING_DRAWER.getLeft().get()).getPath())) + withExistingParent(BuiltInRegistries.BLOCK.getKey(COMPACTING_DRAWER.getBlock()).getPath() + "_locked", modLoc(BuiltInRegistries.BLOCK.getKey(COMPACTING_DRAWER.getBlock()).getPath())) .texture("lock_icon", modLoc("block/lock")); - withExistingParent(ForgeRegistries.BLOCKS.getKey(ENDER_DRAWER.getLeft().get()).getPath() + "_locked", modLoc(ForgeRegistries.BLOCKS.getKey(ENDER_DRAWER.getLeft().get()).getPath())) + withExistingParent(BuiltInRegistries.BLOCK.getKey(ENDER_DRAWER.getBlock()).getPath() + "_locked", modLoc(BuiltInRegistries.BLOCK.getKey(ENDER_DRAWER.getBlock()).getPath())) .texture("lock_icon", modLoc("block/lock")); - withExistingParent(ForgeRegistries.BLOCKS.getKey(FLUID_DRAWER_1.getLeft().get()).getPath() + "_locked", modLoc(ForgeRegistries.BLOCKS.getKey(FLUID_DRAWER_1.getLeft().get()).getPath())) + withExistingParent(BuiltInRegistries.BLOCK.getKey(FLUID_DRAWER_1.getBlock()).getPath() + "_locked", modLoc(BuiltInRegistries.BLOCK.getKey(FLUID_DRAWER_1.getBlock()).getPath())) .texture("lock_icon", modLoc("block/lock")); - withExistingParent(ForgeRegistries.BLOCKS.getKey(FLUID_DRAWER_2.getLeft().get()).getPath() + "_locked", modLoc(ForgeRegistries.BLOCKS.getKey(FLUID_DRAWER_2.getLeft().get()).getPath())) + withExistingParent(BuiltInRegistries.BLOCK.getKey(FLUID_DRAWER_2.getBlock()).getPath() + "_locked", modLoc(BuiltInRegistries.BLOCK.getKey(FLUID_DRAWER_2.getBlock()).getPath())) .texture("lock_icon", modLoc("block/lock")); - withExistingParent(ForgeRegistries.BLOCKS.getKey(FLUID_DRAWER_4.getLeft().get()).getPath() + "_locked", modLoc(ForgeRegistries.BLOCKS.getKey(FLUID_DRAWER_4.getLeft().get()).getPath())) + withExistingParent(BuiltInRegistries.BLOCK.getKey(FLUID_DRAWER_4.getBlock()).getPath() + "_locked", modLoc(BuiltInRegistries.BLOCK.getKey(FLUID_DRAWER_4.getBlock()).getPath())) .texture("lock_icon", modLoc("block/lock")); - withExistingParent(ForgeRegistries.BLOCKS.getKey(SIMPLE_COMPACTING_DRAWER.getLeft().get()).getPath() + "_locked", modLoc(ForgeRegistries.BLOCKS.getKey(SIMPLE_COMPACTING_DRAWER.getLeft().get()).getPath())) + withExistingParent(BuiltInRegistries.BLOCK.getKey(SIMPLE_COMPACTING_DRAWER.getBlock()).getPath() + "_locked", modLoc(BuiltInRegistries.BLOCK.getKey(SIMPLE_COMPACTING_DRAWER.getBlock()).getPath())) .texture("lock_icon", modLoc("block/lock")); -// withExistingParent(ForgeRegistries.BLOCKS.getKey(FRAMED_COMPACTING_DRAWER.getLeft().get()).getPath() + "_locked", modLoc(ForgeRegistries.BLOCKS.getKey(FRAMED_COMPACTING_DRAWER.getLeft().get()).getPath())) +// withExistingParent(BuiltInRegistries.BLOCK.getKey(FRAMED_COMPACTING_DRAWER.getBlock()).getPath() + "_locked", modLoc(BuiltInRegistries.BLOCK.getKey(FRAMED_COMPACTING_DRAWER.getBlock()).getPath())) // .texture("lock_icon", modLoc("block/lock")); } }); } - event.getGenerator().addProvider(true, new FunctionalStorageRecipesProvider(event.getGenerator(), blocksToProcess)); - event.getGenerator().addProvider(true, new TitaniumSerializableProvider(event.getGenerator(), MOD_ID) { - - public void add(Map serializables) { - new CustomCompactingRecipe(new ResourceLocation("clay"), new ItemStack(Items.CLAY_BALL, 4), new ItemStack(Items.CLAY)); - new CustomCompactingRecipe(new ResourceLocation("glowstone"), new ItemStack(Items.GLOWSTONE_DUST, 4), new ItemStack(Items.GLOWSTONE)); - new CustomCompactingRecipe(new ResourceLocation("melon"), new ItemStack(Items.MELON_SLICE, 9), new ItemStack(Items.MELON)); - new CustomCompactingRecipe(new ResourceLocation("quartz"), new ItemStack(Items.QUARTZ, 4), new ItemStack(Items.QUARTZ_BLOCK)); - new CustomCompactingRecipe(new ResourceLocation("ice"), new ItemStack(Items.ICE, 9), new ItemStack(Items.PACKED_ICE)); - new CustomCompactingRecipe(new ResourceLocation("packed_ice"), new ItemStack(Items.PACKED_ICE, 9), new ItemStack(Items.BLUE_ICE)); - new CustomCompactingRecipe(new ResourceLocation("amethyst"), new ItemStack(Items.AMETHYST_SHARD, 4), new ItemStack(Items.AMETHYST_BLOCK)); - - CustomCompactingRecipe.RECIPES.forEach(customCompactingRecipe -> serializables.put(customCompactingRecipe, customCompactingRecipe)); - } - }); + event.getGenerator().addProvider(true, new FunctionalStorageRecipesProvider(event.getGenerator(), blocksToProcess, event.getLookupProvider())); } } diff --git a/src/main/java/com/buuz135/functionalstorage/block/ArmoryCabinetBlock.java b/src/main/java/com/buuz135/functionalstorage/block/ArmoryCabinetBlock.java index d1519701..cfca2e0e 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/ArmoryCabinetBlock.java +++ b/src/main/java/com/buuz135/functionalstorage/block/ArmoryCabinetBlock.java @@ -2,6 +2,7 @@ import com.buuz135.functionalstorage.FunctionalStorage; import com.buuz135.functionalstorage.block.tile.ArmoryCabinetTile; +import com.buuz135.functionalstorage.item.FSAttachments; import com.hrznstudio.titanium.block.RotatableBlock; import com.hrznstudio.titanium.datagenerator.loot.block.BasicBlockLootTables; import net.minecraft.core.BlockPos; @@ -13,7 +14,6 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; @@ -26,13 +26,13 @@ public class ArmoryCabinetBlock extends RotatableBlock { public ArmoryCabinetBlock() { - super("armory_cabinet", Properties.copy(Blocks.IRON_BLOCK), ArmoryCabinetTile.class); + super("armory_cabinet", Properties.ofFullCopy(Blocks.IRON_BLOCK), ArmoryCabinetTile.class); //setItemGroup(FunctionalStorage.TAB); } @Override public BlockEntityType.BlockEntitySupplier getTileEntityFactory() { - return (p_155268_, p_155269_) -> new ArmoryCabinetTile(this, FunctionalStorage.ARMORY_CABINET.getRight().get(), p_155268_, p_155269_); + return (p_155268_, p_155269_) -> new ArmoryCabinetTile(this, FunctionalStorage.ARMORY_CABINET.type().get(), p_155268_, p_155269_); } @NotNull @@ -58,7 +58,7 @@ public List getDrops(BlockState p_60537_, LootParams.Builder builder) BlockEntity drawerTile = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY); if (drawerTile instanceof ArmoryCabinetTile) { if (!((ArmoryCabinetTile) drawerTile).isEverythingEmpty()) { - stack.getOrCreateTag().put("Tile", drawerTile.saveWithoutMetadata()); + stack.set(FSAttachments.TILE, drawerTile.saveWithoutMetadata(drawerTile.getLevel().registryAccess())); } } stacks.add(stack); @@ -73,11 +73,11 @@ public NonNullList getDynamicDrops(BlockState state, Level worldIn, B @Override public void setPlacedBy(Level level, BlockPos pos, BlockState p_49849_, @Nullable LivingEntity p_49850_, ItemStack stack) { super.setPlacedBy(level, pos, p_49849_, p_49850_, stack); - if (stack.hasTag() && stack.getTag().contains("Tile")) { + if (stack.has(FSAttachments.TILE)) { BlockEntity entity = level.getBlockEntity(pos); - if (entity instanceof ArmoryCabinetTile) { - entity.load(stack.getTag().getCompound("Tile")); - ((ArmoryCabinetTile) entity).markForUpdate(); + if (entity instanceof ArmoryCabinetTile et) { + et.loadAdditional(stack.get(FSAttachments.TILE), entity.getLevel().registryAccess()); + et.markForUpdate(); } } } diff --git a/src/main/java/com/buuz135/functionalstorage/block/CompactingDrawerBlock.java b/src/main/java/com/buuz135/functionalstorage/block/CompactingDrawerBlock.java index c93638c0..1c5a7c98 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/CompactingDrawerBlock.java +++ b/src/main/java/com/buuz135/functionalstorage/block/CompactingDrawerBlock.java @@ -2,72 +2,36 @@ import com.buuz135.functionalstorage.FunctionalStorage; import com.buuz135.functionalstorage.block.tile.CompactingDrawerTile; -import com.buuz135.functionalstorage.block.tile.ControllableDrawerTile; -import com.buuz135.functionalstorage.block.tile.ItemControllableDrawerTile; -import com.buuz135.functionalstorage.block.tile.StorageControllerTile; import com.buuz135.functionalstorage.client.item.CompactingDrawerISTER; -import com.buuz135.functionalstorage.client.item.DrawerISTER; -import com.buuz135.functionalstorage.inventory.item.CompactingDrawerCapabilityProvider; -import com.buuz135.functionalstorage.item.ConfigurationToolItem; -import com.buuz135.functionalstorage.item.LinkingToolItem; +import com.buuz135.functionalstorage.inventory.item.CompactingStackItemHandler; import com.buuz135.functionalstorage.util.StorageTags; import com.google.common.collect.Multimap; import com.google.common.collect.MultimapBuilder; import com.hrznstudio.titanium.block.RotatableBlock; -import com.hrznstudio.titanium.datagenerator.loot.block.BasicBlockLootTables; import com.hrznstudio.titanium.recipe.generator.TitaniumShapedRecipeBuilder; -import com.hrznstudio.titanium.util.RayTraceUtils; -import com.hrznstudio.titanium.util.TileUtil; -import net.minecraft.ChatFormatting; import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.core.NonNullList; -import net.minecraft.data.recipes.FinishedRecipe; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.inventory.tooltip.TooltipComponent; +import net.minecraft.data.recipes.RecipeOutput; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.LootParams; -import net.minecraft.world.level.storage.loot.LootTable; -import net.minecraft.world.level.storage.loot.parameters.LootContextParams; -import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.HitResult; -import net.minecraft.world.phys.shapes.BooleanOp; -import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.client.extensions.common.IClientItemExtensions; -import net.minecraftforge.common.Tags; -import net.minecraftforge.common.capabilities.ICapabilityProvider; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import net.neoforged.neoforge.client.extensions.common.IClientItemExtensions; +import net.neoforged.neoforge.common.Tags; +import net.neoforged.neoforge.items.IItemHandler; -import javax.annotation.Nonnull; import java.util.ArrayList; +import java.util.Collection; import java.util.List; -import java.util.Optional; import java.util.function.Consumer; -public class CompactingDrawerBlock extends RotatableBlock { +public class CompactingDrawerBlock extends Drawer { public static Multimap CACHED_SHAPES = MultimapBuilder.hashKeys().arrayListValues().build(); @@ -93,15 +57,9 @@ public CompactingDrawerBlock(String name, Properties properties) { registerDefaultState(defaultBlockState().setValue(RotatableBlock.FACING_HORIZONTAL, Direction.NORTH).setValue(DrawerBlock.LOCKED, false)); } - @NotNull - @Override - public RotationType getRotationType() { - return RotationType.FOUR_WAY; - } - @Override public BlockEntityType.BlockEntitySupplier getTileEntityFactory() { - return (blockPos, state) -> new CompactingDrawerTile(this, (BlockEntityType) FunctionalStorage.COMPACTING_DRAWER.getRight().get(), blockPos, state); + return (blockPos, state) -> new CompactingDrawerTile(this, (BlockEntityType) FunctionalStorage.COMPACTING_DRAWER.type().get(), blockPos, state); } @Override @@ -118,121 +76,12 @@ private static List getShapes(BlockState state, BlockGetter source, } @Override - protected void createBlockStateDefinition(StateDefinition.Builder p_206840_1_) { - super.createBlockStateDefinition(p_206840_1_); - p_206840_1_.add(DrawerBlock.LOCKED); - } - - @Nonnull - @Override - public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext selectionContext) { - return Shapes.box(0, 0, 0, 1,1,1); - } - - @Override - public boolean hasCustomBoxes(BlockState state, BlockGetter source, BlockPos pos) { - return true; - } - - @Override - public boolean hasIndividualRenderVoxelShape() { - return true; - } - - @Override - public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand hand, BlockHitResult ray) { - return TileUtil.getTileEntity(worldIn, pos, CompactingDrawerTile.class).map(drawerTile -> drawerTile.onSlotActivated(player, hand, ray.getDirection(), ray.getLocation().x, ray.getLocation().y, ray.getLocation().z, getHit(state, worldIn, pos, player))).orElse(InteractionResult.PASS); - } - - @Override - public void attack(BlockState state, Level worldIn, BlockPos pos, Player player) { - TileUtil.getTileEntity(worldIn, pos, CompactingDrawerTile.class).ifPresent(drawerTile -> drawerTile.onClicked(player, getHit(state, worldIn, pos, player))); - } - - public int getHit(BlockState state, Level worldIn, BlockPos pos, Player player) { - HitResult result = RayTraceUtils.rayTraceSimple(worldIn, player, 32, 0); - if (result instanceof BlockHitResult) { - VoxelShape hit = RayTraceUtils.rayTraceVoxelShape((BlockHitResult) result, worldIn, player, 32, 0); - if (hit != null) { - if (hit.equals(Shapes.block())) return -1; - List shapes = new ArrayList<>(CACHED_SHAPES.get(state.getValue(RotatableBlock.FACING_HORIZONTAL))); - for (int i = 0; i < shapes.size(); i++) { - if (Shapes.joinIsNotEmpty(shapes.get(i), hit, BooleanOp.AND)) { - return i; - } - } - } - } - return -1; - } - - @Override - public LootTable.Builder getLootTable(@Nonnull BasicBlockLootTables blockLootTables) { - //CopyNbtFunction.Builder nbtBuilder = CopyNbtFunction.copyData(ContextNbtProvider.BLOCK_ENTITY); - //nbtBuilder.copy("handler", "BlockEntityTag.handler"); - //nbtBuilder.copy("storageUpgrades", "BlockEntityTag.storageUpgrades"); - //nbtBuilder.copy("utilityUpgrades", "BlockEntityTag.utilityUpgrades"); - //return blockLootTables.droppingSelfWithNbt(this, nbtBuilder); - return blockLootTables.droppingNothing(); - } - - - @Override - public List getDrops(BlockState p_60537_, LootParams.Builder builder) { - NonNullList stacks = NonNullList.create(); - ItemStack stack = new ItemStack(this); - BlockEntity drawerTile = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY); - if (drawerTile instanceof ControllableDrawerTile tile) { - if (!tile.isEverythingEmpty()) { - stack.getOrCreateTag().put("Tile", drawerTile.saveWithoutMetadata()); - } - if (tile.isLocked()){ - stack.getOrCreateTag().putBoolean("Locked", tile.isLocked()); - } - } - stacks.add(stack); - return stacks; - } - - @Override - public NonNullList getDynamicDrops(BlockState state, Level worldIn, BlockPos pos, BlockState newState, boolean isMoving) { - return NonNullList.create(); - } - - @Override - public void setPlacedBy(Level level, BlockPos pos, BlockState p_49849_, @Nullable LivingEntity p_49850_, ItemStack stack) { - super.setPlacedBy(level, pos, p_49849_, p_49850_, stack); - BlockEntity entity = level.getBlockEntity(pos); - if (stack.hasTag()) { - if (stack.getTag().contains("Tile")){ - if (entity instanceof ControllableDrawerTile tile) { - entity.load(stack.getTag().getCompound("Tile")); - tile.markForUpdate(); - } - } - if (stack.getTag().contains("Locked")){ - if (entity instanceof ControllableDrawerTile tile) { - tile.setLocked(stack.getTag().getBoolean("Locked")); - } - } - } - var offhand = p_49850_.getOffhandItem(); - if (offhand.is(FunctionalStorage.CONFIGURATION_TOOL.get())) { - var action = ConfigurationToolItem.getAction(offhand); - if (entity instanceof ControllableDrawerTile tile) { - if (action == ConfigurationToolItem.ConfigurationAction.LOCKING) { - tile.setLocked(true); - } else if (action.getMax() == 1) { - tile.getDrawerOptions().setActive(action, false); - } else { - tile.getDrawerOptions().setAdvancedValue(action, 1); - } - } - } + public Collection getHitShapes(BlockState state) { + return CACHED_SHAPES.get(state.getValue(RotatableBlock.FACING_HORIZONTAL)); } @Override - public void registerRecipe(Consumer consumer) { + public void registerRecipe(RecipeOutput consumer) { TitaniumShapedRecipeBuilder.shapedRecipe(this) .pattern("SSS").pattern("PDP").pattern("SIS") .define('S', Blocks.STONE) @@ -242,89 +91,24 @@ public void registerRecipe(Consumer consumer) { .save(consumer); } - @Override - public void onRemove(BlockState state, Level worldIn, BlockPos pos, BlockState newState, boolean isMoving) { - if (!state.is(newState.getBlock())){ - TileUtil.getTileEntity(worldIn, pos, CompactingDrawerTile.class).ifPresent(tile -> { - if (tile.getControllerPos() != null){ - TileUtil.getTileEntity(worldIn, tile.getControllerPos(), StorageControllerTile.class).ifPresent(drawerControllerTile -> { - drawerControllerTile.addConnectedDrawers(LinkingToolItem.ActionMode.REMOVE, pos); - }); - } - }); - } - super.onRemove(state, worldIn, pos, newState, isMoving); - } - - - @Override - public boolean canConnectRedstone(BlockState state, BlockGetter level, BlockPos pos, @Nullable Direction direction) { - return true; - } - - @Override - public boolean isSignalSource(BlockState p_60571_) { - return true; - } - - @Override - public int getSignal(BlockState p_60483_, BlockGetter blockGetter, BlockPos blockPos, Direction p_60486_) { - ItemControllableDrawerTile tile = TileUtil.getTileEntity(blockGetter, blockPos, ItemControllableDrawerTile.class).orElse(null); - if (tile != null){ - for (int i = 0; i < tile.getUtilityUpgrades().getSlots(); i++) { - ItemStack stack = tile.getUtilityUpgrades().getStackInSlot(i); - if (stack.getItem().equals(FunctionalStorage.REDSTONE_UPGRADE.get())) { - int redstoneSlot = stack.getOrCreateTag().getInt("Slot"); - if (redstoneSlot < tile.getStorage().getSlots()) { - int amount = tile.getStorage().getStackInSlot(redstoneSlot).getCount() * 14 / tile.getStorage().getSlotLimit(redstoneSlot); - return amount + (amount > 0 ? 1 : 0); - } - } - } - } - return 0; - } - - @Override - public void appendHoverText(ItemStack p_49816_, @Nullable BlockGetter p_49817_, List tooltip, TooltipFlag p_49819_) { - super.appendHoverText(p_49816_, p_49817_, tooltip, p_49819_); - if (p_49816_.hasTag() && p_49816_.getTag().contains("Tile")) { - MutableComponent text = Component.translatable("drawer.block.contents"); - tooltip.add(text.withStyle(ChatFormatting.GRAY)); - tooltip.add(Component.literal("")); - tooltip.add(Component.literal("")); - } - } - public static class CompactingDrawerItem extends BlockItem { - private final int slots; - private Block drawerBlock; - public CompactingDrawerItem(Block p_40565_, Properties p_40566_, int slots) { - super(p_40565_, p_40566_); - this.drawerBlock = p_40565_; + public CompactingDrawerItem(Block block, net.minecraft.world.item.Item.Properties properties, int slots) { + super(block, properties); this.slots = slots; } - @Override - public Optional getTooltipImage(ItemStack stack) { - return super.getTooltipImage(stack); - } - - @Nullable - @Override - public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag nbt) { - return new CompactingDrawerCapabilityProvider(stack, slots); + public IItemHandler initCapabilities(ItemStack stack) { + return new CompactingStackItemHandler(stack, slots); } - @OnlyIn(Dist.CLIENT) @Override public void initializeClient(Consumer consumer) { consumer.accept(new IClientItemExtensions() { @Override public BlockEntityWithoutLevelRenderer getCustomRenderer() { - return drawerBlock instanceof SimpleCompactingDrawerBlock ? CompactingDrawerISTER.SIMPLE : CompactingDrawerISTER.NORMAL; + return getBlock() instanceof SimpleCompactingDrawerBlock ? CompactingDrawerISTER.SIMPLE : CompactingDrawerISTER.NORMAL; } }); } diff --git a/src/main/java/com/buuz135/functionalstorage/block/CompactingFramedDrawerBlock.java b/src/main/java/com/buuz135/functionalstorage/block/CompactingFramedDrawerBlock.java index 7ada92ef..44bf5476 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/CompactingFramedDrawerBlock.java +++ b/src/main/java/com/buuz135/functionalstorage/block/CompactingFramedDrawerBlock.java @@ -4,13 +4,14 @@ import com.buuz135.functionalstorage.block.tile.CompactingDrawerTile; import com.buuz135.functionalstorage.block.tile.CompactingFramedDrawerTile; import com.buuz135.functionalstorage.block.tile.FramedDrawerTile; +import com.buuz135.functionalstorage.item.FSAttachments; import com.buuz135.functionalstorage.util.StorageTags; import com.hrznstudio.titanium.recipe.generator.TitaniumShapedRecipeBuilder; import com.hrznstudio.titanium.util.TileUtil; import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.core.NonNullList; -import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.data.recipes.RecipeOutput; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; @@ -19,72 +20,31 @@ import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.HitResult; -import net.minecraftforge.common.Tags; +import net.neoforged.neoforge.common.Tags; import org.jetbrains.annotations.Nullable; import java.util.List; -import java.util.function.Consumer; -public class CompactingFramedDrawerBlock extends CompactingDrawerBlock{ +public class CompactingFramedDrawerBlock extends CompactingDrawerBlock implements FramedBlock { public CompactingFramedDrawerBlock(String name) { - super(name, Properties.copy(Blocks.STONE).noOcclusion().isViewBlocking((p_61036_, p_61037_, p_61038_) -> false)); + super(name, Properties.ofFullCopy(Blocks.STONE).noOcclusion().isViewBlocking((p_61036_, p_61037_, p_61038_) -> false)); } @Override public BlockEntityType.BlockEntitySupplier getTileEntityFactory() { - return (blockPos, state) -> new CompactingFramedDrawerTile(this, (BlockEntityType) FunctionalStorage.FRAMED_COMPACTING_DRAWER.getValue().get(), blockPos, state); + return (blockPos, state) -> new CompactingFramedDrawerTile(this, (BlockEntityType) FunctionalStorage.FRAMED_COMPACTING_DRAWER.type().get(), blockPos, state); } @Override - public void setPlacedBy(Level level, BlockPos pos, BlockState p_49849_, @Nullable LivingEntity p_49850_, ItemStack stack) { - super.setPlacedBy(level, pos, p_49849_, p_49850_, stack); - TileUtil.getTileEntity(level, pos, CompactingFramedDrawerTile.class).ifPresent(framedDrawerTile -> { - framedDrawerTile.setFramedDrawerModelData(FramedDrawerBlock.getDrawerModelData(stack)); - }); - } - - - @Override - public List getDrops(BlockState p_60537_, LootParams.Builder builder) { - NonNullList stacks = NonNullList.create(); - ItemStack stack = new ItemStack(this); - BlockEntity drawerTile = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY); - if (drawerTile instanceof CompactingFramedDrawerTile framedDrawerTile) { - if (!framedDrawerTile.isEverythingEmpty()) { - stack.getOrCreateTag().put("Tile", drawerTile.saveWithoutMetadata()); - } - if (framedDrawerTile.getFramedDrawerModelData() != null) { - stack.getOrCreateTag().put("Style", framedDrawerTile.getFramedDrawerModelData().serializeNBT()); - } - if (framedDrawerTile.isLocked()){ - stack.getOrCreateTag().putBoolean("Locked", framedDrawerTile.isLocked()); - } - } - stacks.add(stack); - return stacks; - } - - @Override - public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter level, BlockPos pos, Player player) { - BlockEntity entity = level.getBlockEntity(pos); - if (entity instanceof FramedDrawerTile framedDrawerTile && framedDrawerTile.getFramedDrawerModelData() != null && !framedDrawerTile.getFramedDrawerModelData().getDesign().isEmpty()){ - ItemStack stack = new ItemStack(this); - stack.getOrCreateTag().put("Style", framedDrawerTile.getFramedDrawerModelData().serializeNBT()); - return stack; - } - return super.getCloneItemStack(state, target, level, pos, player); - } - - @Override - public void registerRecipe(Consumer consumer) { + public void registerRecipe(RecipeOutput consumer) { TitaniumShapedRecipeBuilder.shapedRecipe(this) .pattern("SSS").pattern("PDP").pattern("SIS") .define('S', Items.IRON_NUGGET) @@ -93,9 +53,5 @@ public void registerRecipe(Consumer consumer) { .define('I', Tags.Items.INGOTS_IRON) .save(consumer); } - @Override - public void appendHoverText(ItemStack p_49816_, @Nullable BlockGetter p_49817_, List components, TooltipFlag p_49819_) { - components.add(Component.translatable("frameddrawer.use").withStyle(ChatFormatting.GRAY)); - super.appendHoverText(p_49816_, p_49817_, components, p_49819_); - } + } diff --git a/src/main/java/com/buuz135/functionalstorage/block/ControllerExtensionBlock.java b/src/main/java/com/buuz135/functionalstorage/block/ControllerExtensionBlock.java index bf83dd53..d16e1baf 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/ControllerExtensionBlock.java +++ b/src/main/java/com/buuz135/functionalstorage/block/ControllerExtensionBlock.java @@ -5,33 +5,32 @@ import com.buuz135.functionalstorage.util.StorageTags; import com.hrznstudio.titanium.datagenerator.loot.block.BasicBlockLootTables; import com.hrznstudio.titanium.recipe.generator.TitaniumShapedRecipeBuilder; -import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.data.recipes.RecipeOutput; import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.storage.loot.LootTable; -import net.minecraftforge.common.Tags; +import net.neoforged.neoforge.common.Tags; +import net.neoforged.neoforge.common.crafting.BlockTagIngredient; import org.jetbrains.annotations.NotNull; -import java.util.function.Consumer; - public class ControllerExtensionBlock extends StorageControllerExtensionBlock { public ControllerExtensionBlock() { - super("controller_extension", Properties.copy(Blocks.IRON_BLOCK), ControllerExtensionTile.class); + super("controller_extension", Properties.ofFullCopy(Blocks.IRON_BLOCK), ControllerExtensionTile.class); } @Override public BlockEntityType.BlockEntitySupplier getTileEntityFactory() { - return (p_155268_, p_155269_) -> new ControllerExtensionTile(this, (BlockEntityType) FunctionalStorage.CONTROLLER_EXTENSION.getRight().get(), p_155268_, p_155269_); + return (p_155268_, p_155269_) -> new ControllerExtensionTile(this, (BlockEntityType) FunctionalStorage.CONTROLLER_EXTENSION.type().get(), p_155268_, p_155269_); } @Override - public void registerRecipe(Consumer consumer) { - TitaniumShapedRecipeBuilder.shapedRecipe(FunctionalStorage.CONTROLLER_EXTENSION.getLeft().get()) + public void registerRecipe(RecipeOutput consumer) { + TitaniumShapedRecipeBuilder.shapedRecipe(FunctionalStorage.CONTROLLER_EXTENSION.block().get()) .pattern("IBI").pattern("CDC").pattern("IBI") - .define('I', Tags.Items.STONE) - .define('B', Tags.Items.STORAGE_BLOCKS_QUARTZ) + .define('I', Tags.Items.STONES) + .define('B', Items.QUARTZ_BLOCK) .define('C', StorageTags.DRAWER) .define('D', Items.REPEATER) .save(consumer); diff --git a/src/main/java/com/buuz135/functionalstorage/block/Drawer.java b/src/main/java/com/buuz135/functionalstorage/block/Drawer.java new file mode 100644 index 00000000..b31c602e --- /dev/null +++ b/src/main/java/com/buuz135/functionalstorage/block/Drawer.java @@ -0,0 +1,287 @@ +package com.buuz135.functionalstorage.block; + +import com.buuz135.functionalstorage.FunctionalStorage; +import com.buuz135.functionalstorage.block.tile.ControllableDrawerTile; +import com.buuz135.functionalstorage.block.tile.DrawerTile; +import com.buuz135.functionalstorage.block.tile.FramedDrawerTile; +import com.buuz135.functionalstorage.block.tile.FramedSimpleCompactingDrawerTile; +import com.buuz135.functionalstorage.block.tile.FramedTile; +import com.buuz135.functionalstorage.block.tile.ItemControllableDrawerTile; +import com.buuz135.functionalstorage.block.tile.StorageControllerTile; +import com.buuz135.functionalstorage.item.ConfigurationToolItem; +import com.buuz135.functionalstorage.item.FSAttachments; +import com.buuz135.functionalstorage.item.LinkingToolItem; +import com.hrznstudio.titanium.block.RotatableBlock; +import com.hrznstudio.titanium.datagenerator.loot.block.BasicBlockLootTables; +import com.hrznstudio.titanium.util.RayTraceUtils; +import com.hrznstudio.titanium.util.TileUtil; +import net.minecraft.ChatFormatting; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.NonNullList; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.storage.loot.LootParams; +import net.minecraft.world.level.storage.loot.LootTable; +import net.minecraft.world.level.storage.loot.parameters.LootContextParams; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.shapes.BooleanOp; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +public abstract class Drawer> extends RotatableBlock { + public Drawer(String name, Properties properties, Class tileClass) { + super(name, properties, tileClass); + } + + @Nullable + public ControllableDrawerTile getBlockEntityAt(BlockGetter level, BlockPos pos) { + return TileUtil.getTileEntity(level, pos, ControllableDrawerTile.class).orElse(null); + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder def) { + super.createBlockStateDefinition(def); + def.add(DrawerBlock.LOCKED); + } + + @NotNull + @Override + public RotationType getRotationType() { + return RotationType.FOUR_WAY; + } + + @Nonnull + @Override + public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext selectionContext) { + return Shapes.box(0, 0, 0, 1, 1, 1); + } + + @Override + public boolean hasCustomBoxes(BlockState state, BlockGetter source, BlockPos pos) { + return true; + } + + @Override + public boolean hasIndividualRenderVoxelShape() { + return true; + } + + @Override + protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand hand, BlockHitResult ray) { + var entity = getBlockEntityAt(worldIn, pos); + if (entity != null) { + var result = entity.onSlotActivated(player, hand, ray.getDirection(), ray.getLocation().x, ray.getLocation().y, ray.getLocation().z, getHit(state, worldIn, player)); + if (result == InteractionResult.SUCCESS) { + return ItemInteractionResult.SUCCESS; + } else if (result.consumesAction()) { + return ItemInteractionResult.CONSUME; + } else { + // TODO - validate if this is ok + return ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION; + } + } + return ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION; + } + + @Override + protected InteractionResult useWithoutItem(BlockState state, Level worldIn, BlockPos pos, Player player, BlockHitResult ray) { + var entity = getBlockEntityAt(worldIn, pos); + if (entity != null) { + return entity.onSlotActivated(player, InteractionHand.MAIN_HAND, ray.getDirection(), ray.getLocation().x, ray.getLocation().y, ray.getLocation().z, getHit(state, worldIn, player)); + } + return InteractionResult.PASS; + } + + @Override + public List getDrops(BlockState p_60537_, LootParams.Builder builder) { + NonNullList stacks = NonNullList.create(); + ItemStack stack = new ItemStack(this); + BlockEntity drawerTile = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY); + if (drawerTile instanceof ControllableDrawerTile tile) { + copyTo((T) tile, stack); + } + stacks.add(stack); + return stacks; + } + + @Override + public LootTable.Builder getLootTable(@Nonnull BasicBlockLootTables blockLootTables) { + return blockLootTables.droppingNothing(); + } + + @Override + public NonNullList getDynamicDrops(BlockState state, Level worldIn, BlockPos pos, BlockState newState, boolean isMoving) { + return NonNullList.create(); + } + + protected void copyTo(T tile, ItemStack stack) { + if (!tile.isEverythingEmpty()) { + stack.set(FSAttachments.TILE, tile.saveWithoutMetadata(tile.getLevel().registryAccess())); + } + if (tile.isLocked()) { + stack.set(FSAttachments.LOCKED, tile.isLocked()); + } + if (tile instanceof FramedTile framedDrawerTile && framedDrawerTile.getFramedDrawerModelData() != null) { + stack.set(FSAttachments.STYLE, framedDrawerTile.getFramedDrawerModelData().serializeNBT(tile.getLevel().registryAccess())); + } + } + + protected void copyFrom(ItemStack stack, T tile) { + tile.setLocked(stack.getOrDefault(FSAttachments.LOCKED, false)); + if (stack.has(FSAttachments.TILE)) { + tile.loadAdditional(stack.get(FSAttachments.TILE), tile.getLevel().registryAccess()); + tile.markForUpdate(); + } + if (stack.has(FSAttachments.STYLE) && tile instanceof FramedTile framed) { + framed.setFramedDrawerModelData(FramedDrawerBlock.getDrawerModelData(stack)); + } + } + + protected void configure(LivingEntity player, T tile) { + var offhand = player.getOffhandItem(); + if (offhand.is(FunctionalStorage.CONFIGURATION_TOOL.get())) { + var action = ConfigurationToolItem.getAction(offhand); + if (action == ConfigurationToolItem.ConfigurationAction.LOCKING) { + tile.setLocked(true); + } else if (action.getMax() == 1) { + tile.getDrawerOptions().setActive(action, false); + } else { + tile.getDrawerOptions().setAdvancedValue(action, 1); + } + } + } + + @Override + public void setPlacedBy(Level level, BlockPos pos, BlockState p_49849_, @org.jetbrains.annotations.Nullable LivingEntity player, ItemStack stack) { + super.setPlacedBy(level, pos, p_49849_, player, stack); + BlockEntity entity = level.getBlockEntity(pos); + if (entity instanceof ControllableDrawerTile tile) { + copyFrom(stack, (T) tile); + if (player != null) configure(player, (T) tile); + } + } + + @Override + public boolean isSignalSource(BlockState p_60571_) { + return true; + } + + @Override + public boolean canConnectRedstone(BlockState state, BlockGetter level, BlockPos pos, @org.jetbrains.annotations.Nullable Direction direction) { + ControllableDrawerTile tile = TileUtil.getTileEntity(level, pos, ControllableDrawerTile.class).orElse(null); + if (tile != null) { + for (int i = 0; i < tile.getUtilityUpgrades().getSlots(); i++) { + ItemStack stack = tile.getUtilityUpgrades().getStackInSlot(i); + if (stack.is(FunctionalStorage.REDSTONE_UPGRADE.get())) { + return true; + } + } + } + return false; + } + + @Override + public int getSignal(BlockState p_60483_, BlockGetter blockGetter, BlockPos blockPos, Direction p_60486_) { + ItemControllableDrawerTile tile = TileUtil.getTileEntity(blockGetter, blockPos, ItemControllableDrawerTile.class).orElse(null); + if (tile != null){ + for (int i = 0; i < tile.getUtilityUpgrades().getSlots(); i++) { + ItemStack stack = tile.getUtilityUpgrades().getStackInSlot(i); + if (stack.getItem().equals(FunctionalStorage.REDSTONE_UPGRADE.get())){ + int redstoneSlot = stack.getOrDefault(FSAttachments.SLOT, 0); + if (redstoneSlot < tile.getStorage().getSlots()) { + int amount = tile.getStorage().getStackInSlot(redstoneSlot).getCount() * 14 / tile.getStorage().getSlotLimit(redstoneSlot); + return amount + (amount > 0 ? 1 : 0); + } + } + } + } + return 0; + } + + @Override + public void appendHoverText(ItemStack stack, Item.TooltipContext context, List tooltipComponents, TooltipFlag tooltipFlag) { + super.appendHoverText(stack, context, tooltipComponents, tooltipFlag); + if (stack.has(FSAttachments.TILE)) { + MutableComponent text = Component.translatable("drawer.block.contents"); + tooltipComponents.add(text.withStyle(ChatFormatting.GRAY)); + tooltipComponents.add(Component.literal("")); + tooltipComponents.add(Component.literal("")); + } + + if (this instanceof FramedBlock) { + tooltipComponents.add(Component.translatable("frameddrawer.use").withStyle(ChatFormatting.GRAY)); + } + } + + @Override + public ItemStack getCloneItemStack(BlockState state, HitResult target, LevelReader level, BlockPos pos, Player player) { + BlockEntity entity = level.getBlockEntity(pos); + ItemStack stack = new ItemStack(this); + if (entity instanceof FramedTile framedDrawerTile && framedDrawerTile.getFramedDrawerModelData() != null && !framedDrawerTile.getFramedDrawerModelData().getDesign().isEmpty()) { + stack.set(FSAttachments.STYLE, framedDrawerTile.getFramedDrawerModelData().serializeNBT(level.registryAccess())); + return stack; + } + if (entity instanceof ControllableDrawerTile tile) { + copyTo((T) tile, stack); + } + return stack; + } + + @Override + public void onRemove(BlockState state, Level worldIn, BlockPos pos, BlockState newState, boolean isMoving) { + if (!state.is(newState.getBlock())){ + TileUtil.getTileEntity(worldIn, pos, ControllableDrawerTile.class).ifPresent(tile -> { + if (tile.getControllerPos() != null) { + TileUtil.getTileEntity(worldIn, tile.getControllerPos(), StorageControllerTile.class).ifPresent(drawerControllerTile -> { + drawerControllerTile.addConnectedDrawers(LinkingToolItem.ActionMode.REMOVE, pos); + }); + } + }); + } + super.onRemove(state, worldIn, pos, newState, isMoving); + } + + public abstract Collection getHitShapes(BlockState state); + + public int getHit(BlockState state, Level worldIn, Player player) { + HitResult result = RayTraceUtils.rayTraceSimple(worldIn, player, 32, 0); + if (result instanceof BlockHitResult) { + VoxelShape hit = RayTraceUtils.rayTraceVoxelShape((BlockHitResult) result, worldIn, player, 32, 0); + if (hit != null) { + if (hit.equals(Shapes.block())) return -1; + List shapes = new ArrayList<>(getHitShapes(state)); + for (int i = 0; i < shapes.size(); i++) { + if (Shapes.joinIsNotEmpty(shapes.get(i), hit, BooleanOp.AND)) { + return i; + } + } + } + } + return -1; + } +} diff --git a/src/main/java/com/buuz135/functionalstorage/block/DrawerBlock.java b/src/main/java/com/buuz135/functionalstorage/block/DrawerBlock.java index 755583ae..ff7fc9bc 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/DrawerBlock.java +++ b/src/main/java/com/buuz135/functionalstorage/block/DrawerBlock.java @@ -1,84 +1,47 @@ package com.buuz135.functionalstorage.block; import com.buuz135.functionalstorage.FunctionalStorage; -import com.buuz135.functionalstorage.block.tile.ControllableDrawerTile; import com.buuz135.functionalstorage.block.tile.DrawerTile; -import com.buuz135.functionalstorage.block.tile.ItemControllableDrawerTile; -import com.buuz135.functionalstorage.block.tile.StorageControllerTile; import com.buuz135.functionalstorage.client.item.DrawerISTER; -import com.buuz135.functionalstorage.inventory.item.DrawerCapabilityProvider; -import com.buuz135.functionalstorage.item.ConfigurationToolItem; -import com.buuz135.functionalstorage.item.LinkingToolItem; +import com.buuz135.functionalstorage.inventory.item.DrawerStackItemHandler; import com.buuz135.functionalstorage.recipe.DrawerlessWoodIngredient; import com.buuz135.functionalstorage.util.IWoodType; import com.google.common.collect.Multimap; import com.google.common.collect.MultimapBuilder; import com.hrznstudio.titanium.block.RotatableBlock; -import com.hrznstudio.titanium.datagenerator.loot.block.BasicBlockLootTables; +import com.hrznstudio.titanium.module.BlockWithTile; import com.hrznstudio.titanium.recipe.generator.TitaniumShapedRecipeBuilder; import com.hrznstudio.titanium.tab.TitaniumTab; -import com.hrznstudio.titanium.util.RayTraceUtils; -import com.hrznstudio.titanium.util.TileUtil; -import net.minecraft.ChatFormatting; import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.core.NonNullList; -import net.minecraft.data.recipes.FinishedRecipe; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.inventory.tooltip.TooltipComponent; +import net.minecraft.data.recipes.RecipeOutput; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.RenderShape; -import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.LootParams; -import net.minecraft.world.level.storage.loot.LootTable; -import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.AABB; -import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.HitResult; -import net.minecraft.world.phys.shapes.BooleanOp; -import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.client.extensions.common.IClientItemExtensions; -import net.minecraftforge.common.Tags; -import net.minecraftforge.common.capabilities.ICapabilityProvider; -import org.apache.commons.lang3.tuple.Pair; -import org.jetbrains.annotations.NotNull; +import net.neoforged.neoforge.client.extensions.common.IClientItemExtensions; +import net.neoforged.neoforge.common.Tags; +import net.neoforged.neoforge.items.IItemHandler; import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; import java.util.List; -import java.util.Optional; import java.util.function.Consumer; -public class DrawerBlock extends RotatableBlock { +public class DrawerBlock extends Drawer { - public static HashMap> CACHED_SHAPES = new HashMap<>(); + public static final HashMap> CACHED_SHAPES = new HashMap<>(); - public static BooleanProperty LOCKED = BooleanProperty.create("locked"); + public static final BooleanProperty LOCKED = BooleanProperty.create("locked"); static { CACHED_SHAPES.computeIfAbsent(FunctionalStorage.DrawerType.X_1, type1 -> MultimapBuilder.hashKeys().arrayListValues().build()) @@ -136,23 +99,9 @@ public DrawerBlock(IWoodType woodType, FunctionalStorage.DrawerType type, BlockB setItemGroup(FunctionalStorage.TAB); registerDefaultState(defaultBlockState().setValue(RotatableBlock.FACING_HORIZONTAL, Direction.NORTH).setValue(LOCKED, false)); } - - - @Override - protected void createBlockStateDefinition(StateDefinition.Builder p_206840_1_) { - super.createBlockStateDefinition(p_206840_1_); - p_206840_1_.add(LOCKED); - } - - @NotNull - @Override - public RotationType getRotationType() { - return RotationType.FOUR_WAY; - } - @Override public BlockEntityType.BlockEntitySupplier getTileEntityFactory() { - return (blockPos, state) -> new DrawerTile(this, (BlockEntityType) FunctionalStorage.DRAWER_TYPES.get(type).stream().filter(registryObjectRegistryObjectPair -> registryObjectRegistryObjectPair.getLeft().get().equals(this)).map(Pair::getRight).findFirst().get().get(), blockPos, state, type, woodType); + return (blockPos, state) -> new DrawerTile(this, (BlockEntityType) FunctionalStorage.DRAWER_TYPES.get(type).stream().filter(registryObjectRegistryObjectPair -> registryObjectRegistryObjectPair.getBlock() == this).map(BlockWithTile::type).findFirst().get().get(), blockPos, state, type, woodType); } @Override @@ -168,158 +117,57 @@ private static List getShapes(BlockState state, BlockGetter source, return boxes; } - @Nonnull - @Override - public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext selectionContext) { - return Shapes.box(0, 0, 0, 1,1,1); - } - @Override - public boolean hasCustomBoxes(BlockState state, BlockGetter source, BlockPos pos) { - return true; - } - - @Override - public boolean hasIndividualRenderVoxelShape() { - return true; - } - - @Override - public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand hand, BlockHitResult ray) { - return TileUtil.getTileEntity(worldIn, pos, DrawerTile.class).map(drawerTile -> drawerTile.onSlotActivated(player, hand, ray.getDirection(), ray.getLocation().x, ray.getLocation().y, ray.getLocation().z, getHit(state, worldIn, pos, player))).orElse(InteractionResult.PASS); - } - - @Override - public void attack(BlockState state, Level worldIn, BlockPos pos, Player player) { - TileUtil.getTileEntity(worldIn, pos, DrawerTile.class).ifPresent(drawerTile -> drawerTile.onClicked(player, getHit(state, worldIn, pos, player))); - } - - public int getHit(BlockState state, Level worldIn, BlockPos pos, Player player) { - HitResult result = RayTraceUtils.rayTraceSimple(worldIn, player, 32, 0); - if (result instanceof BlockHitResult) { - VoxelShape hit = RayTraceUtils.rayTraceVoxelShape((BlockHitResult) result, worldIn, player, 32, 0); - if (hit != null) { - if (hit.equals(Shapes.block())) return -1; - List shapes = new ArrayList<>(); - shapes.addAll(CACHED_SHAPES.get(type).get(state.getValue(RotatableBlock.FACING_HORIZONTAL))); - for (int i = 0; i < shapes.size(); i++) { - if (Shapes.joinIsNotEmpty(shapes.get(i), hit, BooleanOp.AND)) { - return i; - } - } - } - } - return -1; - } - - @Override - public LootTable.Builder getLootTable(@Nonnull BasicBlockLootTables blockLootTables) { - //CopyNbtFunction.Builder nbtBuilder = CopyNbtFunction.copyData(ContextNbtProvider.BLOCK_ENTITY); - //nbtBuilder.copy("handler", "BlockEntityTag.handler"); - //nbtBuilder.copy("storageUpgrades", "BlockEntityTag.storageUpgrades"); - //nbtBuilder.copy("utilityUpgrades", "BlockEntityTag.utilityUpgrades"); - //return blockLootTables.droppingSelfWithNbt(this, nbtBuilder); - return blockLootTables.droppingNothing(); - } - - - @Override - public List getDrops(BlockState p_60537_, LootParams.Builder builder) { - NonNullList stacks = NonNullList.create(); - ItemStack stack = new ItemStack(this); - BlockEntity drawerTile = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY); - if (drawerTile instanceof DrawerTile tile) { - if (!tile.isEverythingEmpty()) { - stack.getOrCreateTag().put("Tile", drawerTile.saveWithoutMetadata()); - } - if (tile.isLocked()){ - stack.getOrCreateTag().putBoolean("Locked", tile.isLocked()); - } - } - stacks.add(stack); - return stacks; - } - - @Override - public NonNullList getDynamicDrops(BlockState state, Level worldIn, BlockPos pos, BlockState newState, boolean isMoving) { - return NonNullList.create(); - } - - @Override - public void setPlacedBy(Level level, BlockPos pos, BlockState p_49849_, @Nullable LivingEntity p_49850_, ItemStack stack) { - super.setPlacedBy(level, pos, p_49849_, p_49850_, stack); - BlockEntity entity = level.getBlockEntity(pos); - if (stack.hasTag()) { - if (stack.getTag().contains("Tile")){ - if (entity instanceof ControllableDrawerTile tile) { - entity.load(stack.getTag().getCompound("Tile")); - tile.markForUpdate(); - } - } - if (stack.getTag().contains("Locked")){ - if (entity instanceof ControllableDrawerTile tile) { - tile.setLocked(stack.getTag().getBoolean("Locked")); - } - } - } - var offhand = p_49850_.getOffhandItem(); - if (offhand.is(FunctionalStorage.CONFIGURATION_TOOL.get())) { - var action = ConfigurationToolItem.getAction(offhand); - if (entity instanceof ControllableDrawerTile tile) { - if (action == ConfigurationToolItem.ConfigurationAction.LOCKING) { - tile.setLocked(true); - } else if (action.getMax() == 1) { - tile.getDrawerOptions().setActive(action, false); - } else { - tile.getDrawerOptions().setAdvancedValue(action, 1); - } - } - } + public Collection getHitShapes(BlockState state) { + return DrawerBlock.CACHED_SHAPES.get(type).get(state.getValue(RotatableBlock.FACING_HORIZONTAL)); } @Override - public void registerRecipe(Consumer consumer) { + public void registerRecipe(RecipeOutput consumer) { if (type == FunctionalStorage.DrawerType.X_1) { - TitaniumShapedRecipeBuilder.shapedRecipe(this) - .pattern("PPP").pattern("PCP").pattern("PPP") - .define('P', woodType.getPlanks()) - .define('C', Tags.Items.CHESTS_WOODEN) - .save(consumer); if (woodType.getName().equals("oak")){ TitaniumShapedRecipeBuilder.shapedRecipe(this) - .setName(new ResourceLocation(FunctionalStorage.MOD_ID, "oak_drawer_alternate_x1")) + .setName(com.buuz135.functionalstorage.util.Utils.resourceLocation(FunctionalStorage.MOD_ID, "oak_drawer_alternate_x1")) + .pattern("PPP").pattern("PCP").pattern("PPP") + .define('P', new DrawerlessWoodIngredient().toVanilla()) + .define('C', Tags.Items.CHESTS_WOODEN) + .save(consumer); + } else { + TitaniumShapedRecipeBuilder.shapedRecipe(this) .pattern("PPP").pattern("PCP").pattern("PPP") - .define('P', new DrawerlessWoodIngredient()) + .define('P', woodType.getPlanks()) .define('C', Tags.Items.CHESTS_WOODEN) .save(consumer); } } if (type == FunctionalStorage.DrawerType.X_2){ - TitaniumShapedRecipeBuilder.shapedRecipe(this, 2) - .pattern("PCP").pattern("PPP").pattern("PCP") - .define('P', woodType.getPlanks()) - .define('C', Tags.Items.CHESTS_WOODEN) - .save(consumer); if (woodType.getName().equals("oak")){ TitaniumShapedRecipeBuilder.shapedRecipe(this, 2) - .setName(new ResourceLocation(FunctionalStorage.MOD_ID, "oak_drawer_alternate_x2")) + .setName(com.buuz135.functionalstorage.util.Utils.resourceLocation(FunctionalStorage.MOD_ID, "oak_drawer_alternate_x2")) .pattern("PCP").pattern("PPP").pattern("PCP") - .define('P', new DrawerlessWoodIngredient()) + .define('P', new DrawerlessWoodIngredient().toVanilla()) + .define('C', Tags.Items.CHESTS_WOODEN) + .save(consumer); + } else { + TitaniumShapedRecipeBuilder.shapedRecipe(this, 2) + .pattern("PCP").pattern("PPP").pattern("PCP") + .define('P', woodType.getPlanks()) .define('C', Tags.Items.CHESTS_WOODEN) .save(consumer); } } if (type == FunctionalStorage.DrawerType.X_4){ - TitaniumShapedRecipeBuilder.shapedRecipe(this, 4) - .pattern("CPC").pattern("PPP").pattern("CPC") - .define('P', woodType.getPlanks()) - .define('C', Tags.Items.CHESTS_WOODEN) - .save(consumer); if (woodType.getName().equals("oak")){ TitaniumShapedRecipeBuilder.shapedRecipe(this, 4) - .setName(new ResourceLocation(FunctionalStorage.MOD_ID, "oak_drawer_alternate_x4")) + .setName(com.buuz135.functionalstorage.util.Utils.resourceLocation(FunctionalStorage.MOD_ID, "oak_drawer_alternate_x4")) + .pattern("CPC").pattern("PPP").pattern("CPC") + .define('P', new DrawerlessWoodIngredient().toVanilla()) + .define('C', Tags.Items.CHESTS_WOODEN) + .save(consumer); + } else { + TitaniumShapedRecipeBuilder.shapedRecipe(this, 4) .pattern("CPC").pattern("PPP").pattern("CPC") - .define('P', new DrawerlessWoodIngredient()) + .define('P', woodType.getPlanks()) .define('C', Tags.Items.CHESTS_WOODEN) .save(consumer); } @@ -334,82 +182,20 @@ public IWoodType getWoodType() { return woodType; } - @Override - public void onRemove(BlockState state, Level worldIn, BlockPos pos, BlockState newState, boolean isMoving) { - if (!state.is(newState.getBlock())){ - TileUtil.getTileEntity(worldIn, pos, DrawerTile.class).ifPresent(tile -> { - if (tile.getControllerPos() != null) { - TileUtil.getTileEntity(worldIn, tile.getControllerPos(), StorageControllerTile.class).ifPresent(drawerControllerTile -> { - drawerControllerTile.addConnectedDrawers(LinkingToolItem.ActionMode.REMOVE, pos); - }); - } - }); - } - super.onRemove(state, worldIn, pos, newState, isMoving); - } - - @Override - public void appendHoverText(ItemStack p_49816_, @Nullable BlockGetter p_49817_, List tooltip, TooltipFlag p_49819_) { - super.appendHoverText(p_49816_, p_49817_, tooltip, p_49819_); - if (p_49816_.hasTag() && p_49816_.getTag().contains("Tile")) { - MutableComponent text = Component.translatable("drawer.block.contents"); - tooltip.add(text.withStyle(ChatFormatting.GRAY)); - tooltip.add(Component.literal("")); - tooltip.add(Component.literal("")); - } - } - - @Override - public boolean canConnectRedstone(BlockState state, BlockGetter level, BlockPos pos, @Nullable Direction direction) { - return true; - } - - @Override - public boolean isSignalSource(BlockState p_60571_) { - return true; - } - - @Override - public int getSignal(BlockState p_60483_, BlockGetter blockGetter, BlockPos blockPos, Direction p_60486_) { - ItemControllableDrawerTile tile = TileUtil.getTileEntity(blockGetter, blockPos, ItemControllableDrawerTile.class).orElse(null); - if (tile != null){ - for (int i = 0; i < tile.getUtilityUpgrades().getSlots(); i++) { - ItemStack stack = tile.getUtilityUpgrades().getStackInSlot(i); - if (stack.getItem().equals(FunctionalStorage.REDSTONE_UPGRADE.get())){ - int redstoneSlot = stack.getOrCreateTag().getInt("Slot"); - if (redstoneSlot < tile.getStorage().getSlots()) { - int amount = tile.getStorage().getStackInSlot(redstoneSlot).getCount() * 14 / tile.getStorage().getSlotLimit(redstoneSlot); - return amount + (amount > 0 ? 1 : 0); - } - } - } - } - return 0; - } - - public static class DrawerItem extends BlockItem{ - private DrawerBlock drawerBlock; + private final DrawerBlock drawerBlock; public DrawerItem(DrawerBlock drawerBlock, Properties properties, TitaniumTab tab) { super(drawerBlock, properties); this.drawerBlock = drawerBlock; - tab.getTabList().add(this); - } - - @Override - public Optional getTooltipImage(ItemStack stack) { - return super.getTooltipImage(stack); } @Nullable - @Override - public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag nbt) { - return new DrawerCapabilityProvider(stack, this.drawerBlock.getType()); + public IItemHandler initCapabilities(ItemStack stack) { + return new DrawerStackItemHandler(stack, this.drawerBlock.getType()); } - @OnlyIn(Dist.CLIENT) @Override public void initializeClient(Consumer consumer) { consumer.accept(new IClientItemExtensions() { @@ -426,5 +212,4 @@ public BlockEntityWithoutLevelRenderer getCustomRenderer() { } - } diff --git a/src/main/java/com/buuz135/functionalstorage/block/DrawerControllerBlock.java b/src/main/java/com/buuz135/functionalstorage/block/DrawerControllerBlock.java index 8e5abfb5..147db90a 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/DrawerControllerBlock.java +++ b/src/main/java/com/buuz135/functionalstorage/block/DrawerControllerBlock.java @@ -5,33 +5,31 @@ import com.buuz135.functionalstorage.util.StorageTags; import com.hrznstudio.titanium.datagenerator.loot.block.BasicBlockLootTables; import com.hrznstudio.titanium.recipe.generator.TitaniumShapedRecipeBuilder; -import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.data.recipes.RecipeOutput; import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.storage.loot.LootTable; -import net.minecraftforge.common.Tags; +import net.neoforged.neoforge.common.Tags; import org.jetbrains.annotations.NotNull; -import java.util.function.Consumer; - public class DrawerControllerBlock extends StorageControllerBlock { public DrawerControllerBlock() { - super("storage_controller", Properties.copy(Blocks.IRON_BLOCK), DrawerControllerTile.class); + super("storage_controller", Properties.ofFullCopy(Blocks.IRON_BLOCK), DrawerControllerTile.class); } @Override public BlockEntityType.BlockEntitySupplier getTileEntityFactory() { - return (p_155268_, p_155269_) -> new DrawerControllerTile(this, (BlockEntityType) FunctionalStorage.DRAWER_CONTROLLER.getRight().get(), p_155268_, p_155269_); + return (p_155268_, p_155269_) -> new DrawerControllerTile(this, (BlockEntityType) FunctionalStorage.DRAWER_CONTROLLER.type().get(), p_155268_, p_155269_); } @Override - public void registerRecipe(Consumer consumer) { - TitaniumShapedRecipeBuilder.shapedRecipe(FunctionalStorage.DRAWER_CONTROLLER.getLeft().get()) + public void registerRecipe(RecipeOutput consumer) { + TitaniumShapedRecipeBuilder.shapedRecipe(FunctionalStorage.DRAWER_CONTROLLER.block().get()) .pattern("IBI").pattern("CDC").pattern("IBI") - .define('I', Tags.Items.STONE) - .define('B', Tags.Items.STORAGE_BLOCKS_QUARTZ) + .define('I', Tags.Items.STONES) + .define('B', Items.QUARTZ_BLOCK) .define('C', StorageTags.DRAWER) .define('D', Items.COMPARATOR) .save(consumer); diff --git a/src/main/java/com/buuz135/functionalstorage/block/EnderDrawerBlock.java b/src/main/java/com/buuz135/functionalstorage/block/EnderDrawerBlock.java index 8f0d8fd6..e837441e 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/EnderDrawerBlock.java +++ b/src/main/java/com/buuz135/functionalstorage/block/EnderDrawerBlock.java @@ -1,89 +1,63 @@ package com.buuz135.functionalstorage.block; import com.buuz135.functionalstorage.FunctionalStorage; -import com.buuz135.functionalstorage.block.tile.*; +import com.buuz135.functionalstorage.block.tile.EnderDrawerTile; +import com.buuz135.functionalstorage.block.tile.StorageControllerTile; +import com.buuz135.functionalstorage.item.FSAttachments; import com.buuz135.functionalstorage.item.LinkingToolItem; import com.hrznstudio.titanium.block.RotatableBlock; -import com.hrznstudio.titanium.datagenerator.loot.block.BasicBlockLootTables; -import com.hrznstudio.titanium.util.RayTraceUtils; import com.hrznstudio.titanium.util.TileUtil; import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.core.NonNullList; -import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; -import net.minecraft.util.Mth; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.*; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.LootParams; -import net.minecraft.world.level.storage.loot.LootTable; -import net.minecraft.world.level.storage.loot.parameters.LootContextParams; -import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.HitResult; -import net.minecraft.world.phys.shapes.BooleanOp; -import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; -import net.minecraftforge.registries.ForgeRegistries; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.HashMap; import java.util.List; -import java.util.function.Consumer; import java.util.stream.Collectors; import static com.buuz135.functionalstorage.block.DrawerBlock.LOCKED; -public class EnderDrawerBlock extends RotatableBlock { +public class EnderDrawerBlock extends Drawer { public EnderDrawerBlock() { - super("ender_drawer", Properties.copy(Blocks.ENDER_CHEST), EnderDrawerTile.class); + super("ender_drawer", Properties.ofFullCopy(Blocks.ENDER_CHEST), EnderDrawerTile.class); setItemGroup(FunctionalStorage.TAB); registerDefaultState(defaultBlockState().setValue(RotatableBlock.FACING_HORIZONTAL, Direction.NORTH).setValue(LOCKED, false)); } - public static HashMap> FREQUENCY_LOOK = new HashMap<>(); + public static final HashMap> FREQUENCY_LOOK = new HashMap<>(); public static List getFrequencyDisplay(String string){ return FREQUENCY_LOOK.computeIfAbsent(string, s -> { - List minecraftItems = ForgeRegistries.ITEMS.getValues().stream().filter(item -> item != Items.AIR && ForgeRegistries.ITEMS.getKey(item).getNamespace().equals("minecraft") && !(item instanceof BlockItem)).collect(Collectors.toList()); + List minecraftItems = BuiltInRegistries.ITEM.stream().filter(item -> item != Items.AIR && BuiltInRegistries.ITEM.getKey(item).getNamespace().equals("minecraft") && !(item instanceof BlockItem)).collect(Collectors.toList()); return Arrays.stream(string.split("-")).map(s1 -> new ItemStack(minecraftItems.get(Math.abs(s1.hashCode()) % minecraftItems.size()))).collect(Collectors.toList()); }); } - @Override - protected void createBlockStateDefinition(StateDefinition.Builder p_206840_1_) { - super.createBlockStateDefinition(p_206840_1_); - p_206840_1_.add(LOCKED); - } - - @NotNull - @Override - public RotationType getRotationType() { - return RotationType.FOUR_WAY; - } - @Override public BlockEntityType.BlockEntitySupplier getTileEntityFactory() { - return (blockPos, state) -> new EnderDrawerTile(this, (BlockEntityType) FunctionalStorage.ENDER_DRAWER.getRight().get(),blockPos, state); + return (blockPos, state) -> new EnderDrawerTile(this, (BlockEntityType) FunctionalStorage.ENDER_DRAWER.type().get(),blockPos, state); } @Override @@ -99,92 +73,20 @@ private static List getShapes(BlockState state, BlockGetter source, return boxes; } - @Nonnull - @Override - public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext selectionContext) { - return Shapes.box(0, 0, 0, 1,1,1); - } - - @Override - public boolean hasCustomBoxes(BlockState state, BlockGetter source, BlockPos pos) { - return true; - } - - @Override - public boolean hasIndividualRenderVoxelShape() { - return true; - } - - @Override - public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand hand, BlockHitResult ray) { - return TileUtil.getTileEntity(worldIn, pos, EnderDrawerTile.class).map(drawerTile -> drawerTile.onSlotActivated(player, hand, ray.getDirection(), ray.getLocation().x, ray.getLocation().y, ray.getLocation().z, getHit(state, worldIn, pos, player))).orElse(InteractionResult.PASS); - } - - @Override - public void attack(BlockState state, Level worldIn, BlockPos pos, Player player) { - TileUtil.getTileEntity(worldIn, pos, EnderDrawerTile.class).ifPresent(drawerTile -> drawerTile.onClicked(player, getHit(state, worldIn, pos, player))); - } - - public int getHit(BlockState state, Level worldIn, BlockPos pos, Player player) { - HitResult result = RayTraceUtils.rayTraceSimple(worldIn, player, 32, 0); - if (result instanceof BlockHitResult) { - VoxelShape hit = RayTraceUtils.rayTraceVoxelShape((BlockHitResult) result, worldIn, player, 32, 0); - if (hit != null) { - if (hit.equals(Shapes.block())) return -1; - List shapes = new ArrayList<>(DrawerBlock.CACHED_SHAPES.get(FunctionalStorage.DrawerType.X_1).get(state.getValue(RotatableBlock.FACING_HORIZONTAL))); - for (int i = 0; i < shapes.size(); i++) { - if (Shapes.joinIsNotEmpty(shapes.get(i), hit, BooleanOp.AND)) { - return i; - } - } - } - } - return -1; - } - @Override - public LootTable.Builder getLootTable(@Nonnull BasicBlockLootTables blockLootTables) { - //CopyNbtFunction.Builder nbtBuilder = CopyNbtFunction.copyData(ContextNbtProvider.BLOCK_ENTITY); - //nbtBuilder.copy("frequency", "BlockEntityTag.frequency"); - return blockLootTables.droppingNothing(); + public Collection getHitShapes(BlockState state) { + return DrawerBlock.CACHED_SHAPES.get(FunctionalStorage.DrawerType.X_1).get(state.getValue(RotatableBlock.FACING_HORIZONTAL)); } @Override - public List getDrops(BlockState p_60537_, LootParams.Builder builder) { - NonNullList stacks = NonNullList.create(); - ItemStack stack = new ItemStack(this); - BlockEntity drawerTile = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY); - if (drawerTile instanceof EnderDrawerTile tile) { - if (!tile.isEverythingEmpty()) { - stack.getOrCreateTag().put("Tile", drawerTile.saveWithoutMetadata()); - } + protected void copyTo(EnderDrawerTile tile, ItemStack stack) { + if (!tile.isEverythingEmpty()) { + stack.set(FSAttachments.TILE, tile.saveWithoutMetadata(tile.getLevel().registryAccess())); } - stacks.add(stack); - return stacks; - } - - @Override - public void setPlacedBy(Level level, BlockPos pos, BlockState p_49849_, @Nullable LivingEntity p_49850_, ItemStack stack) { - super.setPlacedBy(level, pos, p_49849_, p_49850_, stack); - if (stack.hasTag()) { - if (stack.getTag().contains("Tile")) { - BlockEntity entity = level.getBlockEntity(pos); - if (entity instanceof ControllableDrawerTile tile) { - entity.load(stack.getTag().getCompound("Tile")); - tile.markForUpdate(); - } - } - } - } - - @Override - public NonNullList getDynamicDrops(BlockState state, Level worldIn, BlockPos pos, BlockState newState, boolean isMoving) { - return NonNullList.create(); } @Override - public void registerRecipe(Consumer consumer) { - + protected void configure(LivingEntity player, EnderDrawerTile tile) { } @Override @@ -203,42 +105,14 @@ public void onRemove(BlockState state, Level worldIn, BlockPos pos, BlockState n @Override - public void appendHoverText(ItemStack p_49816_, @Nullable BlockGetter p_49817_, List tooltip, TooltipFlag p_49819_) { - super.appendHoverText(p_49816_, p_49817_, tooltip, p_49819_); - if (p_49816_.hasTag()) { + public void appendHoverText(ItemStack stack, Item.TooltipContext context, List tooltipComponents, TooltipFlag tooltipFlag) { + if (stack.has(FSAttachments.TILE)) { MutableComponent text = Component.translatable("linkingtool.ender.frequency"); - tooltip.add(text.withStyle(ChatFormatting.GRAY)); - tooltip.add(Component.literal("")); - tooltip.add(Component.literal("")); + tooltipComponents.add(text.withStyle(ChatFormatting.GRAY)); + tooltipComponents.add(Component.literal("")); + tooltipComponents.add(Component.literal("")); } } - @Override - public boolean canConnectRedstone(BlockState state, BlockGetter level, BlockPos pos, @Nullable Direction direction) { - return true; - } - - @Override - public boolean isSignalSource(BlockState p_60571_) { - return true; - } - - @Override - public int getSignal(BlockState p_60483_, BlockGetter blockGetter, BlockPos blockPos, Direction p_60486_) { - ItemControllableDrawerTile tile = TileUtil.getTileEntity(blockGetter, blockPos, ItemControllableDrawerTile.class).orElse(null); - if (tile != null){ - for (int i = 0; i < tile.getUtilityUpgrades().getSlots(); i++) { - ItemStack stack = tile.getUtilityUpgrades().getStackInSlot(i); - if (stack.getItem().equals(FunctionalStorage.REDSTONE_UPGRADE.get())) { - int redstoneSlot = stack.getOrCreateTag().getInt("Slot"); - if (redstoneSlot < tile.getStorage().getSlots()) { - int amount = tile.getStorage().getStackInSlot(redstoneSlot).getCount() * 14 / tile.getStorage().getSlotLimit(redstoneSlot); - return amount + (amount > 0 ? 1 : 0); - } - } - } - } - return 0; - } } diff --git a/src/main/java/com/buuz135/functionalstorage/block/FluidDrawerBlock.java b/src/main/java/com/buuz135/functionalstorage/block/FluidDrawerBlock.java index 95245f2a..3613773d 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/FluidDrawerBlock.java +++ b/src/main/java/com/buuz135/functionalstorage/block/FluidDrawerBlock.java @@ -1,69 +1,43 @@ package com.buuz135.functionalstorage.block; import com.buuz135.functionalstorage.FunctionalStorage; -import com.buuz135.functionalstorage.block.tile.ControllableDrawerTile; import com.buuz135.functionalstorage.block.tile.FluidDrawerTile; -import com.buuz135.functionalstorage.block.tile.StorageControllerTile; import com.buuz135.functionalstorage.client.item.FluidDrawerISTER; -import com.buuz135.functionalstorage.inventory.item.DrawerCapabilityProvider; -import com.buuz135.functionalstorage.item.ConfigurationToolItem; -import com.buuz135.functionalstorage.item.LinkingToolItem; +import com.buuz135.functionalstorage.item.FSAttachments; import com.buuz135.functionalstorage.util.NumberUtils; +import com.buuz135.functionalstorage.util.Utils; import com.hrznstudio.titanium.block.RotatableBlock; -import com.hrznstudio.titanium.datagenerator.loot.block.BasicBlockLootTables; import com.hrznstudio.titanium.recipe.generator.TitaniumShapedRecipeBuilder; import com.hrznstudio.titanium.tab.TitaniumTab; -import com.hrznstudio.titanium.util.RayTraceUtils; import com.hrznstudio.titanium.util.TileUtil; import net.minecraft.ChatFormatting; import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.core.NonNullList; -import net.minecraft.data.recipes.FinishedRecipe; -import net.minecraft.nbt.CompoundTag; +import net.minecraft.data.recipes.RecipeOutput; +import net.minecraft.nbt.NbtOps; import net.minecraft.network.chat.Component; +import net.minecraft.resources.RegistryOps; import net.minecraft.tags.ItemTags; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.inventory.tooltip.TooltipComponent; import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.world.level.storage.loot.LootParams; -import net.minecraft.world.level.storage.loot.LootTable; -import net.minecraft.world.level.storage.loot.parameters.LootContextParams; -import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.HitResult; -import net.minecraft.world.phys.shapes.BooleanOp; -import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.client.extensions.common.IClientItemExtensions; -import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.fluids.FluidStack; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import net.neoforged.neoforge.client.extensions.common.IClientItemExtensions; +import net.neoforged.neoforge.fluids.FluidStack; -import javax.annotation.Nonnull; import java.util.ArrayList; +import java.util.Collection; import java.util.List; -import java.util.Optional; import java.util.function.Consumer; -public class FluidDrawerBlock extends RotatableBlock { +public class FluidDrawerBlock extends Drawer { /** * Framed version @@ -86,28 +60,15 @@ private static List getShapes(BlockState state, BlockGetter source, boxes.add(total); return boxes; } - - @Override - protected void createBlockStateDefinition(StateDefinition.Builder p_206840_1_) { - super.createBlockStateDefinition(p_206840_1_); - p_206840_1_.add(DrawerBlock.LOCKED); - } - - @NotNull - @Override - public RotationType getRotationType() { - return RotationType.FOUR_WAY; - } - @Override public BlockEntityType.BlockEntitySupplier getTileEntityFactory() { return (blockPos, state) -> { - BlockEntityType entityType = (BlockEntityType) FunctionalStorage.FLUID_DRAWER_1.getRight().get(); + BlockEntityType entityType = (BlockEntityType) FunctionalStorage.FLUID_DRAWER_1.type().get(); if (type == FunctionalStorage.DrawerType.X_2) { - entityType = (BlockEntityType) FunctionalStorage.FLUID_DRAWER_2.getRight().get(); + entityType = (BlockEntityType) FunctionalStorage.FLUID_DRAWER_2.type().get(); } if (type == FunctionalStorage.DrawerType.X_4) { - entityType = (BlockEntityType) FunctionalStorage.FLUID_DRAWER_4.getRight().get(); + entityType = (BlockEntityType) FunctionalStorage.FLUID_DRAWER_4.type().get(); } return new FluidDrawerTile(this, entityType, blockPos, state, type); }; @@ -118,116 +79,13 @@ public List getBoundingBoxes(BlockState state, BlockGetter source, B return getShapes(state, source, pos, this.type); } - @Nonnull - @Override - public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext selectionContext) { - return Shapes.box(0, 0, 0, 1, 1, 1); - } - - @Override - public boolean hasCustomBoxes(BlockState state, BlockGetter source, BlockPos pos) { - return true; - } - - @Override - public boolean hasIndividualRenderVoxelShape() { - return true; - } - - @Override - public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand hand, BlockHitResult ray) { - return TileUtil.getTileEntity(worldIn, pos, FluidDrawerTile.class).map(drawerTile -> drawerTile.onSlotActivated(player, hand, ray.getDirection(), ray.getLocation().x, ray.getLocation().y, ray.getLocation().z, getHit(state, worldIn, pos, player))).orElse(InteractionResult.PASS); - } - - @Override - public void attack(BlockState state, Level worldIn, BlockPos pos, Player player) { - TileUtil.getTileEntity(worldIn, pos, FluidDrawerTile.class).ifPresent(drawerTile -> drawerTile.onClicked(player, getHit(state, worldIn, pos, player))); - } - - public int getHit(BlockState state, Level worldIn, BlockPos pos, Player player) { - HitResult result = RayTraceUtils.rayTraceSimple(worldIn, player, 32, 0); - if (result instanceof BlockHitResult) { - VoxelShape hit = RayTraceUtils.rayTraceVoxelShape((BlockHitResult) result, worldIn, player, 32, 0); - if (hit != null) { - if (hit.equals(Shapes.block())) return -1; - List shapes = new ArrayList<>(); - shapes.addAll(DrawerBlock.CACHED_SHAPES.get(type).get(state.getValue(RotatableBlock.FACING_HORIZONTAL))); - for (int i = 0; i < shapes.size(); i++) { - if (Shapes.joinIsNotEmpty(shapes.get(i), hit, BooleanOp.AND)) { - return i; - } - } - } - } - return -1; - } - - @Override - public LootTable.Builder getLootTable(@Nonnull BasicBlockLootTables blockLootTables) { - //CopyNbtFunction.Builder nbtBuilder = CopyNbtFunction.copyData(ContextNbtProvider.BLOCK_ENTITY); - //nbtBuilder.copy("handler", "BlockEntityTag.handler"); - //nbtBuilder.copy("storageUpgrades", "BlockEntityTag.storageUpgrades"); - //nbtBuilder.copy("utilityUpgrades", "BlockEntityTag.utilityUpgrades"); - //return blockLootTables.droppingSelfWithNbt(this, nbtBuilder); - return blockLootTables.droppingNothing(); - } - - - @Override - public List getDrops(BlockState p_60537_, LootParams.Builder builder) { - NonNullList stacks = NonNullList.create(); - ItemStack stack = new ItemStack(this); - BlockEntity drawerTile = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY); - if (drawerTile instanceof FluidDrawerTile tile) { - if (!tile.isEverythingEmpty()) { - stack.getOrCreateTag().put("Tile", drawerTile.saveWithoutMetadata()); - } - if (tile.isLocked()) { - stack.getOrCreateTag().putBoolean("Locked", tile.isLocked()); - } - } - stacks.add(stack); - return stacks; - } - @Override - public NonNullList getDynamicDrops(BlockState state, Level worldIn, BlockPos pos, BlockState newState, boolean isMoving) { - return NonNullList.create(); + public Collection getHitShapes(BlockState state) { + return DrawerBlock.CACHED_SHAPES.get(type).get(state.getValue(RotatableBlock.FACING_HORIZONTAL)); } @Override - public void setPlacedBy(Level level, BlockPos pos, BlockState p_49849_, @Nullable LivingEntity p_49850_, ItemStack stack) { - super.setPlacedBy(level, pos, p_49849_, p_49850_, stack); - if (stack.hasTag()) { - if (stack.getTag().contains("Tile")) { - BlockEntity entity = level.getBlockEntity(pos); - if (entity instanceof ControllableDrawerTile tile) { - entity.load(stack.getTag().getCompound("Tile")); - tile.markForUpdate(); - } - } - if (stack.getTag().contains("Locked")) { - level.setBlock(pos, p_49849_.setValue(DrawerBlock.LOCKED, true), 3); - } - } - BlockEntity entity = level.getBlockEntity(pos); - var offhand = p_49850_.getOffhandItem(); - if (offhand.is(FunctionalStorage.CONFIGURATION_TOOL.get())) { - var action = ConfigurationToolItem.getAction(offhand); - if (entity instanceof ControllableDrawerTile tile) { - if (action == ConfigurationToolItem.ConfigurationAction.LOCKING) { - tile.setLocked(true); - } else if (action.getMax() == 1) { - tile.getDrawerOptions().setActive(action, false); - } else { - tile.getDrawerOptions().setAdvancedValue(action, 1); - } - } - } - } - - @Override - public void registerRecipe(Consumer consumer) { + public void registerRecipe(RecipeOutput consumer) { if (type == FunctionalStorage.DrawerType.X_1) { TitaniumShapedRecipeBuilder.shapedRecipe(this) .pattern("PPP").pattern("PCP").pattern("PPP") @@ -256,43 +114,18 @@ public FunctionalStorage.DrawerType getType() { } @Override - public void onRemove(BlockState state, Level worldIn, BlockPos pos, BlockState newState, boolean isMoving) { - if (!state.is(newState.getBlock())) { - TileUtil.getTileEntity(worldIn, pos, FluidDrawerTile.class).ifPresent(tile -> { - if (tile.getControllerPos() != null) { - TileUtil.getTileEntity(worldIn, tile.getControllerPos(), StorageControllerTile.class).ifPresent(drawerControllerTile -> { - drawerControllerTile.addConnectedDrawers(LinkingToolItem.ActionMode.REMOVE, pos); - }); - } - }); - } - super.onRemove(state, worldIn, pos, newState, isMoving); - } - - @Override - public void appendHoverText(ItemStack itemStack, @Nullable BlockGetter p_49817_, List tooltip, TooltipFlag p_49819_) { - super.appendHoverText(itemStack, p_49817_, tooltip, p_49819_); - if (itemStack.hasTag() && itemStack.getTag().contains("Tile")) { - var tileTag = itemStack.getTag().getCompound("Tile").getCompound("fluidHandler"); + public void appendHoverText(ItemStack itemStack, Item.TooltipContext context, List tooltip, TooltipFlag tooltipFlag) { + if (itemStack.has(FSAttachments.TILE)) { + var tileTag = itemStack.get(FSAttachments.TILE).getCompound("fluidHandler"); tooltip.add(Component.translatable("drawer.block.contents").withStyle(ChatFormatting.GRAY)); for (int i = 0; i < type.getSlots(); i++) { - FluidStack stack = FluidStack.loadFluidStackFromNBT(tileTag.getCompound(i + "")); + FluidStack stack = FluidStack.OPTIONAL_CODEC.decode(RegistryOps.create(NbtOps.INSTANCE, Utils.registryAccess()), tileTag.getCompound(i + "").getCompound("Fluid")).getOrThrow().getFirst(); if (!stack.isEmpty()) - tooltip.add(Component.literal(" - " + ChatFormatting.YELLOW + NumberUtils.getFormatedFluidBigNumber(stack.getAmount()) + ChatFormatting.WHITE + " of ").append(stack.getDisplayName().copy().withStyle(ChatFormatting.GOLD))); + tooltip.add(Component.literal(" - " + ChatFormatting.YELLOW + NumberUtils.getFormatedFluidBigNumber(stack.getAmount()) + ChatFormatting.WHITE + " of ").append(stack.getHoverName().copy().withStyle(ChatFormatting.GOLD))); } } } - @Override - public boolean canConnectRedstone(BlockState state, BlockGetter level, BlockPos pos, @Nullable Direction direction) { - return true; - } - - @Override - public boolean isSignalSource(BlockState p_60571_) { - return true; - } - @Override public int getSignal(BlockState p_60483_, BlockGetter blockGetter, BlockPos blockPos, Direction p_60486_) { FluidDrawerTile tile = TileUtil.getTileEntity(blockGetter, blockPos, FluidDrawerTile.class).orElse(null); @@ -300,7 +133,7 @@ public int getSignal(BlockState p_60483_, BlockGetter blockGetter, BlockPos bloc for (int i = 0; i < tile.getUtilityUpgrades().getSlots(); i++) { ItemStack stack = tile.getUtilityUpgrades().getStackInSlot(i); if (stack.getItem().equals(FunctionalStorage.REDSTONE_UPGRADE.get())) { - int redstoneSlot = stack.getOrCreateTag().getInt("Slot"); + int redstoneSlot = stack.getOrDefault(FSAttachments.SLOT, 0); if (redstoneSlot < tile.getFluidHandler().getTanks()) { return tile.getFluidHandler().getFluidInTank(redstoneSlot).getAmount() * 15 / tile.getFluidHandler().getTankCapacity(redstoneSlot); } @@ -312,26 +145,13 @@ public int getSignal(BlockState p_60483_, BlockGetter blockGetter, BlockPos bloc public static class FluidDrawerItem extends BlockItem { - private FluidDrawerBlock drawerBlock; + private final FluidDrawerBlock drawerBlock; - public FluidDrawerItem(FluidDrawerBlock p_40565_, Properties p_40566_, TitaniumTab tab) { - super(p_40565_, p_40566_); - this.drawerBlock = p_40565_; - tab.getTabList().add(this); + public FluidDrawerItem(FluidDrawerBlock block, Properties props, TitaniumTab tab) { + super(block, props); + this.drawerBlock = block; } - @Override - public Optional getTooltipImage(ItemStack stack) { - return super.getTooltipImage(stack); - } - - @Nullable - @Override - public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag nbt) { - return new DrawerCapabilityProvider(stack, this.drawerBlock.getType()); - } - - @OnlyIn(Dist.CLIENT) @Override public void initializeClient(Consumer consumer) { consumer.accept(new IClientItemExtensions() { @@ -346,6 +166,4 @@ public BlockEntityWithoutLevelRenderer getCustomRenderer() { }); } } - - } diff --git a/src/main/java/com/buuz135/functionalstorage/block/FramedBlock.java b/src/main/java/com/buuz135/functionalstorage/block/FramedBlock.java new file mode 100644 index 00000000..b22e5555 --- /dev/null +++ b/src/main/java/com/buuz135/functionalstorage/block/FramedBlock.java @@ -0,0 +1,4 @@ +package com.buuz135.functionalstorage.block; + +public interface FramedBlock { +} diff --git a/src/main/java/com/buuz135/functionalstorage/block/FramedControllerExtensionBlock.java b/src/main/java/com/buuz135/functionalstorage/block/FramedControllerExtensionBlock.java index 8a9ed6d6..a038f5ab 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/FramedControllerExtensionBlock.java +++ b/src/main/java/com/buuz135/functionalstorage/block/FramedControllerExtensionBlock.java @@ -2,42 +2,40 @@ import com.buuz135.functionalstorage.FunctionalStorage; import com.buuz135.functionalstorage.block.tile.FramedControllerExtensionTile; -import com.buuz135.functionalstorage.block.tile.FramedDrawerControllerTile; +import com.buuz135.functionalstorage.item.FSAttachments; import com.buuz135.functionalstorage.util.StorageTags; import com.hrznstudio.titanium.recipe.generator.TitaniumShapedRecipeBuilder; import com.hrznstudio.titanium.util.TileUtil; import net.minecraft.core.BlockPos; import net.minecraft.core.NonNullList; -import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.data.recipes.RecipeOutput; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.HitResult; -import net.minecraftforge.common.Tags; +import net.neoforged.neoforge.common.Tags; import org.jetbrains.annotations.Nullable; import java.util.List; -import java.util.function.Consumer; -public class FramedControllerExtensionBlock extends StorageControllerExtensionBlock{ +public class FramedControllerExtensionBlock extends StorageControllerExtensionBlock implements FramedBlock { public FramedControllerExtensionBlock() { - super("framed_controller_extension", Properties.copy(Blocks.IRON_BLOCK).noOcclusion().isViewBlocking(((p_61036_, p_61037_, p_61038_) -> false)), FramedControllerExtensionTile.class); + super("framed_controller_extension", Properties.ofFullCopy(Blocks.IRON_BLOCK).noOcclusion().isViewBlocking(((p_61036_, p_61037_, p_61038_) -> false)), FramedControllerExtensionTile.class); } @Override public BlockEntityType.BlockEntitySupplier getTileEntityFactory() { - return ((p_155268_, p_155269_) -> new FramedControllerExtensionTile(this, (BlockEntityType) FunctionalStorage.FRAMED_CONTROLLER_EXTENSION.getRight().get(), p_155268_, p_155269_)); + return ((p_155268_, p_155269_) -> new FramedControllerExtensionTile(this, (BlockEntityType) FunctionalStorage.FRAMED_CONTROLLER_EXTENSION.type().get(), p_155268_, p_155269_)); } @Override @@ -54,11 +52,9 @@ public List getDrops(BlockState p_60537_, LootParams.Builder builder) ItemStack stack = new ItemStack(this); BlockEntity blockEntity = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY); - if(blockEntity instanceof FramedControllerExtensionTile framedControllerExtensionTile) - { - if(framedControllerExtensionTile.getFramedDrawerModelData() != null) - { - stack.getOrCreateTag().put("Style", framedControllerExtensionTile.getFramedDrawerModelData().serializeNBT()); + if (blockEntity instanceof FramedControllerExtensionTile framedControllerExtensionTile) { + if (framedControllerExtensionTile.getFramedDrawerModelData() != null) { + stack.set(FSAttachments.STYLE, framedControllerExtensionTile.getFramedDrawerModelData().serializeNBT(blockEntity.getLevel().registryAccess())); } } @@ -67,16 +63,13 @@ public List getDrops(BlockState p_60537_, LootParams.Builder builder) } @Override - public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter level, BlockPos pos, Player player) { + public ItemStack getCloneItemStack(BlockState state, HitResult target, LevelReader level, BlockPos pos, Player player) { BlockEntity blockEntity = level.getBlockEntity(pos); - if(blockEntity instanceof FramedControllerExtensionTile framedControllerExtensionTile) - { - if(framedControllerExtensionTile.getFramedDrawerModelData() != null) - { - if(!framedControllerExtensionTile.getFramedDrawerModelData().getDesign().isEmpty()) - { + if (blockEntity instanceof FramedControllerExtensionTile framedControllerExtensionTile) { + if (framedControllerExtensionTile.getFramedDrawerModelData() != null) { + if (!framedControllerExtensionTile.getFramedDrawerModelData().getDesign().isEmpty()) { ItemStack stack = new ItemStack(this); - stack.getOrCreateTag().put("Style", framedControllerExtensionTile.getFramedDrawerModelData().serializeNBT()); + stack.set(FSAttachments.STYLE, framedControllerExtensionTile.getFramedDrawerModelData().serializeNBT(level.registryAccess())); return stack; } } @@ -85,11 +78,11 @@ public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGett } @Override - public void registerRecipe(Consumer consumer) { - TitaniumShapedRecipeBuilder.shapedRecipe(FunctionalStorage.FRAMED_CONTROLLER_EXTENSION.getLeft().get()) + public void registerRecipe(RecipeOutput consumer) { + TitaniumShapedRecipeBuilder.shapedRecipe(FunctionalStorage.FRAMED_CONTROLLER_EXTENSION.block().get()) .pattern("IBI").pattern("CDC").pattern("IBI") .define('I', Items.IRON_NUGGET) - .define('B', Tags.Items.STORAGE_BLOCKS_QUARTZ) + .define('B', Items.QUARTZ_BLOCK) .define('C', StorageTags.DRAWER) .define('D', Items.REPEATER) .save(consumer); diff --git a/src/main/java/com/buuz135/functionalstorage/block/FramedDrawerBlock.java b/src/main/java/com/buuz135/functionalstorage/block/FramedDrawerBlock.java index 565e953b..64ae05fe 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/FramedDrawerBlock.java +++ b/src/main/java/com/buuz135/functionalstorage/block/FramedDrawerBlock.java @@ -1,16 +1,21 @@ package com.buuz135.functionalstorage.block; import com.buuz135.functionalstorage.FunctionalStorage; +import com.buuz135.functionalstorage.block.tile.CompactingDrawerTile; +import com.buuz135.functionalstorage.block.tile.CompactingFramedDrawerTile; import com.buuz135.functionalstorage.block.tile.DrawerTile; import com.buuz135.functionalstorage.block.tile.FramedDrawerTile; import com.buuz135.functionalstorage.client.model.FramedDrawerModelData; +import com.buuz135.functionalstorage.item.FSAttachments; import com.buuz135.functionalstorage.util.DrawerWoodType; +import com.hrznstudio.titanium.module.BlockWithTile; import com.hrznstudio.titanium.recipe.generator.TitaniumShapedRecipeBuilder; import com.hrznstudio.titanium.util.TileUtil; import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.core.NonNullList; -import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.data.recipes.RecipeOutput; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; @@ -22,105 +27,63 @@ import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.HitResult; -import net.minecraftforge.common.Tags; -import net.minecraftforge.items.ItemHandlerHelper; -import net.minecraftforge.registries.ForgeRegistries; -import org.apache.commons.lang3.tuple.Pair; +import net.neoforged.neoforge.common.Tags; +import net.neoforged.neoforge.items.ItemHandlerHelper; import org.jetbrains.annotations.Nullable; import java.util.HashMap; import java.util.List; -import java.util.function.Consumer; -public class FramedDrawerBlock extends DrawerBlock{ +public class FramedDrawerBlock extends DrawerBlock implements FramedBlock { public FramedDrawerBlock(FunctionalStorage.DrawerType type) { - super(DrawerWoodType.FRAMED, type, Properties.copy(Blocks.OAK_PLANKS).noOcclusion().isViewBlocking((p_61036_, p_61037_, p_61038_) -> false)); + super(DrawerWoodType.FRAMED, type, Properties.ofFullCopy(Blocks.OAK_PLANKS).noOcclusion().isViewBlocking((p_61036_, p_61037_, p_61038_) -> false)); } @Override public BlockEntityType.BlockEntitySupplier getTileEntityFactory() { - return (blockPos, state) -> new FramedDrawerTile(this, (BlockEntityType) FunctionalStorage.DRAWER_TYPES.get(this.getType()).stream().filter(registryObjectRegistryObjectPair -> registryObjectRegistryObjectPair.getLeft().get().equals(this)).map(Pair::getRight).findFirst().get().get(), blockPos, state, this.getType()); - } - - @Override - public void setPlacedBy(Level level, BlockPos pos, BlockState p_49849_, @Nullable LivingEntity p_49850_, ItemStack stack) { - super.setPlacedBy(level, pos, p_49849_, p_49850_, stack); - TileUtil.getTileEntity(level, pos, FramedDrawerTile.class).ifPresent(framedDrawerTile -> { - framedDrawerTile.setFramedDrawerModelData(getDrawerModelData(stack)); - }); + return (blockPos, state) -> new FramedDrawerTile(this, (BlockEntityType) FunctionalStorage.DRAWER_TYPES.get(this.getType()).stream().filter(registryObjectRegistryObjectPair -> registryObjectRegistryObjectPair.getBlock() == this).map(BlockWithTile::type).findFirst().get().get(), blockPos, state, this.getType()); } public static FramedDrawerModelData getDrawerModelData(ItemStack stack){ - if (stack.hasTag() && stack.getTag().contains("Style")){ - CompoundTag tag = stack.getTag().getCompound("Style"); + if (stack.has(FSAttachments.STYLE)) { + CompoundTag tag = stack.getOrDefault(FSAttachments.STYLE, new CompoundTag()); if (tag.isEmpty()) return null; HashMap data = new HashMap<>(); - data.put("particle", ForgeRegistries.ITEMS.getValue(new ResourceLocation(tag.getString("particle")))); - data.put("front", ForgeRegistries.ITEMS.getValue(new ResourceLocation(tag.getString("front")))); - data.put("side", ForgeRegistries.ITEMS.getValue(new ResourceLocation(tag.getString("side")))); - data.put("front_divider", ForgeRegistries.ITEMS.getValue(new ResourceLocation(tag.getString("front_divider")))); + data.put("particle", BuiltInRegistries.ITEM.get(com.buuz135.functionalstorage.util.Utils.resourceLocation(tag.getString("particle")))); + data.put("front", BuiltInRegistries.ITEM.get(com.buuz135.functionalstorage.util.Utils.resourceLocation(tag.getString("front")))); + data.put("side", BuiltInRegistries.ITEM.get(com.buuz135.functionalstorage.util.Utils.resourceLocation(tag.getString("side")))); + data.put("front_divider", BuiltInRegistries.ITEM.get(com.buuz135.functionalstorage.util.Utils.resourceLocation(tag.getString("front_divider")))); return new FramedDrawerModelData(data); } return null; } public static ItemStack fill(ItemStack first, ItemStack second, ItemStack drawer, ItemStack divider){ - drawer = ItemHandlerHelper.copyStackWithSize(drawer, 1); - CompoundTag style = drawer.getOrCreateTagElement("Style"); - style.putString("particle", ForgeRegistries.ITEMS.getKey(first.getItem()).toString()); - style.putString("side", ForgeRegistries.ITEMS.getKey(first.getItem()).toString()); - style.putString("front", ForgeRegistries.ITEMS.getKey(second.getItem()).toString()); + drawer = drawer.copyWithCount(1); + CompoundTag style = drawer.getOrDefault(FSAttachments.STYLE, new CompoundTag()); + style.putString("particle", BuiltInRegistries.ITEM.getKey(first.getItem()).toString()); + style.putString("side", BuiltInRegistries.ITEM.getKey(first.getItem()).toString()); + style.putString("front", BuiltInRegistries.ITEM.getKey(second.getItem()).toString()); if (divider.isEmpty()){ - style.putString("front_divider", ForgeRegistries.ITEMS.getKey(first.getItem()).toString()); + style.putString("front_divider", BuiltInRegistries.ITEM.getKey(first.getItem()).toString()); } else { - style.putString("front_divider", ForgeRegistries.ITEMS.getKey(divider.getItem()).toString()); + style.putString("front_divider", BuiltInRegistries.ITEM.getKey(divider.getItem()).toString()); } - drawer.getOrCreateTag().put("Style", style); + drawer.set(FSAttachments.STYLE, style); return drawer; } @Override - public List getDrops(BlockState p_60537_, LootParams.Builder builder) { - NonNullList stacks = NonNullList.create(); - ItemStack stack = new ItemStack(this); - BlockEntity drawerTile = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY); - if (drawerTile instanceof FramedDrawerTile framedDrawerTile) { - if (!framedDrawerTile.isEverythingEmpty()) { - stack.getOrCreateTag().put("Tile", drawerTile.saveWithoutMetadata()); - } - if (framedDrawerTile.getFramedDrawerModelData() != null) { - stack.getOrCreateTag().put("Style", framedDrawerTile.getFramedDrawerModelData().serializeNBT()); - } - if (framedDrawerTile.isLocked()){ - stack.getOrCreateTag().putBoolean("Locked", framedDrawerTile.isLocked()); - } - } - stacks.add(stack); - return stacks; - } - - @Override - public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter level, BlockPos pos, Player player) { - BlockEntity entity = level.getBlockEntity(pos); - if (entity instanceof FramedDrawerTile framedDrawerTile && framedDrawerTile.getFramedDrawerModelData() != null && !framedDrawerTile.getFramedDrawerModelData().getDesign().isEmpty()){ - ItemStack stack = new ItemStack(this); - stack.getOrCreateTag().put("Style", framedDrawerTile.getFramedDrawerModelData().serializeNBT()); - return stack; - } - return super.getCloneItemStack(state, target, level, pos, player); - } - - @Override - public void registerRecipe(Consumer consumer) { + public void registerRecipe(RecipeOutput consumer) { if (this.getType() == FunctionalStorage.DrawerType.X_1) { TitaniumShapedRecipeBuilder.shapedRecipe(this) .pattern("PPP").pattern("PCP").pattern("PPP") @@ -146,9 +109,4 @@ public void registerRecipe(Consumer consumer) { } } - @Override - public void appendHoverText(ItemStack p_49816_, @Nullable BlockGetter p_49817_, List components, TooltipFlag p_49819_) { - components.add(Component.translatable("frameddrawer.use").withStyle(ChatFormatting.GRAY)); - super.appendHoverText(p_49816_, p_49817_, components, p_49819_); - } } diff --git a/src/main/java/com/buuz135/functionalstorage/block/FramedDrawerControllerBlock.java b/src/main/java/com/buuz135/functionalstorage/block/FramedDrawerControllerBlock.java index ed975149..29a737f4 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/FramedDrawerControllerBlock.java +++ b/src/main/java/com/buuz135/functionalstorage/block/FramedDrawerControllerBlock.java @@ -2,41 +2,39 @@ import com.buuz135.functionalstorage.FunctionalStorage; import com.buuz135.functionalstorage.block.tile.FramedDrawerControllerTile; +import com.buuz135.functionalstorage.item.FSAttachments; import com.buuz135.functionalstorage.util.StorageTags; import com.hrznstudio.titanium.recipe.generator.TitaniumShapedRecipeBuilder; import com.hrznstudio.titanium.util.TileUtil; import net.minecraft.core.BlockPos; import net.minecraft.core.NonNullList; -import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.data.recipes.RecipeOutput; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.HitResult; -import net.minecraftforge.common.Tags; +import net.neoforged.neoforge.common.Tags; import org.jetbrains.annotations.Nullable; import java.util.List; -import java.util.function.Consumer; -public class FramedDrawerControllerBlock extends StorageControllerBlock -{ +public class FramedDrawerControllerBlock extends StorageControllerBlock implements FramedBlock { public FramedDrawerControllerBlock() { - super("framed_storage_controller", Properties.copy(Blocks.IRON_BLOCK).noOcclusion().isViewBlocking(((p_61036_, p_61037_, p_61038_) -> false)), FramedDrawerControllerTile.class); + super("framed_storage_controller", Properties.ofFullCopy(Blocks.IRON_BLOCK).noOcclusion().isViewBlocking(((p_61036_, p_61037_, p_61038_) -> false)), FramedDrawerControllerTile.class); } @Override public BlockEntityType.BlockEntitySupplier getTileEntityFactory() { - return (p_155268_, p_155269_) -> new FramedDrawerControllerTile(this, (BlockEntityType) FunctionalStorage.FRAMED_DRAWER_CONTROLLER.getRight().get(), p_155268_, p_155269_); + return (p_155268_, p_155269_) -> new FramedDrawerControllerTile(this, (BlockEntityType) FunctionalStorage.FRAMED_DRAWER_CONTROLLER.type().get(), p_155268_, p_155269_); } @Override @@ -53,11 +51,9 @@ public List getDrops(BlockState p_60537_, LootParams.Builder builder) ItemStack stack = new ItemStack(this); BlockEntity blockEntity = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY); - if(blockEntity instanceof FramedDrawerControllerTile framedControllerTile) - { - if(framedControllerTile.getFramedDrawerModelData() != null) - { - stack.getOrCreateTag().put("Style", framedControllerTile.getFramedDrawerModelData().serializeNBT()); + if (blockEntity instanceof FramedDrawerControllerTile framedControllerTile) { + if (framedControllerTile.getFramedDrawerModelData() != null) { + stack.set(FSAttachments.STYLE, framedControllerTile.getFramedDrawerModelData().serializeNBT(blockEntity.getLevel().registryAccess())); } } @@ -66,16 +62,13 @@ public List getDrops(BlockState p_60537_, LootParams.Builder builder) } @Override - public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter level, BlockPos pos, Player player) { + public ItemStack getCloneItemStack(BlockState state, HitResult target, LevelReader level, BlockPos pos, Player player) { BlockEntity blockEntity = level.getBlockEntity(pos); - if(blockEntity instanceof FramedDrawerControllerTile framedDrawerControllerTile) - { - if(framedDrawerControllerTile.getFramedDrawerModelData() != null) - { - if(!framedDrawerControllerTile.getFramedDrawerModelData().getDesign().isEmpty()) - { + if (blockEntity instanceof FramedDrawerControllerTile framedDrawerControllerTile) { + if (framedDrawerControllerTile.getFramedDrawerModelData() != null) { + if (!framedDrawerControllerTile.getFramedDrawerModelData().getDesign().isEmpty()) { ItemStack stack = new ItemStack(this); - stack.getOrCreateTag().put("Style", framedDrawerControllerTile.getFramedDrawerModelData().serializeNBT()); + stack.set(FSAttachments.STYLE, framedDrawerControllerTile.getFramedDrawerModelData().serializeNBT(blockEntity.getLevel().registryAccess())); return stack; } } @@ -84,11 +77,11 @@ public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGett } @Override - public void registerRecipe(Consumer consumer) { - TitaniumShapedRecipeBuilder.shapedRecipe(FunctionalStorage.FRAMED_DRAWER_CONTROLLER.getLeft().get()) + public void registerRecipe(RecipeOutput consumer) { + TitaniumShapedRecipeBuilder.shapedRecipe(FunctionalStorage.FRAMED_DRAWER_CONTROLLER.block().get()) .pattern("IBI").pattern("CDC").pattern("IBI") .define('I', Items.IRON_NUGGET) - .define('B', Tags.Items.STORAGE_BLOCKS_QUARTZ) + .define('B', Items.QUARTZ_BLOCK) .define('C', StorageTags.DRAWER) .define('D', Items.COMPARATOR) .save(consumer); diff --git a/src/main/java/com/buuz135/functionalstorage/block/FramedSimpleCompactingDrawerBlock.java b/src/main/java/com/buuz135/functionalstorage/block/FramedSimpleCompactingDrawerBlock.java index ec13bb8c..66a56028 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/FramedSimpleCompactingDrawerBlock.java +++ b/src/main/java/com/buuz135/functionalstorage/block/FramedSimpleCompactingDrawerBlock.java @@ -5,85 +5,24 @@ import com.buuz135.functionalstorage.block.tile.SimpleCompactingDrawerTile; import com.buuz135.functionalstorage.util.StorageTags; import com.hrznstudio.titanium.recipe.generator.TitaniumShapedRecipeBuilder; -import com.hrznstudio.titanium.util.TileUtil; -import net.minecraft.ChatFormatting; -import net.minecraft.core.BlockPos; -import net.minecraft.core.NonNullList; -import net.minecraft.data.recipes.FinishedRecipe; -import net.minecraft.network.chat.Component; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ItemStack; +import net.minecraft.data.recipes.RecipeOutput; import net.minecraft.world.item.Items; -import net.minecraft.world.item.TooltipFlag; -import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.LootParams; -import net.minecraft.world.level.storage.loot.parameters.LootContextParams; -import net.minecraft.world.phys.HitResult; -import net.minecraftforge.common.Tags; -import org.jetbrains.annotations.Nullable; +import net.neoforged.neoforge.common.Tags; -import java.util.List; -import java.util.function.Consumer; - -public class FramedSimpleCompactingDrawerBlock extends SimpleCompactingDrawerBlock { +public class FramedSimpleCompactingDrawerBlock extends SimpleCompactingDrawerBlock implements FramedBlock { public FramedSimpleCompactingDrawerBlock(String name) { - super(name, Properties.copy(Blocks.STONE).noOcclusion().isViewBlocking((p_61036_, p_61037_, p_61038_) -> false)); + super(name, Properties.ofFullCopy(Blocks.STONE).noOcclusion().isViewBlocking((p_61036_, p_61037_, p_61038_) -> false)); } @Override public BlockEntityType.BlockEntitySupplier getTileEntityFactory() { - return (blockPos, state) -> new FramedSimpleCompactingDrawerTile(this, (BlockEntityType) FunctionalStorage.FRAMED_SIMPLE_COMPACTING_DRAWER.getValue().get(), blockPos, state); + return (blockPos, state) -> new FramedSimpleCompactingDrawerTile(this, (BlockEntityType) FunctionalStorage.FRAMED_SIMPLE_COMPACTING_DRAWER.type().get(), blockPos, state); } @Override - public void setPlacedBy(Level level, BlockPos pos, BlockState p_49849_, @Nullable LivingEntity p_49850_, ItemStack stack) { - super.setPlacedBy(level, pos, p_49849_, p_49850_, stack); - TileUtil.getTileEntity(level, pos, FramedSimpleCompactingDrawerTile.class).ifPresent(framedDrawerTile -> { - framedDrawerTile.setFramedDrawerModelData(FramedDrawerBlock.getDrawerModelData(stack)); - }); - } - - - @Override - public List getDrops(BlockState p_60537_, LootParams.Builder builder) { - NonNullList stacks = NonNullList.create(); - ItemStack stack = new ItemStack(this); - BlockEntity drawerTile = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY); - if (drawerTile instanceof FramedSimpleCompactingDrawerTile framedDrawerTile) { - if (!framedDrawerTile.isEverythingEmpty()) { - stack.getOrCreateTag().put("Tile", drawerTile.saveWithoutMetadata()); - } - if (framedDrawerTile.getFramedDrawerModelData() != null) { - stack.getOrCreateTag().put("Style", framedDrawerTile.getFramedDrawerModelData().serializeNBT()); - } - if (framedDrawerTile.isLocked()) { - stack.getOrCreateTag().putBoolean("Locked", framedDrawerTile.isLocked()); - } - } - stacks.add(stack); - return stacks; - } - - @Override - public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter level, BlockPos pos, Player player) { - BlockEntity entity = level.getBlockEntity(pos); - if (entity instanceof FramedSimpleCompactingDrawerTile framedDrawerTile && framedDrawerTile.getFramedDrawerModelData() != null && !framedDrawerTile.getFramedDrawerModelData().getDesign().isEmpty()) { - ItemStack stack = new ItemStack(this); - stack.getOrCreateTag().put("Style", framedDrawerTile.getFramedDrawerModelData().serializeNBT()); - return stack; - } - return super.getCloneItemStack(state, target, level, pos, player); - } - - @Override - public void registerRecipe(Consumer consumer) { + public void registerRecipe(RecipeOutput consumer) { TitaniumShapedRecipeBuilder.shapedRecipe(this) .pattern("SSS").pattern("SDP").pattern("SIS") .define('S', Items.IRON_NUGGET) @@ -93,9 +32,5 @@ public void registerRecipe(Consumer consumer) { .save(consumer); } - @Override - public void appendHoverText(ItemStack p_49816_, @Nullable BlockGetter p_49817_, List components, TooltipFlag p_49819_) { - components.add(Component.translatable("frameddrawer.use").withStyle(ChatFormatting.GRAY)); - super.appendHoverText(p_49816_, p_49817_, components, p_49819_); - } + } diff --git a/src/main/java/com/buuz135/functionalstorage/block/SimpleCompactingDrawerBlock.java b/src/main/java/com/buuz135/functionalstorage/block/SimpleCompactingDrawerBlock.java index 75c017f2..88b243fc 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/SimpleCompactingDrawerBlock.java +++ b/src/main/java/com/buuz135/functionalstorage/block/SimpleCompactingDrawerBlock.java @@ -1,60 +1,28 @@ package com.buuz135.functionalstorage.block; import com.buuz135.functionalstorage.FunctionalStorage; -import com.buuz135.functionalstorage.block.tile.ControllableDrawerTile; -import com.buuz135.functionalstorage.block.tile.ItemControllableDrawerTile; import com.buuz135.functionalstorage.block.tile.SimpleCompactingDrawerTile; -import com.buuz135.functionalstorage.block.tile.StorageControllerTile; -import com.buuz135.functionalstorage.item.ConfigurationToolItem; -import com.buuz135.functionalstorage.item.LinkingToolItem; import com.buuz135.functionalstorage.util.StorageTags; import com.hrznstudio.titanium.block.RotatableBlock; -import com.hrznstudio.titanium.datagenerator.loot.block.BasicBlockLootTables; import com.hrznstudio.titanium.recipe.generator.TitaniumShapedRecipeBuilder; -import com.hrznstudio.titanium.util.RayTraceUtils; -import com.hrznstudio.titanium.util.TileUtil; -import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.core.NonNullList; -import net.minecraft.data.recipes.FinishedRecipe; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; -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.data.recipes.RecipeOutput; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.LootParams; -import net.minecraft.world.level.storage.loot.LootTable; -import net.minecraft.world.level.storage.loot.parameters.LootContextParams; -import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.HitResult; -import net.minecraft.world.phys.shapes.BooleanOp; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; -import net.minecraftforge.common.Tags; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import net.neoforged.neoforge.common.Tags; import javax.annotation.Nonnull; import java.util.ArrayList; +import java.util.Collection; import java.util.List; -import java.util.function.Consumer; - -public class SimpleCompactingDrawerBlock extends RotatableBlock { +public class SimpleCompactingDrawerBlock extends Drawer { public SimpleCompactingDrawerBlock(String name, Properties properties) { super(name, properties, SimpleCompactingDrawerTile.class); @@ -70,15 +38,9 @@ private static List getShapes(BlockState state, BlockGetter source, return boxes; } - @NotNull - @Override - public RotationType getRotationType() { - return RotationType.FOUR_WAY; - } - @Override public BlockEntityType.BlockEntitySupplier getTileEntityFactory() { - return (blockPos, state) -> new SimpleCompactingDrawerTile(this, (BlockEntityType) FunctionalStorage.SIMPLE_COMPACTING_DRAWER.getRight().get(), blockPos, state); + return (blockPos, state) -> new SimpleCompactingDrawerTile(this, (BlockEntityType) FunctionalStorage.SIMPLE_COMPACTING_DRAWER.type().get(), blockPos, state); } @Override @@ -87,121 +49,12 @@ public List getBoundingBoxes(BlockState state, BlockGetter source, B } @Override - protected void createBlockStateDefinition(StateDefinition.Builder p_206840_1_) { - super.createBlockStateDefinition(p_206840_1_); - p_206840_1_.add(DrawerBlock.LOCKED); - } - - @Nonnull - @Override - public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext selectionContext) { - return Shapes.box(0, 0, 0, 1, 1, 1); - } - - @Override - public boolean hasCustomBoxes(BlockState state, BlockGetter source, BlockPos pos) { - return true; - } - - @Override - public boolean hasIndividualRenderVoxelShape() { - return true; - } - - @Override - public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand hand, BlockHitResult ray) { - return TileUtil.getTileEntity(worldIn, pos, SimpleCompactingDrawerTile.class).map(drawerTile -> drawerTile.onSlotActivated(player, hand, ray.getDirection(), ray.getLocation().x, ray.getLocation().y, ray.getLocation().z, getHit(state, worldIn, pos, player))).orElse(InteractionResult.PASS); - } - - @Override - public void attack(BlockState state, Level worldIn, BlockPos pos, Player player) { - TileUtil.getTileEntity(worldIn, pos, SimpleCompactingDrawerTile.class).ifPresent(drawerTile -> drawerTile.onClicked(player, getHit(state, worldIn, pos, player))); - } - - public int getHit(BlockState state, Level worldIn, BlockPos pos, Player player) { - HitResult result = RayTraceUtils.rayTraceSimple(worldIn, player, 32, 0); - if (result instanceof BlockHitResult) { - VoxelShape hit = RayTraceUtils.rayTraceVoxelShape((BlockHitResult) result, worldIn, player, 32, 0); - if (hit != null) { - if (hit.equals(Shapes.block())) return -1; - List shapes = new ArrayList<>(DrawerBlock.CACHED_SHAPES.get(FunctionalStorage.DrawerType.X_2).get(state.getValue(RotatableBlock.FACING_HORIZONTAL))); - for (int i = 0; i < shapes.size(); i++) { - if (Shapes.joinIsNotEmpty(shapes.get(i), hit, BooleanOp.AND)) { - return i; - } - } - } - } - return -1; - } - - @Override - public LootTable.Builder getLootTable(@Nonnull BasicBlockLootTables blockLootTables) { - //CopyNbtFunction.Builder nbtBuilder = CopyNbtFunction.copyData(ContextNbtProvider.BLOCK_ENTITY); - //nbtBuilder.copy("handler", "BlockEntityTag.handler"); - //nbtBuilder.copy("storageUpgrades", "BlockEntityTag.storageUpgrades"); - //nbtBuilder.copy("utilityUpgrades", "BlockEntityTag.utilityUpgrades"); - //return blockLootTables.droppingSelfWithNbt(this, nbtBuilder); - return blockLootTables.droppingNothing(); - } - - - @Override - public List getDrops(BlockState p_60537_, LootParams.Builder builder) { - NonNullList stacks = NonNullList.create(); - ItemStack stack = new ItemStack(this); - BlockEntity drawerTile = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY); - if (drawerTile instanceof ControllableDrawerTile tile) { - if (!tile.isEverythingEmpty()) { - stack.getOrCreateTag().put("Tile", drawerTile.saveWithoutMetadata()); - } - if (tile.isLocked()) { - stack.getOrCreateTag().putBoolean("Locked", tile.isLocked()); - } - } - stacks.add(stack); - return stacks; + public Collection getHitShapes(BlockState state) { + return DrawerBlock.CACHED_SHAPES.get(FunctionalStorage.DrawerType.X_2).get(state.getValue(RotatableBlock.FACING_HORIZONTAL)); } @Override - public NonNullList getDynamicDrops(BlockState state, Level worldIn, BlockPos pos, BlockState newState, boolean isMoving) { - return NonNullList.create(); - } - - @Override - public void setPlacedBy(Level level, BlockPos pos, BlockState p_49849_, @Nullable LivingEntity p_49850_, ItemStack stack) { - super.setPlacedBy(level, pos, p_49849_, p_49850_, stack); - BlockEntity entity = level.getBlockEntity(pos); - if (stack.hasTag()) { - if (stack.getTag().contains("Tile")) { - if (entity instanceof ControllableDrawerTile tile) { - entity.load(stack.getTag().getCompound("Tile")); - tile.markForUpdate(); - } - } - if (stack.getTag().contains("Locked")) { - if (entity instanceof ControllableDrawerTile tile) { - tile.setLocked(stack.getTag().getBoolean("Locked")); - } - } - } - var offhand = p_49850_.getOffhandItem(); - if (offhand.is(FunctionalStorage.CONFIGURATION_TOOL.get())) { - var action = ConfigurationToolItem.getAction(offhand); - if (entity instanceof ControllableDrawerTile tile) { - if (action == ConfigurationToolItem.ConfigurationAction.LOCKING) { - tile.setLocked(true); - } else if (action.getMax() == 1) { - tile.getDrawerOptions().setActive(action, false); - } else { - tile.getDrawerOptions().setAdvancedValue(action, 1); - } - } - } - } - - @Override - public void registerRecipe(Consumer consumer) { + public void registerRecipe(RecipeOutput consumer) { TitaniumShapedRecipeBuilder.shapedRecipe(this) .pattern("SSS").pattern("SDP").pattern("SIS") .define('S', Blocks.STONE) @@ -210,58 +63,4 @@ public void registerRecipe(Consumer consumer) { .define('I', Tags.Items.INGOTS_IRON) .save(consumer); } - - @Override - public void onRemove(BlockState state, Level worldIn, BlockPos pos, BlockState newState, boolean isMoving) { - if (!state.is(newState.getBlock())) { - TileUtil.getTileEntity(worldIn, pos, SimpleCompactingDrawerTile.class).ifPresent(tile -> { - if (tile.getControllerPos() != null) { - TileUtil.getTileEntity(worldIn, tile.getControllerPos(), StorageControllerTile.class).ifPresent(drawerControllerTile -> { - drawerControllerTile.addConnectedDrawers(LinkingToolItem.ActionMode.REMOVE, pos); - }); - } - }); - } - super.onRemove(state, worldIn, pos, newState, isMoving); - } - - - @Override - public boolean canConnectRedstone(BlockState state, BlockGetter level, BlockPos pos, @Nullable Direction direction) { - return true; - } - - @Override - public boolean isSignalSource(BlockState p_60571_) { - return true; - } - - @Override - public int getSignal(BlockState p_60483_, BlockGetter blockGetter, BlockPos blockPos, Direction p_60486_) { - ItemControllableDrawerTile tile = TileUtil.getTileEntity(blockGetter, blockPos, ItemControllableDrawerTile.class).orElse(null); - if (tile != null) { - for (int i = 0; i < tile.getUtilityUpgrades().getSlots(); i++) { - ItemStack stack = tile.getUtilityUpgrades().getStackInSlot(i); - if (stack.getItem().equals(FunctionalStorage.REDSTONE_UPGRADE.get())) { - int redstoneSlot = stack.getOrCreateTag().getInt("Slot"); - if (redstoneSlot < tile.getStorage().getSlots()) { - int amount = tile.getStorage().getStackInSlot(redstoneSlot).getCount() * 14 / tile.getStorage().getSlotLimit(redstoneSlot); - return amount + (amount > 0 ? 1 : 0); - } - } - } - } - return 0; - } - - @Override - public void appendHoverText(ItemStack p_49816_, @Nullable BlockGetter p_49817_, List tooltip, TooltipFlag p_49819_) { - super.appendHoverText(p_49816_, p_49817_, tooltip, p_49819_); - if (p_49816_.hasTag() && p_49816_.getTag().contains("Tile")) { - MutableComponent text = Component.translatable("drawer.block.contents"); - tooltip.add(text.withStyle(ChatFormatting.GRAY)); - tooltip.add(Component.literal("")); - tooltip.add(Component.literal("")); - } - } } diff --git a/src/main/java/com/buuz135/functionalstorage/block/StorageControllerBlock.java b/src/main/java/com/buuz135/functionalstorage/block/StorageControllerBlock.java index 0430a9c2..4568ba4f 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/StorageControllerBlock.java +++ b/src/main/java/com/buuz135/functionalstorage/block/StorageControllerBlock.java @@ -9,7 +9,9 @@ import net.minecraft.core.Direction; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; @@ -41,8 +43,29 @@ protected void createBlockStateDefinition(StateDefinition.Builder storageTile.onSlotActivated(player, hand, ray.getDirection(), ray.getLocation().x, ray.getLocation().y, ray.getLocation().z)).orElse(InteractionResult.PASS); + protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand hand, BlockHitResult ray) { + var entity = TileUtil.getTileEntity(worldIn, pos, StorageControllerTile.class).orElse(null); + if (entity != null) { + var result = entity.onSlotActivated(player, hand, ray.getDirection(), ray.getLocation().x, ray.getLocation().y, ray.getLocation().z); + if (result == InteractionResult.SUCCESS) { + return ItemInteractionResult.SUCCESS; + } else if (result.consumesAction()) { + return ItemInteractionResult.CONSUME; + } else { + // TODO - validate if this is ok + return ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION; + } + } + return ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION; + } + + @Override + protected InteractionResult useWithoutItem(BlockState state, Level worldIn, BlockPos pos, Player player, BlockHitResult ray) { + var entity = TileUtil.getTileEntity(worldIn, pos, StorageControllerTile.class).orElse(null); + if (entity != null) { + return entity.onSlotActivated(player, InteractionHand.MAIN_HAND, ray.getDirection(), ray.getLocation().x, ray.getLocation().y, ray.getLocation().z); + } + return InteractionResult.PASS; } @Override diff --git a/src/main/java/com/buuz135/functionalstorage/block/StorageControllerExtensionBlock.java b/src/main/java/com/buuz135/functionalstorage/block/StorageControllerExtensionBlock.java index a5322b4f..9247ae31 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/StorageControllerExtensionBlock.java +++ b/src/main/java/com/buuz135/functionalstorage/block/StorageControllerExtensionBlock.java @@ -10,7 +10,9 @@ import net.minecraft.core.Direction; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; @@ -39,8 +41,29 @@ protected void createBlockStateDefinition(StateDefinition.Builder drawerTile.onSlotActivated(player, hand, ray.getDirection(), ray.getLocation().x, ray.getLocation().y, ray.getLocation().z)).orElse(InteractionResult.PASS); + protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand hand, BlockHitResult ray) { + var entity = TileUtil.getTileEntity(worldIn, pos, StorageControllerExtensionTile.class).orElse(null); + if (entity != null) { + var result = entity.onSlotActivated(player, hand, ray.getDirection(), ray.getLocation().x, ray.getLocation().y, ray.getLocation().z); + if (result == InteractionResult.SUCCESS) { + return ItemInteractionResult.SUCCESS; + } else if (result.consumesAction()) { + return ItemInteractionResult.CONSUME; + } else { + // TODO - validate if this is ok + return ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION; + } + } + return ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION; + } + + @Override + protected InteractionResult useWithoutItem(BlockState state, Level worldIn, BlockPos pos, Player player, BlockHitResult ray) { + var entity = TileUtil.getTileEntity(worldIn, pos, StorageControllerExtensionTile.class).orElse(null); + if (entity != null) { + return entity.onSlotActivated(player, InteractionHand.MAIN_HAND, ray.getDirection(), ray.getLocation().x, ray.getLocation().y, ray.getLocation().z); + } + return InteractionResult.PASS; } @Override diff --git a/src/main/java/com/buuz135/functionalstorage/block/tile/ArmoryCabinetTile.java b/src/main/java/com/buuz135/functionalstorage/block/tile/ArmoryCabinetTile.java index 39fed6a8..e60502bf 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/tile/ArmoryCabinetTile.java +++ b/src/main/java/com/buuz135/functionalstorage/block/tile/ArmoryCabinetTile.java @@ -6,25 +6,22 @@ import com.hrznstudio.titanium.block.tile.ActiveTile; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.Connection; import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.items.IItemHandler; +import net.neoforged.neoforge.items.IItemHandler; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import javax.annotation.Nonnull; -import javax.annotation.Nullable; public class ArmoryCabinetTile extends ActiveTile { @Save public ArmoryCabinetInventoryHandler handler; - private final LazyOptional lazyStorage; public ArmoryCabinetTile(BasicTileBlock base, BlockEntityType entityType, BlockPos pos, BlockState state) { super(base, entityType, pos, state); @@ -34,39 +31,24 @@ public void onChange() { ArmoryCabinetTile.this.markForUpdate(); } }; - this.lazyStorage = LazyOptional.of(() -> handler); - } - - @Nonnull - @Override - public LazyOptional getCapability(@Nonnull Capability cap, @Nullable Direction side) { - if (cap == ForgeCapabilities.ITEM_HANDLER) { - return lazyStorage.cast(); - } - return super.getCapability(cap, side); } public IItemHandler getStorage() { return handler; } - public LazyOptional getOptional() { - return lazyStorage; - } - @Override public ClientboundBlockEntityDataPacket getUpdatePacket() { - return ClientboundBlockEntityDataPacket.create(this, blockEntity -> new CompoundTag()); + return ClientboundBlockEntityDataPacket.create(this, (blockEntity, acc) -> new CompoundTag()); } @Override - public void onDataPacket(Connection net, ClientboundBlockEntityDataPacket pkt) { - //super.onDataPacket(net, pkt); + public void onDataPacket(Connection net, ClientboundBlockEntityDataPacket pkt, HolderLookup.Provider provider) { } - @Override + @Override // TODO - wat? @Nonnull - public CompoundTag getUpdateTag() { + public CompoundTag getUpdateTag(HolderLookup.Provider provider) { CompoundTag compoundTag = new CompoundTag(); return compoundTag; } @@ -87,8 +69,7 @@ public ArmoryCabinetTile getSelf() { } @Override - public void invalidateCaps() { - super.invalidateCaps(); - getOptional().invalidate(); + public IItemHandler getItemHandler(@Nullable Direction direction) { + return getStorage(); } } diff --git a/src/main/java/com/buuz135/functionalstorage/block/tile/CompactingDrawerTile.java b/src/main/java/com/buuz135/functionalstorage/block/tile/CompactingDrawerTile.java index a2c0e344..16585fa8 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/tile/CompactingDrawerTile.java +++ b/src/main/java/com/buuz135/functionalstorage/block/tile/CompactingDrawerTile.java @@ -16,23 +16,16 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.items.IItemHandler; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; +import net.neoforged.neoforge.items.IItemHandler; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class CompactingDrawerTile extends ItemControllableDrawerTile { @Save public CompactingInventoryHandler handler; - private final LazyOptional lazyStorage; private boolean hasCheckedRecipes; public CompactingDrawerTile(BasicTileBlock base, BlockEntityType blockEntityType, BlockPos pos, BlockState state) { @@ -69,7 +62,6 @@ public boolean isLocked() { } }; - lazyStorage = LazyOptional.of(() -> this.handler); this.hasCheckedRecipes = false; } @@ -78,7 +70,7 @@ public boolean isLocked() { public void initClient() { super.initClient(); addGuiAddonFactory(() -> new DrawerInfoGuiAddon(64, 16, - new ResourceLocation(FunctionalStorage.MOD_ID, this instanceof CompactingFramedDrawerTile ? "textures/block/framed_front_compacting.png" : "textures/block/compacting_drawer_front.png"), + com.buuz135.functionalstorage.util.Utils.resourceLocation(FunctionalStorage.MOD_ID, this instanceof CompactingFramedDrawerTile ? "textures/block/framed_front_compacting.png" : "textures/block/compacting_drawer_front.png"), 3, integer -> { if (integer == 0) return Pair.of(28, 28); @@ -133,25 +125,11 @@ public IItemHandler getStorage() { return handler; } - @Override - public LazyOptional getOptional() { - return lazyStorage; - } - @Override public int getBaseSize(int slot) { return handler.getSlotLimitBase(slot); } - @Nonnull - @Override - public LazyOptional getCapability(@Nonnull Capability cap, @Nullable Direction side) { - if (cap == ForgeCapabilities.ITEM_HANDLER) { - return lazyStorage.cast(); - } - return super.getCapability(cap, side); - } - @NotNull @Override public CompactingDrawerTile getSelf() { diff --git a/src/main/java/com/buuz135/functionalstorage/block/tile/CompactingFramedDrawerTile.java b/src/main/java/com/buuz135/functionalstorage/block/tile/CompactingFramedDrawerTile.java index 0d4b288e..ca343cfb 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/tile/CompactingFramedDrawerTile.java +++ b/src/main/java/com/buuz135/functionalstorage/block/tile/CompactingFramedDrawerTile.java @@ -6,12 +6,11 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.client.model.data.ModelData; - +import net.neoforged.neoforge.client.model.data.ModelData; import javax.annotation.Nonnull; import java.util.HashMap; -public class CompactingFramedDrawerTile extends CompactingDrawerTile{ +public class CompactingFramedDrawerTile extends CompactingDrawerTile implements FramedTile { @Save private FramedDrawerModelData framedDrawerModelData; diff --git a/src/main/java/com/buuz135/functionalstorage/block/tile/ControllableDrawerTile.java b/src/main/java/com/buuz135/functionalstorage/block/tile/ControllableDrawerTile.java index acebd406..91351bba 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/tile/ControllableDrawerTile.java +++ b/src/main/java/com/buuz135/functionalstorage/block/tile/ControllableDrawerTile.java @@ -19,16 +19,17 @@ import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.util.INBTSerializable; -import net.minecraftforge.items.ItemHandlerHelper; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; +import net.neoforged.neoforge.common.util.INBTSerializable; +import net.neoforged.neoforge.items.ItemHandlerHelper; import java.util.HashMap; @@ -62,7 +63,16 @@ public ControllableDrawerTile(BasicTileBlock base, BlockEntityType entityT } if (getUtilitySlotAmount() > 0){ this.addInventory((InventoryComponent) (this.utilityUpgrades = new InventoryComponent>("utility_upgrades", 114, 70, getUtilitySlotAmount()) - .setInputFilter((stack, integer) -> stack.getItem() instanceof UpgradeItem && ((UpgradeItem) stack.getItem()).getType() == UpgradeItem.Type.UTILITY) + .setInputFilter((stack, integer) -> { + if (stack.is(FunctionalStorage.VOID_UPGRADE)) { + for (int i = 0; i < utilityUpgrades.getSlots(); i++) { + if (utilityUpgrades.getStackInSlot(i).is(FunctionalStorage.VOID_UPGRADE)) { + return false; + } + } + } + return stack.getItem() instanceof UpgradeItem && ((UpgradeItem) stack.getItem()).getType() == UpgradeItem.Type.UTILITY; + }) .setSlotLimit(1) .setOnSlotChanged((itemStack, integer) -> { needsUpgradeCache = true; @@ -200,7 +210,7 @@ public InteractionResult onSlotActivated(Player playerIn, InteractionHand hand, } } } - if (super.onActivated(playerIn, hand, facing, hitX, hitY, hitZ) == InteractionResult.SUCCESS) { + if (super.onActivated(playerIn, hand, facing, hitX, hitY, hitZ) == ItemInteractionResult.SUCCESS) { return InteractionResult.SUCCESS; } if (slot == -1) { @@ -298,11 +308,6 @@ public InventoryComponent> getStorageUpgrades() { return storageUpgrades; } - @Override - public void invalidateCaps() { - super.invalidateCaps(); - } - public boolean isEverythingEmpty() { for (int i = 0; i < getStorageUpgrades().getSlots(); i++) { if (!getStorageUpgrades().getStackInSlot(i).isEmpty()) { @@ -355,7 +360,7 @@ public void setAdvancedValue(ConfigurationToolItem.ConfigurationAction configura } @Override - public CompoundTag serializeNBT() { + public CompoundTag serializeNBT(net.minecraft.core.HolderLookup.Provider provider) { CompoundTag compoundTag = new CompoundTag(); for (ConfigurationToolItem.ConfigurationAction action : this.options.keySet()) { compoundTag.putBoolean(action.name(), this.options.get(action)); @@ -367,7 +372,7 @@ public CompoundTag serializeNBT() { } @Override - public void deserializeNBT(CompoundTag nbt) { + public void deserializeNBT(net.minecraft.core.HolderLookup.Provider provider, CompoundTag nbt) { for (String allKey : nbt.getAllKeys()) { if (allKey.startsWith("Advanced: ")) { this.advancedOptions.put(ConfigurationToolItem.ConfigurationAction.valueOf(allKey.replace("Advanced: ", "")), nbt.getInt(allKey)); diff --git a/src/main/java/com/buuz135/functionalstorage/block/tile/DrawerTile.java b/src/main/java/com/buuz135/functionalstorage/block/tile/DrawerTile.java index b0b5618d..e01a86a1 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/tile/DrawerTile.java +++ b/src/main/java/com/buuz135/functionalstorage/block/tile/DrawerTile.java @@ -15,22 +15,15 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.items.IItemHandler; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; +import net.neoforged.neoforge.items.IItemHandler; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class DrawerTile extends ItemControllableDrawerTile { @Save public BigInventoryHandler handler; - private final LazyOptional lazyStorage; private FunctionalStorage.DrawerType type; private IWoodType woodType; @@ -71,7 +64,6 @@ public boolean isCreative() { }; - lazyStorage = LazyOptional.of(() -> this.handler); } @OnlyIn(Dist.CLIENT) @@ -79,7 +71,7 @@ public boolean isCreative() { public void initClient() { super.initClient(); addGuiAddonFactory(() -> new DrawerInfoGuiAddon(64, 16, - new ResourceLocation(FunctionalStorage.MOD_ID, "textures/block/" + woodType.getName() + "_front_" + type.getSlots() + ".png"), + com.buuz135.functionalstorage.util.Utils.resourceLocation(FunctionalStorage.MOD_ID, "textures/block/" + woodType.getName() + "_front_" + type.getSlots() + ".png"), type.getSlots(), type.getSlotPosition(), integer -> getHandler().getStackInSlot(integer), @@ -87,15 +79,6 @@ public void initClient() { )); } - @Nonnull - @Override - public LazyOptional getCapability(@Nonnull Capability cap, @Nullable Direction side) { - if (cap == ForgeCapabilities.ITEM_HANDLER) { - return lazyStorage.cast(); - } - return super.getCapability(cap, side); - } - public InteractionResult onSlotActivated(Player playerIn, InteractionHand hand, Direction facing, double hitX, double hitY, double hitZ, int slot) { ItemStack stack = playerIn.getItemInHand(hand); if (stack.getItem().equals(FunctionalStorage.CONFIGURATION_TOOL.get()) || stack.getItem().equals(FunctionalStorage.LINKING_TOOL.get())) return InteractionResult.PASS; @@ -128,11 +111,6 @@ public IItemHandler getStorage() { return handler; } - @Override - public LazyOptional getOptional() { - return lazyStorage; - } - @Override public int getBaseSize(int lost) { return type.getSlotAmount(); diff --git a/src/main/java/com/buuz135/functionalstorage/block/tile/EnderDrawerTile.java b/src/main/java/com/buuz135/functionalstorage/block/tile/EnderDrawerTile.java index 293aed2c..077ddc82 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/tile/EnderDrawerTile.java +++ b/src/main/java/com/buuz135/functionalstorage/block/tile/EnderDrawerTile.java @@ -9,6 +9,7 @@ import com.hrznstudio.titanium.block.BasicTileBlock; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; @@ -19,35 +20,29 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.items.IItemHandler; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; +import net.neoforged.neoforge.items.IItemHandler; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.UUID; public class EnderDrawerTile extends ItemControllableDrawerTile { @Save private String frequency; - private LazyOptional lazyStorage; + private IItemHandler storage; public EnderDrawerTile(BasicTileBlock base, BlockEntityType blockEntityType, BlockPos pos, BlockState state) { super(base, blockEntityType, pos, state); this.frequency = UUID.randomUUID().toString(); - this.lazyStorage = LazyOptional.empty(); } @Override public void setLevel(Level p_155231_) { super.setLevel(p_155231_); - this.lazyStorage.invalidate(); - this.lazyStorage = LazyOptional.of(() -> EnderSavedData.getInstance(this.level).getFrequency(this.frequency)); + this.invalidateCapabilities(); + this.storage = EnderSavedData.getInstance(this.level).getFrequency(this.frequency); } @OnlyIn(Dist.CLIENT) @@ -55,7 +50,7 @@ public void setLevel(Level p_155231_) { public void initClient() { super.initClient(); addGuiAddonFactory(() -> new DrawerInfoGuiAddon(64, 16, - new ResourceLocation(FunctionalStorage.MOD_ID, "textures/block/ender_front.png"), + com.buuz135.functionalstorage.util.Utils.resourceLocation(FunctionalStorage.MOD_ID, "textures/block/ender_front.png"), 1, FunctionalStorage.DrawerType.X_1.getSlotPosition(), integer -> getStorage().getStackInSlot(integer), @@ -63,15 +58,6 @@ public void initClient() { )); } - @Nonnull - @Override - public LazyOptional getCapability(@Nonnull Capability cap, @Nullable Direction side) { - if (cap == ForgeCapabilities.ITEM_HANDLER) { - return lazyStorage.cast(); - } - return super.getCapability(cap, side); - } - @Override public void serverTick(Level level, BlockPos pos, BlockState state, EnderDrawerTile blockEntity) { super.serverTick(level, pos, state, blockEntity); @@ -113,9 +99,9 @@ public void onClicked(Player playerIn, int slot) { } @Override - public void load(CompoundTag compound) { + public void loadAdditional(CompoundTag compound, HolderLookup.Provider provider) { String oldFreq = this.frequency; - super.load(compound); + super.loadAdditional(compound, provider); if (!this.frequency.equalsIgnoreCase(oldFreq) && level instanceof ServerLevel){ setFrequency(this.frequency); } @@ -144,12 +130,7 @@ public int getStorageSlotAmount() { @Override public IItemHandler getStorage() { - return this.lazyStorage.resolve().get(); - } - - @Override - public LazyOptional getOptional() { - return this.lazyStorage; + return this.storage; } @Override @@ -181,8 +162,8 @@ public int getBaseSize(int lost) { public void setFrequency(String frequency) { if (frequency == null) return; this.frequency = frequency; - this.lazyStorage.invalidate(); - this.lazyStorage = LazyOptional.of(() -> EnderSavedData.getInstance(this.level).getFrequency(this.frequency)); + this.invalidateCapabilities(); + this.storage = EnderSavedData.getInstance(this.level).getFrequency(this.frequency); this.markForUpdate(); } diff --git a/src/main/java/com/buuz135/functionalstorage/block/tile/FluidDrawerTile.java b/src/main/java/com/buuz135/functionalstorage/block/tile/FluidDrawerTile.java index 1e232de9..48af4c7e 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/tile/FluidDrawerTile.java +++ b/src/main/java/com/buuz135/functionalstorage/block/tile/FluidDrawerTile.java @@ -9,10 +9,11 @@ import com.hrznstudio.titanium.annotation.Save; import com.hrznstudio.titanium.block.BasicTileBlock; import com.hrznstudio.titanium.component.inventory.InventoryComponent; -import com.hrznstudio.titanium.util.TileUtil; +import com.mojang.authlib.GameProfile; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; @@ -22,27 +23,25 @@ import net.minecraft.world.level.block.BucketPickup; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.fluids.FluidUtil; -import net.minecraftforge.fluids.IFluidBlock; -import net.minecraftforge.fluids.capability.IFluidHandler; -import net.minecraftforge.fluids.capability.wrappers.BucketPickupHandlerWrapper; -import net.minecraftforge.fluids.capability.wrappers.FluidBlockWrapper; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; +import net.neoforged.neoforge.capabilities.Capabilities; +import net.neoforged.neoforge.common.util.FakePlayerFactory; +import net.neoforged.neoforge.fluids.FluidUtil; +import net.neoforged.neoforge.fluids.capability.IFluidHandler; +import net.neoforged.neoforge.fluids.capability.wrappers.BucketPickupHandlerWrapper; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.nio.charset.StandardCharsets; +import java.util.Optional; +import java.util.UUID; public class FluidDrawerTile extends ControllableDrawerTile { - - public LazyOptional fluidHandlerLazyOptional; + public static final GameProfile FP = new GameProfile(UUID.nameUUIDFromBytes("FunctionalStorage-Pickup".getBytes(StandardCharsets.UTF_8)), "FunctionalStorage-Pickp"); @Save - private BigFluidHandler fluidHandler; - private FunctionalStorage.DrawerType type; + public BigFluidHandler fluidHandler; + private final FunctionalStorage.DrawerType type; public FluidDrawerTile(BasicTileBlock base, BlockEntityType blockEntityType, BlockPos pos, BlockState state, FunctionalStorage.DrawerType type) { super(base, blockEntityType, pos, state); @@ -68,7 +67,6 @@ public boolean isDrawerCreative() { return isCreative(); } }; - this.fluidHandlerLazyOptional = LazyOptional.of(() -> fluidHandler); } private int getTankCapacity(int storageMultiplier) { @@ -89,7 +87,7 @@ public void initClient() { } String finalSlotName = slotName; addGuiAddonFactory(() -> new FluidDrawerInfoGuiAddon(64, 16, - new ResourceLocation(FunctionalStorage.MOD_ID, "textures/block/fluid_front" + finalSlotName + ".png"), + com.buuz135.functionalstorage.util.Utils.resourceLocation(FunctionalStorage.MOD_ID, "textures/block/fluid_front" + finalSlotName + ".png"), type.getSlots(), type.getSlotPosition(), this::getFluidHandler, @@ -97,18 +95,6 @@ public void initClient() { )); } - @Nonnull - @Override - public LazyOptional getCapability(@Nonnull Capability cap, @Nullable Direction side) { - if (cap == ForgeCapabilities.ITEM_HANDLER) { - return LazyOptional.empty(); - } - if (cap == ForgeCapabilities.FLUID_HANDLER) { - return fluidHandlerLazyOptional.cast(); - } - return super.getCapability(cap, side); - } - @Override public double getStorageDiv() { return FunctionalStorageConfig.FLUID_DIVISOR; @@ -124,40 +110,38 @@ public void serverTick(Level level, BlockPos pos, BlockState stateOwn, FluidDraw var item = stack.getItem(); if (item.equals(FunctionalStorage.PUSHING_UPGRADE.get())) { var direction = UpgradeItem.getDirection(stack); - TileUtil.getTileEntity(level, pos.relative(direction)).ifPresent(blockEntity1 -> { - blockEntity1.getCapability(ForgeCapabilities.FLUID_HANDLER, direction.getOpposite()).ifPresent(otherFluidHandler -> { - for (int tankId = 0; tankId < this.getFluidHandler().getTanks(); tankId++) { - var fluidTank = this.fluidHandler.getTankList()[tankId]; - if (fluidTank.getFluid().isEmpty()) continue; - var extracted = fluidTank.drain(FunctionalStorageConfig.UPGRADE_PUSH_FLUID, IFluidHandler.FluidAction.SIMULATE); - if (extracted.isEmpty()) continue; - var insertedAmount = otherFluidHandler.fill(extracted, IFluidHandler.FluidAction.EXECUTE); - if (insertedAmount > 0) { - fluidTank.drain(insertedAmount, IFluidHandler.FluidAction.EXECUTE); - this.fluidHandler.onChange(); - break; - } + var otherFluidHandler = level.getCapability(Capabilities.FluidHandler.BLOCK, pos.relative(direction), direction.getOpposite()); + if (otherFluidHandler != null) { + for (int tankId = 0; tankId < this.getFluidHandler().getTanks(); tankId++) { + var fluidTank = this.fluidHandler.getTankList()[tankId]; + if (fluidTank.getFluid().isEmpty()) continue; + var extracted = fluidTank.drain(FunctionalStorageConfig.UPGRADE_PUSH_FLUID, IFluidHandler.FluidAction.SIMULATE); + if (extracted.isEmpty()) continue; + var insertedAmount = otherFluidHandler.fill(extracted, IFluidHandler.FluidAction.EXECUTE); + if (insertedAmount > 0) { + fluidTank.drain(insertedAmount, IFluidHandler.FluidAction.EXECUTE); + this.fluidHandler.onChange(); + break; } - }); - }); + } + } } if (item.equals(FunctionalStorage.PULLING_UPGRADE.get())) { var direction = UpgradeItem.getDirection(stack); - TileUtil.getTileEntity(level, pos.relative(direction)).ifPresent(blockEntity1 -> { - blockEntity1.getCapability(ForgeCapabilities.FLUID_HANDLER, direction.getOpposite()).ifPresent(otherFluidHandler -> { - for (int tankId = 0; tankId < this.getFluidHandler().getTanks(); tankId++) { - var fluidTank = this.fluidHandler.getTankList()[tankId]; - var extracted = otherFluidHandler.drain(FunctionalStorageConfig.UPGRADE_PULL_FLUID, IFluidHandler.FluidAction.SIMULATE); - if (extracted.isEmpty()) continue; - var insertedAmount = fluidTank.fill(extracted, IFluidHandler.FluidAction.EXECUTE); - if (insertedAmount > 0) { - otherFluidHandler.drain(insertedAmount, IFluidHandler.FluidAction.EXECUTE); - this.fluidHandler.onChange(); - break; - } + var otherFluidHandler = level.getCapability(Capabilities.FluidHandler.BLOCK, pos.relative(direction), direction.getOpposite()); + if (otherFluidHandler != null) { + for (int tankId = 0; tankId < this.getFluidHandler().getTanks(); tankId++) { + var fluidTank = this.fluidHandler.getTankList()[tankId]; + var extracted = otherFluidHandler.drain(FunctionalStorageConfig.UPGRADE_PULL_FLUID, IFluidHandler.FluidAction.SIMULATE); + if (extracted.isEmpty()) continue; + var insertedAmount = fluidTank.fill(extracted, IFluidHandler.FluidAction.EXECUTE); + if (insertedAmount > 0) { + otherFluidHandler.drain(insertedAmount, IFluidHandler.FluidAction.EXECUTE); + this.fluidHandler.onChange(); + break; } - }); - }); + } + } } if (item.equals(FunctionalStorage.COLLECTOR_UPGRADE.get()) && level.getGameTime() % (FunctionalStorageConfig.UPGRADE_TICK * 3) == 0) { var direction = UpgradeItem.getDirection(stack); @@ -166,10 +150,8 @@ public void serverTick(Level level, BlockPos pos, BlockState stateOwn, FluidDraw BlockState state = level.getBlockState(pos.relative(direction)); Block block = state.getBlock(); IFluidHandler targetFluidHandler = null; - if (block instanceof IFluidBlock) { - targetFluidHandler = new FluidBlockWrapper((IFluidBlock) block, level, pos.relative(direction)); - } else if (block instanceof BucketPickup) { - targetFluidHandler = new BucketPickupHandlerWrapper((BucketPickup) block, level, pos.relative(direction)); + if (block instanceof BucketPickup) { + targetFluidHandler = new BucketPickupHandlerWrapper(FakePlayerFactory.get((ServerLevel) level, FP), (BucketPickup) block, level, pos.relative(direction)); } if (targetFluidHandler != null) { var drained = targetFluidHandler.drain(Integer.MAX_VALUE, IFluidHandler.FluidAction.SIMULATE); @@ -199,16 +181,14 @@ public InteractionResult onSlotActivated(Player playerIn, InteractionHand hand, if (stack.getItem().equals(FunctionalStorage.CONFIGURATION_TOOL.get()) || stack.getItem().equals(FunctionalStorage.LINKING_TOOL.get())) return InteractionResult.PASS; if (slot != -1 && !playerIn.getItemInHand(hand).isEmpty()) { - var interactionResult = stack.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM).map(iFluidHandlerItem -> { - return playerIn.getCapability(ForgeCapabilities.ITEM_HANDLER).map(iItemHandler -> { - var result = FluidUtil.tryEmptyContainerAndStow(stack, this.fluidHandler.getTankList()[slot], iItemHandler, Integer.MAX_VALUE, playerIn, true); - if (result.isSuccess()) { - playerIn.setItemInHand(hand, result.getResult().copy()); - return InteractionResult.SUCCESS; - } - return InteractionResult.PASS; - }).orElse(InteractionResult.PASS); - }).orElse(InteractionResult.PASS); + var interactionResult = Optional.ofNullable(stack.getCapability(Capabilities.FluidHandler.ITEM)).map(iFluidHandlerItem -> Optional.ofNullable(playerIn.getCapability(Capabilities.ItemHandler.ENTITY)).map(iItemHandler -> { + var result = FluidUtil.tryEmptyContainerAndStow(stack, this.fluidHandler.getTankList()[slot], iItemHandler, Integer.MAX_VALUE, playerIn, true); + if (result.isSuccess()) { + playerIn.setItemInHand(hand, result.getResult().copy()); + return InteractionResult.SUCCESS; + } + return InteractionResult.PASS; + }).orElse(InteractionResult.PASS)).orElse(InteractionResult.PASS); if (interactionResult == InteractionResult.SUCCESS) { return interactionResult; } @@ -220,8 +200,8 @@ public InteractionResult onSlotActivated(Player playerIn, InteractionHand hand, public void onClicked(Player playerIn, int slot) { ItemStack stack = playerIn.getItemInHand(InteractionHand.MAIN_HAND); if (slot != -1 && !stack.isEmpty()) { - stack.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM).ifPresent(iFluidHandlerItem -> { - playerIn.getCapability(ForgeCapabilities.ITEM_HANDLER).ifPresent(iItemHandler -> { + Optional.ofNullable(stack.getCapability(Capabilities.FluidHandler.ITEM)).ifPresent(iFluidHandlerItem -> { + Optional.ofNullable(playerIn.getCapability(Capabilities.ItemHandler.ENTITY)).ifPresent(iItemHandler -> { var result = FluidUtil.tryFillContainerAndStow(stack, this.fluidHandler.getTankList()[slot], iItemHandler, Integer.MAX_VALUE, playerIn, true); if (result.isSuccess()) { playerIn.setItemInHand(InteractionHand.MAIN_HAND, result.getResult()); @@ -282,6 +262,15 @@ public boolean isEverythingEmpty() { return true; } + public boolean isInventoryEmpty() { + for (int i = 0; i < getFluidHandler().getTanks(); i++) { + if (!getFluidHandler().getFluidInTank(i).isEmpty()) { + return false; + } + } + return false; + } + @Override public InventoryComponent> getStorageUpgradesConstructor() { return new InventoryComponent>("storage_upgrades", 10, 70, getStorageSlotAmount()) { @@ -326,4 +315,8 @@ public ItemStack extractItem(int slot, int amount, boolean simulate) { } + @Override + public IFluidHandler getFluidHandler(@Nullable Direction direction) { + return fluidHandler; + } } diff --git a/src/main/java/com/buuz135/functionalstorage/block/tile/FramedControllerExtensionTile.java b/src/main/java/com/buuz135/functionalstorage/block/tile/FramedControllerExtensionTile.java index 21e76e89..c48a8795 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/tile/FramedControllerExtensionTile.java +++ b/src/main/java/com/buuz135/functionalstorage/block/tile/FramedControllerExtensionTile.java @@ -6,12 +6,12 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.client.model.data.ModelData; +import net.neoforged.neoforge.client.model.data.ModelData; import org.jetbrains.annotations.NotNull; import java.util.HashMap; -public class FramedControllerExtensionTile extends StorageControllerExtensionTile{ +public class FramedControllerExtensionTile extends StorageControllerExtensionTile implements FramedTile { @Save private FramedDrawerModelData framedDrawerModelData; diff --git a/src/main/java/com/buuz135/functionalstorage/block/tile/FramedDrawerControllerTile.java b/src/main/java/com/buuz135/functionalstorage/block/tile/FramedDrawerControllerTile.java index 791df26d..7d9b448c 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/tile/FramedDrawerControllerTile.java +++ b/src/main/java/com/buuz135/functionalstorage/block/tile/FramedDrawerControllerTile.java @@ -6,12 +6,12 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.client.model.data.ModelData; +import net.neoforged.neoforge.client.model.data.ModelData; import org.jetbrains.annotations.NotNull; import java.util.HashMap; -public class FramedDrawerControllerTile extends StorageControllerTile { +public class FramedDrawerControllerTile extends StorageControllerTile implements FramedTile { @Save private FramedDrawerModelData framedDrawerModelData; diff --git a/src/main/java/com/buuz135/functionalstorage/block/tile/FramedDrawerTile.java b/src/main/java/com/buuz135/functionalstorage/block/tile/FramedDrawerTile.java index 59630a89..7a0f93c2 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/tile/FramedDrawerTile.java +++ b/src/main/java/com/buuz135/functionalstorage/block/tile/FramedDrawerTile.java @@ -8,12 +8,11 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.client.model.data.ModelData; - +import net.neoforged.neoforge.client.model.data.ModelData; import javax.annotation.Nonnull; import java.util.HashMap; -public class FramedDrawerTile extends DrawerTile{ +public class FramedDrawerTile extends DrawerTile implements FramedTile { @Save private FramedDrawerModelData framedDrawerModelData; diff --git a/src/main/java/com/buuz135/functionalstorage/block/tile/FramedSimpleCompactingDrawerTile.java b/src/main/java/com/buuz135/functionalstorage/block/tile/FramedSimpleCompactingDrawerTile.java index c06df4eb..e9219829 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/tile/FramedSimpleCompactingDrawerTile.java +++ b/src/main/java/com/buuz135/functionalstorage/block/tile/FramedSimpleCompactingDrawerTile.java @@ -6,12 +6,11 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.client.model.data.ModelData; - +import net.neoforged.neoforge.client.model.data.ModelData; import javax.annotation.Nonnull; import java.util.HashMap; -public class FramedSimpleCompactingDrawerTile extends SimpleCompactingDrawerTile { +public class FramedSimpleCompactingDrawerTile extends SimpleCompactingDrawerTile implements FramedTile { @Save private FramedDrawerModelData framedDrawerModelData; diff --git a/src/main/java/com/buuz135/functionalstorage/block/tile/FramedTile.java b/src/main/java/com/buuz135/functionalstorage/block/tile/FramedTile.java new file mode 100644 index 00000000..ccb26dd9 --- /dev/null +++ b/src/main/java/com/buuz135/functionalstorage/block/tile/FramedTile.java @@ -0,0 +1,9 @@ +package com.buuz135.functionalstorage.block.tile; + +import com.buuz135.functionalstorage.client.model.FramedDrawerModelData; + +public interface FramedTile { + FramedDrawerModelData getFramedDrawerModelData(); + + void setFramedDrawerModelData(FramedDrawerModelData framedDrawerModelData); +} diff --git a/src/main/java/com/buuz135/functionalstorage/block/tile/ItemControllableDrawerTile.java b/src/main/java/com/buuz135/functionalstorage/block/tile/ItemControllableDrawerTile.java index 1517bfed..aaf276fa 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/tile/ItemControllableDrawerTile.java +++ b/src/main/java/com/buuz135/functionalstorage/block/tile/ItemControllableDrawerTile.java @@ -7,12 +7,12 @@ import com.hrznstudio.titanium.block.BasicTileBlock; import com.hrznstudio.titanium.component.inventory.InventoryComponent; import com.hrznstudio.titanium.util.RayTraceUtils; -import com.hrznstudio.titanium.util.TileUtil; import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; @@ -23,13 +23,13 @@ import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.items.IItemHandler; -import net.minecraftforge.items.ItemHandlerHelper; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; +import net.neoforged.neoforge.capabilities.Capabilities; +import net.neoforged.neoforge.items.IItemHandler; +import net.neoforged.neoforge.items.ItemHandlerHelper; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.HashMap; import java.util.UUID; @@ -61,63 +61,56 @@ public void serverTick(Level level, BlockPos pos, BlockState state, T blockEntit Item item = stack.getItem(); if (item.equals(FunctionalStorage.PULLING_UPGRADE.get())) { Direction direction = UpgradeItem.getDirection(stack); - TileUtil.getTileEntity(level, pos.relative(direction)).ifPresent(blockEntity1 -> { - blockEntity1.getCapability(ForgeCapabilities.ITEM_HANDLER, direction.getOpposite()).ifPresent(iItemHandler -> { - for (int otherSlot = 0; otherSlot < iItemHandler.getSlots(); otherSlot++) { - ItemStack pulledStack = iItemHandler.extractItem(otherSlot, FunctionalStorageConfig.UPGRADE_PULL_ITEMS, true); - if (pulledStack.isEmpty()) continue; - boolean hasWorked = false; - for (int ourSlot = 0; ourSlot < this.getStorage().getSlots(); ourSlot++) { - ItemStack simulated = getStorage().insertItem(ourSlot, pulledStack, true); - if (!simulated.equals(pulledStack)) { - ItemStack extracted = iItemHandler.extractItem(otherSlot, pulledStack.getCount() - simulated.getCount(), false); - getStorage().insertItem(ourSlot, extracted, false); - hasWorked = true; - break; - } + var iItemHandler = level.getCapability(Capabilities.ItemHandler.BLOCK, pos.relative(direction), direction.getOpposite()); + if (iItemHandler != null) { + for (int otherSlot = 0; otherSlot < iItemHandler.getSlots(); otherSlot++) { + ItemStack pulledStack = iItemHandler.extractItem(otherSlot, FunctionalStorageConfig.UPGRADE_PULL_ITEMS, true); + if (pulledStack.isEmpty()) continue; + boolean hasWorked = false; + for (int ourSlot = 0; ourSlot < this.getStorage().getSlots(); ourSlot++) { + ItemStack simulated = getStorage().insertItem(ourSlot, pulledStack, true); + if (!simulated.equals(pulledStack)) { + ItemStack extracted = iItemHandler.extractItem(otherSlot, pulledStack.getCount() - simulated.getCount(), false); + getStorage().insertItem(ourSlot, extracted, false); + hasWorked = true; + break; } - if (hasWorked) break; } - }); - }); - } - if (item.equals(FunctionalStorage.PUSHING_UPGRADE.get())) { + if (hasWorked) break; + } + } + } else if (item.equals(FunctionalStorage.PUSHING_UPGRADE.get())) { Direction direction = UpgradeItem.getDirection(stack); - TileUtil.getTileEntity(level, pos.relative(direction)).ifPresent(blockEntity1 -> { - blockEntity1.getCapability(ForgeCapabilities.ITEM_HANDLER, direction.getOpposite()).ifPresent(otherHandler -> { - for (int drawerSlot = 0; drawerSlot < getStorage().getSlots(); drawerSlot++) { - ItemStack pulledStack = getStorage().extractItem(drawerSlot, FunctionalStorageConfig.UPGRADE_PUSH_ITEMS, true); - if (pulledStack.isEmpty()) continue; - boolean hasWorked = false; - for (int destinationSlot = 0; destinationSlot < otherHandler.getSlots(); destinationSlot++) { - ItemStack otherHandlerStackInSlot = otherHandler.getStackInSlot(destinationSlot); - if (!otherHandlerStackInSlot.isEmpty() && !ItemStack.isSameItemSameTags(pulledStack, otherHandler.getStackInSlot(destinationSlot))) - continue; - if (otherHandler.getStackInSlot(destinationSlot).getCount() >= otherHandler.getSlotLimit(destinationSlot)) - continue; - ItemStack simulated = otherHandler.insertItem(destinationSlot, pulledStack, true); - if (simulated.getCount() <= pulledStack.getCount()) { - otherHandler.insertItem(destinationSlot, getStorage().extractItem(drawerSlot, pulledStack.getCount() - simulated.getCount(), false), false); - hasWorked = true; - break; - } + var otherHandler = level.getCapability(Capabilities.ItemHandler.BLOCK, pos.relative(direction), direction.getOpposite()); + if (otherHandler != null) { + for (int drawerSlot = 0; drawerSlot < getStorage().getSlots(); drawerSlot++) { + ItemStack pulledStack = getStorage().extractItem(drawerSlot, FunctionalStorageConfig.UPGRADE_PUSH_ITEMS, true); + if (pulledStack.isEmpty()) continue; + boolean hasWorked = false; + for (int destinationSlot = 0; destinationSlot < otherHandler.getSlots(); destinationSlot++) { + if (otherHandler.getStackInSlot(destinationSlot).getCount() >= otherHandler.getSlotLimit(destinationSlot)) + continue; + ItemStack simulated = otherHandler.insertItem(destinationSlot, pulledStack, true); + if (simulated.getCount() <= pulledStack.getCount()) { + otherHandler.insertItem(destinationSlot, getStorage().extractItem(drawerSlot, pulledStack.getCount() - simulated.getCount(), false), false); + hasWorked = true; + break; } - if (hasWorked) break; } - }); - }); - } - if (item.equals(FunctionalStorage.COLLECTOR_UPGRADE.get())) { + if (hasWorked) break; + } + } + } else if (item.equals(FunctionalStorage.COLLECTOR_UPGRADE.get())) { Direction direction = UpgradeItem.getDirection(stack); AABB box = new AABB(pos.relative(direction)); for (ItemEntity entitiesOfClass : level.getEntitiesOfClass(ItemEntity.class, box)) { - ItemStack pulledStack = ItemHandlerHelper.copyStackWithSize(entitiesOfClass.getItem(), Math.min(entitiesOfClass.getItem().getCount(), FunctionalStorageConfig.UPGRADE_COLLECTOR_ITEMS)); + ItemStack pulledStack = entitiesOfClass.getItem().copyWithCount(Math.min(entitiesOfClass.getItem().getCount(), FunctionalStorageConfig.UPGRADE_COLLECTOR_ITEMS)); if (pulledStack.isEmpty()) continue; boolean hasWorked = false; for (int ourSlot = 0; ourSlot < this.getStorage().getSlots(); ourSlot++) { ItemStack simulated = getStorage().insertItem(ourSlot, pulledStack, true); if (simulated.getCount() != pulledStack.getCount()) { - getStorage().insertItem(ourSlot, ItemHandlerHelper.copyStackWithSize(entitiesOfClass.getItem(), pulledStack.getCount() - simulated.getCount()), false); + getStorage().insertItem(ourSlot, entitiesOfClass.getItem().copyWithCount(pulledStack.getCount() - simulated.getCount()), false); entitiesOfClass.getItem().shrink(pulledStack.getCount() - simulated.getCount()); hasWorked = true; break; @@ -135,7 +128,7 @@ public void serverTick(Level level, BlockPos pos, BlockState state, T blockEntit @Override public InteractionResult onSlotActivated(Player playerIn, InteractionHand hand, Direction facing, double hitX, double hitY, double hitZ, int slot) { ItemStack stack = playerIn.getItemInHand(hand); - if (super.onActivated(playerIn, hand, facing, hitX, hitY, hitZ) == InteractionResult.SUCCESS) { + if (super.onActivated(playerIn, hand, facing, hitX, hitY, hitZ) == ItemInteractionResult.SUCCESS) { return InteractionResult.SUCCESS; } if (slot != -1 && isServer()) { @@ -175,16 +168,8 @@ public void onClicked(Player playerIn, int slot) { public abstract IItemHandler getStorage(); - public abstract LazyOptional getOptional(); - public abstract int getBaseSize(int lost); - @Override - public void invalidateCaps() { - super.invalidateCaps(); - getOptional().invalidate(); - } - @Override public InventoryComponent> getStorageUpgradesConstructor() { return new InventoryComponent>("storage_upgrades", 10, 70, getStorageSlotAmount()) { @@ -249,9 +234,22 @@ public boolean isEverythingEmpty() { return true; } + public boolean isInventoryEmpty() { + for (int i = 0; i < getStorage().getSlots(); i++) { + if (!getStorage().getStackInSlot(i).isEmpty()) { + return false; + } + } + return true; + } + @Override public int getTitleColor() { return ChatFormatting.DARK_GRAY.getColor(); } + @Override + public IItemHandler getItemHandler(@Nullable Direction direction) { + return getStorage(); + } } diff --git a/src/main/java/com/buuz135/functionalstorage/block/tile/SimpleCompactingDrawerTile.java b/src/main/java/com/buuz135/functionalstorage/block/tile/SimpleCompactingDrawerTile.java index b35441f3..300e61fb 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/tile/SimpleCompactingDrawerTile.java +++ b/src/main/java/com/buuz135/functionalstorage/block/tile/SimpleCompactingDrawerTile.java @@ -16,21 +16,14 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.items.IItemHandler; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; +import net.neoforged.neoforge.items.IItemHandler; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class SimpleCompactingDrawerTile extends ItemControllableDrawerTile { - private final LazyOptional lazyStorage; @Save public CompactingInventoryHandler handler; private boolean hasCheckedRecipes; @@ -69,7 +62,6 @@ public boolean isLocked() { } }; - lazyStorage = LazyOptional.of(() -> this.handler); this.hasCheckedRecipes = false; } @@ -78,7 +70,7 @@ public boolean isLocked() { public void initClient() { super.initClient(); addGuiAddonFactory(() -> new DrawerInfoGuiAddon(64, 16, - new ResourceLocation(FunctionalStorage.MOD_ID, "textures/block/simple_compacting_drawer_front.png"), + com.buuz135.functionalstorage.util.Utils.resourceLocation(FunctionalStorage.MOD_ID, "textures/block/simple_compacting_drawer_front.png"), 2, integer -> { if (integer == 0) return Pair.of(16, 28); @@ -133,25 +125,12 @@ public IItemHandler getStorage() { return handler; } - @Override - public LazyOptional getOptional() { - return lazyStorage; - } @Override public int getBaseSize(int slot) { return handler.getSlotLimitBase(slot); } - @Nonnull - @Override - public LazyOptional getCapability(@Nonnull Capability cap, @Nullable Direction side) { - if (cap == ForgeCapabilities.ITEM_HANDLER) { - return lazyStorage.cast(); - } - return super.getCapability(cap, side); - } - @NotNull @Override public SimpleCompactingDrawerTile getSelf() { diff --git a/src/main/java/com/buuz135/functionalstorage/block/tile/StorageControllerExtensionTile.java b/src/main/java/com/buuz135/functionalstorage/block/tile/StorageControllerExtensionTile.java index fb98fed2..32156b37 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/tile/StorageControllerExtensionTile.java +++ b/src/main/java/com/buuz135/functionalstorage/block/tile/StorageControllerExtensionTile.java @@ -12,12 +12,8 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.items.IItemHandler; +import net.neoforged.neoforge.items.IItemHandler; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Optional; public abstract class StorageControllerExtensionTile> extends ItemControllableDrawerTile { @@ -46,11 +42,6 @@ public IItemHandler getStorage() { return getControllerInstance().map(StorageControllerTile::getStorage).orElse(null); } - @Override - public LazyOptional getOptional() { - return getControllerInstance().map(StorageControllerTile::getOptional).orElse(null); - } - @Override public int getBaseSize(int lost) { return 1; @@ -72,20 +63,9 @@ public void toggleOption(ConfigurationToolItem.ConfigurationAction action) { } } - @Nonnull - @Override - public LazyOptional getCapability(@Nonnull Capability cap, @Nullable Direction side) { - return getControllerInstance().map(drawerControllerTile -> drawerControllerTile.getCapability(cap, side)).orElse(super.getCapability(cap, side)); - } - private Optional getControllerInstance() { if (getControllerPos() == null) return Optional.empty(); if (level == null || !level.isLoaded(getControllerPos())) return Optional.empty(); return TileUtil.getTileEntity(this.level, getControllerPos(), StorageControllerTile.class); } - - @Override - public void invalidateCaps() { - - } } diff --git a/src/main/java/com/buuz135/functionalstorage/block/tile/StorageControllerTile.java b/src/main/java/com/buuz135/functionalstorage/block/tile/StorageControllerTile.java index 58e700e2..9f5637a3 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/tile/StorageControllerTile.java +++ b/src/main/java/com/buuz135/functionalstorage/block/tile/StorageControllerTile.java @@ -30,17 +30,10 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.fluids.capability.IFluidHandler; -import net.minecraftforge.items.IItemHandler; -import org.jetbrains.annotations.NotNull; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; +import net.neoforged.neoforge.items.IItemHandler; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.HashMap; import java.util.UUID; @@ -53,8 +46,6 @@ public abstract class StorageControllerTile> protected ConnectedDrawers connectedDrawers; public ControllerInventoryHandler inventoryHandler; public ControllerFluidHandler fluidHandler; - protected LazyOptional itemHandlerLazyOptional; - protected LazyOptional fluidHandlerLazyOptional; public StorageControllerTile(BasicTileBlock base, BlockEntityType entityType, BlockPos pos, BlockState state) { super(base, entityType, pos, state); @@ -65,14 +56,12 @@ public ConnectedDrawers getDrawers() { return connectedDrawers; } }; - this.itemHandlerLazyOptional = LazyOptional.of(() -> this.inventoryHandler); this.fluidHandler = new ControllerFluidHandler() { @Override public ConnectedDrawers getDrawers() { return connectedDrawers; } }; - this.fluidHandlerLazyOptional = LazyOptional.of(() -> this.fluidHandler); } @Override @@ -169,11 +158,6 @@ public IItemHandler getStorage() { return inventoryHandler; } - @Override - public LazyOptional getOptional() { - return itemHandlerLazyOptional; - } - @Override public int getBaseSize(int lost) { return 1; @@ -251,29 +235,11 @@ public boolean addConnectedDrawers(LinkingToolItem.ActionMode action, BlockPos.. return didWork; } - @Nonnull - @Override - public LazyOptional getCapability(@Nonnull Capability cap, @Nullable Direction side) { - if (cap == ForgeCapabilities.ITEM_HANDLER) { - return itemHandlerLazyOptional.cast(); - } - if (cap == ForgeCapabilities.FLUID_HANDLER) { - return fluidHandlerLazyOptional.cast(); - } - return super.getCapability(cap, side); - } - - @Override - public void invalidateCaps() { - super.invalidateCaps(); - this.fluidHandlerLazyOptional.invalidate(); - this.itemHandlerLazyOptional.invalidate(); - } - - @Override - public AABB getRenderBoundingBox() { - return super.getRenderBoundingBox().inflate(1200); - } + // TODO 1.20.4 - fix +// @Override +// public AABB getRenderBoundingBox() { +// return super.getRenderBoundingBox().inflate(1200); +// } @Override public InventoryComponent> getStorageUpgradesConstructor() { diff --git a/src/main/java/com/buuz135/functionalstorage/client/BaseDrawerRenderer.java b/src/main/java/com/buuz135/functionalstorage/client/BaseDrawerRenderer.java new file mode 100644 index 00000000..48befb3c --- /dev/null +++ b/src/main/java/com/buuz135/functionalstorage/client/BaseDrawerRenderer.java @@ -0,0 +1,52 @@ +package com.buuz135.functionalstorage.client; + +import com.buuz135.functionalstorage.block.tile.CompactingDrawerTile; +import com.buuz135.functionalstorage.block.tile.ControllableDrawerTile; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.LevelRenderer; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; +import net.minecraft.core.Direction; +import org.joml.Vector3f; + +import static com.buuz135.functionalstorage.util.MathUtils.createTransformMatrix; + +public abstract class BaseDrawerRenderer> implements BlockEntityRenderer { + @Override + public final void render(T tile, float partialTicks, PoseStack matrixStack, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) { + if (Minecraft.getInstance().player != null && !tile.getBlockPos().closerThan(Minecraft.getInstance().player.getOnPos(), FunctionalStorageClientConfig.DRAWER_RENDER_RANGE)){ + return; + } + matrixStack.pushPose(); + + Direction facing = tile.getFacingDirection(); + matrixStack.mulPose(createTransformMatrix( + new Vector3f(0), new Vector3f(0, 180, 0), 1)); + + if (facing == Direction.NORTH) { + matrixStack.mulPose(createTransformMatrix( + new Vector3f(-1, 0, 0), new Vector3f(0), 1)); + } + else if (facing == Direction.EAST) { + matrixStack.mulPose(createTransformMatrix( + new Vector3f(-1, 0, -1), new Vector3f(0, -90, 0), 1)); + } + else if (facing == Direction.SOUTH) { + matrixStack.mulPose(createTransformMatrix( + new Vector3f(0, 0, -1), new Vector3f(0, 180, 0), 1)); + } + else if (facing == Direction.WEST) { + matrixStack.mulPose(createTransformMatrix( + new Vector3f(0, 0, 0), new Vector3f(0, 90, 0), 1)); + } + + matrixStack.translate(0,0,-0.5/16D); + combinedLightIn = LevelRenderer.getLightColor(tile.getLevel(), tile.getBlockPos().relative(facing)); + DrawerRenderer.renderUpgrades(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, tile); + + renderItems(tile, partialTicks, matrixStack, bufferIn, combinedLightIn, combinedOverlayIn); + } + + public abstract void renderItems(T tile, float partialTicks, PoseStack matrixStack, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn); +} diff --git a/src/main/java/com/buuz135/functionalstorage/client/ClientSetup.java b/src/main/java/com/buuz135/functionalstorage/client/ClientSetup.java new file mode 100644 index 00000000..764f46a3 --- /dev/null +++ b/src/main/java/com/buuz135/functionalstorage/client/ClientSetup.java @@ -0,0 +1,26 @@ +package com.buuz135.functionalstorage.client; + +import com.buuz135.functionalstorage.block.tile.ItemControllableDrawerTile; +import com.buuz135.functionalstorage.item.FSAttachments; +import com.buuz135.functionalstorage.item.UpgradeItem; +import com.hrznstudio.titanium.block.RotatableBlock; +import com.hrznstudio.titanium.client.screen.container.BasicAddonScreen; +import com.hrznstudio.titanium.event.handler.EventManager; +import com.hrznstudio.titanium.util.FacingUtil; +import net.minecraft.ChatFormatting; +import net.minecraft.client.Minecraft; +import net.minecraft.network.chat.Component; +import net.neoforged.neoforge.event.entity.player.ItemTooltipEvent; + +public class ClientSetup { + public static void init() { + EventManager.forge(ItemTooltipEvent.class).filter( + event -> UpgradeItem.isDirectionUpgrade(event.getItemStack().getItem()) && event.getItemStack().has(FSAttachments.DIRECTION) + ).filter(event -> Minecraft.getInstance().screen != null && Minecraft.getInstance().screen instanceof BasicAddonScreen bcs && bcs.getMenu().getObject() instanceof ItemControllableDrawerTile) + .process(event -> { + var sc = (BasicAddonScreen) Minecraft.getInstance().screen; + var direction = ((ItemControllableDrawerTile) sc.getMenu().getObject()).getBlockState().getValue(RotatableBlock.FACING_HORIZONTAL); + event.getToolTip().add(3, Component.translatable("drawer_upgrade.functionalstorage.relative_direction", UpgradeItem.getRelativeDirection(direction, UpgradeItem.getDirection(event.getItemStack()))).withStyle(ChatFormatting.YELLOW)); + }).subscribe(); + } +} diff --git a/src/main/java/com/buuz135/functionalstorage/client/CompactingDrawerRenderer.java b/src/main/java/com/buuz135/functionalstorage/client/CompactingDrawerRenderer.java index 3f572506..2cf0f0e9 100644 --- a/src/main/java/com/buuz135/functionalstorage/client/CompactingDrawerRenderer.java +++ b/src/main/java/com/buuz135/functionalstorage/client/CompactingDrawerRenderer.java @@ -14,43 +14,14 @@ import static com.buuz135.functionalstorage.util.MathUtils.createTransformMatrix; -public class CompactingDrawerRenderer implements BlockEntityRenderer { +public class CompactingDrawerRenderer extends BaseDrawerRenderer { @Override - public void render(CompactingDrawerTile tile, float partialTicks, PoseStack matrixStack, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) { - if (Minecraft.getInstance().player != null && !tile.getBlockPos().closerThan(Minecraft.getInstance().player.getOnPos(), FunctionalStorageClientConfig.DRAWER_RENDER_RANGE)){ - return; - } - matrixStack.pushPose(); - - Direction facing = tile.getFacingDirection(); - matrixStack.mulPoseMatrix(createTransformMatrix( - new Vector3f(0), new Vector3f(0, 180, 0), 1)); - - if (facing == Direction.NORTH) { - matrixStack.mulPoseMatrix(createTransformMatrix( - new Vector3f(-1, 0, 0), new Vector3f(0), 1)); - } - else if (facing == Direction.EAST) { - matrixStack.mulPoseMatrix(createTransformMatrix( - new Vector3f(-1, 0, -1), new Vector3f(0, -90, 0), 1)); - } - else if (facing == Direction.SOUTH) { - matrixStack.mulPoseMatrix(createTransformMatrix( - new Vector3f(0, 0, -1), new Vector3f(0, 180, 0), 1)); - } - else if (facing == Direction.WEST) { - matrixStack.mulPoseMatrix(createTransformMatrix( - new Vector3f(0, 0, 0), new Vector3f(0, 90, 0), 1)); - } - - matrixStack.translate(0,0,-0.5/16D); - combinedLightIn = LevelRenderer.getLightColor(tile.getLevel(), tile.getBlockPos().relative(facing)); - DrawerRenderer.renderUpgrades(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, tile); + public void renderItems(CompactingDrawerTile tile, float partialTicks, PoseStack matrixStack, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) { ItemStack stack = tile.getHandler().getResultList().get(0).getResult(); if (!stack.isEmpty()){ matrixStack.pushPose(); - matrixStack.mulPoseMatrix(createTransformMatrix( + matrixStack.mulPose(createTransformMatrix( new Vector3f(.75f, .27f, .0005f), new Vector3f(0), new Vector3f(.5f, .5f, 1.0f))); DrawerRenderer.renderStack(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, stack, tile.getHandler().getStackInSlot(0).getCount(),tile.getHandler().getSlotLimit(0), 0.02f, tile.getDrawerOptions(), tile.getLevel()); matrixStack.popPose(); @@ -58,7 +29,7 @@ else if (facing == Direction.WEST) { stack = tile.getHandler().getResultList().get(1).getResult(); if (!stack.isEmpty()){ matrixStack.pushPose(); - matrixStack.mulPoseMatrix(createTransformMatrix( + matrixStack.mulPose(createTransformMatrix( new Vector3f(.25f, .27f, .0005f), new Vector3f(0), new Vector3f(.5f, .5f, 1.0f))); DrawerRenderer.renderStack(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, stack, tile.getHandler().getStackInSlot(1).getCount(), tile.getHandler().getSlotLimit(1), 0.02f, tile.getDrawerOptions(), tile.getLevel()); matrixStack.popPose(); @@ -66,7 +37,7 @@ else if (facing == Direction.WEST) { stack = tile.getHandler().getResultList().get(2).getResult(); if (!stack.isEmpty()){ matrixStack.pushPose(); - matrixStack.mulPoseMatrix(createTransformMatrix( + matrixStack.mulPose(createTransformMatrix( new Vector3f(.5f, .77f, .0005f),new Vector3f(0), new Vector3f(.5f, .5f, 1.0f))); DrawerRenderer.renderStack(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, stack, tile.getHandler().getStackInSlot(2).getCount(), tile.getHandler().getSlotLimit(2), 0.02f, tile.getDrawerOptions(), tile.getLevel()); matrixStack.popPose(); diff --git a/src/main/java/com/buuz135/functionalstorage/client/ControllerRenderer.java b/src/main/java/com/buuz135/functionalstorage/client/ControllerRenderer.java index 7932b4ce..94bdba68 100644 --- a/src/main/java/com/buuz135/functionalstorage/client/ControllerRenderer.java +++ b/src/main/java/com/buuz135/functionalstorage/client/ControllerRenderer.java @@ -2,6 +2,7 @@ import com.buuz135.functionalstorage.block.config.FunctionalStorageConfig; import com.buuz135.functionalstorage.block.tile.StorageControllerTile; +import com.buuz135.functionalstorage.item.FSAttachments; import com.buuz135.functionalstorage.item.LinkingToolItem; import com.hrznstudio.titanium.util.RayTraceUtils; import com.mojang.blaze3d.platform.GlStateManager; @@ -17,7 +18,6 @@ import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; import net.minecraft.core.BlockPos; -import net.minecraft.nbt.CompoundTag; import net.minecraft.util.Mth; import net.minecraft.world.item.ItemStack; import net.minecraft.world.phys.AABB; @@ -27,28 +27,23 @@ import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; import org.joml.Matrix4f; -import org.lwjgl.opengl.GL11; import java.util.List; -import java.util.OptionalDouble; -import static com.buuz135.functionalstorage.item.LinkingToolItem.NBT_CONTROLLER; -import static com.buuz135.functionalstorage.item.LinkingToolItem.NBT_FIRST; - -public class ControllerRenderer implements BlockEntityRenderer { +public class ControllerRenderer implements BlockEntityRenderer> { public static RenderType TYPE = RenderType.create("custom_lines", DefaultVertexFormat.POSITION_COLOR_NORMAL, VertexFormat.Mode.LINES, 256, false, false,RenderType.CompositeState.builder() .setShaderState(new RenderStateShard.ShaderStateShard(GameRenderer::getRendertypeLinesShader)) .setDepthTestState(new RenderStateShard.DepthTestStateShard("always", 519)) - .setLineState(new RenderStateShard.LineStateShard(OptionalDouble.empty())) +// .set(new RenderStateShard.LineStateShard(OptionalDouble.empty())) .setLayeringState(new RenderStateShard.LayeringStateShard("view_offset_z_layering", () -> { - PoseStack posestack = RenderSystem.getModelViewStack(); - posestack.pushPose(); + var posestack = RenderSystem.getModelViewStack(); + posestack.pushMatrix(); posestack.scale(0.99975586F, 0.99975586F, 0.99975586F); RenderSystem.applyModelViewMatrix(); }, () -> { - PoseStack posestack = RenderSystem.getModelViewStack(); - posestack.popPose(); + var posestack = RenderSystem.getModelViewStack(); + posestack.popMatrix(); RenderSystem.applyModelViewMatrix(); })) .setCullState(new RenderStateShard.CullStateShard(false)) @@ -65,8 +60,8 @@ private static void renderShape(PoseStack p_109783_, VertexConsumer p_109784_, V f /= f3; f1 /= f3; f2 /= f3; - p_109784_.vertex(posestack$pose.pose(), (float) (p_194324_ + p_109786_), (float) (p_194325_ + p_109787_), (float) (p_194326_ + p_109788_)).color(p_109789_, p_109790_, p_109791_, p_109792_).normal(posestack$pose.normal(), f, f1, f2).endVertex(); - p_109784_.vertex(posestack$pose.pose(), (float) (p_194327_ + p_109786_), (float) (p_194328_ + p_109787_), (float) (p_194329_ + p_109788_)).color(p_109789_, p_109790_, p_109791_, p_109792_).normal(posestack$pose.normal(), f, f1, f2).endVertex(); + p_109784_.addVertex(posestack$pose.pose(), (float) (p_194324_ + p_109786_), (float) (p_194325_ + p_109787_), (float) (p_194326_ + p_109788_)).setColor(p_109789_, p_109790_, p_109791_, p_109792_).setNormal(posestack$pose, f, f1, f2); + p_109784_.addVertex(posestack$pose.pose(), (float) (p_194327_ + p_109786_), (float) (p_194328_ + p_109787_), (float) (p_194329_ + p_109788_)).setColor(p_109789_, p_109790_, p_109791_, p_109792_).setNormal(posestack$pose, f, f1, f2); }); } @@ -75,12 +70,10 @@ public void render(StorageControllerTile tile, float partialTicks, PoseStack mat ItemStack stack = Minecraft.getInstance().player.getMainHandItem(); if (stack.isEmpty()) return; if (stack.getItem() instanceof LinkingToolItem) { - CompoundTag controllerNBT = stack.getOrCreateTag().getCompound(NBT_CONTROLLER); - BlockPos controller = new BlockPos(controllerNBT.getInt("X"), controllerNBT.getInt("Y"), controllerNBT.getInt("Z")); + BlockPos controller = FSAttachments.CONTROLLER.get(stack); if (!controller.equals(tile.getBlockPos())) return; - if (stack.getOrCreateTag().contains(NBT_FIRST)) { - CompoundTag firstpos = stack.getOrCreateTag().getCompound(NBT_FIRST); - BlockPos firstPos = new BlockPos(firstpos.getInt("X"), firstpos.getInt("Y"), firstpos.getInt("Z")); + if (stack.has(FSAttachments.FIRST_POSITION)) { + BlockPos firstPos = stack.get(FSAttachments.FIRST_POSITION); HitResult result = RayTraceUtils.rayTraceSimple(Minecraft.getInstance().level, Minecraft.getInstance().player, 8, partialTicks); if (result.getType() == HitResult.Type.BLOCK){ BlockPos hit = ((BlockHitResult)result).getBlockPos(); @@ -132,6 +125,11 @@ public boolean shouldRenderOffScreen(StorageControllerTile p_112306_) { return true; } + @Override + public AABB getRenderBoundingBox(StorageControllerTile blockEntity) { + return AABB.INFINITE; + } + private static RenderType AREA_TYPE = createRenderType(); public static RenderType createRenderType() { @@ -162,70 +160,70 @@ private void renderFaces(PoseStack stack, MultiBufferSource renderTypeBuffer, AA buffer = renderTypeBuffer.getBuffer(AREA_TYPE); - buffer.vertex(matrix, x1, y1, z1).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x1, y2, z1).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x2, y2, z1).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x2, y1, z1).color(red, green, blue, alpha).endVertex(); + buffer.addVertex(matrix, x1, y1, z1).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x1, y2, z1).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x2, y2, z1).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x2, y1, z1).setColor(red, green, blue, alpha); - buffer.vertex(matrix, x1, y1, z1).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x2, y1, z1).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x2, y2, z1).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x1, y2, z1).color(red, green, blue, alpha).endVertex(); + buffer.addVertex(matrix, x1, y1, z1).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x2, y1, z1).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x2, y2, z1).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x1, y2, z1).setColor(red, green, blue, alpha); - buffer.vertex(matrix, x1, y1, z2).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x2, y1, z2).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x2, y2, z2).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x1, y2, z2).color(red, green, blue, alpha).endVertex(); + buffer.addVertex(matrix, x1, y1, z2).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x2, y1, z2).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x2, y2, z2).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x1, y2, z2).setColor(red, green, blue, alpha); - buffer.vertex(matrix, x1, y1, z2).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x1, y2, z2).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x2, y2, z2).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x2, y1, z2).color(red, green, blue, alpha).endVertex(); + buffer.addVertex(matrix, x1, y1, z2).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x1, y2, z2).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x2, y2, z2).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x2, y1, z2).setColor(red, green, blue, alpha); - buffer.vertex(matrix, x1, y1, z1).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x2, y1, z1).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x2, y1, z2).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x1, y1, z2).color(red, green, blue, alpha).endVertex(); + buffer.addVertex(matrix, x1, y1, z1).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x2, y1, z1).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x2, y1, z2).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x1, y1, z2).setColor(red, green, blue, alpha); - buffer.vertex(matrix, x1, y1, z1).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x1, y1, z2).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x2, y1, z2).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x2, y1, z1).color(red, green, blue, alpha).endVertex(); + buffer.addVertex(matrix, x1, y1, z1).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x1, y1, z2).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x2, y1, z2).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x2, y1, z1).setColor(red, green, blue, alpha); - buffer.vertex(matrix, x1, y2, z1).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x1, y2, z2).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x2, y2, z2).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x2, y2, z1).color(red, green, blue, alpha).endVertex(); + buffer.addVertex(matrix, x1, y2, z1).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x1, y2, z2).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x2, y2, z2).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x2, y2, z1).setColor(red, green, blue, alpha); - buffer.vertex(matrix, x1, y2, z1).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x2, y2, z1).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x2, y2, z2).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x1, y2, z2).color(red, green, blue, alpha).endVertex(); + buffer.addVertex(matrix, x1, y2, z1).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x2, y2, z1).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x2, y2, z2).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x1, y2, z2).setColor(red, green, blue, alpha); - buffer.vertex(matrix, x1, y1, z1).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x1, y1, z2).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x1, y2, z2).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x1, y2, z1).color(red, green, blue, alpha).endVertex(); + buffer.addVertex(matrix, x1, y1, z1).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x1, y1, z2).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x1, y2, z2).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x1, y2, z1).setColor(red, green, blue, alpha); - buffer.vertex(matrix, x1, y1, z1).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x1, y2, z1).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x1, y2, z2).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x1, y1, z2).color(red, green, blue, alpha).endVertex(); + buffer.addVertex(matrix, x1, y1, z1).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x1, y2, z1).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x1, y2, z2).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x1, y1, z2).setColor(red, green, blue, alpha); - buffer.vertex(matrix, x2, y1, z1).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x2, y2, z1).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x2, y2, z2).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x2, y1, z2).color(red, green, blue, alpha).endVertex(); + buffer.addVertex(matrix, x2, y1, z1).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x2, y2, z1).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x2, y2, z2).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x2, y1, z2).setColor(red, green, blue, alpha); - buffer.vertex(matrix, x2, y1, z1).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x2, y1, z2).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x2, y2, z2).color(red, green, blue, alpha).endVertex(); - buffer.vertex(matrix, x2, y2, z1).color(red, green, blue, alpha).endVertex(); + buffer.addVertex(matrix, x2, y1, z1).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x2, y1, z2).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x2, y2, z2).setColor(red, green, blue, alpha); + buffer.addVertex(matrix, x2, y2, z1).setColor(red, green, blue, alpha); } } diff --git a/src/main/java/com/buuz135/functionalstorage/client/DrawerRenderer.java b/src/main/java/com/buuz135/functionalstorage/client/DrawerRenderer.java index d3ff6dee..7e9d3c41 100644 --- a/src/main/java/com/buuz135/functionalstorage/client/DrawerRenderer.java +++ b/src/main/java/com/buuz135/functionalstorage/client/DrawerRenderer.java @@ -28,40 +28,13 @@ import org.joml.Matrix4f; import org.joml.Vector3f; + import static com.buuz135.functionalstorage.util.MathUtils.createTransformMatrix; -public class DrawerRenderer implements BlockEntityRenderer { +public class DrawerRenderer extends BaseDrawerRenderer { @Override - public void render(DrawerTile tile, float partialTicks, PoseStack matrixStack, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) { - if (Minecraft.getInstance().player != null && !tile.getBlockPos().closerThan(Minecraft.getInstance().player.getOnPos(), FunctionalStorageClientConfig.DRAWER_RENDER_RANGE)){ - return; - } - matrixStack.pushPose(); - - Direction facing = tile.getFacingDirection(); - matrixStack.mulPoseMatrix(createTransformMatrix( - new Vector3f(0), new Vector3f(0, 180, 0), 1)); - - if (facing == Direction.NORTH) { - matrixStack.mulPoseMatrix(createTransformMatrix( - new Vector3f(-1, 0, 0), new Vector3f(0), 1)); - } - else if (facing == Direction.EAST) { - matrixStack.mulPoseMatrix(createTransformMatrix( - new Vector3f(-1, 0, -1), new Vector3f(0, -90, 0), 1)); - } - else if (facing == Direction.SOUTH) { - matrixStack.mulPoseMatrix(createTransformMatrix( - new Vector3f(0, 0, -1), new Vector3f(0, 180, 0), 1)); - } - else if (facing == Direction.WEST) { - matrixStack.mulPoseMatrix(createTransformMatrix( - new Vector3f(0, 0, 0), new Vector3f(0, 90, 0), 1)); - } - matrixStack.translate(0,0,-0.5/16D); - combinedLightIn = LevelRenderer.getLightColor(tile.getLevel(), tile.getBlockPos().relative(facing)); - renderUpgrades(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, tile); + public final void renderItems(DrawerTile tile, float partialTicks, PoseStack matrixStack, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) { if (tile.getDrawerType() == FunctionalStorage.DrawerType.X_1) render1Slot(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, tile); if (tile.getDrawerType() == FunctionalStorage.DrawerType.X_2) render2Slot(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, tile); if (tile.getDrawerType() == FunctionalStorage.DrawerType.X_4) render4Slot(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, tile); @@ -87,7 +60,7 @@ public static void renderUpgrades(PoseStack matrixStack, MultiBufferSource buffe } if (tile.isVoid()){ matrixStack.pushPose(); - matrixStack.mulPoseMatrix(createTransformMatrix( + matrixStack.mulPose(createTransformMatrix( new Vector3f(0.969f,0.031f,0.469f/16.0f), new Vector3f(0), scale)); Minecraft.getInstance().getItemRenderer().renderStatic(new ItemStack(FunctionalStorage.VOID_UPGRADE.get()), ItemDisplayContext.NONE, combinedLightIn, combinedOverlayIn, matrixStack, bufferIn, tile.getLevel(),0); matrixStack.popPose(); @@ -97,7 +70,7 @@ public static void renderUpgrades(PoseStack matrixStack, MultiBufferSource buffe public static void renderIndicator(PoseStack matrixStack, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn, float progress, ControllableDrawerTile.DrawerOptions options) { var indicatiorValue = options.getAdvancedValue(ConfigurationToolItem.ConfigurationAction.INDICATOR); if (indicatiorValue != 0) { - TextureAtlasSprite still = Minecraft.getInstance().getTextureAtlas(InventoryMenu.BLOCK_ATLAS).apply(new ResourceLocation(FunctionalStorage.MOD_ID, "block/indicator")); + TextureAtlasSprite still = Minecraft.getInstance().getTextureAtlas(InventoryMenu.BLOCK_ATLAS).apply(com.buuz135.functionalstorage.util.Utils.resourceLocation(FunctionalStorage.MOD_ID, "block/indicator")); VertexConsumer builder = bufferIn.getBuffer(RenderType.translucent()); Matrix4f posMat = matrixStack.last().pose(); float red = 1; @@ -109,31 +82,31 @@ public static void renderIndicator(PoseStack matrixStack, MultiBufferSource buff float y1 = -6.65F / 16F; float y2 = y1 + 1.25f / 16F; float z2 = 0; - double bx1 = 0; - double bx2 = 8; - double bz1 = 0; - double bz2 = 2; + float bx1 = 0 / 16F; + float bx2 = 8 / 16F; + float bz1 = 0 / 16F; + float bz2 = 2 / 16F; float u1 = still.getU(bx1); float u2 = still.getU(bx2); float v1 = still.getV(bz1); float v2 = still.getV(bz2); - if (indicatiorValue != 3) { //HIDE IN MODE 3 NO BG - builder.vertex(posMat, x2, y1, z2).color(red, green, blue, alpha).uv(u2, v1).overlayCoords(combinedOverlayIn).uv2(combinedLightIn).normal(0f, 0f, 1f).endVertex(); - builder.vertex(posMat, x2, y2, z2).color(red, green, blue, alpha).uv(u2, v2).overlayCoords(combinedOverlayIn).uv2(combinedLightIn).normal(0f, 0f, 1f).endVertex(); - builder.vertex(posMat, x1, y2, z2).color(red, green, blue, alpha).uv(u1, v2).overlayCoords(combinedOverlayIn).uv2(combinedLightIn).normal(0f, 0f, 1f).endVertex(); - builder.vertex(posMat, x1, y1, z2).color(red, green, blue, alpha).uv(u1, v1).overlayCoords(combinedOverlayIn).uv2(combinedLightIn).normal(0f, 0f, 1f).endVertex(); + if (indicatiorValue != 3 ) { //HIDE IN MODE 3 NO BG + builder.addVertex(posMat, x2, y1, z2).setColor(red, green, blue, alpha).setUv(u2, v1).setOverlay(combinedOverlayIn).setLight(combinedLightIn).setNormal(0f, 0f, 1f); + builder.addVertex(posMat, x2, y2, z2).setColor(red, green, blue, alpha).setUv(u2, v2).setOverlay(combinedOverlayIn).setLight(combinedLightIn).setNormal(0f, 0f, 1f); + builder.addVertex(posMat, x1, y2, z2).setColor(red, green, blue, alpha).setUv(u1, v2).setOverlay(combinedOverlayIn).setLight(combinedLightIn).setNormal(0f, 0f, 1f); + builder.addVertex(posMat, x1, y1, z2).setColor(red, green, blue, alpha).setUv(u1, v1).setOverlay(combinedOverlayIn).setLight(combinedLightIn).setNormal(0f, 0f, 1f); } - u2 = still.getU(bx2 * progress); + u2 = still.getU((bx2 * progress)); x2 = x1 + 0.5f * progress; z2 = 0.0001f; - v1 = still.getV(8); - v2 = still.getV(10); + v1 = still.getV(8 / 16F); + v2 = still.getV(10 / 16F); if (indicatiorValue == 1 || progress >= 1) { - builder.vertex(posMat, x2, y1, z2).color(red, green, blue, alpha).uv(u2, v1).overlayCoords(combinedOverlayIn).uv2(combinedLightIn).normal(0f, 0f, 1f).endVertex(); - builder.vertex(posMat, x2, y2, z2).color(red, green, blue, alpha).uv(u2, v2).overlayCoords(combinedOverlayIn).uv2(combinedLightIn).normal(0f, 0f, 1f).endVertex(); - builder.vertex(posMat, x1, y2, z2).color(red, green, blue, alpha).uv(u1, v2).overlayCoords(combinedOverlayIn).uv2(combinedLightIn).normal(0f, 0f, 1f).endVertex(); - builder.vertex(posMat, x1, y1, z2).color(red, green, blue, alpha).uv(u1, v1).overlayCoords(combinedOverlayIn).uv2(combinedLightIn).normal(0f, 0f, 1f).endVertex(); + builder.addVertex(posMat, x2, y1, z2).setColor(red, green, blue, alpha).setUv(u2, v1).setOverlay(combinedOverlayIn).setLight(combinedLightIn).setNormal(0f, 0f, 1f); + builder.addVertex(posMat, x2, y2, z2).setColor(red, green, blue, alpha).setUv(u2, v2).setOverlay(combinedOverlayIn).setLight(combinedLightIn).setNormal(0f, 0f, 1f); + builder.addVertex(posMat, x1, y2, z2).setColor(red, green, blue, alpha).setUv(u1, v2).setOverlay(combinedOverlayIn).setLight(combinedLightIn).setNormal(0f, 0f, 1f); + builder.addVertex(posMat, x1, y1, z2).setColor(red, green, blue, alpha).setUv(u1, v1).setOverlay(combinedOverlayIn).setLight(combinedLightIn).setNormal(0f, 0f, 1f); } } } @@ -151,14 +124,14 @@ private void render2Slot(PoseStack matrixStack, MultiBufferSource bufferIn, int BigInventoryHandler inventoryHandler = (BigInventoryHandler) tile.getStorage(); if (!inventoryHandler.getStoredStacks().get(0).getStack().isEmpty()){ matrixStack.pushPose(); - matrixStack.mulPoseMatrix(createTransformMatrix(new Vector3f(0.5f, 0.27f, 0.0005f), new Vector3f(0), new Vector3f(.5f, .5f, 1.0f))); + matrixStack.mulPose(createTransformMatrix(new Vector3f(0.5f, 0.27f, 0.0005f), new Vector3f(0), new Vector3f(.5f, .5f, 1.0f))); ItemStack stack = inventoryHandler.getStoredStacks().get(0).getStack(); renderStack(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, stack, inventoryHandler.getStackInSlot(0).getCount(), inventoryHandler.getSlotLimit(0),0.02f, tile.getDrawerOptions(), tile.getLevel()); matrixStack.popPose(); } if (!inventoryHandler.getStoredStacks().get(1).getStack().isEmpty()){ matrixStack.pushPose(); - matrixStack.mulPoseMatrix(createTransformMatrix( + matrixStack.mulPose(createTransformMatrix( new Vector3f(0.5f, 0.77f, 0.0005f), new Vector3f(0), new Vector3f(.5f, .5f, 1.0f))); ItemStack stack = inventoryHandler.getStoredStacks().get(1).getStack(); renderStack(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, stack, inventoryHandler.getStackInSlot(1).getCount(), inventoryHandler.getSlotLimit(1),0.02f, tile.getDrawerOptions(), tile.getLevel()); @@ -169,7 +142,7 @@ private void render4Slot(PoseStack matrixStack, MultiBufferSource bufferIn, int BigInventoryHandler inventoryHandler = (BigInventoryHandler) tile.getStorage(); if (!inventoryHandler.getStoredStacks().get(0).getStack().isEmpty()){ //BOTTOM RIGHT matrixStack.pushPose(); - matrixStack.mulPoseMatrix(createTransformMatrix( + matrixStack.mulPose(createTransformMatrix( new Vector3f(.75f, .27f, .0005f), new Vector3f(0), new Vector3f(.5f, .5f, 1.0f))); ItemStack stack = inventoryHandler.getStoredStacks().get(0).getStack(); renderStack(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, stack, inventoryHandler.getStackInSlot(0).getCount(), inventoryHandler.getSlotLimit(0),0.02f, tile.getDrawerOptions(), tile.getLevel()); @@ -177,7 +150,7 @@ private void render4Slot(PoseStack matrixStack, MultiBufferSource bufferIn, int } if (!inventoryHandler.getStoredStacks().get(1).getStack().isEmpty()){ //BOTTOM LEFT matrixStack.pushPose(); - matrixStack.mulPoseMatrix(createTransformMatrix( + matrixStack.mulPose(createTransformMatrix( new Vector3f(.25f, .27f, .0005f), new Vector3f(0), new Vector3f(.5f, .5f, 1.0f))); ItemStack stack = inventoryHandler.getStoredStacks().get(1).getStack(); renderStack(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, stack, inventoryHandler.getStackInSlot(1).getCount(), inventoryHandler.getSlotLimit(1),0.02f, tile.getDrawerOptions(), tile.getLevel()); @@ -185,7 +158,7 @@ private void render4Slot(PoseStack matrixStack, MultiBufferSource bufferIn, int } if (!inventoryHandler.getStoredStacks().get(2).getStack().isEmpty()){ //TOP RIGHT matrixStack.pushPose(); - matrixStack.mulPoseMatrix(createTransformMatrix( + matrixStack.mulPose(createTransformMatrix( new Vector3f(.75f, .77f, .0005f), new Vector3f(0), new Vector3f(.5f, .5f, 1.0f))); ItemStack stack = inventoryHandler.getStoredStacks().get(2).getStack(); renderStack(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, stack, inventoryHandler.getStackInSlot(2).getCount(), inventoryHandler.getSlotLimit(2),0.02f, tile.getDrawerOptions(), tile.getLevel()); @@ -193,7 +166,7 @@ private void render4Slot(PoseStack matrixStack, MultiBufferSource bufferIn, int } if (!inventoryHandler.getStoredStacks().get(3).getStack().isEmpty()){ //TOP LEFT matrixStack.pushPose(); - matrixStack.mulPoseMatrix(createTransformMatrix( + matrixStack.mulPose(createTransformMatrix( new Vector3f(.25f, .77f, .0005f), new Vector3f(0), new Vector3f(.5f, .5f, 1.0f))); ItemStack stack = inventoryHandler.getStoredStacks().get(3).getStack(); renderStack(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, stack, inventoryHandler.getStackInSlot(3).getCount(), inventoryHandler.getSlotLimit(3),0.02f, tile.getDrawerOptions(), tile.getLevel()); @@ -208,11 +181,11 @@ public static void renderStack(PoseStack matrixStack, MultiBufferSource bufferIn BakedModel model = Minecraft.getInstance().getItemRenderer().getModel(stack, Minecraft.getInstance().level, null, 0); if (model.isGui3d()){ float thickness = (float)FunctionalStorageClientConfig.DRAWER_RENDER_THICKNESS; - // Avoid scaling normal matrix by using mulPoseMatrix() instead of scale() - matrixStack.mulPoseMatrix(createTransformMatrix( + // Avoid scaling normal matrix by using mulPose() instead of scale() + matrixStack.mulPose(createTransformMatrix( new Vector3f(0), new Vector3f(0), new Vector3f(.75f, .75f, thickness))); } else { - matrixStack.mulPoseMatrix(createTransformMatrix( + matrixStack.mulPose(createTransformMatrix( new Vector3f(0), new Vector3f(0), .4f)); } @@ -222,13 +195,13 @@ public static void renderStack(PoseStack matrixStack, MultiBufferSource bufferIn Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemDisplayContext.FIXED, combinedLightIn, combinedOverlayIn, matrixStack, bufferIn, level,0); } - matrixStack.mulPoseMatrix(createTransformMatrix( + matrixStack.mulPose(createTransformMatrix( new Vector3f(0), new Vector3f(0, 180, 0), 1)); if (!model.isGui3d()){ - matrixStack.mulPoseMatrix(createTransformMatrix( + matrixStack.mulPose(createTransformMatrix( new Vector3f(0), new Vector3f(0), new Vector3f(0.5f / 0.4f, 0.5f / 0.4f, 1))); } else { - matrixStack.mulPoseMatrix(createTransformMatrix( + matrixStack.mulPose(createTransformMatrix( new Vector3f(0), new Vector3f(0), .665f)); } diff --git a/src/main/java/com/buuz135/functionalstorage/client/EnderDrawerRenderer.java b/src/main/java/com/buuz135/functionalstorage/client/EnderDrawerRenderer.java index bbd9680f..358cb32a 100644 --- a/src/main/java/com/buuz135/functionalstorage/client/EnderDrawerRenderer.java +++ b/src/main/java/com/buuz135/functionalstorage/client/EnderDrawerRenderer.java @@ -20,69 +20,14 @@ import static com.buuz135.functionalstorage.util.MathUtils.createTransformMatrix; -public class EnderDrawerRenderer implements BlockEntityRenderer { +public class EnderDrawerRenderer extends BaseDrawerRenderer { @Override - public void render(EnderDrawerTile tile, float partialTicks, PoseStack matrixStack, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) { - if (Minecraft.getInstance().player != null && !tile.getBlockPos().closerThan(Minecraft.getInstance().player.getOnPos(), FunctionalStorageClientConfig.DRAWER_RENDER_RANGE)){ - return; - } - matrixStack.pushPose(); - - Direction facing = tile.getFacingDirection(); - matrixStack.mulPoseMatrix(createTransformMatrix( - new Vector3f(0), new Vector3f(0, 180, 0), 1)); - - if (facing == Direction.NORTH) { - matrixStack.mulPoseMatrix(createTransformMatrix( - new Vector3f(-1, 0, 0), new Vector3f(0), 1)); - } - else if (facing == Direction.EAST) { - matrixStack.mulPoseMatrix(createTransformMatrix( - new Vector3f(-1, 0, -1), new Vector3f(0, -90, 0), 1)); - } - else if (facing == Direction.SOUTH) { - matrixStack.mulPoseMatrix(createTransformMatrix( - new Vector3f(0, 0, -1), new Vector3f(0, 180, 0), 1)); - } - else if (facing == Direction.WEST) { - matrixStack.mulPoseMatrix(createTransformMatrix( - new Vector3f(0, 0, 0), new Vector3f(0, 90, 0), 1)); - } - - matrixStack.translate(0,0,-0.5/16D); - combinedLightIn = LevelRenderer.getLightColor(tile.getLevel(), tile.getBlockPos().relative(facing)); - renderUpgrades(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, tile); + public void renderItems(EnderDrawerTile tile, float partialTicks, PoseStack matrixStack, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) { render1Slot(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, tile); matrixStack.popPose(); } - public static void renderUpgrades(PoseStack matrixStack, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn, ControllableDrawerTile tile){ - float scale = 0.0625f; - if (tile.getDrawerOptions().isActive(ConfigurationToolItem.ConfigurationAction.TOGGLE_UPGRADES)){ - matrixStack.pushPose(); - matrixStack.translate(0.031,0.031f,0.472/16D); - for (int i = 0; i < tile.getStorageUpgrades().getSlots(); i++) { - ItemStack stack = tile.getStorageUpgrades().getStackInSlot(i); - if (!stack.isEmpty()){ - matrixStack.pushPose(); - matrixStack.scale(scale, scale, scale); - Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemDisplayContext.NONE, combinedLightIn, combinedOverlayIn, matrixStack, bufferIn, tile.getLevel(), 0); - matrixStack.popPose(); - matrixStack.translate(scale,0,0); - } - } - matrixStack.popPose(); - } - if (tile.isVoid()){ - matrixStack.pushPose(); - matrixStack.mulPoseMatrix(createTransformMatrix( - new Vector3f(.969f, .031f, .469f/16.0f), new Vector3f(0), scale)); - Minecraft.getInstance().getItemRenderer().renderStatic(new ItemStack(FunctionalStorage.VOID_UPGRADE.get()), ItemDisplayContext.NONE, combinedLightIn, combinedOverlayIn, matrixStack, bufferIn, tile.getLevel(), 0); - matrixStack.popPose(); - } - } - private void render1Slot(PoseStack matrixStack, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn, EnderDrawerTile tile){ EnderInventoryHandler inventoryHandler = EnderSavedData.getInstance(tile.getLevel()).getFrequency(tile.getFrequency()); if (!inventoryHandler.getStoredStacks().get(0).getStack().isEmpty()){ diff --git a/src/main/java/com/buuz135/functionalstorage/client/FluidDrawerRenderer.java b/src/main/java/com/buuz135/functionalstorage/client/FluidDrawerRenderer.java index 0ca794e0..57322c29 100644 --- a/src/main/java/com/buuz135/functionalstorage/client/FluidDrawerRenderer.java +++ b/src/main/java/com/buuz135/functionalstorage/client/FluidDrawerRenderer.java @@ -21,16 +21,17 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.inventory.InventoryMenu; import net.minecraft.world.phys.AABB; -import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions; -import net.minecraftforge.fluids.FluidStack; +import net.neoforged.neoforge.client.extensions.common.IClientFluidTypeExtensions; +import net.neoforged.neoforge.fluids.FluidStack; import org.joml.Matrix4f; public class FluidDrawerRenderer implements BlockEntityRenderer { public static void renderFluidStack(PoseStack matrixStack, MultiBufferSource bufferIn, int combinedLight, int combinedOverlay, FluidStack stack, int amount, int maxAmount, float scale, ControllableDrawerTile.DrawerOptions options, AABB bounds, boolean halfText, boolean isSmallBar) { - matrixStack.pushPose(); - if (options.isActive(ConfigurationToolItem.ConfigurationAction.TOGGLE_RENDER)){ + if (options.isActive(ConfigurationToolItem.ConfigurationAction.TOGGLE_RENDER)) { + matrixStack.pushPose(); + IClientFluidTypeExtensions renderProperties = IClientFluidTypeExtensions.of(stack.getFluid()); ResourceLocation texture = renderProperties.getStillTexture(stack); TextureAtlasSprite still = Minecraft.getInstance().getTextureAtlas(InventoryMenu.BLOCK_ATLAS).apply(texture); @@ -48,43 +49,43 @@ public static void renderFluidStack(PoseStack matrixStack, MultiBufferSource buf float y2 = (float) bounds.maxY; float z1 = (float) bounds.minZ; float z2 = (float) bounds.maxZ; - double bx1 = bounds.minX * 16; - double bx2 = bounds.maxX * 16; - double by1 = bounds.minY * 16; - double by2 = bounds.maxY * 16; - double bz1 = bounds.minZ * 16; - double bz2 = bounds.maxZ * 16; + float bx1 = (float) bounds.minX * 1.0f; + float bx2 = (float) bounds.maxX * 1.0f; + float by1 = (float) bounds.minY * 1.0f; + float by2 = (float) bounds.maxY * 1.0f; + float bz1 = (float) bounds.minZ * 1.0f; + float bz2 = (float) bounds.maxZ * 1.0f; Matrix4f posMat = matrixStack.last().pose(); //TOP - if (true) { + { float u1 = still.getU(bx1); float u2 = still.getU(bx2); float v1 = still.getV(bz1); float v2 = still.getV(bz2); - builder.vertex(posMat, x1, y2, z2).color(red, green, blue, alpha).uv(u1, v2).overlayCoords(combinedOverlay).uv2(combinedLight).normal(0f, 1f, 0f).endVertex(); - builder.vertex(posMat, x2, y2, z2).color(red, green, blue, alpha).uv(u2, v2).overlayCoords(combinedOverlay).uv2(combinedLight).normal(0f, 1f, 0f).endVertex(); - builder.vertex(posMat, x2, y2, z1).color(red, green, blue, alpha).uv(u2, v1).overlayCoords(combinedOverlay).uv2(combinedLight).normal(0f, 1f, 0f).endVertex(); - builder.vertex(posMat, x1, y2, z1).color(red, green, blue, alpha).uv(u1, v1).overlayCoords(combinedOverlay).uv2(combinedLight).normal(0f, 1f, 0f).endVertex(); + builder.addVertex(posMat, x1, y2, z2).setColor(red, green, blue, alpha).setUv(u1, v2).setOverlay(combinedOverlay).setLight(combinedLight).setNormal(0f, 1f, 0f); + builder.addVertex(posMat, x2, y2, z2).setColor(red, green, blue, alpha).setUv(u2, v2).setOverlay(combinedOverlay).setLight(combinedLight).setNormal(0f, 1f, 0f); + builder.addVertex(posMat, x2, y2, z1).setColor(red, green, blue, alpha).setUv(u2, v1).setOverlay(combinedOverlay).setLight(combinedLight).setNormal(0f, 1f, 0f); + builder.addVertex(posMat, x1, y2, z1).setColor(red, green, blue, alpha).setUv(u1, v1).setOverlay(combinedOverlay).setLight(combinedLight).setNormal(0f, 1f, 0f); } + //FRONT - if (true) { + { float u1 = still.getU(bx1); float u2 = still.getU(bx2); float v1 = still.getV(by1); float v2 = still.getV(by2); - builder.vertex(posMat, x2, y1, z2).color(red, green, blue, alpha).uv(u2, v1).overlayCoords(combinedOverlay).uv2(combinedLight).normal(0f, 0f, 1f).endVertex(); - builder.vertex(posMat, x2, y2, z2).color(red, green, blue, alpha).uv(u2, v2).overlayCoords(combinedOverlay).uv2(combinedLight).normal(0f, 0f, 1f).endVertex(); - builder.vertex(posMat, x1, y2, z2).color(red, green, blue, alpha).uv(u1, v2).overlayCoords(combinedOverlay).uv2(combinedLight).normal(0f, 0f, 1f).endVertex(); - builder.vertex(posMat, x1, y1, z2).color(red, green, blue, alpha).uv(u1, v1).overlayCoords(combinedOverlay).uv2(combinedLight).normal(0f, 0f, 1f).endVertex(); + builder.addVertex(posMat, x2, y1, z2).setColor(red, green, blue, alpha).setUv(u2, v1).setOverlay(combinedOverlay).setLight(combinedLight).setNormal(0f, 0f, 1f); + builder.addVertex(posMat, x2, y2, z2).setColor(red, green, blue, alpha).setUv(u2, v2).setOverlay(combinedOverlay).setLight(combinedLight).setNormal(0f, 0f, 1f); + builder.addVertex(posMat, x1, y2, z2).setColor(red, green, blue, alpha).setUv(u1, v2).setOverlay(combinedOverlay).setLight(combinedLight).setNormal(0f, 0f, 1f); + builder.addVertex(posMat, x1, y1, z2).setColor(red, green, blue, alpha).setUv(u1, v1).setOverlay(combinedOverlay).setLight(combinedLight).setNormal(0f, 0f, 1f); } + matrixStack.popPose(); } - - matrixStack.popPose(); if (options.isActive(ConfigurationToolItem.ConfigurationAction.TOGGLE_NUMBERS)) { matrixStack.pushPose(); matrixStack.translate(0.5, 0.84, 0.97); diff --git a/src/main/java/com/buuz135/functionalstorage/client/FramedColors.java b/src/main/java/com/buuz135/functionalstorage/client/FramedColors.java index 30ac551d..16aacd67 100644 --- a/src/main/java/com/buuz135/functionalstorage/client/FramedColors.java +++ b/src/main/java/com/buuz135/functionalstorage/client/FramedColors.java @@ -1,78 +1,40 @@ package com.buuz135.functionalstorage.client; import com.buuz135.functionalstorage.FunctionalStorage; -import com.buuz135.functionalstorage.block.CompactingFramedDrawerBlock; +import com.buuz135.functionalstorage.block.FramedBlock; import com.buuz135.functionalstorage.block.FramedDrawerBlock; -import com.buuz135.functionalstorage.block.FramedDrawerControllerBlock; -import com.buuz135.functionalstorage.block.tile.FramedControllerExtensionTile; -import com.buuz135.functionalstorage.block.tile.FramedDrawerControllerTile; -import com.buuz135.functionalstorage.block.tile.FramedDrawerTile; +import com.buuz135.functionalstorage.block.tile.FramedTile; import com.buuz135.functionalstorage.client.model.FramedDrawerModelData; import net.minecraft.client.Minecraft; import net.minecraft.client.color.block.BlockColor; import net.minecraft.client.color.item.ItemColor; import net.minecraft.core.BlockPos; -import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.BlockAndTintGetter; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.client.event.RegisterColorHandlersEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.registries.ForgeRegistries; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.client.event.RegisterColorHandlersEvent; import org.jetbrains.annotations.Nullable; import java.util.Map; -@Mod.EventBusSubscriber(modid = FunctionalStorage.MOD_ID, value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD) +@EventBusSubscriber(modid = FunctionalStorage.MOD_ID, value = Dist.CLIENT, bus = EventBusSubscriber.Bus.MOD) public class FramedColors implements BlockColor, ItemColor { @Override public int getColor(BlockState state, @Nullable BlockAndTintGetter level, @Nullable BlockPos pos, int tintIndex) { if (level != null && pos != null && tintIndex == 0) { - BlockEntity entity = level.getBlockEntity(pos); - if (entity instanceof FramedDrawerTile tile) { + if (level.getBlockEntity(pos) instanceof FramedTile tile) { FramedDrawerModelData framedDrawerModelData = tile.getFramedDrawerModelData(); if (framedDrawerModelData != null) { for (Map.Entry entry: framedDrawerModelData.getDesign().entrySet()) { if (entry.getValue() instanceof BlockItem blockItem) { - if (ForgeRegistries.ITEMS.getKey(blockItem).getNamespace().equals(FunctionalStorage.MOD_ID)) - continue; - BlockState state1 = blockItem.getBlock().defaultBlockState(); - int color = Minecraft.getInstance().getBlockColors().getColor(state1, level, pos, tintIndex); - if (color != -1) - return color; - } - } - } - } - if (entity instanceof FramedDrawerControllerTile tile) { - FramedDrawerModelData framedDrawerModelData = tile.getFramedDrawerModelData(); - if (framedDrawerModelData != null) { - for (Map.Entry entry: framedDrawerModelData.getDesign().entrySet()) { - if (entry.getValue() instanceof BlockItem blockItem) { - if (ForgeRegistries.ITEMS.getKey(blockItem).getNamespace().equals(FunctionalStorage.MOD_ID)) - continue; - BlockState state1 = blockItem.getBlock().defaultBlockState(); - int color = Minecraft.getInstance().getBlockColors().getColor(state1, level, pos, tintIndex); - if (color != -1) - return color; - } - } - } - } - if (entity instanceof FramedControllerExtensionTile tile) { - FramedDrawerModelData framedDrawerModelData = tile.getFramedDrawerModelData(); - if (framedDrawerModelData != null) { - for (Map.Entry entry : framedDrawerModelData.getDesign().entrySet()) { - if (entry.getValue() instanceof BlockItem blockItem) { - if (ForgeRegistries.ITEMS.getKey(blockItem).getNamespace().equals(FunctionalStorage.MOD_ID)) + if (BuiltInRegistries.ITEM.getKey(blockItem).getNamespace().equals(FunctionalStorage.MOD_ID)) continue; BlockState state1 = blockItem.getBlock().defaultBlockState(); int color = Minecraft.getInstance().getBlockColors().getColor(state1, level, pos, tintIndex); @@ -89,11 +51,11 @@ public int getColor(BlockState state, @Nullable BlockAndTintGetter level, @Nulla @Override public int getColor(ItemStack itemStack, int tintIndex) { if (tintIndex == 0) { - if (itemStack.getItem() instanceof BlockItem item && (item.getBlock() instanceof FramedDrawerBlock || item.getBlock() instanceof CompactingFramedDrawerBlock || item.getBlock() instanceof FramedDrawerControllerBlock)) { + if (itemStack.getItem() instanceof BlockItem item && item.getBlock() instanceof FramedBlock) { FramedDrawerModelData framedDrawerModelData = FramedDrawerBlock.getDrawerModelData(itemStack); if (framedDrawerModelData != null) { for (Map.Entry entry: framedDrawerModelData.getDesign().entrySet()) { - if (entry.getValue() instanceof BlockItem blockItem) { + if (entry.getValue() instanceof BlockItem) { int color = Minecraft.getInstance().getItemColors().getColor(itemStack, tintIndex); if (color != -1) return color; @@ -106,21 +68,14 @@ public int getColor(ItemStack itemStack, int tintIndex) { } @SubscribeEvent - public static void blockColors(RegisterColorHandlersEvent.Block event) { - Block block1 = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(FunctionalStorage.MOD_ID, "framed_1")); - event.register(new FramedColors(), block1); - Block block2 = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(FunctionalStorage.MOD_ID, "framed_2")); - event.register(new FramedColors(), block2); - Block block4 = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(FunctionalStorage.MOD_ID, "framed_4")); - event.register(new FramedColors(), block4); - - Block block5 = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(FunctionalStorage.MOD_ID, "compacting_framed_drawer")); - event.register(new FramedColors(), block5); - - Block controller = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(FunctionalStorage.MOD_ID, "framed_storage_controller")); - event.register(new FramedColors(), controller); + static void blockColors(RegisterColorHandlersEvent.Block event) { + final var instance = new FramedColors(); + FunctionalStorage.FRAMED_BLOCKS.forEach(bl -> event.register(instance, bl)); + } - Block controllerExtension = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(FunctionalStorage.MOD_ID, "framed_controller_extension")); - event.register(new FramedColors(), controllerExtension); + @SubscribeEvent + static void itemColors(RegisterColorHandlersEvent.Item event) { + final var instance = new FramedColors(); + FunctionalStorage.FRAMED_BLOCKS.forEach(bl -> event.register(instance, bl)); } } diff --git a/src/main/java/com/buuz135/functionalstorage/client/SimpleCompactingDrawerRenderer.java b/src/main/java/com/buuz135/functionalstorage/client/SimpleCompactingDrawerRenderer.java index 2fec5d00..75fb3a0a 100644 --- a/src/main/java/com/buuz135/functionalstorage/client/SimpleCompactingDrawerRenderer.java +++ b/src/main/java/com/buuz135/functionalstorage/client/SimpleCompactingDrawerRenderer.java @@ -12,40 +12,14 @@ import static com.buuz135.functionalstorage.util.MathUtils.createTransformMatrix; -public class SimpleCompactingDrawerRenderer implements BlockEntityRenderer { +public class SimpleCompactingDrawerRenderer extends BaseDrawerRenderer { @Override - public void render(SimpleCompactingDrawerTile tile, float partialTicks, PoseStack matrixStack, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) { - if (Minecraft.getInstance().player != null && !tile.getBlockPos().closerThan(Minecraft.getInstance().player.getOnPos(), FunctionalStorageClientConfig.DRAWER_RENDER_RANGE)) { - return; - } - matrixStack.pushPose(); - - Direction facing = tile.getFacingDirection(); - matrixStack.mulPoseMatrix(createTransformMatrix( - new Vector3f(0), new Vector3f(0, 180, 0), 1)); - - if (facing == Direction.NORTH) { - matrixStack.mulPoseMatrix(createTransformMatrix( - new Vector3f(-1, 0, 0), new Vector3f(0), 1)); - } else if (facing == Direction.EAST) { - matrixStack.mulPoseMatrix(createTransformMatrix( - new Vector3f(-1, 0, -1), new Vector3f(0, -90, 0), 1)); - } else if (facing == Direction.SOUTH) { - matrixStack.mulPoseMatrix(createTransformMatrix( - new Vector3f(0, 0, -1), new Vector3f(0, 180, 0), 1)); - } else if (facing == Direction.WEST) { - matrixStack.mulPoseMatrix(createTransformMatrix( - new Vector3f(0, 0, 0), new Vector3f(0, 90, 0), 1)); - } - - matrixStack.translate(0, 0, -0.5 / 16D); - combinedLightIn = LevelRenderer.getLightColor(tile.getLevel(), tile.getBlockPos().relative(facing)); - DrawerRenderer.renderUpgrades(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, tile); + public void renderItems(SimpleCompactingDrawerTile tile, float partialTicks, PoseStack matrixStack, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) { ItemStack stack = tile.getHandler().getResultList().get(0).getResult(); if (!stack.isEmpty()) { matrixStack.pushPose(); - matrixStack.mulPoseMatrix(createTransformMatrix( + matrixStack.mulPose(createTransformMatrix( new Vector3f(0.5f, 0.27f, 0.0005f), new Vector3f(0), new Vector3f(.5f, .5f, 1.0f))); DrawerRenderer.renderStack(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, stack, tile.getHandler().getStackInSlot(0).getCount(),tile.getHandler().getSlotLimit(0), 0.02f, tile.getDrawerOptions(), tile.getLevel()); matrixStack.popPose(); @@ -53,7 +27,7 @@ public void render(SimpleCompactingDrawerTile tile, float partialTicks, PoseStac stack = tile.getHandler().getResultList().get(1).getResult(); if (!stack.isEmpty()) { matrixStack.pushPose(); - matrixStack.mulPoseMatrix(createTransformMatrix( + matrixStack.mulPose(createTransformMatrix( new Vector3f(0.5f, 0.77f, 0.0005f), new Vector3f(0), new Vector3f(.5f, .5f, 1.0f))); DrawerRenderer.renderStack(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, stack, tile.getHandler().getStackInSlot(1).getCount(), tile.getHandler().getSlotLimit(1),0.02f, tile.getDrawerOptions(), tile.getLevel()); matrixStack.popPose(); diff --git a/src/main/java/com/buuz135/functionalstorage/client/gui/FluidDrawerInfoGuiAddon.java b/src/main/java/com/buuz135/functionalstorage/client/gui/FluidDrawerInfoGuiAddon.java index 42b35ee1..0fe88728 100644 --- a/src/main/java/com/buuz135/functionalstorage/client/gui/FluidDrawerInfoGuiAddon.java +++ b/src/main/java/com/buuz135/functionalstorage/client/gui/FluidDrawerInfoGuiAddon.java @@ -15,8 +15,8 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions; -import net.minecraftforge.fluids.FluidStack; +import net.neoforged.neoforge.client.extensions.common.IClientFluidTypeExtensions; +import net.neoforged.neoforge.fluids.FluidStack; import org.apache.commons.lang3.tuple.Pair; import java.awt.*; @@ -133,7 +133,7 @@ public void drawForegroundLayer(GuiGraphics guiGraphics, Screen screen, IAssetPr if (over.isEmpty()) { componentList.add(Component.translatable("gui.functionalstorage.fluid").withStyle(ChatFormatting.GOLD).append(Component.literal("Empty").withStyle(ChatFormatting.WHITE))); } else { - componentList.add(Component.translatable("gui.functionalstorage.fluid").withStyle(ChatFormatting.GOLD).append(over.getDisplayName().copy().withStyle(ChatFormatting.WHITE))); + componentList.add(Component.translatable("gui.functionalstorage.fluid").withStyle(ChatFormatting.GOLD).append(over.getHoverName().copy().withStyle(ChatFormatting.WHITE))); var amount = NumberUtils.getFormatedFluidBigNumber(over.getAmount()) + "/" + NumberUtils.getFormatedFluidBigNumber(slotMaxAmount.apply(i)); componentList.add(Component.translatable("gui.functionalstorage.amount").withStyle(ChatFormatting.GOLD).append(Component.literal(amount).withStyle(ChatFormatting.WHITE))); } diff --git a/src/main/java/com/buuz135/functionalstorage/client/item/CompactingDrawerISTER.java b/src/main/java/com/buuz135/functionalstorage/client/item/CompactingDrawerISTER.java index 6c99fa5d..1e71cb3a 100644 --- a/src/main/java/com/buuz135/functionalstorage/client/item/CompactingDrawerISTER.java +++ b/src/main/java/com/buuz135/functionalstorage/client/item/CompactingDrawerISTER.java @@ -1,41 +1,41 @@ package com.buuz135.functionalstorage.client.item; -import com.buuz135.functionalstorage.FunctionalStorage; import com.buuz135.functionalstorage.block.tile.ControllableDrawerTile; import com.buuz135.functionalstorage.client.DrawerRenderer; import com.buuz135.functionalstorage.client.model.FramedDrawerModelData; +import com.buuz135.functionalstorage.item.FSAttachments; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Axis; -import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectFunction; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.client.model.data.ModelData; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.registries.ForgeRegistries; +import net.neoforged.neoforge.capabilities.Capabilities; +import net.neoforged.neoforge.client.model.data.ModelData; import org.jetbrains.annotations.NotNull; import org.joml.Vector3f; import java.util.HashMap; +import java.util.IdentityHashMap; import static com.buuz135.functionalstorage.util.MathUtils.createTransformMatrix; -public class CompactingDrawerISTER extends FunctionalStorageISTER{ +public class CompactingDrawerISTER extends FunctionalStorageISTER { public static CompactingDrawerISTER NORMAL = new CompactingDrawerISTER(false); public static CompactingDrawerISTER SIMPLE = new CompactingDrawerISTER(true); private final boolean simple; - private final Object2ObjectArrayMap modelCache; + private final IdentityHashMap modelCache; public CompactingDrawerISTER(boolean simple) { this.simple = simple; - this.modelCache = new Object2ObjectArrayMap<>(); + this.modelCache = new IdentityHashMap<>(); } @Override @@ -44,76 +44,60 @@ public void onResourceManagerReload(@NotNull ResourceManager resourceManager) { } @Override - public void renderByItem(@NotNull ItemStack stack, @NotNull ItemDisplayContext displayContext, @NotNull PoseStack matrix, @NotNull MultiBufferSource renderer, int light, int overlayLight) { - var modelData = ModelData.EMPTY; - if (stack.hasTag() && stack.getTag().contains("Style")){ - modelData = modelCache.computeIfAbsent(stack.hashCode(), new Object2ObjectFunction() { - @Override - public ModelData get(Object o) { - var tag = stack.getTag().getCompound("Style"); - HashMap data = new HashMap<>(); - data.put("particle", ForgeRegistries.ITEMS.getValue(new ResourceLocation(tag.getString("particle")))); - data.put("front", ForgeRegistries.ITEMS.getValue(new ResourceLocation(tag.getString("front")))); - data.put("side", ForgeRegistries.ITEMS.getValue(new ResourceLocation(tag.getString("side")))); - data.put("front_divider", ForgeRegistries.ITEMS.getValue(new ResourceLocation(tag.getString("front_divider")))); - var framedDrawerModelData = new FramedDrawerModelData(data); - return ModelData.builder().with(FramedDrawerModelData.FRAMED_PROPERTY, framedDrawerModelData).build(); - } - }); - } + public void renderByItem(HolderLookup.Provider access, @NotNull ItemStack stack, @NotNull ItemDisplayContext displayContext, @NotNull PoseStack matrix, @NotNull MultiBufferSource renderer, int light, int overlayLight) { + var modelData = getData(stack); renderBlockItem(stack, displayContext, matrix, renderer, light, overlayLight, modelData); - if (stack.hasTag()){ + if (stack.has(FSAttachments.TILE)) { var options = new ControllableDrawerTile.DrawerOptions(); - if (stack.getTag().contains("Tile")) options.deserializeNBT(stack.getTagElement("Tile").getCompound("drawerOptions")); + options.deserializeNBT(Minecraft.getInstance().level.registryAccess(), stack.get(FSAttachments.TILE).getCompound("drawerOptions")); matrix.mulPose(Axis.YP.rotationDegrees(180)); - matrix.translate(-1,0,0); - stack.getCapability(ForgeCapabilities.ITEM_HANDLER).ifPresent(iItemHandler -> { + matrix.translate(-1, 0, 0); + var iItemHandler = stack.getCapability(Capabilities.ItemHandler.ITEM); + if (iItemHandler != null) { if (simple) { ItemStack internalStack = iItemHandler.getStackInSlot(0); - if (!internalStack.isEmpty()){ + if (!internalStack.isEmpty()) { matrix.pushPose(); - matrix.mulPoseMatrix(createTransformMatrix( + matrix.mulPose(createTransformMatrix( new Vector3f(0.5f, 0.27f, 0.0005f), new Vector3f(0), new Vector3f(.5f, .5f, 1.0f))); - DrawerRenderer.renderStack(matrix, renderer, light, overlayLight, internalStack, internalStack.getCount(), iItemHandler.getSlotLimit(0), 0.02f, options, Minecraft.getInstance().level); + DrawerRenderer.renderStack(matrix, renderer, light, overlayLight, internalStack, internalStack.getCount(), iItemHandler.getSlotLimit(0), 0.02f, options, Minecraft.getInstance().level); matrix.popPose(); } internalStack = iItemHandler.getStackInSlot(1); - if (!internalStack.isEmpty()){ + if (!internalStack.isEmpty()) { matrix.pushPose(); - matrix.mulPoseMatrix(createTransformMatrix( + matrix.mulPose(createTransformMatrix( new Vector3f(0.5f, 0.77f, 0.0005f), new Vector3f(0), new Vector3f(.5f, .5f, 1.0f))); - DrawerRenderer.renderStack(matrix, renderer, light, overlayLight, internalStack, internalStack.getCount(), iItemHandler.getSlotLimit(1), 0.02f, options, Minecraft.getInstance().level); + DrawerRenderer.renderStack(matrix, renderer, light, overlayLight, internalStack, internalStack.getCount(), iItemHandler.getSlotLimit(1), 0.02f, options, Minecraft.getInstance().level); matrix.popPose(); } } else { ItemStack internalStack = iItemHandler.getStackInSlot(0); - if (!internalStack.isEmpty()){ + if (!internalStack.isEmpty()) { matrix.pushPose(); - matrix.mulPoseMatrix(createTransformMatrix( + matrix.mulPose(createTransformMatrix( new Vector3f(.75f, .27f, .0005f), new Vector3f(0), new Vector3f(.5f, .5f, 1.0f))); - DrawerRenderer.renderStack(matrix, renderer, light, overlayLight, internalStack, internalStack.getCount(), iItemHandler.getSlotLimit(0), 0.02f, options, Minecraft.getInstance().level); + DrawerRenderer.renderStack(matrix, renderer, light, overlayLight, internalStack, internalStack.getCount(), iItemHandler.getSlotLimit(0), 0.02f, options, Minecraft.getInstance().level); matrix.popPose(); } internalStack = iItemHandler.getStackInSlot(1); - if (!internalStack.isEmpty()){ + if (!internalStack.isEmpty()) { matrix.pushPose(); - matrix.mulPoseMatrix(createTransformMatrix( + matrix.mulPose(createTransformMatrix( new Vector3f(.25f, .27f, .0005f), new Vector3f(0), new Vector3f(.5f, .5f, 1.0f))); - DrawerRenderer.renderStack(matrix, renderer, light, overlayLight, internalStack, internalStack.getCount(), iItemHandler.getSlotLimit(1), 0.02f, options, Minecraft.getInstance().level); + DrawerRenderer.renderStack(matrix, renderer, light, overlayLight, internalStack, internalStack.getCount(), iItemHandler.getSlotLimit(1), 0.02f, options, Minecraft.getInstance().level); matrix.popPose(); } internalStack = iItemHandler.getStackInSlot(2); - if (!internalStack.isEmpty()){ + if (!internalStack.isEmpty()) { matrix.pushPose(); - matrix.mulPoseMatrix(createTransformMatrix( - new Vector3f(.5f, .77f, .0005f),new Vector3f(0), new Vector3f(.5f, .5f, 1.0f))); - DrawerRenderer.renderStack(matrix, renderer, light, overlayLight, internalStack, internalStack.getCount(), iItemHandler.getSlotLimit(2), 0.02f, options, Minecraft.getInstance().level); + matrix.mulPose(createTransformMatrix( + new Vector3f(.5f, .77f, .0005f), new Vector3f(0), new Vector3f(.5f, .5f, 1.0f))); + DrawerRenderer.renderStack(matrix, renderer, light, overlayLight, internalStack, internalStack.getCount(), iItemHandler.getSlotLimit(2), 0.02f, options, Minecraft.getInstance().level); matrix.popPose(); } } - - }); + } } - } } diff --git a/src/main/java/com/buuz135/functionalstorage/client/item/DrawerISTER.java b/src/main/java/com/buuz135/functionalstorage/client/item/DrawerISTER.java index 07d51459..d9e4e211 100644 --- a/src/main/java/com/buuz135/functionalstorage/client/item/DrawerISTER.java +++ b/src/main/java/com/buuz135/functionalstorage/client/item/DrawerISTER.java @@ -3,41 +3,37 @@ import com.buuz135.functionalstorage.FunctionalStorage; import com.buuz135.functionalstorage.block.tile.ControllableDrawerTile; import com.buuz135.functionalstorage.client.DrawerRenderer; -import com.buuz135.functionalstorage.client.model.FramedDrawerModelData; +import com.buuz135.functionalstorage.item.FSAttachments; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Axis; -import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectFunction; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.core.HolderLookup; import net.minecraft.server.packs.resources.ResourceManager; -import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.client.model.data.ModelData; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.registries.ForgeRegistries; +import net.neoforged.neoforge.capabilities.Capabilities; +import net.neoforged.neoforge.client.model.data.ModelData; import org.jetbrains.annotations.NotNull; import org.joml.Vector3f; -import java.util.HashMap; +import java.util.IdentityHashMap; import static com.buuz135.functionalstorage.util.MathUtils.createTransformMatrix; public class DrawerISTER extends FunctionalStorageISTER{ - public static DrawerISTER SLOT_1 = new DrawerISTER(FunctionalStorage.DrawerType.X_1); - public static DrawerISTER SLOT_2 = new DrawerISTER(FunctionalStorage.DrawerType.X_2); - public static DrawerISTER SLOT_4 = new DrawerISTER(FunctionalStorage.DrawerType.X_4); + public static final DrawerISTER SLOT_1 = new DrawerISTER(FunctionalStorage.DrawerType.X_1); + public static final DrawerISTER SLOT_2 = new DrawerISTER(FunctionalStorage.DrawerType.X_2); + public static final DrawerISTER SLOT_4 = new DrawerISTER(FunctionalStorage.DrawerType.X_4); private final FunctionalStorage.DrawerType type; - private final Object2ObjectArrayMap modelCache; + private final IdentityHashMap modelCache; public DrawerISTER(FunctionalStorage.DrawerType type) { this.type = type; - this.modelCache = new Object2ObjectArrayMap<>(); + this.modelCache = new IdentityHashMap<>(); } @Override @@ -46,87 +42,72 @@ public void onResourceManagerReload(@NotNull ResourceManager resourceManager) { } @Override - public void renderByItem(@NotNull ItemStack stack, @NotNull ItemDisplayContext displayContext, @NotNull PoseStack matrix, @NotNull MultiBufferSource renderer, int light, int overlayLight) { - var modelData = ModelData.EMPTY; - if (stack.hasTag() && stack.getTag().contains("Style")){ - modelData = modelCache.computeIfAbsent(stack.hashCode(), new Object2ObjectFunction() { - @Override - public ModelData get(Object o) { - var tag = stack.getTag().getCompound("Style"); - HashMap data = new HashMap<>(); - data.put("particle", ForgeRegistries.ITEMS.getValue(new ResourceLocation(tag.getString("particle")))); - data.put("front", ForgeRegistries.ITEMS.getValue(new ResourceLocation(tag.getString("front")))); - data.put("side", ForgeRegistries.ITEMS.getValue(new ResourceLocation(tag.getString("side")))); - data.put("front_divider", ForgeRegistries.ITEMS.getValue(new ResourceLocation(tag.getString("front_divider")))); - var framedDrawerModelData = new FramedDrawerModelData(data); - return ModelData.builder().with(FramedDrawerModelData.FRAMED_PROPERTY, framedDrawerModelData).build(); - } - }); - } + public void renderByItem(HolderLookup.Provider access, @NotNull ItemStack stack, @NotNull ItemDisplayContext displayContext, @NotNull PoseStack matrix, @NotNull MultiBufferSource renderer, int light, int overlayLight) { + var modelData = getData(stack); renderBlockItem(stack, displayContext, matrix, renderer, light, overlayLight, modelData); - if (stack.hasTag()){ + if (stack.has(FSAttachments.TILE)) { var options = new ControllableDrawerTile.DrawerOptions(); - if (stack.getTag().contains("Tile")) options.deserializeNBT(stack.getTagElement("Tile").getCompound("drawerOptions")); + options.deserializeNBT(Minecraft.getInstance().level.registryAccess(), stack.get(FSAttachments.TILE).getCompound("drawerOptions")); matrix.mulPose(Axis.YP.rotationDegrees(180)); matrix.translate(-1,0,0); - stack.getCapability(ForgeCapabilities.ITEM_HANDLER).ifPresent(iItemHandler -> { - if (type == FunctionalStorage.DrawerType.X_1){ - if (!iItemHandler.getStackInSlot(0).isEmpty()){ + var iItemHandler = stack.getCapability(Capabilities.ItemHandler.ITEM); + if (iItemHandler != null) { + if (type == FunctionalStorage.DrawerType.X_1) { + if (!iItemHandler.getStackInSlot(0).isEmpty()) { matrix.translate(0.5, 0.5, 0); - DrawerRenderer.renderStack(matrix, renderer, light, overlayLight, iItemHandler.getStackInSlot(0), iItemHandler.getStackInSlot(0).getCount(), iItemHandler.getSlotLimit(0), 0.02f, options , Minecraft.getInstance().level); + DrawerRenderer.renderStack(matrix, renderer, light, overlayLight, iItemHandler.getStackInSlot(0), iItemHandler.getStackInSlot(0).getCount(), iItemHandler.getSlotLimit(0), 0.02f, options, Minecraft.getInstance().level); } } else if (type == FunctionalStorage.DrawerType.X_2) { - if (!iItemHandler.getStackInSlot(0).isEmpty()){ + if (!iItemHandler.getStackInSlot(0).isEmpty()) { matrix.pushPose(); - matrix.mulPoseMatrix(createTransformMatrix(new Vector3f(0.5f, 0.27f, 0.0005f), new Vector3f(0), new Vector3f(.5f, .5f, 1.0f))); + matrix.mulPose(createTransformMatrix(new Vector3f(0.5f, 0.27f, 0.0005f), new Vector3f(0), new Vector3f(.5f, .5f, 1.0f))); ItemStack insideStack = iItemHandler.getStackInSlot(0); - DrawerRenderer.renderStack(matrix, renderer, light, overlayLight, insideStack, insideStack.getCount(), iItemHandler.getSlotLimit(0),0.02f, options, Minecraft.getInstance().level); + DrawerRenderer.renderStack(matrix, renderer, light, overlayLight, insideStack, insideStack.getCount(), iItemHandler.getSlotLimit(0), 0.02f, options, Minecraft.getInstance().level); matrix.popPose(); } - if (!iItemHandler.getStackInSlot(1).isEmpty()){ + if (!iItemHandler.getStackInSlot(1).isEmpty()) { matrix.pushPose(); - matrix.mulPoseMatrix(createTransformMatrix( + matrix.mulPose(createTransformMatrix( new Vector3f(0.5f, 0.77f, 0.0005f), new Vector3f(0), new Vector3f(.5f, .5f, 1.0f))); ItemStack insideStack = iItemHandler.getStackInSlot(1); - DrawerRenderer.renderStack(matrix, renderer, light, overlayLight, insideStack, insideStack.getCount(), iItemHandler.getSlotLimit(1),0.02f, options, Minecraft.getInstance().level); + DrawerRenderer.renderStack(matrix, renderer, light, overlayLight, insideStack, insideStack.getCount(), iItemHandler.getSlotLimit(1), 0.02f, options, Minecraft.getInstance().level); matrix.popPose(); } } else if (type == FunctionalStorage.DrawerType.X_4) { - if (!iItemHandler.getStackInSlot(0).isEmpty()){ //BOTTOM RIGHT + if (!iItemHandler.getStackInSlot(0).isEmpty()) { //BOTTOM RIGHT matrix.pushPose(); - matrix.mulPoseMatrix(createTransformMatrix( + matrix.mulPose(createTransformMatrix( new Vector3f(.75f, .27f, .0005f), new Vector3f(0), new Vector3f(.5f, .5f, 1.0f))); ItemStack insideStack = iItemHandler.getStackInSlot(0); - DrawerRenderer.renderStack(matrix, renderer, light, overlayLight, insideStack, insideStack.getCount(), iItemHandler.getSlotLimit(0),0.02f, options, Minecraft.getInstance().level); + DrawerRenderer.renderStack(matrix, renderer, light, overlayLight, insideStack, insideStack.getCount(), iItemHandler.getSlotLimit(0), 0.02f, options, Minecraft.getInstance().level); matrix.popPose(); } - if (!iItemHandler.getStackInSlot(1).isEmpty()){ //BOTTOM LEFT + if (!iItemHandler.getStackInSlot(1).isEmpty()) { //BOTTOM LEFT matrix.pushPose(); - matrix.mulPoseMatrix(createTransformMatrix( + matrix.mulPose(createTransformMatrix( new Vector3f(.25f, .27f, .0005f), new Vector3f(0), new Vector3f(.5f, .5f, 1.0f))); ItemStack insideStack = iItemHandler.getStackInSlot(1); - DrawerRenderer.renderStack(matrix, renderer, light, overlayLight, insideStack, insideStack.getCount(), iItemHandler.getSlotLimit(1),0.02f, options, Minecraft.getInstance().level); + DrawerRenderer.renderStack(matrix, renderer, light, overlayLight, insideStack, insideStack.getCount(), iItemHandler.getSlotLimit(1), 0.02f, options, Minecraft.getInstance().level); matrix.popPose(); } - if (!iItemHandler.getStackInSlot(2).isEmpty()){ //TOP RIGHT + if (!iItemHandler.getStackInSlot(2).isEmpty()) { //TOP RIGHT matrix.pushPose(); - matrix.mulPoseMatrix(createTransformMatrix( + matrix.mulPose(createTransformMatrix( new Vector3f(.75f, .77f, .0005f), new Vector3f(0), new Vector3f(.5f, .5f, 1.0f))); ItemStack insideStack = iItemHandler.getStackInSlot(2); - DrawerRenderer.renderStack(matrix, renderer, light, overlayLight, insideStack, insideStack.getCount(), iItemHandler.getSlotLimit(2),0.02f, options, Minecraft.getInstance().level); + DrawerRenderer.renderStack(matrix, renderer, light, overlayLight, insideStack, insideStack.getCount(), iItemHandler.getSlotLimit(2), 0.02f, options, Minecraft.getInstance().level); matrix.popPose(); } - if (!iItemHandler.getStackInSlot(3).isEmpty()){ //TOP LEFT + if (!iItemHandler.getStackInSlot(3).isEmpty()) { //TOP LEFT matrix.pushPose(); - matrix.mulPoseMatrix(createTransformMatrix( + matrix.mulPose(createTransformMatrix( new Vector3f(.25f, .77f, .0005f), new Vector3f(0), new Vector3f(.5f, .5f, 1.0f))); ItemStack insideStack = iItemHandler.getStackInSlot(3); - DrawerRenderer.renderStack(matrix, renderer, light, overlayLight, insideStack, insideStack.getCount(), iItemHandler.getSlotLimit(3),0.02f, options, Minecraft.getInstance().level); + DrawerRenderer.renderStack(matrix, renderer, light, overlayLight, insideStack, insideStack.getCount(), iItemHandler.getSlotLimit(3), 0.02f, options, Minecraft.getInstance().level); matrix.popPose(); } } - - }); + } } } diff --git a/src/main/java/com/buuz135/functionalstorage/client/item/FluidDrawerISTER.java b/src/main/java/com/buuz135/functionalstorage/client/item/FluidDrawerISTER.java index c187ead5..d5e53fab 100644 --- a/src/main/java/com/buuz135/functionalstorage/client/item/FluidDrawerISTER.java +++ b/src/main/java/com/buuz135/functionalstorage/client/item/FluidDrawerISTER.java @@ -2,45 +2,33 @@ import com.buuz135.functionalstorage.FunctionalStorage; import com.buuz135.functionalstorage.block.tile.ControllableDrawerTile; -import com.buuz135.functionalstorage.client.DrawerRenderer; import com.buuz135.functionalstorage.client.FluidDrawerRenderer; -import com.buuz135.functionalstorage.client.model.FramedDrawerModelData; +import com.buuz135.functionalstorage.item.FSAttachments; +import com.buuz135.functionalstorage.util.Utils; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Axis; -import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectFunction; -import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.core.HolderLookup; +import net.minecraft.nbt.CompoundTag; import net.minecraft.server.packs.resources.ResourceManager; -import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.material.Fluids; import net.minecraft.world.phys.AABB; -import net.minecraftforge.client.model.data.ModelData; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.registries.ForgeRegistries; +import net.neoforged.neoforge.fluids.FluidStack; import org.jetbrains.annotations.NotNull; -import org.joml.Vector3f; - -import java.util.HashMap; - -import static com.buuz135.functionalstorage.util.MathUtils.createTransformMatrix; public class FluidDrawerISTER extends FunctionalStorageISTER{ - public static FluidDrawerISTER SLOT_1 = new FluidDrawerISTER(FunctionalStorage.DrawerType.X_1); - public static FluidDrawerISTER SLOT_2 = new FluidDrawerISTER(FunctionalStorage.DrawerType.X_2); - public static FluidDrawerISTER SLOT_4 = new FluidDrawerISTER(FunctionalStorage.DrawerType.X_4); + public static final FluidDrawerISTER SLOT_1 = new FluidDrawerISTER(FunctionalStorage.DrawerType.X_1); + public static final FluidDrawerISTER SLOT_2 = new FluidDrawerISTER(FunctionalStorage.DrawerType.X_2); + public static final FluidDrawerISTER SLOT_4 = new FluidDrawerISTER(FunctionalStorage.DrawerType.X_4); private final FunctionalStorage.DrawerType type; - private final Object2ObjectArrayMap modelCache; public FluidDrawerISTER(FunctionalStorage.DrawerType type) { this.type = type; - this.modelCache = new Object2ObjectArrayMap<>(); } @Override @@ -49,45 +37,30 @@ public void onResourceManagerReload(@NotNull ResourceManager resourceManager) { } @Override - public void renderByItem(@NotNull ItemStack stack, @NotNull ItemDisplayContext displayContext, @NotNull PoseStack matrix, @NotNull MultiBufferSource renderer, int light, int overlayLight) { - var modelData = ModelData.EMPTY; - if (stack.hasTag() && stack.getTag().contains("Style")){ - modelData = modelCache.computeIfAbsent(stack.hashCode(), new Object2ObjectFunction() { - @Override - public ModelData get(Object o) { - var tag = stack.getTag().getCompound("Style"); - HashMap data = new HashMap<>(); - data.put("particle", ForgeRegistries.ITEMS.getValue(new ResourceLocation(tag.getString("particle")))); - data.put("front", ForgeRegistries.ITEMS.getValue(new ResourceLocation(tag.getString("front")))); - data.put("side", ForgeRegistries.ITEMS.getValue(new ResourceLocation(tag.getString("side")))); - data.put("front_divider", ForgeRegistries.ITEMS.getValue(new ResourceLocation(tag.getString("front_divider")))); - var framedDrawerModelData = new FramedDrawerModelData(data); - return ModelData.builder().with(FramedDrawerModelData.FRAMED_PROPERTY, framedDrawerModelData).build(); - } - }); - } + public void renderByItem(HolderLookup.Provider access, @NotNull ItemStack stack, @NotNull ItemDisplayContext displayContext, @NotNull PoseStack matrix, @NotNull MultiBufferSource renderer, int light, int overlayLight) { + var modelData = getData(stack); renderBlockItem(stack, displayContext, matrix, renderer, light, overlayLight, modelData); - if (stack.hasTag() && stack.getTag().contains("Tile")){ + if (stack.has(FSAttachments.TILE)) { var options = new ControllableDrawerTile.DrawerOptions(); - if (stack.getTag().contains("Tile")) options.deserializeNBT(stack.getTagElement("Tile").getCompound("drawerOptions")); + options.deserializeNBT(access, stack.get(FSAttachments.TILE).getCompound("drawerOptions")); matrix.mulPose(Axis.YP.rotationDegrees(180)); matrix.translate(-1,0,-1); - var tileTag = stack.getTag().getCompound("Tile").getCompound("fluidHandler"); + var tileTag = stack.get(FSAttachments.TILE).getCompound("fluidHandler"); if (type == FunctionalStorage.DrawerType.X_1){ - FluidStack fluidStack = FluidStack.loadFluidStackFromNBT(tileTag.getCompound(0 + "")); + FluidStack fluidStack = deserialize(access, tileTag, 0); if (!fluidStack.isEmpty()){ int displayAmount = fluidStack.getAmount(); AABB bounds = new AABB(1 / 16D, 1.25 / 16D, 1 / 16D, 15 / 16D, 1.25 / 16D + (fluidStack.getAmount() / (double) fluidStack.getAmount()) * (12.5 / 16D), 15 / 16D); FluidDrawerRenderer.renderFluidStack(matrix, renderer, light, overlayLight, fluidStack, displayAmount, fluidStack.getAmount(), 0.007f, options, bounds, false, false); } } else if (type == FunctionalStorage.DrawerType.X_2) { - FluidStack fluidStack = FluidStack.loadFluidStackFromNBT(tileTag.getCompound(0 + "")); + FluidStack fluidStack = deserialize(access, tileTag, 0); if (!fluidStack.isEmpty()){ int displayAmount = fluidStack.getAmount(); AABB bounds = new AABB(1 / 16D, 1.25 / 16D, 1 / 16D, 15 / 16D, 1.25 / 16D + (fluidStack.getAmount() / (double) fluidStack.getAmount()) * (5.5 / 16D), 15 / 16D); FluidDrawerRenderer.renderFluidStack(matrix, renderer, light, overlayLight, fluidStack, displayAmount, fluidStack.getAmount(), 0.007f, options, bounds, false, true); } - fluidStack = FluidStack.loadFluidStackFromNBT(tileTag.getCompound(1 + "")); + fluidStack = deserialize(access, tileTag, 1); if (!fluidStack.isEmpty()){ matrix.pushPose(); matrix.translate(0, 0.5, 0); @@ -97,7 +70,7 @@ public ModelData get(Object o) { matrix.popPose(); } } else if (type == FunctionalStorage.DrawerType.X_4) { - FluidStack fluidStack = FluidStack.loadFluidStackFromNBT(tileTag.getCompound(0 + "")); + FluidStack fluidStack = deserialize(access, tileTag, 0); if (!fluidStack.isEmpty()){ matrix.pushPose(); matrix.translate(0.5, 0, 0); @@ -106,7 +79,7 @@ public ModelData get(Object o) { FluidDrawerRenderer.renderFluidStack(matrix, renderer, light, overlayLight, fluidStack, displayAmount, fluidStack.getAmount(), 0.007f, options, bounds, true, true); matrix.popPose(); } - fluidStack = FluidStack.loadFluidStackFromNBT(tileTag.getCompound(1 + "")); + fluidStack = deserialize(access, tileTag, 1); if (!fluidStack.isEmpty()){ matrix.pushPose(); int displayAmount = fluidStack.getAmount(); @@ -114,7 +87,7 @@ public ModelData get(Object o) { FluidDrawerRenderer.renderFluidStack(matrix, renderer, light, overlayLight, fluidStack, displayAmount, fluidStack.getAmount(), 0.007f, options, bounds, true, true); matrix.popPose(); } - fluidStack = FluidStack.loadFluidStackFromNBT(tileTag.getCompound(2 + "")); + fluidStack = deserialize(access, tileTag, 2); if (!fluidStack.isEmpty()){ matrix.pushPose(); matrix.translate(0.5, 0.5, 0); @@ -123,7 +96,7 @@ public ModelData get(Object o) { FluidDrawerRenderer.renderFluidStack(matrix, renderer, light, overlayLight, fluidStack, displayAmount, fluidStack.getAmount(), 0.007f, options, bounds, true, true); matrix.popPose(); } - fluidStack = FluidStack.loadFluidStackFromNBT(tileTag.getCompound(3 + "")); + fluidStack = deserialize(access, tileTag, 3); if (!fluidStack.isEmpty()){ matrix.pushPose(); matrix.translate(0, 0.5, 0); @@ -135,4 +108,9 @@ public ModelData get(Object o) { } } } + + public static FluidStack deserialize(HolderLookup.Provider access, CompoundTag tileTag, int i) { + var fluidTag = tileTag.getCompound(String.valueOf(i)); + return Utils.deserializeFluid(access, fluidTag.getCompound("Fluid")); + } } diff --git a/src/main/java/com/buuz135/functionalstorage/client/item/FunctionalStorageISTER.java b/src/main/java/com/buuz135/functionalstorage/client/item/FunctionalStorageISTER.java index aa1f0527..d8f53abc 100644 --- a/src/main/java/com/buuz135/functionalstorage/client/item/FunctionalStorageISTER.java +++ b/src/main/java/com/buuz135/functionalstorage/client/item/FunctionalStorageISTER.java @@ -1,8 +1,11 @@ package com.buuz135.functionalstorage.client.item; -import com.buuz135.functionalstorage.FunctionalStorage; +import com.buuz135.functionalstorage.client.model.FramedDrawerModelData; +import com.buuz135.functionalstorage.item.FSAttachments; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; +import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.client.Camera; import net.minecraft.client.Minecraft; import net.minecraft.client.model.geom.EntityModelSet; @@ -13,21 +16,27 @@ import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.resources.model.BakedModel; import net.minecraft.core.Direction; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.util.RandomSource; import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.HalfTransparentBlock; import net.minecraft.world.level.block.StainedGlassPaneBlock; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.client.RenderTypeHelper; -import net.minecraftforge.client.model.data.ModelData; +import net.neoforged.neoforge.client.model.data.ModelData; import org.jetbrains.annotations.NotNull; +import java.util.HashMap; + public abstract class FunctionalStorageISTER extends BlockEntityWithoutLevelRenderer { + protected final Int2ObjectMap modelCache = new Int2ObjectArrayMap<>(); public FunctionalStorageISTER() { super(Minecraft.getInstance().getBlockEntityRenderDispatcher(), Minecraft.getInstance().getEntityModels()); @@ -52,10 +61,14 @@ protected Camera getCamera() { @Override public abstract void onResourceManagerReload(@NotNull ResourceManager resourceManager); - @Override - public abstract void renderByItem(@NotNull ItemStack stack, @NotNull ItemDisplayContext displayContext, @NotNull PoseStack matrix, @NotNull MultiBufferSource renderer, + public abstract void renderByItem(HolderLookup.Provider access, @NotNull ItemStack stack, @NotNull ItemDisplayContext displayContext, @NotNull PoseStack matrix, @NotNull MultiBufferSource renderer, int light, int overlayLight); + @Override + public void renderByItem(ItemStack stack, ItemDisplayContext displayContext, PoseStack poseStack, MultiBufferSource buffer, int packedLight, int packedOverlay) { + renderByItem(Minecraft.getInstance().level.registryAccess(), stack, displayContext, poseStack, buffer, packedLight, packedOverlay); + } + /** * @implNote Heavily based on/from vanilla's ItemRenderer#render code that calls the renderByItem method on the ISBER */ @@ -107,6 +120,23 @@ protected void renderBlockItem(@NotNull ItemStack stack, @NotNull ItemDisplayCon } + protected ModelData getData(ItemStack stack) { + ModelData modelData = ModelData.EMPTY; + if (stack.has(FSAttachments.STYLE)) { + var tag = stack.get(FSAttachments.STYLE); + modelData = modelCache.computeIfAbsent(tag.hashCode(), o -> { + HashMap data = new HashMap<>(); + data.put("particle", BuiltInRegistries.ITEM.get(ResourceLocation.parse(tag.getString("particle")))); + data.put("front", BuiltInRegistries.ITEM.get(ResourceLocation.parse(tag.getString("front")))); + data.put("side", BuiltInRegistries.ITEM.get(ResourceLocation.parse(tag.getString("side")))); + data.put("front_divider", BuiltInRegistries.ITEM.get(ResourceLocation.parse(tag.getString("front_divider")))); + var framedDrawerModelData = new FramedDrawerModelData(data); + return ModelData.builder().with(FramedDrawerModelData.FRAMED_PROPERTY, framedDrawerModelData).build(); + }); + } + return modelData; + } + private static boolean isLeftHand(ItemDisplayContext type) { return type == ItemDisplayContext.FIRST_PERSON_LEFT_HAND || type == ItemDisplayContext.THIRD_PERSON_LEFT_HAND; diff --git a/src/main/java/com/buuz135/functionalstorage/client/loader/FramedModel.java b/src/main/java/com/buuz135/functionalstorage/client/loader/FramedModel.java index f1e0a5c7..382e557e 100644 --- a/src/main/java/com/buuz135/functionalstorage/client/loader/FramedModel.java +++ b/src/main/java/com/buuz135/functionalstorage/client/loader/FramedModel.java @@ -22,6 +22,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Vec3i; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.RandomSource; import net.minecraft.world.inventory.InventoryMenu; @@ -29,17 +30,16 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.client.ChunkRenderTypeSet; -import net.minecraftforge.client.model.IDynamicBakedModel; -import net.minecraftforge.client.model.IQuadTransformer; -import net.minecraftforge.client.model.SimpleModelState; -import net.minecraftforge.client.model.data.ModelData; -import net.minecraftforge.client.model.data.ModelProperty; -import net.minecraftforge.client.model.geometry.IGeometryBakingContext; -import net.minecraftforge.client.model.geometry.IGeometryLoader; -import net.minecraftforge.client.model.geometry.IUnbakedGeometry; -import net.minecraftforge.common.util.ConcatenatedListView; -import net.minecraftforge.registries.ForgeRegistries; +import net.neoforged.neoforge.client.ChunkRenderTypeSet; +import net.neoforged.neoforge.client.model.IDynamicBakedModel; +import net.neoforged.neoforge.client.model.IQuadTransformer; +import net.neoforged.neoforge.client.model.SimpleModelState; +import net.neoforged.neoforge.client.model.data.ModelData; +import net.neoforged.neoforge.client.model.data.ModelProperty; +import net.neoforged.neoforge.client.model.geometry.IGeometryBakingContext; +import net.neoforged.neoforge.client.model.geometry.IGeometryLoader; +import net.neoforged.neoforge.client.model.geometry.IUnbakedGeometry; +import net.neoforged.neoforge.common.util.ConcatenatedListView; import org.apache.commons.lang3.tuple.ImmutableTriple; import org.apache.commons.lang3.tuple.Triple; import org.apache.logging.log4j.LogManager; @@ -55,7 +55,7 @@ /** * A Custom Model for Framed Drawers.
- * Based on {@link net.minecraftforge.client.model.CompositeModel} from Forge.
+ * Based on {@link net.neoforged.neoforge.client.model.CompositeModel} from Forge.
* Using parts of Painted Block Model from Ender IO. */ public class FramedModel implements IUnbakedGeometry { @@ -65,8 +65,7 @@ public class FramedModel implements IUnbakedGeometry { private final ImmutableList itemPasses; private final boolean logWarning; - public FramedModel(ImmutableMap children, ImmutableList itemPasses) - { + public FramedModel(ImmutableMap children, ImmutableList itemPasses) { this(children, itemPasses, false); } @@ -82,10 +81,7 @@ public void resolveParents(Function modelGetter, } @Override - public BakedModel bake(IGeometryBakingContext context, ModelBaker bakery, Function spriteGetter, ModelState modelState, ItemOverrides overrides, ResourceLocation modelLocation) { - if (logWarning) - LOGGER.warn("Model \"" + modelLocation + "\" is using the deprecated \"parts\" field in its composite model instead of \"children\". This field will be removed in 1.20."); - + public BakedModel bake(IGeometryBakingContext context, ModelBaker baker, Function spriteGetter, ModelState modelState, ItemOverrides overrides) { Material particleLocation = context.getMaterial("particle"); TextureAtlasSprite particle = spriteGetter.apply(particleLocation); @@ -99,7 +95,7 @@ public BakedModel bake(IGeometryBakingContext context, ModelBaker bakery, Functi if (!context.isComponentVisible(name, true)) continue; var model = entry.getValue(); - bakedPartsBuilder.put(name, model.bake(bakery, model, spriteGetter, modelState, modelLocation, true)); + bakedPartsBuilder.put(name, model.bake(baker, model, spriteGetter, modelState, true)); } var bakedParts = bakedPartsBuilder.build(); @@ -115,13 +111,11 @@ public BakedModel bake(IGeometryBakingContext context, ModelBaker bakery, Functi } @Override - public Set getConfigurableComponentNames() - { + public Set getConfigurableComponentNames() { return children.keySet(); } - public class Baked implements IDynamicBakedModel - { + public class Baked implements IDynamicBakedModel { private final boolean isAmbientOcclusion; private final boolean isGui3d; private final boolean isSideLit; @@ -131,8 +125,7 @@ public class Baked implements IDynamicBakedModel private final ImmutableMap children; private final ImmutableList itemPasses; - public Baked(boolean isGui3d, boolean isSideLit, boolean isAmbientOcclusion, TextureAtlasSprite particle, ItemTransforms transforms, ItemOverrides overrides, ImmutableMap children, ImmutableList itemPasses) - { + public Baked(boolean isGui3d, boolean isSideLit, boolean isAmbientOcclusion, TextureAtlasSprite particle, ItemTransforms transforms, ItemOverrides overrides, ImmutableMap children, ImmutableList itemPasses) { this.children = children; this.isAmbientOcclusion = isAmbientOcclusion; this.isGui3d = isGui3d; @@ -145,13 +138,10 @@ public Baked(boolean isGui3d, boolean isSideLit, boolean isAmbientOcclusion, Tex @NotNull @Override - public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull RandomSource rand, @NotNull ModelData data, @Nullable RenderType renderType) - { + public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull RandomSource rand, @NotNull ModelData data, @Nullable RenderType renderType) { List> quadLists = new ArrayList<>(); - for (Map.Entry entry : children.entrySet()) - { - if (renderType == null || (state != null && entry.getValue().getRenderTypes(state, rand, data).contains(renderType))) - { + for (Map.Entry entry : children.entrySet()) { + if (renderType == null || (state != null && entry.getValue().getRenderTypes(state, rand, data).contains(renderType))) { FramedDrawerModelData framedDrawerModelData = data.get(FramedDrawerModelData.FRAMED_PROPERTY); List quads = entry.getValue().getQuads(state, side, rand, Data.resolve(data, entry.getKey()), renderType); if (framedDrawerModelData != null && framedDrawerModelData.getDesign().containsKey(entry.getKey())) { @@ -172,7 +162,7 @@ protected static List getQuadsUsingShape(@Nullable Item frameItem, Li Optional>> spriteOptional = getSpriteData(model, state1, side, rand, null, renderType); List returnQuads = new ArrayList<>(); for (BakedQuad shapeQuad : shape) { - List> spriteData = spriteOptional.orElse(getSpriteFromModel(shapeQuad, model, state1,null)); + List> spriteData = spriteOptional.orElse(getSpriteFromModel(shapeQuad, model, state1, null)); returnQuads.addAll(framedQuad(shapeQuad, spriteData, state1.getLightEmission(Minecraft.getInstance().level, BlockPos.ZERO))); } return returnQuads; @@ -185,14 +175,14 @@ private static Optional>> getSpr List positions = new ArrayList<>(); List> modelData = new ArrayList<>(); if (!quads.isEmpty()) { - for (BakedQuad bakedQuad: quads) { + for (BakedQuad bakedQuad : quads) { float[] position = unpackVertices(bakedQuad.getVertices(), 0, IQuadTransformer.POSITION, 3); positions.add(getPositionFromDirection(position, side)); } List index = getMinMaxPosition(positions, side); for (int i = 0; i < index.size(); i++) { int[] lights = new int[4]; - for (int j=0; j<4 ; j++) { + for (int j = 0; j < 4; j++) { lights[j] = quads.get(i).getVertices()[IQuadTransformer.UV2 + j * IQuadTransformer.STRIDE]; } int tint = quads.get(i).isTinted() ? Minecraft.getInstance().getBlockColors().getColor(state, Minecraft.getInstance().level, null, quads.get(i).getTintIndex()) : -1; @@ -204,7 +194,7 @@ private static Optional>> getSpr } private static float getPositionFromDirection(float[] position, Direction side) { - Vec3i normal = new Vec3i(0,0,0); + Vec3i normal = new Vec3i(0, 0, 0); if (side != null) { normal = side.getNormal(); } @@ -228,7 +218,7 @@ protected static List> getSpriteFromM List positions = new ArrayList<>(); List> modelData = new ArrayList<>(); if (!quads.isEmpty()) { - for (BakedQuad bakedQuad: quads) { + for (BakedQuad bakedQuad : quads) { float[] position = unpackVertices(bakedQuad.getVertices(), 0, IQuadTransformer.POSITION, 3); positions.add(getPositionFromDirection(position, shape.getDirection())); @@ -236,7 +226,7 @@ protected static List> getSpriteFromM List index = getMinMaxPosition(positions, shape.getDirection()); for (int i = 0; i < index.size(); i++) { int[] lights = new int[4]; - for (int j=0; j<4; j++) { + for (int j = 0; j < 4; j++) { lights[j] = quads.get(i).getVertices()[IQuadTransformer.UV2 + j * IQuadTransformer.STRIDE]; } int tint = quads.get(i).isTinted() ? Minecraft.getInstance().getBlockColors().getColor(state, Minecraft.getInstance().level, null, quads.get(i).getTintIndex()) : -1; @@ -244,7 +234,7 @@ protected static List> getSpriteFromM modelData.add(triple); } } - return quads.isEmpty() ? List.of(Triple.of(Minecraft.getInstance().getTextureAtlas(InventoryMenu.BLOCK_ATLAS).apply(MissingTextureAtlasSprite.getLocation()), -1, new int[] {0,0,0,0})) : modelData; + return quads.isEmpty() ? List.of(Triple.of(Minecraft.getInstance().getTextureAtlas(InventoryMenu.BLOCK_ATLAS).apply(MissingTextureAtlasSprite.getLocation()), -1, new int[] {0, 0, 0, 0})) : modelData; } protected static List framedQuad(BakedQuad toCopy, List> modelData, int lightEmission) { @@ -268,7 +258,7 @@ protected static List framedQuad(BakedQuad toCopy, List(); for (Map.Entry entry : children.entrySet()) sets.add(entry.getValue().getRenderTypes(state, rand, FramedModel.Data.resolve(data, entry.getKey()))); @@ -393,14 +375,12 @@ public ChunkRenderTypeSet getRenderTypes(@NotNull BlockState state, @NotNull Ran } @Override - public List getRenderPasses(ItemStack itemStack, boolean fabulous) - { + public List getRenderPasses(ItemStack itemStack, boolean fabulous) { return List.of(new ItemModel(this, itemStack)); } @Nullable - public BakedModel getPart(String name) - { + public BakedModel getPart(String name) { return children.get(name); } } @@ -408,20 +388,17 @@ public BakedModel getPart(String name) /** * A model data container which stores data for child components. */ - public static class Data - { + public static class Data { public static final ModelProperty PROPERTY = new ModelProperty<>(); private final Map partData; - private Data(Map partData) - { + private Data(Map partData) { this.partData = partData; } @Nullable - public ModelData get(String name) - { + public ModelData get(String name) { return partData.get(name); } @@ -432,8 +409,7 @@ public ModelData get(String name) * @param name The name of the part to get data for * @return The data for the part, or the one passed in if not found */ - public static ModelData resolve(ModelData modelData, String name) - { + public static ModelData resolve(ModelData modelData, String name) { var compositeData = modelData.get(PROPERTY); if (compositeData == null) return modelData; @@ -441,39 +417,32 @@ public static ModelData resolve(ModelData modelData, String name) return partData != null ? partData : modelData; } - public static FramedModel.Data.Builder builder() - { + public static FramedModel.Data.Builder builder() { return new FramedModel.Data.Builder(); } - public static final class Builder - { + public static final class Builder { private final Map partData = new IdentityHashMap<>(); - public FramedModel.Data.Builder with(String name, ModelData data) - { + public FramedModel.Data.Builder with(String name, ModelData data) { partData.put(name, data); return this; } - public FramedModel.Data build() - { + public FramedModel.Data build() { return new FramedModel.Data(partData); } } } - public static final class Loader implements IGeometryLoader - { + public static final class Loader implements IGeometryLoader { public static final FramedModel.Loader INSTANCE = new FramedModel.Loader(); - private Loader() - { + private Loader() { } @Override - public FramedModel read(JsonObject jsonObject, JsonDeserializationContext deserializationContext) - { + public FramedModel read(JsonObject jsonObject, JsonDeserializationContext deserializationContext) { List itemPasses = new ArrayList<>(); ImmutableMap.Builder childrenBuilder = ImmutableMap.builder(); readChildren(jsonObject, "children", deserializationContext, childrenBuilder, itemPasses, false); @@ -483,11 +452,9 @@ public FramedModel read(JsonObject jsonObject, JsonDeserializationContext deseri if (children.isEmpty()) throw new JsonParseException("Composite model requires a \"children\" element with at least one element."); - if (jsonObject.has("item_render_order")) - { + if (jsonObject.has("item_render_order")) { itemPasses.clear(); - for (var element : jsonObject.getAsJsonArray("item_render_order")) - { + for (var element : jsonObject.getAsJsonArray("item_render_order")) { var name = element.getAsString(); if (!children.containsKey(name)) throw new JsonParseException("Specified \"" + name + "\" in \"item_render_order\", but that is not a child of this model."); @@ -498,13 +465,11 @@ public FramedModel read(JsonObject jsonObject, JsonDeserializationContext deseri return new FramedModel(children, ImmutableList.copyOf(itemPasses), logWarning); } - private boolean readChildren(JsonObject jsonObject, String name, JsonDeserializationContext deserializationContext, ImmutableMap.Builder children, List itemPasses, boolean logWarning) - { + private boolean readChildren(JsonObject jsonObject, String name, JsonDeserializationContext deserializationContext, ImmutableMap.Builder children, List itemPasses, boolean logWarning) { if (!jsonObject.has(name)) return false; var childrenJsonObject = jsonObject.getAsJsonObject(name); - for (Map.Entry entry : childrenJsonObject.entrySet()) - { + for (Map.Entry entry : childrenJsonObject.entrySet()) { children.put(entry.getKey(), deserializationContext.deserialize(entry.getValue(), BlockModel.class)); itemPasses.add(entry.getKey()); // We can do this because GSON preserves ordering during deserialization } @@ -525,10 +490,8 @@ public ItemModel(Baked baked, ItemStack itemStack) { @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, RandomSource rand, ModelData extraData, @Nullable RenderType renderType) { List> quadLists = new ArrayList<>(); - for (Map.Entry entry : baked.children.entrySet()) - { - if (renderType == null || (state != null && entry.getValue().getRenderTypes(state, rand, extraData).contains(renderType))) - { + for (Map.Entry entry : baked.children.entrySet()) { + if (renderType == null || (state != null && entry.getValue().getRenderTypes(state, rand, extraData).contains(renderType))) { List quads = entry.getValue().getQuads(state, side, rand, Data.resolve(extraData, entry.getKey()), renderType); FramedDrawerModelData framedDrawerModelData = FramedDrawerBlock.getDrawerModelData(itemStack); diff --git a/src/main/java/com/buuz135/functionalstorage/client/model/FramedDrawerModelData.java b/src/main/java/com/buuz135/functionalstorage/client/model/FramedDrawerModelData.java index 777d5e8a..3e387473 100644 --- a/src/main/java/com/buuz135/functionalstorage/client/model/FramedDrawerModelData.java +++ b/src/main/java/com/buuz135/functionalstorage/client/model/FramedDrawerModelData.java @@ -23,12 +23,12 @@ package com.buuz135.functionalstorage.client.model; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; -import net.minecraftforge.client.model.data.ModelProperty; -import net.minecraftforge.common.util.INBTSerializable; -import net.minecraftforge.registries.ForgeRegistries; +import net.neoforged.neoforge.client.model.data.ModelProperty; +import net.neoforged.neoforge.common.util.INBTSerializable; import java.util.HashMap; import java.util.Map; @@ -50,25 +50,25 @@ public Map getDesign() { } @Override - public CompoundTag serializeNBT() { + public CompoundTag serializeNBT(net.minecraft.core.HolderLookup.Provider provider) { CompoundTag compoundTag = new CompoundTag(); - design.forEach((s, item) -> compoundTag.putString(s, ForgeRegistries.ITEMS.getKey(item).toString())); + design.forEach((s, item) -> compoundTag.putString(s, BuiltInRegistries.ITEM.getKey(item).toString())); return compoundTag; } @Override - public void deserializeNBT(CompoundTag nbt) { + public void deserializeNBT(net.minecraft.core.HolderLookup.Provider provider, CompoundTag nbt) { design = new HashMap<>(); for (String allKey : nbt.getAllKeys()) { - design.put(allKey, ForgeRegistries.ITEMS.getValue(new ResourceLocation(nbt.getString(allKey)))); + design.put(allKey, BuiltInRegistries.ITEM.get(com.buuz135.functionalstorage.util.Utils.resourceLocation(nbt.getString(allKey)))); } this.generateCode(); } - private void generateCode(){ + private void generateCode() { this.code = ""; this.design.forEach((s, item) -> { - this.code += (s + ForgeRegistries.ITEMS.getKey(item).toString()); + this.code += (s + BuiltInRegistries.ITEM.getKey(item)); }); } diff --git a/src/main/java/com/buuz135/functionalstorage/compat/jade/DrawerComponentProvider.java b/src/main/java/com/buuz135/functionalstorage/compat/jade/DrawerComponentProvider.java new file mode 100644 index 00000000..2e4701db --- /dev/null +++ b/src/main/java/com/buuz135/functionalstorage/compat/jade/DrawerComponentProvider.java @@ -0,0 +1,156 @@ +package com.buuz135.functionalstorage.compat.jade; + +import com.buuz135.functionalstorage.FunctionalStorage; +import com.buuz135.functionalstorage.block.EnderDrawerBlock; +import com.buuz135.functionalstorage.block.tile.ControllableDrawerTile; +import com.buuz135.functionalstorage.block.tile.EnderDrawerTile; +import com.buuz135.functionalstorage.block.tile.FluidDrawerTile; +import com.buuz135.functionalstorage.block.tile.ItemControllableDrawerTile; +import com.buuz135.functionalstorage.inventory.BigInventoryHandler; +import com.buuz135.functionalstorage.inventory.CompactingInventoryHandler; +import com.buuz135.functionalstorage.inventory.EnderInventoryHandler; +import com.buuz135.functionalstorage.item.UpgradeItem; +import com.buuz135.functionalstorage.network.EnderDrawerSyncMessage; +import com.buuz135.functionalstorage.util.NumberUtils; +import com.buuz135.functionalstorage.world.EnderSavedData; +import com.mojang.datafixers.util.Pair; +import net.minecraft.ChatFormatting; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.vehicle.Minecart; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.Vec2; +import net.neoforged.neoforge.fluids.FluidStack; +import snownee.jade.api.BlockAccessor; +import snownee.jade.api.IBlockComponentProvider; +import snownee.jade.api.ITooltip; +import snownee.jade.api.config.IPluginConfig; +import snownee.jade.api.fluid.JadeFluidObject; +import snownee.jade.api.ui.BoxStyle; +import snownee.jade.api.ui.IElement; +import snownee.jade.api.ui.IElementHelper; +import snownee.jade.api.ui.ProgressStyle; +import snownee.jade.api.view.FluidView; + +import java.util.ArrayList; + +public enum DrawerComponentProvider implements IBlockComponentProvider { + INSTANCE; + public static final ResourceLocation ITEM_STORAGE = com.buuz135.functionalstorage.util.Utils.resourceLocation("minecraft:item_storage"); + + public static final ResourceLocation ID = com.buuz135.functionalstorage.util.Utils.resourceLocation(FunctionalStorage.MOD_ID, "drawer"); + + @Override + public void appendTooltip(ITooltip iTooltip, BlockAccessor blockAccessor, IPluginConfig iPluginConfig) { + iTooltip.remove(ITEM_STORAGE); + iTooltip.remove(com.buuz135.functionalstorage.util.Utils.resourceLocation("minecraft:fluid_storage")); + + var helper = IElementHelper.get(); + if (blockAccessor.getBlockEntity() instanceof ControllableDrawerTile controllable) { + if (blockAccessor.getBlockEntity() instanceof ItemControllableDrawerTile tile) { + var stacks = new ArrayList>(); + if (tile instanceof EnderDrawerTile ed && ed.getFrequency() != null) { + var inv = EnderSavedData.getInstance(Minecraft.getInstance().level).getFrequency(ed.getFrequency()); + for (int slot = 0; slot < inv.getSlots(); slot++) { + var stack = inv.getStoredStacks().get(slot); + if (stack.getStack().getItem() != Items.AIR) { + stacks.add(new Pair<>(stack.getStack().copyWithCount(stack.getAmount()), inv.getSlotLimit(slot))); + } + } + } else if (tile.getStorage() instanceof BigInventoryHandler bigInv) { + for (int slot = 0; slot < bigInv.getStoredStacks().size(); slot++) { + var stack = bigInv.getStoredStacks().get(slot); + if (stack.getStack().getItem() != Items.AIR) { + stacks.add(new Pair<>(stack.getStack().copyWithCount(stack.getAmount()), bigInv.getSlotLimit(slot))); + } + } + } else if (tile.getStorage() instanceof CompactingInventoryHandler compacting) { + var results = compacting.getResultList(); + for (int i = 0; i < results.size(); i++) { + var result = results.get(i); + if (result.getResult().getItem() != Items.AIR) { + stacks.add(new Pair<>(result.getResult().copyWithCount(compacting.getStackInSlot(i).getCount()), compacting.getSlotLimit(i))); + } + } + } + + if (!stacks.isEmpty()) { + var contentsBox = helper.tooltip(); + iTooltip.add(helper.text(Component.translatable("drawer.block.contents"))); + for (var stack : stacks) { + // Account for locked slots too + boolean wasEmpty = stack.getFirst().getCount() == 0; + if (stack.getFirst().getCount() == 0) stack.getFirst().setCount(1); + IElement icon = helper.item(stack.getFirst().copy(), 0.86f, "").size(new Vec2(.86f * 18, .86f * 18)).translate(new Vec2(0, -1)); + if (wasEmpty) stack.getFirst().shrink(1); + contentsBox.add(icon); + contentsBox.append( + helper.text(Component.literal("x ").append(NumberUtils.getFormatedBigNumber(stack.getFirst().getCount()) + " / " + NumberUtils.getFormatedBigNumber(stack.getSecond()))) + .translate(new Vec2(4, (.86f * 18 - 10) / 2)) + ); + } + iTooltip.add(helper.box(contentsBox, BoxStyle.getNestedBox())); + } + } else if (blockAccessor.getBlockEntity() instanceof FluidDrawerTile tile) { + if (!tile.isInventoryEmpty()) { + var stacks = new ArrayList>(); + for (int slot = 0; slot < tile.getFluidHandler().getTanks(); slot++) { + var stack = tile.getFluidHandler().getTankList()[slot]; + if (stack.getFluid().getFluid() != Fluids.EMPTY) { + stacks.add(new Pair<>(stack.getFluid().copyWithAmount(stack.getFluidAmount()), tile.getFluidHandler().getTankCapacity(slot))); + } + } + + if (!stacks.isEmpty()) { + var contentsBox = helper.tooltip(); + iTooltip.add(helper.text(Component.translatable("drawer.block.contents"))); + for (var stack : stacks) { + var view = new FluidView(helper.fluid(JadeFluidObject.of(stack.getFirst().getFluid()))); + ProgressStyle progressStyle = helper.progressStyle().overlay(view.overlay); + contentsBox.add(helper.progress((float) stack.getFirst().getAmount() / stack.getSecond(), Component.empty().append(stack.getFirst().getHoverName()).append(Component.literal(" x ").append(NumberUtils.getFormatedFluidBigNumber(stack.getFirst().getAmount()) + " / " + NumberUtils.getFormatedFluidBigNumber(stack.getSecond()))), progressStyle, BoxStyle.getNestedBox(), true)); + } + iTooltip.add(helper.box(contentsBox, BoxStyle.getNestedBox())); + } + } + } + + if (controllable instanceof EnderDrawerTile ender && ender.getFrequency() != null) { + var freq = EnderDrawerBlock.getFrequencyDisplay(ender.getFrequency()); + var contentsBox = helper.tooltip(); + iTooltip.add(helper.text(Component.translatable("linkingtool.ender.frequency"))); + for (var stack : freq) { + contentsBox.append(helper.item(stack)); + } + iTooltip.add(helper.box(contentsBox, BoxStyle.getNestedBox())); + } + + if (Screen.hasShiftDown()) { + var upInv = controllable.getUtilityUpgrades(); + for (int i = 0; i < upInv.getSlots(); i++) { + var stack = upInv.getStackInSlot(i); + if (stack.getItem() instanceof UpgradeItem ui) { + iTooltip.add(ui.getDescription(stack, controllable)); + } + } + if (controllable.getStorageMultiplier() > 1) { + iTooltip.add(Component.translatable("drawer.block.multiplier", + Component.literal("x" + controllable.getStorageMultiplier()).withStyle(ChatFormatting.GOLD))); + } + } + } + } + + @Override + public int getDefaultPriority() { + return 4999; + } + + @Override + public ResourceLocation getUid() { + return ID; + } +} diff --git a/src/main/java/com/buuz135/functionalstorage/compat/jade/FSJadePlugin.java b/src/main/java/com/buuz135/functionalstorage/compat/jade/FSJadePlugin.java new file mode 100644 index 00000000..4b72247a --- /dev/null +++ b/src/main/java/com/buuz135/functionalstorage/compat/jade/FSJadePlugin.java @@ -0,0 +1,19 @@ +package com.buuz135.functionalstorage.compat.jade; + +import com.buuz135.functionalstorage.block.Drawer; +import snownee.jade.api.IWailaClientRegistration; +import snownee.jade.api.IWailaCommonRegistration; +import snownee.jade.api.IWailaPlugin; +import snownee.jade.api.WailaPlugin; + +@WailaPlugin +public class FSJadePlugin implements IWailaPlugin { + @Override + public void registerClient(IWailaClientRegistration registration) { + registration.registerBlockComponent(DrawerComponentProvider.INSTANCE, Drawer.class); + } + + @Override + public void register(IWailaCommonRegistration registration) { + } +} diff --git a/src/main/java/com/buuz135/functionalstorage/compat/jei/CompactingRecipeCategory.java b/src/main/java/com/buuz135/functionalstorage/compat/jei/CompactingRecipeCategory.java index 97065d30..2ce331c1 100644 --- a/src/main/java/com/buuz135/functionalstorage/compat/jei/CompactingRecipeCategory.java +++ b/src/main/java/com/buuz135/functionalstorage/compat/jei/CompactingRecipeCategory.java @@ -53,7 +53,7 @@ public void setRecipe(IRecipeLayoutBuilder builder, CustomCompactingRecipe recip @Override public void draw(CustomCompactingRecipe recipe, IRecipeSlotsView recipeSlotsView, GuiGraphics guiGraphics, double mouseX, double mouseY) { - //new ResourceLocation(FunctionalStorage.MOD_ID, "textures/block/compacting_drawer_front.png") - guiGraphics.blit(new ResourceLocation(FunctionalStorage.MOD_ID, "textures/block/compacting_drawer_front.png"), 0,0, 64,64, 64, 64, 64,64); + //com.buuz135.functionalstorage.util.Utils.resourceLocation(FunctionalStorage.MOD_ID, "textures/block/compacting_drawer_front.png") + guiGraphics.blit(com.buuz135.functionalstorage.util.Utils.resourceLocation(FunctionalStorage.MOD_ID, "textures/block/compacting_drawer_front.png"), 0,0, 64,64, 64, 64, 64,64); } } diff --git a/src/main/java/com/buuz135/functionalstorage/compat/jei/JEIPlugin.java b/src/main/java/com/buuz135/functionalstorage/compat/jei/JEIPlugin.java index e457b7b2..f71a20cc 100644 --- a/src/main/java/com/buuz135/functionalstorage/compat/jei/JEIPlugin.java +++ b/src/main/java/com/buuz135/functionalstorage/compat/jei/JEIPlugin.java @@ -16,7 +16,7 @@ @JeiPlugin public class JEIPlugin implements IModPlugin { - public static ResourceLocation PLUGIN_ID = new ResourceLocation(FunctionalStorage.MOD_ID, "main"); + public static ResourceLocation PLUGIN_ID = com.buuz135.functionalstorage.util.Utils.resourceLocation(FunctionalStorage.MOD_ID, "main"); private CompactingRecipeCategory compactingRecipeCategory; @@ -28,16 +28,16 @@ public void registerCategories(IRecipeCategoryRegistration registration) { @Override public void registerRecipes(IRecipeRegistration registration) { - registration.addRecipes(CompactingRecipeCategory.TYPE, RecipeUtil.getRecipes(Minecraft.getInstance().level, (RecipeType) FunctionalStorage.CUSTOM_COMPACTING_RECIPE_TYPE.get())); + registration.addRecipes(CompactingRecipeCategory.TYPE, RecipeUtil.getRecipes(Minecraft.getInstance().level, (RecipeType) FunctionalStorage.CUSTOM_COMPACTING_RECIPE_TYPE.value())); } @Override public void registerRecipeCatalysts(IRecipeCatalystRegistration registration) { IModPlugin.super.registerRecipeCatalysts(registration); - registration.addRecipeCatalyst(new ItemStack(FunctionalStorage.COMPACTING_DRAWER.getKey().get()), CompactingRecipeCategory.TYPE); - registration.addRecipeCatalyst(new ItemStack(FunctionalStorage.FRAMED_COMPACTING_DRAWER.getKey().get()), CompactingRecipeCategory.TYPE); - registration.addRecipeCatalyst(new ItemStack(FunctionalStorage.SIMPLE_COMPACTING_DRAWER.getKey().get()), CompactingRecipeCategory.TYPE); - registration.addRecipeCatalyst(new ItemStack(FunctionalStorage.FRAMED_SIMPLE_COMPACTING_DRAWER.getKey().get()), CompactingRecipeCategory.TYPE); + registration.addRecipeCatalyst(new ItemStack(FunctionalStorage.COMPACTING_DRAWER.getBlock()), CompactingRecipeCategory.TYPE); + registration.addRecipeCatalyst(new ItemStack(FunctionalStorage.FRAMED_COMPACTING_DRAWER.getBlock()), CompactingRecipeCategory.TYPE); + registration.addRecipeCatalyst(new ItemStack(FunctionalStorage.SIMPLE_COMPACTING_DRAWER.getBlock()), CompactingRecipeCategory.TYPE); + registration.addRecipeCatalyst(new ItemStack(FunctionalStorage.FRAMED_SIMPLE_COMPACTING_DRAWER.getBlock()), CompactingRecipeCategory.TYPE); } @Override diff --git a/src/main/java/com/buuz135/functionalstorage/compat/top/CustomElementItemStack.java b/src/main/java/com/buuz135/functionalstorage/compat/top/CustomElementItemStack.java index f271251b..dbd09e33 100644 --- a/src/main/java/com/buuz135/functionalstorage/compat/top/CustomElementItemStack.java +++ b/src/main/java/com/buuz135/functionalstorage/compat/top/CustomElementItemStack.java @@ -2,7 +2,6 @@ import com.buuz135.functionalstorage.FunctionalStorage; -import com.mojang.blaze3d.vertex.PoseStack; import mcjty.theoneprobe.api.IElement; import mcjty.theoneprobe.api.IItemStyle; import mcjty.theoneprobe.apiimpl.styles.ItemStyle; @@ -13,12 +12,13 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; public class CustomElementItemStack implements IElement { - public static ResourceLocation RL = new ResourceLocation(FunctionalStorage.MOD_ID, "drawer_element"); + public static ResourceLocation RL = com.buuz135.functionalstorage.util.Utils.resourceLocation(FunctionalStorage.MOD_ID, "drawer_element"); private final ItemStack itemStack; private final IItemStyle style; @@ -37,7 +37,7 @@ public CustomElementItemStack(ItemStack itemStack, String display, IItemStyle st this.displayName = true; } - public CustomElementItemStack(FriendlyByteBuf buf) { + public CustomElementItemStack(RegistryFriendlyByteBuf buf) { if (buf.readBoolean()) { this.itemStack = NetworkTools.readItemStack(buf); } else { @@ -49,11 +49,10 @@ public CustomElementItemStack(FriendlyByteBuf buf) { this.displayName = buf.readBoolean(); } + @Override public void render(GuiGraphics matrixStack, int x, int y) { ItemRenderer itemRender = Minecraft.getInstance().getItemRenderer(); if (!itemStack.isEmpty()) { - int size = itemStack.getCount(); - if (!RenderHelper.renderItemStack(Minecraft.getInstance(), itemRender, itemStack, matrixStack, x + (style.getWidth() - 18) / 2, y + (style.getHeight() - 18) / 2, display)) { Minecraft var10000 = Minecraft.getInstance(); ChatFormatting var10004 = ChatFormatting.RED; @@ -62,20 +61,22 @@ public void render(GuiGraphics matrixStack, int x, int y) { if (this.displayName){ RenderHelper.renderText(Minecraft.getInstance(), matrixStack, x + 22, y + 7, itemStack.getHoverName()); } - } } + @Override public int getWidth() { return this.style.getWidth() + (this.displayName ? Minecraft.getInstance().font.width(itemStack.getHoverName().getString()) : 0) ; } + @Override public int getHeight() { return this.style.getHeight(); } - public void toBytes(FriendlyByteBuf buf) { + @Override + public void toBytes(RegistryFriendlyByteBuf buf) { if (!this.itemStack.isEmpty()) { buf.writeBoolean(true); NetworkTools.writeItemStack(buf, this.itemStack); @@ -89,6 +90,7 @@ public void toBytes(FriendlyByteBuf buf) { buf.writeBoolean(this.displayName); } + @Override public ResourceLocation getID() { return RL; } diff --git a/src/main/java/com/buuz135/functionalstorage/compat/top/FunctionalDrawerProvider.java b/src/main/java/com/buuz135/functionalstorage/compat/top/FunctionalDrawerProvider.java index 90e3054f..83b1255e 100644 --- a/src/main/java/com/buuz135/functionalstorage/compat/top/FunctionalDrawerProvider.java +++ b/src/main/java/com/buuz135/functionalstorage/compat/top/FunctionalDrawerProvider.java @@ -15,6 +15,7 @@ import mcjty.theoneprobe.apiimpl.elements.ElementVertical; import mcjty.theoneprobe.apiimpl.styles.ProgressStyle; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Player; @@ -30,11 +31,11 @@ public class FunctionalDrawerProvider implements IProbeInfoProvider { - public static Function REGISTER = iTheOneProbe -> { + public static final Function REGISTER = iTheOneProbe -> { iTheOneProbe.registerProvider(new FunctionalDrawerProvider()); iTheOneProbe.registerElementFactory(new IElementFactory() { @Override - public IElement createElement(FriendlyByteBuf friendlyByteBuf) { + public IElement createElement(RegistryFriendlyByteBuf friendlyByteBuf) { return new CustomElementItemStack(friendlyByteBuf); } @@ -48,7 +49,7 @@ public ResourceLocation getId() { @Override public ResourceLocation getID() { - return new ResourceLocation(FunctionalStorage.MOD_ID, "drawer"); + return com.buuz135.functionalstorage.util.Utils.resourceLocation(FunctionalStorage.MOD_ID, "drawer"); } @Override @@ -68,7 +69,7 @@ public void addProbeInfo(ProbeMode probeMode, IProbeInfo iProbeInfo, Player play elementVertical.element(new CustomElementItemStack(storedStack.getStack(), NumberUtils.getFormatedBigNumber(handler.getStackInSlot(i).getCount()) + "/" + NumberUtils.getFormatedBigNumber(handler.getSlotLimit(i)), iProbeInfo.defaultItemStyle(), true)); } } - if (elementVertical.getElements().size() > 0) vertical.element(elementVertical); + if (!elementVertical.getElements().isEmpty()) vertical.element(elementVertical); vertical.element(new ElementVertical(iProbeInfo.defaultLayoutStyle().topPadding(4))); } else { ElementHorizontal abstractElementPanel = new ElementHorizontal(iProbeInfo.defaultLayoutStyle().spacing(8).leftPadding(7).rightPadding(7)); @@ -79,7 +80,7 @@ public void addProbeInfo(ProbeMode probeMode, IProbeInfo iProbeInfo, Player play abstractElementPanel.element(new CustomElementItemStack(storedStack.getStack(), NumberUtils.getFormatedBigNumber(handler.getStackInSlot(i).getCount()) + "/" + NumberUtils.getFormatedBigNumber(handler.getSlotLimit(i)), iProbeInfo.defaultItemStyle())); } } - if (abstractElementPanel.getElements().size() > 0) vertical.element(abstractElementPanel); + if (!abstractElementPanel.getElements().isEmpty()) vertical.element(abstractElementPanel); vertical.element(new ElementVertical(iProbeInfo.defaultLayoutStyle().topPadding(4))); } } @@ -93,7 +94,7 @@ public void addProbeInfo(ProbeMode probeMode, IProbeInfo iProbeInfo, Player play abstractElementPanel.element(new CustomElementItemStack(storedStack.getStack(), NumberUtils.getFormatedBigNumber(storedStack.getAmount()) + "/" + NumberUtils.getFormatedBigNumber(savedData.getSlotLimit(i)), iProbeInfo.defaultItemStyle(), player.isShiftKeyDown() || probeMode == ProbeMode.EXTENDED)); } } - if (abstractElementPanel.getElements().size() > 0) vertical.element(abstractElementPanel); + if (!abstractElementPanel.getElements().isEmpty()) vertical.element(abstractElementPanel); ElementVertical elementVertical = new ElementVertical(iProbeInfo.defaultLayoutStyle()); elementVertical.getStyle().borderColor(Color.CYAN.darker().getRGB()); elementVertical.text(Component.translatable("linkingtool.ender.frequency")); @@ -114,7 +115,7 @@ public void addProbeInfo(ProbeMode probeMode, IProbeInfo iProbeInfo, Player play abstractElementPanel.element(new CustomElementItemStack(inventoryHandler.getResultList().get(2).getResult(), NumberUtils.getFormatedBigNumber(inventoryHandler.getStackInSlot(2).getCount()) + "/" + NumberUtils.getFormatedBigNumber(inventoryHandler.getSlotLimit(2)), iProbeInfo.defaultItemStyle(), true)); abstractElementPanel.element(new CustomElementItemStack(inventoryHandler.getResultList().get(1).getResult(), NumberUtils.getFormatedBigNumber(inventoryHandler.getStackInSlot(1).getCount()) + "/" + NumberUtils.getFormatedBigNumber(inventoryHandler.getSlotLimit(1)), iProbeInfo.defaultItemStyle(), true)); abstractElementPanel.element(new CustomElementItemStack(inventoryHandler.getResultList().get(0).getResult(), NumberUtils.getFormatedBigNumber(inventoryHandler.getStackInSlot(0).getCount()) + "/" + NumberUtils.getFormatedBigNumber(inventoryHandler.getSlotLimit(0)), iProbeInfo.defaultItemStyle(), true)); - if (abstractElementPanel.getElements().size() > 0) vertical.element(abstractElementPanel); + if (!abstractElementPanel.getElements().isEmpty()) vertical.element(abstractElementPanel); } else { ElementHorizontal abstractElementPanel = new ElementHorizontal(iProbeInfo.defaultLayoutStyle().spacing(8).leftPadding(7).rightPadding(7)); abstractElementPanel.getStyle().borderColor(Color.CYAN.darker().getRGB()); @@ -122,9 +123,9 @@ public void addProbeInfo(ProbeMode probeMode, IProbeInfo iProbeInfo, Player play abstractElementPanel.element(new CustomElementItemStack(inventoryHandler.getResultList().get(2).getResult(), NumberUtils.getFormatedBigNumber(inventoryHandler.getStackInSlot(2).getCount()) + "/" + NumberUtils.getFormatedBigNumber(inventoryHandler.getSlotLimit(2)), iProbeInfo.defaultItemStyle())); amount -= inventoryHandler.getResultList().get(2).getNeeded() * inventoryHandler.getStackInSlot(2).getCount(); abstractElementPanel.element(new CustomElementItemStack(inventoryHandler.getResultList().get(1).getResult(), NumberUtils.getFormatedBigNumber((int) Math.floor(amount / inventoryHandler.getResultList().get(1).getNeeded())), iProbeInfo.defaultItemStyle())); - amount -= inventoryHandler.getResultList().get(1).getNeeded() * Math.floor(amount / inventoryHandler.getResultList().get(1).getNeeded()); + amount -= (int) (inventoryHandler.getResultList().get(1).getNeeded() * Math.floor(amount / inventoryHandler.getResultList().get(1).getNeeded())); abstractElementPanel.element(new CustomElementItemStack(inventoryHandler.getResultList().get(0).getResult(), NumberUtils.getFormatedBigNumber((int) Math.floor(amount / inventoryHandler.getResultList().get(0).getNeeded())), iProbeInfo.defaultItemStyle())); - if (abstractElementPanel.getElements().size() > 0) vertical.element(abstractElementPanel); + if (!abstractElementPanel.getElements().isEmpty()) vertical.element(abstractElementPanel); } vertical.element(new ElementVertical(iProbeInfo.defaultLayoutStyle().topPadding(4))); } @@ -135,15 +136,15 @@ public void addProbeInfo(ProbeMode probeMode, IProbeInfo iProbeInfo, Player play abstractElementPanel.getStyle().borderColor(Color.CYAN.darker().getRGB()); abstractElementPanel.element(new CustomElementItemStack(inventoryHandler.getResultList().get(1).getResult(), NumberUtils.getFormatedBigNumber(inventoryHandler.getStackInSlot(1).getCount()) + "/" + NumberUtils.getFormatedBigNumber(inventoryHandler.getSlotLimit(1)), iProbeInfo.defaultItemStyle(), true)); abstractElementPanel.element(new CustomElementItemStack(inventoryHandler.getResultList().get(0).getResult(), NumberUtils.getFormatedBigNumber(inventoryHandler.getStackInSlot(0).getCount()) + "/" + NumberUtils.getFormatedBigNumber(inventoryHandler.getSlotLimit(0)), iProbeInfo.defaultItemStyle(), true)); - if (abstractElementPanel.getElements().size() > 0) vertical.element(abstractElementPanel); + if (!abstractElementPanel.getElements().isEmpty()) vertical.element(abstractElementPanel); } else { ElementHorizontal abstractElementPanel = new ElementHorizontal(iProbeInfo.defaultLayoutStyle().spacing(8).leftPadding(7).rightPadding(7)); abstractElementPanel.getStyle().borderColor(Color.CYAN.darker().getRGB()); int amount = inventoryHandler.getAmount(); abstractElementPanel.element(new CustomElementItemStack(inventoryHandler.getResultList().get(1).getResult(), NumberUtils.getFormatedBigNumber((int) Math.floor(amount / inventoryHandler.getResultList().get(1).getNeeded())), iProbeInfo.defaultItemStyle())); - amount -= inventoryHandler.getResultList().get(1).getNeeded() * Math.floor(amount / inventoryHandler.getResultList().get(1).getNeeded()); + amount -= (int) (inventoryHandler.getResultList().get(1).getNeeded() * Math.floor(amount / inventoryHandler.getResultList().get(1).getNeeded())); abstractElementPanel.element(new CustomElementItemStack(inventoryHandler.getResultList().get(0).getResult(), NumberUtils.getFormatedBigNumber((int) Math.floor(amount / inventoryHandler.getResultList().get(0).getNeeded())), iProbeInfo.defaultItemStyle())); - if (abstractElementPanel.getElements().size() > 0) vertical.element(abstractElementPanel); + if (!abstractElementPanel.getElements().isEmpty()) vertical.element(abstractElementPanel); } vertical.element(new ElementVertical(iProbeInfo.defaultLayoutStyle().topPadding(4))); } @@ -171,10 +172,10 @@ public void addProbeInfo(ProbeMode probeMode, IProbeInfo iProbeInfo, Player play abstractElementPanel.element(new CustomElementItemStack(stack, extra, iProbeInfo.defaultItemStyle())); } } - if (abstractElementPanel.getElements().size() > 0) vertical.element(abstractElementPanel); + if (!abstractElementPanel.getElements().isEmpty()) vertical.element(abstractElementPanel); } iProbeInfo.element(vertical); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/buuz135/functionalstorage/compat/TOPPlugin.java b/src/main/java/com/buuz135/functionalstorage/compat/top/TOPPlugin.java similarity index 75% rename from src/main/java/com/buuz135/functionalstorage/compat/TOPPlugin.java rename to src/main/java/com/buuz135/functionalstorage/compat/top/TOPPlugin.java index 529c4d85..42488492 100644 --- a/src/main/java/com/buuz135/functionalstorage/compat/TOPPlugin.java +++ b/src/main/java/com/buuz135/functionalstorage/compat/top/TOPPlugin.java @@ -1,12 +1,11 @@ -package com.buuz135.functionalstorage.compat; +package com.buuz135.functionalstorage.compat.top; -import com.buuz135.functionalstorage.compat.top.FunctionalDrawerProvider; import com.hrznstudio.titanium.annotation.plugin.FeaturePlugin; import com.hrznstudio.titanium.event.handler.EventManager; import com.hrznstudio.titanium.plugin.FeaturePluginInstance; import com.hrznstudio.titanium.plugin.PluginPhase; -import net.minecraftforge.fml.InterModComms; -import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; +import net.neoforged.fml.InterModComms; +import net.neoforged.fml.event.lifecycle.InterModEnqueueEvent; @FeaturePlugin(value = "theoneprobe", type = FeaturePlugin.FeaturePluginType.MOD) public class TOPPlugin implements FeaturePluginInstance { diff --git a/src/main/java/com/buuz135/functionalstorage/data/FunctionalStorageBlockTagsProvider.java b/src/main/java/com/buuz135/functionalstorage/data/FunctionalStorageBlockTagsProvider.java index 02ff862f..1e1b5fef 100644 --- a/src/main/java/com/buuz135/functionalstorage/data/FunctionalStorageBlockTagsProvider.java +++ b/src/main/java/com/buuz135/functionalstorage/data/FunctionalStorageBlockTagsProvider.java @@ -1,14 +1,13 @@ package com.buuz135.functionalstorage.data; import com.buuz135.functionalstorage.FunctionalStorage; +import com.hrznstudio.titanium.module.BlockWithTile; import net.minecraft.core.HolderLookup; import net.minecraft.data.DataGenerator; import net.minecraft.tags.BlockTags; import net.minecraft.world.level.block.Block; -import net.minecraftforge.common.data.BlockTagsProvider; -import net.minecraftforge.common.data.ExistingFileHelper; -import net.minecraftforge.registries.RegistryObject; -import org.apache.commons.lang3.tuple.Pair; +import net.neoforged.neoforge.common.data.BlockTagsProvider; +import net.neoforged.neoforge.common.data.ExistingFileHelper; import org.jetbrains.annotations.Nullable; import java.util.concurrent.CompletableFuture; @@ -24,24 +23,24 @@ public FunctionalStorageBlockTagsProvider(DataGenerator dataGenerator, Completab protected void addTags(HolderLookup.Provider p_256380_) { TagAppender tTagAppender = this.tag(BlockTags.MINEABLE_WITH_AXE); for (FunctionalStorage.DrawerType drawerType : FunctionalStorage.DRAWER_TYPES.keySet()) { - for (RegistryObject blockRegistryObject : FunctionalStorage.DRAWER_TYPES.get(drawerType).stream().map(Pair::getLeft).collect(Collectors.toList())) { + for (var blockRegistryObject : FunctionalStorage.DRAWER_TYPES.get(drawerType).stream().map(BlockWithTile::block).collect(Collectors.toList())) { tTagAppender.add(blockRegistryObject.getKey()); } } this.tag(BlockTags.MINEABLE_WITH_PICKAXE) - .add(FunctionalStorage.COMPACTING_DRAWER.getLeft().get()) - .add(FunctionalStorage.DRAWER_CONTROLLER.getLeft().get()) - .add(FunctionalStorage.ARMORY_CABINET.getLeft().get()) - .add(FunctionalStorage.ENDER_DRAWER.getLeft().get()) - .add(FunctionalStorage.FRAMED_COMPACTING_DRAWER.getLeft().get()) - .add(FunctionalStorage.FLUID_DRAWER_1.getLeft().get()) - .add(FunctionalStorage.FLUID_DRAWER_2.getLeft().get()) - .add(FunctionalStorage.FLUID_DRAWER_4.getLeft().get()) - .add(FunctionalStorage.CONTROLLER_EXTENSION.getLeft().get()) - .add(FunctionalStorage.SIMPLE_COMPACTING_DRAWER.getLeft().get()) - .add(FunctionalStorage.FRAMED_DRAWER_CONTROLLER.getLeft().get()) - .add(FunctionalStorage.FRAMED_CONTROLLER_EXTENSION.getLeft().get()) - .add(FunctionalStorage.FRAMED_SIMPLE_COMPACTING_DRAWER.getLeft().get()) + .add(FunctionalStorage.COMPACTING_DRAWER.getBlock()) + .add(FunctionalStorage.DRAWER_CONTROLLER.getBlock()) + .add(FunctionalStorage.ARMORY_CABINET.getBlock()) + .add(FunctionalStorage.ENDER_DRAWER.getBlock()) + .add(FunctionalStorage.FRAMED_COMPACTING_DRAWER.getBlock()) + .add(FunctionalStorage.FLUID_DRAWER_1.getBlock()) + .add(FunctionalStorage.FLUID_DRAWER_2.getBlock()) + .add(FunctionalStorage.FLUID_DRAWER_4.getBlock()) + .add(FunctionalStorage.CONTROLLER_EXTENSION.getBlock()) + .add(FunctionalStorage.SIMPLE_COMPACTING_DRAWER.getBlock()) + .add(FunctionalStorage.FRAMED_DRAWER_CONTROLLER.getBlock()) + .add(FunctionalStorage.FRAMED_CONTROLLER_EXTENSION.getBlock()) + .add(FunctionalStorage.FRAMED_SIMPLE_COMPACTING_DRAWER.getBlock()) ; } diff --git a/src/main/java/com/buuz135/functionalstorage/data/FunctionalStorageBlockstateProvider.java b/src/main/java/com/buuz135/functionalstorage/data/FunctionalStorageBlockstateProvider.java index 884c4f84..75e1e814 100644 --- a/src/main/java/com/buuz135/functionalstorage/data/FunctionalStorageBlockstateProvider.java +++ b/src/main/java/com/buuz135/functionalstorage/data/FunctionalStorageBlockstateProvider.java @@ -1,39 +1,41 @@ package com.buuz135.functionalstorage.data; import com.buuz135.functionalstorage.FunctionalStorage; -import com.buuz135.functionalstorage.block.*; +import com.buuz135.functionalstorage.block.CompactingDrawerBlock; +import com.buuz135.functionalstorage.block.DrawerBlock; +import com.buuz135.functionalstorage.block.EnderDrawerBlock; +import com.buuz135.functionalstorage.block.FluidDrawerBlock; +import com.buuz135.functionalstorage.block.SimpleCompactingDrawerBlock; import com.hrznstudio.titanium.block.RotatableBlock; import net.minecraft.core.Direction; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.DataGenerator; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.properties.DirectionProperty; -import net.minecraftforge.client.model.generators.BlockStateProvider; -import net.minecraftforge.client.model.generators.ConfiguredModel; -import net.minecraftforge.client.model.generators.ModelFile; -import net.minecraftforge.client.model.generators.VariantBlockStateBuilder; -import net.minecraftforge.common.data.ExistingFileHelper; -import net.minecraftforge.common.util.NonNullLazy; -import net.minecraftforge.registries.ForgeRegistries; +import net.neoforged.neoforge.client.model.generators.BlockStateProvider; +import net.neoforged.neoforge.client.model.generators.ConfiguredModel; +import net.neoforged.neoforge.client.model.generators.ModelFile; +import net.neoforged.neoforge.client.model.generators.VariantBlockStateBuilder; +import net.neoforged.neoforge.common.data.ExistingFileHelper; +import net.neoforged.neoforge.common.util.Lazy; import java.util.List; public class FunctionalStorageBlockstateProvider extends BlockStateProvider { - private ExistingFileHelper helper; - private final NonNullLazy> blocks; + private final Lazy> blocks; - public FunctionalStorageBlockstateProvider(DataGenerator gen, ExistingFileHelper exFileHelper, NonNullLazy> blocks) { + public FunctionalStorageBlockstateProvider(DataGenerator gen, ExistingFileHelper exFileHelper, Lazy> blocks) { super(gen.getPackOutput(), FunctionalStorage.MOD_ID, exFileHelper); - this.helper = exFileHelper; this.blocks = blocks; } public static ResourceLocation getModel(Block block) { - return new ResourceLocation(ForgeRegistries.BLOCKS.getKey(block).getNamespace(), "block/" + ForgeRegistries.BLOCKS.getKey(block).getPath()); + return com.buuz135.functionalstorage.util.Utils.resourceLocation(BuiltInRegistries.BLOCK.getKey(block).getNamespace(), "block/" + BuiltInRegistries.BLOCK.getKey(block).getPath()); } public static ResourceLocation getModelLocked(Block block) { - return new ResourceLocation(ForgeRegistries.BLOCKS.getKey(block).getNamespace(), "block/" + ForgeRegistries.BLOCKS.getKey(block).getPath() + "_locked"); + return com.buuz135.functionalstorage.util.Utils.resourceLocation(BuiltInRegistries.BLOCK.getKey(block).getNamespace(), "block/" + BuiltInRegistries.BLOCK.getKey(block).getPath() + "_locked"); } @Override diff --git a/src/main/java/com/buuz135/functionalstorage/data/FunctionalStorageItemTagsProvider.java b/src/main/java/com/buuz135/functionalstorage/data/FunctionalStorageItemTagsProvider.java index 68868c7b..e5962f01 100644 --- a/src/main/java/com/buuz135/functionalstorage/data/FunctionalStorageItemTagsProvider.java +++ b/src/main/java/com/buuz135/functionalstorage/data/FunctionalStorageItemTagsProvider.java @@ -2,22 +2,15 @@ import com.buuz135.functionalstorage.FunctionalStorage; import com.buuz135.functionalstorage.util.StorageTags; +import com.hrznstudio.titanium.module.BlockWithTile; import net.minecraft.core.HolderLookup; -import net.minecraft.data.DataGenerator; import net.minecraft.data.PackOutput; import net.minecraft.data.tags.ItemTagsProvider; -import net.minecraft.data.tags.TagsProvider; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Block; -import net.minecraftforge.common.data.ExistingFileHelper; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegistryObject; -import org.apache.commons.lang3.tuple.Pair; +import net.neoforged.neoforge.common.data.ExistingFileHelper; import org.jetbrains.annotations.Nullable; import java.util.concurrent.CompletableFuture; -import java.util.stream.Collectors; public class FunctionalStorageItemTagsProvider extends ItemTagsProvider { @@ -30,9 +23,8 @@ public FunctionalStorageItemTagsProvider(PackOutput packOutput, CompletableFutur protected void addTags(HolderLookup.Provider p_256380_) { var tTagAppender = this.tag(StorageTags.DRAWER); for (FunctionalStorage.DrawerType drawerType : FunctionalStorage.DRAWER_TYPES.keySet()) { - for (RegistryObject blockRegistryObject : FunctionalStorage.DRAWER_TYPES.get(drawerType).stream().map(Pair::getLeft).collect(Collectors.toList())) { - tTagAppender.add(blockRegistryObject.get().asItem()); - } + FunctionalStorage.DRAWER_TYPES.get(drawerType).stream().map(BlockWithTile::block) + .forEach(ho -> tTagAppender.add(ho.get().asItem())); } } diff --git a/src/main/java/com/buuz135/functionalstorage/data/FunctionalStorageLangProvider.java b/src/main/java/com/buuz135/functionalstorage/data/FunctionalStorageLangProvider.java index a1df9661..498c3ad6 100644 --- a/src/main/java/com/buuz135/functionalstorage/data/FunctionalStorageLangProvider.java +++ b/src/main/java/com/buuz135/functionalstorage/data/FunctionalStorageLangProvider.java @@ -3,13 +3,11 @@ import com.buuz135.functionalstorage.FunctionalStorage; import com.buuz135.functionalstorage.block.DrawerBlock; import com.buuz135.functionalstorage.item.StorageUpgradeItem; +import com.hrznstudio.titanium.module.BlockWithTile; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.DataGenerator; -import net.minecraft.world.level.block.Block; -import net.minecraftforge.common.data.LanguageProvider; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegistryObject; +import net.neoforged.neoforge.common.data.LanguageProvider; import org.apache.commons.lang3.text.WordUtils; -import org.apache.commons.lang3.tuple.Pair; import java.util.stream.Collectors; @@ -23,20 +21,20 @@ public FunctionalStorageLangProvider(DataGenerator gen, String modid, String loc protected void addTranslations() { this.add("itemGroup.functionalstorage", "Functional Storage"); for (FunctionalStorage.DrawerType drawerType : FunctionalStorage.DRAWER_TYPES.keySet()) { - for (RegistryObject blockRegistryObject : FunctionalStorage.DRAWER_TYPES.get(drawerType).stream().map(Pair::getLeft).collect(Collectors.toList())) { + for (var blockRegistryObject : FunctionalStorage.DRAWER_TYPES.get(drawerType).stream().map(BlockWithTile::block).collect(Collectors.toList())) { DrawerBlock drawerBlock = (DrawerBlock) blockRegistryObject.get(); this.add(drawerBlock, WordUtils.capitalize(drawerBlock.getWoodType().getName().replace('_', ' ').toLowerCase()) + " Drawer (" + drawerBlock.getType().getDisplayName() + ")"); } } - this.add(FunctionalStorage.FLUID_DRAWER_1.getLeft().get(), "Fluid Drawer (" + FunctionalStorage.DrawerType.X_1.getDisplayName() + ")"); - this.add(FunctionalStorage.FLUID_DRAWER_2.getLeft().get(), "Fluid Drawer (" + FunctionalStorage.DrawerType.X_2.getDisplayName() + ")"); - this.add(FunctionalStorage.FLUID_DRAWER_4.getLeft().get(), "Fluid Drawer (" + FunctionalStorage.DrawerType.X_4.getDisplayName() + ")"); - this.add(FunctionalStorage.SIMPLE_COMPACTING_DRAWER.getLeft().get(), "Simple Compacting Drawer"); - this.add(FunctionalStorage.FRAMED_SIMPLE_COMPACTING_DRAWER.getLeft().get(), "Framed Simple Compacting Drawer"); - this.add(FunctionalStorage.COMPACTING_DRAWER.getLeft().get(), "Compacting Drawer"); - this.add(FunctionalStorage.FRAMED_COMPACTING_DRAWER.getLeft().get(), "Framed Compacting Drawer"); - this.add(FunctionalStorage.ENDER_DRAWER.getLeft().get(), "Ender Drawer"); - this.add(FunctionalStorage.CONTROLLER_EXTENSION.getLeft().get(), "Controller Access Point"); + this.add(FunctionalStorage.FLUID_DRAWER_1.getBlock(), "Fluid Drawer (" + FunctionalStorage.DrawerType.X_1.getDisplayName() + ")"); + this.add(FunctionalStorage.FLUID_DRAWER_2.getBlock(), "Fluid Drawer (" + FunctionalStorage.DrawerType.X_2.getDisplayName() + ")"); + this.add(FunctionalStorage.FLUID_DRAWER_4.getBlock(), "Fluid Drawer (" + FunctionalStorage.DrawerType.X_4.getDisplayName() + ")"); + this.add(FunctionalStorage.SIMPLE_COMPACTING_DRAWER.getBlock(), "Simple Compacting Drawer"); + this.add(FunctionalStorage.FRAMED_SIMPLE_COMPACTING_DRAWER.getBlock(), "Framed Simple Compacting Drawer"); + this.add(FunctionalStorage.COMPACTING_DRAWER.getBlock(), "Compacting Drawer"); + this.add(FunctionalStorage.FRAMED_COMPACTING_DRAWER.getBlock(), "Framed Compacting Drawer"); + this.add(FunctionalStorage.ENDER_DRAWER.getBlock(), "Ender Drawer"); + this.add(FunctionalStorage.CONTROLLER_EXTENSION.getBlock(), "Controller Access Point"); this.add("linkingtool.linkingmode", "Linking Mode: "); this.add("linkingtool.linkingmode.single", "Single"); this.add("linkingtool.linkingmode.single.desc", "Links a drawer to a controller"); @@ -50,22 +48,22 @@ protected void addTranslations() { this.add("key.categories.utility", "Utility"); this.add("key.categories.storage", "Storage"); this.add(FunctionalStorage.LINKING_TOOL.get(), "Linking Tool"); - this.add(FunctionalStorage.DRAWER_CONTROLLER.getLeft().get(), "Storage Controller"); - this.add(FunctionalStorage.FRAMED_DRAWER_CONTROLLER.getLeft().get(), "Framed Storage Controller"); - this.add(FunctionalStorage.FRAMED_CONTROLLER_EXTENSION.getLeft().get(), "Framed Controller Access Point"); + this.add(FunctionalStorage.DRAWER_CONTROLLER.getBlock(), "Storage Controller"); + this.add(FunctionalStorage.FRAMED_DRAWER_CONTROLLER.getBlock(), "Framed Storage Controller"); + this.add(FunctionalStorage.FRAMED_CONTROLLER_EXTENSION.getBlock(), "Framed Controller Access Point"); this.add("storageupgrade.desc.item", "Multiplies the block item storage by "); this.add("storageupgrade.desc.fluid", "Multiplies the block fluid storage by "); this.add("storageupgrade.desc.range", "Increases controller radius by %s blocks"); for (StorageUpgradeItem.StorageTier storageTier : FunctionalStorage.STORAGE_UPGRADES.keySet()) { this.add(FunctionalStorage.STORAGE_UPGRADES.get(storageTier).get(), WordUtils.capitalize(storageTier.name().replace("_", " ").toLowerCase()) + (storageTier == StorageUpgradeItem.StorageTier.IRON ? " Downgrade" : " Upgrade")); } - this.add(FunctionalStorage.COLLECTOR_UPGRADE.get(), WordUtils.capitalize(ForgeRegistries.ITEMS.getKey(FunctionalStorage.COLLECTOR_UPGRADE.get()).getPath().replace('_', ' ').toLowerCase())); - this.add(FunctionalStorage.PULLING_UPGRADE.get(), WordUtils.capitalize(ForgeRegistries.ITEMS.getKey(FunctionalStorage.PULLING_UPGRADE.get()).getPath().replace('_', ' ').toLowerCase())); - this.add(FunctionalStorage.PUSHING_UPGRADE.get(), WordUtils.capitalize(ForgeRegistries.ITEMS.getKey(FunctionalStorage.PUSHING_UPGRADE.get()).getPath().replace('_', ' ').toLowerCase())); - this.add(FunctionalStorage.VOID_UPGRADE.get(), WordUtils.capitalize(ForgeRegistries.ITEMS.getKey(FunctionalStorage.VOID_UPGRADE.get()).getPath().replace('_', ' ').toLowerCase())); - this.add(FunctionalStorage.REDSTONE_UPGRADE.get(), WordUtils.capitalize(ForgeRegistries.ITEMS.getKey(FunctionalStorage.REDSTONE_UPGRADE.get()).getPath().replace('_', ' ').toLowerCase())); - this.add(FunctionalStorage.CREATIVE_UPGRADE.get(), WordUtils.capitalize(ForgeRegistries.ITEMS.getKey(FunctionalStorage.CREATIVE_UPGRADE.get()).getPath().replace('_', ' ').toLowerCase())); - this.add(FunctionalStorage.ARMORY_CABINET.getLeft().get(), "Armory Cabinet"); + this.add(FunctionalStorage.COLLECTOR_UPGRADE.get(), WordUtils.capitalize(BuiltInRegistries.ITEM.getKey(FunctionalStorage.COLLECTOR_UPGRADE.get()).getPath().replace('_', ' ').toLowerCase())); + this.add(FunctionalStorage.PULLING_UPGRADE.get(), WordUtils.capitalize(BuiltInRegistries.ITEM.getKey(FunctionalStorage.PULLING_UPGRADE.get()).getPath().replace('_', ' ').toLowerCase())); + this.add(FunctionalStorage.PUSHING_UPGRADE.get(), WordUtils.capitalize(BuiltInRegistries.ITEM.getKey(FunctionalStorage.PUSHING_UPGRADE.get()).getPath().replace('_', ' ').toLowerCase())); + this.add(FunctionalStorage.VOID_UPGRADE.get(), WordUtils.capitalize(BuiltInRegistries.ITEM.getKey(FunctionalStorage.VOID_UPGRADE.get()).getPath().replace('_', ' ').toLowerCase())); + this.add(FunctionalStorage.REDSTONE_UPGRADE.get(), WordUtils.capitalize(BuiltInRegistries.ITEM.getKey(FunctionalStorage.REDSTONE_UPGRADE.get()).getPath().replace('_', ' ').toLowerCase())); + this.add(FunctionalStorage.CREATIVE_UPGRADE.get(), WordUtils.capitalize(BuiltInRegistries.ITEM.getKey(FunctionalStorage.CREATIVE_UPGRADE.get()).getPath().replace('_', ' ').toLowerCase())); + this.add(FunctionalStorage.ARMORY_CABINET.getBlock(), "Armory Cabinet"); this.add(FunctionalStorage.CONFIGURATION_TOOL.get(), "Configuration Tool"); this.add("item.utility.downgrade", "Downgrades the slots to a max of 64 items"); this.add("item.utility.direction", "Direction: "); @@ -87,6 +85,7 @@ protected void addTranslations() { this.add("linkingtool.ender.frequency", "Frequency: "); this.add("linkingtool.ender.clear", "Sneak + Right Click in the air to clear frequency."); this.add("drawer.block.contents", "Contents: "); + this.add("drawer.block.multiplier", "Storage multiplier: %s"); this.add("frameddrawer.use", "How 2 Change Texture: \nInside a crafting window place the block you want use the texture of for the outside of the drawer in the first slot of the crafting window, on the second slot put the block that will be used for the texture on the inside of the framed drawer and on the third slot put a framed drawer. You can change the drawer divider texture by adding a block into the 4th slot\n"); this.add("item.utility.slot", "Slot: "); this.add("item.utility.slot.desc", "Right click in a GUI to change slot"); @@ -98,5 +97,26 @@ protected void addTranslations() { this.add("gui.functionalstorage.storage", "Storage"); this.add("gui.functionalstorage.utility", "Utility"); this.add("gui.functionalstorage.storage_range", "Range"); + + this.add("drawer_upgrade.functionalstorage.sides.up", "up"); + this.add("drawer_upgrade.functionalstorage.sides.down", "down"); + this.add("drawer_upgrade.functionalstorage.sides.left", "left"); + this.add("drawer_upgrade.functionalstorage.sides.right", "right"); + this.add("drawer_upgrade.functionalstorage.sides.front", "front"); + this.add("drawer_upgrade.functionalstorage.sides.back", "back"); + + this.add("drawer_upgrade.functionalstorage.void.item", "Voids excess items"); + this.add("drawer_upgrade.functionalstorage.void.fluid", "Voids excess fluids"); + this.add("drawer_upgrade.functionalstorage.pull.item", "Pulls items: %s"); + this.add("drawer_upgrade.functionalstorage.pull.fluid", "Pulls fluids: %s"); + this.add("drawer_upgrade.functionalstorage.push.item", "Pushes items: %s"); + this.add("drawer_upgrade.functionalstorage.push.fluid", "Pushes fluids: %s"); + this.add("drawer_upgrade.functionalstorage.collect.item", "Collects item entities: %s"); + this.add("drawer_upgrade.functionalstorage.collect.fluid", "Picks up fluids: %s"); + + this.add("drawer_upgrade.functionalstorage.redstone", "Emitting redstone signal for slot %s"); + this.add("drawer_upgrade.functionalstorage.relative_direction", "Relative direction: %s"); + + this.add("config.jade.plugin_functionalstorage.drawer", "Functional Storage Drawers"); } } diff --git a/src/main/java/com/buuz135/functionalstorage/data/FunctionalStorageRecipesProvider.java b/src/main/java/com/buuz135/functionalstorage/data/FunctionalStorageRecipesProvider.java index 0a98456a..3a93f5c0 100644 --- a/src/main/java/com/buuz135/functionalstorage/data/FunctionalStorageRecipesProvider.java +++ b/src/main/java/com/buuz135/functionalstorage/data/FunctionalStorageRecipesProvider.java @@ -1,127 +1,146 @@ package com.buuz135.functionalstorage.data; import com.buuz135.functionalstorage.item.StorageUpgradeItem; +import com.buuz135.functionalstorage.recipe.CustomCompactingRecipe; import com.buuz135.functionalstorage.util.StorageTags; import com.hrznstudio.titanium.block.BasicBlock; -import com.hrznstudio.titanium.recipe.generator.TitaniumRecipeProvider; import com.hrznstudio.titanium.recipe.generator.TitaniumShapedRecipeBuilder; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.DataGenerator; -import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.data.recipes.RecipeCategory; +import net.minecraft.data.recipes.RecipeOutput; +import net.minecraft.data.recipes.RecipeProvider; import net.minecraft.data.recipes.SmithingTransformRecipeBuilder; import net.minecraft.tags.ItemTags; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.block.Block; -import net.minecraftforge.common.Tags; -import net.minecraftforge.common.util.NonNullLazy; -import net.minecraftforge.registries.ForgeRegistries; +import net.neoforged.neoforge.common.Tags; +import net.neoforged.neoforge.common.util.Lazy; import java.util.List; -import java.util.function.Consumer; +import java.util.concurrent.CompletableFuture; -import static com.buuz135.functionalstorage.FunctionalStorage.*; +import static com.buuz135.functionalstorage.FunctionalStorage.ARMORY_CABINET; +import static com.buuz135.functionalstorage.FunctionalStorage.COLLECTOR_UPGRADE; +import static com.buuz135.functionalstorage.FunctionalStorage.CONFIGURATION_TOOL; +import static com.buuz135.functionalstorage.FunctionalStorage.ENDER_DRAWER; +import static com.buuz135.functionalstorage.FunctionalStorage.LINKING_TOOL; +import static com.buuz135.functionalstorage.FunctionalStorage.PULLING_UPGRADE; +import static com.buuz135.functionalstorage.FunctionalStorage.PUSHING_UPGRADE; +import static com.buuz135.functionalstorage.FunctionalStorage.REDSTONE_UPGRADE; +import static com.buuz135.functionalstorage.FunctionalStorage.STORAGE_UPGRADES; +import static com.buuz135.functionalstorage.FunctionalStorage.VOID_UPGRADE; -public class FunctionalStorageRecipesProvider extends TitaniumRecipeProvider { +public class FunctionalStorageRecipesProvider extends RecipeProvider { - private NonNullLazy> blocksToProcess; + private final Lazy> blocksToProcess; - public FunctionalStorageRecipesProvider(DataGenerator generator, NonNullLazy> blocksToProcess) { - super(generator); + public FunctionalStorageRecipesProvider(DataGenerator generator, Lazy> blocksToProcess, CompletableFuture prov) { + super(generator.getPackOutput(), prov); this.blocksToProcess = blocksToProcess; } @Override - public void register(Consumer consumer) { - blocksToProcess.get().stream().map(block -> (BasicBlock) block).forEach(basicBlock -> basicBlock.registerRecipe(consumer)); + protected void buildRecipes(RecipeOutput output) { + blocksToProcess.get().stream().map(block -> (BasicBlock) block).forEach(basicBlock -> basicBlock.registerRecipe(output)); TitaniumShapedRecipeBuilder.shapedRecipe(STORAGE_UPGRADES.get(StorageUpgradeItem.StorageTier.IRON).get()) .pattern("III").pattern("IDI").pattern("III") .define('I', Tags.Items.INGOTS_IRON) .define('D', StorageTags.DRAWER) - .save(consumer); + .save(output); TitaniumShapedRecipeBuilder.shapedRecipe(VOID_UPGRADE.get()) .pattern("III").pattern("IDI").pattern("III") - .define('I', Tags.Items.OBSIDIAN) + .define('I', Tags.Items.OBSIDIANS) .define('D', StorageTags.DRAWER) - .save(consumer); + .save(output); TitaniumShapedRecipeBuilder.shapedRecipe(CONFIGURATION_TOOL.get()) .pattern("PPG").pattern("PDG").pattern("PEP") .define('P', Items.PAPER) .define('G', Tags.Items.INGOTS_GOLD) .define('D', StorageTags.DRAWER) .define('E', Items.EMERALD) - .save(consumer); + .save(output); TitaniumShapedRecipeBuilder.shapedRecipe(LINKING_TOOL.get()) .pattern("PPG").pattern("PDG").pattern("PEP") .define('P', Items.PAPER) .define('G', Tags.Items.INGOTS_GOLD) .define('D', StorageTags.DRAWER) .define('E', Items.DIAMOND) - .save(consumer); + .save(output); TitaniumShapedRecipeBuilder.shapedRecipe(STORAGE_UPGRADES.get(StorageUpgradeItem.StorageTier.COPPER).get()) .pattern("IBI").pattern("CDC").pattern("IBI") .define('I', Items.COPPER_INGOT) .define('B', Items.COPPER_BLOCK) .define('C', Tags.Items.CHESTS_WOODEN) .define('D', StorageTags.DRAWER) - .save(consumer); + .save(output); TitaniumShapedRecipeBuilder.shapedRecipe(STORAGE_UPGRADES.get(StorageUpgradeItem.StorageTier.GOLD).get()) .pattern("IBI").pattern("CDC").pattern("BIB") .define('I', Tags.Items.INGOTS_GOLD) .define('B', Tags.Items.STORAGE_BLOCKS_GOLD) .define('C', Tags.Items.CHESTS_WOODEN) .define('D', STORAGE_UPGRADES.get(StorageUpgradeItem.StorageTier.COPPER).get()) - .save(consumer); + .save(output); TitaniumShapedRecipeBuilder.shapedRecipe(STORAGE_UPGRADES.get(StorageUpgradeItem.StorageTier.DIAMOND).get()) .pattern("IBI").pattern("CDC").pattern("IBI") .define('I', Tags.Items.GEMS_DIAMOND) .define('B', Tags.Items.STORAGE_BLOCKS_DIAMOND) .define('C', Tags.Items.CHESTS_WOODEN) .define('D', STORAGE_UPGRADES.get(StorageUpgradeItem.StorageTier.GOLD).get()) - .save(consumer); + .save(output); TitaniumShapedRecipeBuilder.shapedRecipe(REDSTONE_UPGRADE.get()) .pattern("IBI").pattern("CDC").pattern("IBI") .define('I', Items.REDSTONE) .define('B', Items.REDSTONE_BLOCK) .define('C', Items.COMPARATOR) .define('D', StorageTags.DRAWER) - .save(consumer); + .save(output); SmithingTransformRecipeBuilder.smithing(Ingredient.of(Items.NETHERITE_UPGRADE_SMITHING_TEMPLATE), Ingredient.of(STORAGE_UPGRADES.get(StorageUpgradeItem.StorageTier.DIAMOND).get()), Ingredient.of(Items.NETHERITE_INGOT), RecipeCategory.MISC, STORAGE_UPGRADES.get(StorageUpgradeItem.StorageTier.NETHERITE).get()) .unlocks("has_netherite_ingot", has(Items.NETHERITE_INGOT)) - .save(consumer, ForgeRegistries.ITEMS.getKey(STORAGE_UPGRADES.get(StorageUpgradeItem.StorageTier.NETHERITE).get())); - TitaniumShapedRecipeBuilder.shapedRecipe(ARMORY_CABINET.getLeft().get()) + .save(output, BuiltInRegistries.ITEM.getKey(STORAGE_UPGRADES.get(StorageUpgradeItem.StorageTier.NETHERITE).get())); + TitaniumShapedRecipeBuilder.shapedRecipe(ARMORY_CABINET.getBlock()) .pattern("ICI").pattern("CDC").pattern("IBI") - .define('I', Tags.Items.STONE) + .define('I', Tags.Items.STONES) .define('B', Tags.Items.INGOTS_NETHERITE) .define('C', StorageTags.DRAWER) .define('D', Items.COMPARATOR) - .save(consumer); + .save(output); TitaniumShapedRecipeBuilder.shapedRecipe(PULLING_UPGRADE.get()) .pattern("ICI").pattern("IDI").pattern("IBI") - .define('I', Tags.Items.STONE) + .define('I', Tags.Items.STONES) .define('B', Tags.Items.DUSTS_REDSTONE) .define('C', Items.HOPPER) .define('D', StorageTags.DRAWER) - .save(consumer); + .save(output); TitaniumShapedRecipeBuilder.shapedRecipe(PUSHING_UPGRADE.get()) .pattern("IBI").pattern("IDI").pattern("IRI") - .define('I', Tags.Items.STONE) + .define('I', Tags.Items.STONES) .define('B', Tags.Items.DUSTS_REDSTONE) .define('R', Items.HOPPER) .define('D', StorageTags.DRAWER) - .save(consumer); + .save(output); TitaniumShapedRecipeBuilder.shapedRecipe(COLLECTOR_UPGRADE.get()) .pattern("IBI").pattern("RDR").pattern("IBI") - .define('I', Tags.Items.STONE) + .define('I', Tags.Items.STONES) .define('B', Items.HOPPER) .define('R', Tags.Items.DUSTS_REDSTONE) .define('D', StorageTags.DRAWER) - .save(consumer); - TitaniumShapedRecipeBuilder.shapedRecipe(ENDER_DRAWER.getLeft().get()) + .save(output); + TitaniumShapedRecipeBuilder.shapedRecipe(ENDER_DRAWER.getBlock()) .pattern("PPP").pattern("LCL").pattern("PPP") .define('P', ItemTags.PLANKS) .define('C', Tags.Items.CHESTS_ENDER) .define('L', StorageTags.DRAWER) - .save(consumer); + .save(output); + + new CustomCompactingRecipe(new ItemStack(Items.GLOWSTONE_DUST, 4), new ItemStack(Items.GLOWSTONE)).save(output, com.buuz135.functionalstorage.util.Utils.resourceLocation("functionalstorage/compacting/glowstone")); + new CustomCompactingRecipe(new ItemStack(Items.MELON_SLICE, 9), new ItemStack(Items.MELON)).save(output, com.buuz135.functionalstorage.util.Utils.resourceLocation("functionalstorage/compacting/melon")); + new CustomCompactingRecipe(new ItemStack(Items.QUARTZ, 4), new ItemStack(Items.QUARTZ_BLOCK)).save(output, com.buuz135.functionalstorage.util.Utils.resourceLocation("functionalstorage/compacting/quartz")); + new CustomCompactingRecipe(new ItemStack(Items.ICE, 9), new ItemStack(Items.PACKED_ICE)).save(output, com.buuz135.functionalstorage.util.Utils.resourceLocation("functionalstorage/compacting/ice")); + new CustomCompactingRecipe(new ItemStack(Items.PACKED_ICE, 9), new ItemStack(Items.BLUE_ICE)).save(output, com.buuz135.functionalstorage.util.Utils.resourceLocation("functionalstorage/compacting/packed_ice")); + new CustomCompactingRecipe(new ItemStack(Items.AMETHYST_SHARD, 4), new ItemStack(Items.AMETHYST_BLOCK)).save(output, com.buuz135.functionalstorage.util.Utils.resourceLocation("functionalstorage/compacting/amethyst")); } } diff --git a/src/main/java/com/buuz135/functionalstorage/fluid/BigFluidHandler.java b/src/main/java/com/buuz135/functionalstorage/fluid/BigFluidHandler.java index e75cea40..f5789ed9 100644 --- a/src/main/java/com/buuz135/functionalstorage/fluid/BigFluidHandler.java +++ b/src/main/java/com/buuz135/functionalstorage/fluid/BigFluidHandler.java @@ -1,10 +1,13 @@ package com.buuz135.functionalstorage.fluid; +import com.buuz135.functionalstorage.util.Utils; import net.minecraft.nbt.CompoundTag; -import net.minecraftforge.common.util.INBTSerializable; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.IFluidHandler; -import net.minecraftforge.fluids.capability.templates.FluidTank; +import net.minecraft.nbt.NbtOps; +import net.minecraft.resources.RegistryOps; +import net.neoforged.neoforge.common.util.INBTSerializable; +import net.neoforged.neoforge.fluids.FluidStack; +import net.neoforged.neoforge.fluids.capability.IFluidHandler; +import net.neoforged.neoforge.fluids.capability.templates.FluidTank; import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; @@ -24,7 +27,7 @@ public BigFluidHandler(int size, int capacity) { int finalI = i; this.tanks[i] = new CustomFluidTank(capacity, fluidStack -> { if (isDrawerLocked()) { - return fluidStack.isFluidEqual(this.filterStack[finalI]); + return FluidStack.isSameFluidSameComponents(fluidStack, this.filterStack[finalI]); } return true; }); @@ -79,7 +82,7 @@ public int fill(FluidStack resource, FluidAction action) { @Override public FluidStack drain(FluidStack resource, FluidAction action) { for (CustomFluidTank tank : tanks) { - if (!tank.getFluid().isEmpty() && tank.getFluid().isFluidEqual(resource) && !tank.drain(resource, FluidAction.SIMULATE).isEmpty()) { + if (!tank.getFluid().isEmpty() && FluidStack.isSameFluidSameComponents(tank.getFluid(), resource) && !tank.drain(resource, FluidAction.SIMULATE).isEmpty()) { FluidStack ret = tank.drain(resource, action); if (action == FluidAction.EXECUTE) onChange(); return ret; @@ -117,23 +120,23 @@ public void setCapacity(int capacity) { } @Override - public CompoundTag serializeNBT() { + public CompoundTag serializeNBT(net.minecraft.core.HolderLookup.Provider provider) { CompoundTag compoundTag = new CompoundTag(); for (int i = 0; i < this.tanks.length; i++) { - compoundTag.put(i + "", this.tanks[i].writeToNBT(new CompoundTag())); - compoundTag.put("Locked" + i, this.filterStack[i].writeToNBT(new CompoundTag())); + compoundTag.put(i + "", this.tanks[i].writeToNBT(provider, new CompoundTag())); + compoundTag.put("Locked" + i, FluidStack.OPTIONAL_CODEC.encodeStart(RegistryOps.create(NbtOps.INSTANCE, provider), this.filterStack[i]).getOrThrow()); } compoundTag.putInt("Capacity", this.capacity); return compoundTag; } @Override - public void deserializeNBT(CompoundTag nbt) { + public void deserializeNBT(net.minecraft.core.HolderLookup.Provider provider, CompoundTag nbt) { this.capacity = nbt.getInt("Capacity"); for (int i = 0; i < this.tanks.length; i++) { - this.tanks[i].readFromNBT(nbt.getCompound(i + "")); + this.tanks[i].readFromNBT(provider, nbt.getCompound(i + "")); this.tanks[i].setCapacity(this.capacity); - this.filterStack[i] = FluidStack.loadFluidStackFromNBT(nbt.getCompound("Locked" + i)); + this.filterStack[i] = Utils.deserializeFluid(provider, nbt.getCompound("Locked" + i)); } } @@ -171,7 +174,7 @@ public CustomFluidTank(int capacity, Predicate validator) { public int fill(FluidStack resource, FluidAction action) { int amount = super.fill(resource, action); if (isDrawerVoid() - && ((isDrawerLocked() && isFluidValid(resource)) || (!getFluid().isEmpty() && getFluid().isFluidEqual(resource)))) + && ((isDrawerLocked() && isFluidValid(resource)) || (!getFluid().isEmpty() && FluidStack.isSameFluidSameComponents(getFluid(), resource)))) return resource.getAmount(); return amount; } diff --git a/src/main/java/com/buuz135/functionalstorage/fluid/ControllerFluidHandler.java b/src/main/java/com/buuz135/functionalstorage/fluid/ControllerFluidHandler.java index 62ae784e..102e4aa7 100644 --- a/src/main/java/com/buuz135/functionalstorage/fluid/ControllerFluidHandler.java +++ b/src/main/java/com/buuz135/functionalstorage/fluid/ControllerFluidHandler.java @@ -3,12 +3,12 @@ import com.buuz135.functionalstorage.block.tile.DrawerControllerTile; import com.buuz135.functionalstorage.inventory.ControllerInventoryHandler; import com.buuz135.functionalstorage.util.ConnectedDrawers; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.IFluidHandler; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; +import net.neoforged.neoforge.fluids.FluidStack; +import net.neoforged.neoforge.fluids.capability.IFluidHandler; public abstract class ControllerFluidHandler implements IFluidHandler { @@ -63,7 +63,7 @@ public boolean isFluidValid(int tank, @NotNull FluidStack stack) { @Override public int fill(FluidStack resource, FluidAction action) { for (HandlerTankSelector selector : this.selectors) { - if (!selector.getStackInSlot().isEmpty() && selector.getStackInSlot().isFluidEqual(resource) && selector.fill(resource, FluidAction.SIMULATE) > 0) { + if (!selector.getStackInSlot().isEmpty() && FluidStack.isSameFluidSameComponents(selector.getStackInSlot(), resource) && selector.fill(resource, FluidAction.SIMULATE) > 0) { return selector.fill(resource, action); } } @@ -78,7 +78,7 @@ public int fill(FluidStack resource, FluidAction action) { @Override public @NotNull FluidStack drain(FluidStack resource, FluidAction action) { for (HandlerTankSelector selector : this.selectors) { - if (!selector.getStackInSlot().isEmpty() && selector.getStackInSlot().isFluidEqual(resource)) { + if (!selector.getStackInSlot().isEmpty() && FluidStack.isSameFluidSameComponents(selector.getStackInSlot(), resource)) { return selector.drain(resource, action); } } diff --git a/src/main/java/com/buuz135/functionalstorage/inventory/ArmoryCabinetInventoryHandler.java b/src/main/java/com/buuz135/functionalstorage/inventory/ArmoryCabinetInventoryHandler.java index 5b43235e..c44c510a 100644 --- a/src/main/java/com/buuz135/functionalstorage/inventory/ArmoryCabinetInventoryHandler.java +++ b/src/main/java/com/buuz135/functionalstorage/inventory/ArmoryCabinetInventoryHandler.java @@ -1,13 +1,15 @@ package com.buuz135.functionalstorage.inventory; import com.buuz135.functionalstorage.block.config.FunctionalStorageConfig; +import net.minecraft.core.component.DataComponents; import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.item.HorseArmorItem; +import net.minecraft.nbt.NbtOps; +import net.minecraft.resources.RegistryOps; +import net.minecraft.world.item.AnimalArmorItem; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.RecordItem; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.util.INBTSerializable; -import net.minecraftforge.items.IItemHandler; +import net.neoforged.neoforge.capabilities.Capabilities; +import net.neoforged.neoforge.common.util.INBTSerializable; +import net.neoforged.neoforge.items.IItemHandler; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -76,18 +78,18 @@ private boolean isValid(int slot, @NotNull ItemStack stack) { } private boolean isCertifiedStack(ItemStack stack){ - if (stack.getCapability(ForgeCapabilities.ITEM_HANDLER, null).isPresent()) return false; + if (stack.getCapability(Capabilities.ItemHandler.ITEM) != null) return false; if (stack.getMaxStackSize() > 1) return false; - return stack.hasTag() || stack.isDamageableItem() || stack.isEnchantable() || stack.getItem() instanceof RecordItem || stack.getItem() instanceof HorseArmorItem; + return stack.isDamageableItem() || stack.isEnchantable() || stack.has(DataComponents.JUKEBOX_PLAYABLE) || stack.getItem() instanceof AnimalArmorItem; } @Override - public CompoundTag serializeNBT() { + public CompoundTag serializeNBT(net.minecraft.core.HolderLookup.Provider provider) { CompoundTag compoundTag = new CompoundTag(); for (int i = 0; i < this.stackList.size(); i++) { ItemStack stack = this.stackList.get(i); if (!stack.isEmpty()){ - compoundTag.put(i + "", stack.serializeNBT()); + compoundTag.put(String.valueOf(i), stack.saveOptional(provider)); } } return compoundTag; @@ -102,12 +104,12 @@ private List create(){ } @Override - public void deserializeNBT(CompoundTag nbt) { + public void deserializeNBT(net.minecraft.core.HolderLookup.Provider provider, CompoundTag nbt) { this.stackList = create(); for (String allKey : nbt.getAllKeys()) { int pos = Integer.parseInt(allKey); if (pos < this.stackList.size()){ - this.stackList.set(pos, ItemStack.of(nbt.getCompound(allKey))); + this.stackList.set(pos, ItemStack.CODEC.decode(RegistryOps.create(NbtOps.INSTANCE, provider), nbt.getCompound(allKey)).getOrThrow().getFirst()); } } } diff --git a/src/main/java/com/buuz135/functionalstorage/inventory/BigInventoryHandler.java b/src/main/java/com/buuz135/functionalstorage/inventory/BigInventoryHandler.java index cc29ce05..41dd47db 100644 --- a/src/main/java/com/buuz135/functionalstorage/inventory/BigInventoryHandler.java +++ b/src/main/java/com/buuz135/functionalstorage/inventory/BigInventoryHandler.java @@ -1,11 +1,12 @@ package com.buuz135.functionalstorage.inventory; import com.buuz135.functionalstorage.FunctionalStorage; +import com.buuz135.functionalstorage.util.Utils; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.common.util.INBTSerializable; -import net.minecraftforge.items.IItemHandler; -import net.minecraftforge.items.ItemHandlerHelper; +import net.neoforged.neoforge.common.util.INBTSerializable; +import net.neoforged.neoforge.items.IItemHandler; +import net.neoforged.neoforge.items.ItemHandlerHelper; import javax.annotation.Nonnull; import java.util.ArrayList; @@ -18,7 +19,7 @@ public abstract class BigInventoryHandler implements IItemHandler, INBTSerializa public static String AMOUNT = "Amount"; private final FunctionalStorage.DrawerType type; - private List storedStacks; + private final List storedStacks; public BigInventoryHandler(FunctionalStorage.DrawerType type) { this.type = type; @@ -39,9 +40,10 @@ public int getSlots() { public ItemStack getStackInSlot(int slot) { if (type.getSlots() == slot) return ItemStack.EMPTY; BigStack bigStack = this.storedStacks.get(slot); - ItemStack copied = bigStack.getStack().copy(); - copied.setCount(isCreative() ? Integer.MAX_VALUE : bigStack.getAmount()); - return copied; + if (isCreative()) { + return bigStack.slotStack.copyWithCount(Integer.MAX_VALUE); + } + return bigStack.slotStack; } @Nonnull @@ -54,12 +56,12 @@ public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate int inserted = Math.min(getSlotLimit(slot) - bigStack.getAmount(), stack.getCount()); if (!simulate) { if (bigStack.getStack().isEmpty()) - bigStack.setStack(ItemHandlerHelper.copyStackWithSize(stack, stack.getMaxStackSize())); + bigStack.setStack(stack.copyWithCount(stack.getMaxStackSize())); bigStack.setAmount(Math.min(bigStack.getAmount() + inserted, getSlotLimit(slot))); onChange(); } if (inserted == stack.getCount() || isVoid()) return ItemStack.EMPTY; - return ItemHandlerHelper.copyStackWithSize(stack, stack.getCount() - inserted); + return stack.copyWithCount(stack.getCount() - inserted); } return stack; } @@ -86,7 +88,7 @@ public ItemStack extractItem(int slot, int amount, boolean simulate) { bigStack.setAmount(bigStack.getAmount() - amount); onChange(); } - return ItemHandlerHelper.copyStackWithSize(bigStack.getStack(), amount); + return bigStack.getStack().copyWithCount(amount); } } return ItemStack.EMPTY; @@ -115,25 +117,25 @@ private boolean isValid(int slot, @Nonnull ItemStack stack){ BigStack bigStack = this.storedStacks.get(slot); ItemStack fl = bigStack.getStack(); if (isLocked() && fl.isEmpty()) return false; - return fl.isEmpty() || (ItemStack.isSameItemSameTags(fl, stack)); + return fl.isEmpty() || (ItemStack.isSameItemSameComponents(fl, stack)); } return false; } private boolean isVoidValid(ItemStack stack){ for (BigStack storedStack : this.storedStacks) { - if (ItemStack.isSameItemSameTags(storedStack.getStack(), stack)) return true; + if (ItemStack.isSameItemSameComponents(storedStack.getStack(), stack)) return true; } return false; } @Override - public CompoundTag serializeNBT() { + public CompoundTag serializeNBT(net.minecraft.core.HolderLookup.Provider provider) { CompoundTag compoundTag = new CompoundTag(); CompoundTag items = new CompoundTag(); for (int i = 0; i < this.storedStacks.size(); i++) { CompoundTag bigStack = new CompoundTag(); - bigStack.put(STACK, this.storedStacks.get(i).getStack().serializeNBT()); + bigStack.put(STACK, this.storedStacks.get(i).getStack().saveOptional(provider)); bigStack.putInt(AMOUNT, this.storedStacks.get(i).getAmount()); items.put(i + "", bigStack); } @@ -142,9 +144,9 @@ public CompoundTag serializeNBT() { } @Override - public void deserializeNBT(CompoundTag nbt) { + public void deserializeNBT(net.minecraft.core.HolderLookup.Provider provider, CompoundTag nbt) { for (String allKey : nbt.getCompound(BIG_ITEMS).getAllKeys()) { - this.storedStacks.get(Integer.parseInt(allKey)).setStack(ItemStack.of(nbt.getCompound(BIG_ITEMS).getCompound(allKey).getCompound(STACK))); + this.storedStacks.get(Integer.parseInt(allKey)).setStack(Utils.deserialize(provider, nbt.getCompound(BIG_ITEMS).getCompound(allKey).getCompound(STACK))); this.storedStacks.get(Integer.parseInt(allKey)).setAmount(nbt.getCompound(BIG_ITEMS).getCompound(allKey).getInt(AMOUNT)); } } @@ -168,11 +170,13 @@ public List getStoredStacks() { public static class BigStack { private ItemStack stack; + private ItemStack slotStack; private int amount; public BigStack(ItemStack stack, int amount) { this.stack = stack.copy(); this.amount = amount; + this.slotStack = stack.copyWithCount(amount); } public ItemStack getStack() { @@ -181,6 +185,7 @@ public ItemStack getStack() { public void setStack(ItemStack stack) { this.stack = stack.copy(); + this.slotStack = stack.copyWithCount(amount); } public int getAmount() { @@ -189,6 +194,7 @@ public int getAmount() { public void setAmount(int amount) { this.amount = amount; + this.slotStack.setCount(amount); } } } diff --git a/src/main/java/com/buuz135/functionalstorage/inventory/CompactingInventoryHandler.java b/src/main/java/com/buuz135/functionalstorage/inventory/CompactingInventoryHandler.java index 30617ef6..09cf5f1c 100644 --- a/src/main/java/com/buuz135/functionalstorage/inventory/CompactingInventoryHandler.java +++ b/src/main/java/com/buuz135/functionalstorage/inventory/CompactingInventoryHandler.java @@ -1,22 +1,22 @@ package com.buuz135.functionalstorage.inventory; import com.buuz135.functionalstorage.util.CompactingUtil; +import com.buuz135.functionalstorage.util.Utils; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.common.util.INBTSerializable; -import net.minecraftforge.items.IItemHandler; -import net.minecraftforge.items.ItemHandlerHelper; - +import net.neoforged.neoforge.common.util.INBTSerializable; +import net.neoforged.neoforge.items.IItemHandler; +import net.neoforged.neoforge.items.ItemHandlerHelper; import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; public abstract class CompactingInventoryHandler implements IItemHandler, INBTSerializable, ILockable { - public static String PARENT = "Parent"; - public static String BIG_ITEMS = "BigItems"; - public static String STACK = "Stack"; - public static String AMOUNT = "Amount"; + public static final String PARENT = "Parent"; + public static final String BIG_ITEMS = "BigItems"; + public static final String STACK = "Stack"; + public static final String AMOUNT = "Amount"; public int totalAmount; @@ -68,7 +68,7 @@ public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate onChange(); } if (inserted == stack.getCount() * result.getNeeded() || isVoid()) return ItemStack.EMPTY; - return ItemHandlerHelper.copyStackWithSize(stack, stack.getCount() - inserted / result.getNeeded()); + return stack.copyWithCount(stack.getCount() - inserted / result.getNeeded()); } return stack; @@ -76,7 +76,7 @@ public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate private boolean isVoidValid(ItemStack stack) { for (CompactingUtil.Result result : this.resultList) { - if (ItemStack.isSameItemSameTags(result.getResult(), stack)) return true; + if (ItemStack.isSameItemSameComponents(result.getResult(), stack)) return true; } return false; } @@ -132,7 +132,7 @@ public ItemStack extractItem(int slot, int amount, boolean simulate) { this.amount -= stackAmount; onChange(); } - return ItemHandlerHelper.copyStackWithSize(bigStack.getResult(), amount); + return bigStack.getResult().copyWithCount(amount); } @@ -165,20 +165,20 @@ private boolean isValid(int slot, @Nonnull ItemStack stack){ if (slot < this.slots) { CompactingUtil.Result bigStack = this.resultList.get(slot); ItemStack fl = bigStack.getResult(); - return !fl.isEmpty() && ItemStack.isSameItemSameTags(fl, stack); + return !fl.isEmpty() && ItemStack.isSameItemSameComponents(fl, stack); } return false; } @Override - public CompoundTag serializeNBT() { + public CompoundTag serializeNBT(net.minecraft.core.HolderLookup.Provider provider) { CompoundTag compoundTag = new CompoundTag(); - compoundTag.put(PARENT, this.getParent().serializeNBT()); + compoundTag.put(PARENT, this.getParent().saveOptional(provider)); compoundTag.putInt(AMOUNT, this.amount); CompoundTag items = new CompoundTag(); for (int i = 0; i < this.resultList.size(); i++) { CompoundTag bigStack = new CompoundTag(); - bigStack.put(STACK, this.resultList.get(i).getResult().serializeNBT()); + bigStack.put(STACK, this.resultList.get(i).getResult().saveOptional(provider)); bigStack.putInt(AMOUNT, this.resultList.get(i).getNeeded()); items.put(i + "", bigStack); } @@ -187,11 +187,11 @@ public CompoundTag serializeNBT() { } @Override - public void deserializeNBT(CompoundTag nbt) { - this.parent = ItemStack.of(nbt.getCompound(PARENT)); + public void deserializeNBT(net.minecraft.core.HolderLookup.Provider provider, CompoundTag nbt) { + this.parent = Utils.deserialize(provider, nbt.getCompound(PARENT)); this.amount = nbt.getInt(AMOUNT); for (String allKey : nbt.getCompound(BIG_ITEMS).getAllKeys()) { - this.resultList.get(Integer.parseInt(allKey)).setResult(ItemStack.of(nbt.getCompound(BIG_ITEMS).getCompound(allKey).getCompound(STACK))); + this.resultList.get(Integer.parseInt(allKey)).setResult(Utils.deserialize(provider, nbt.getCompound(BIG_ITEMS).getCompound(allKey).getCompound(STACK))); this.resultList.get(Integer.parseInt(allKey)).setNeeded(Math.max(1, nbt.getCompound(BIG_ITEMS).getCompound(allKey).getInt(AMOUNT))); } } diff --git a/src/main/java/com/buuz135/functionalstorage/inventory/ControllerInventoryHandler.java b/src/main/java/com/buuz135/functionalstorage/inventory/ControllerInventoryHandler.java index b67a83bf..b0e0a8ca 100644 --- a/src/main/java/com/buuz135/functionalstorage/inventory/ControllerInventoryHandler.java +++ b/src/main/java/com/buuz135/functionalstorage/inventory/ControllerInventoryHandler.java @@ -3,7 +3,7 @@ import com.buuz135.functionalstorage.block.tile.DrawerControllerTile; import com.buuz135.functionalstorage.util.ConnectedDrawers; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.items.IItemHandler; +import net.neoforged.neoforge.items.IItemHandler; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; diff --git a/src/main/java/com/buuz135/functionalstorage/inventory/EnderInventoryHandler.java b/src/main/java/com/buuz135/functionalstorage/inventory/EnderInventoryHandler.java index 5f78ec19..473abdf3 100644 --- a/src/main/java/com/buuz135/functionalstorage/inventory/EnderInventoryHandler.java +++ b/src/main/java/com/buuz135/functionalstorage/inventory/EnderInventoryHandler.java @@ -21,16 +21,16 @@ public EnderInventoryHandler(String frequency, EnderSavedData manager) { } @Override - public CompoundTag serializeNBT() { - CompoundTag compoundTag = super.serializeNBT(); + public CompoundTag serializeNBT(net.minecraft.core.HolderLookup.Provider provider) { + CompoundTag compoundTag = super.serializeNBT(provider); compoundTag.putBoolean(NBT_LOCKED, this.locked); compoundTag.putBoolean(NBT_VOID, this.voidItems); return compoundTag; } @Override - public void deserializeNBT(CompoundTag nbt) { - super.deserializeNBT(nbt); + public void deserializeNBT(net.minecraft.core.HolderLookup.Provider provider, CompoundTag nbt) { + super.deserializeNBT(provider, nbt); this.locked = nbt.getBoolean(NBT_LOCKED); this.voidItems = nbt.getBoolean(NBT_VOID); } diff --git a/src/main/java/com/buuz135/functionalstorage/inventory/item/CompactingDrawerCapabilityProvider.java b/src/main/java/com/buuz135/functionalstorage/inventory/item/CompactingDrawerCapabilityProvider.java deleted file mode 100644 index ccbd7c13..00000000 --- a/src/main/java/com/buuz135/functionalstorage/inventory/item/CompactingDrawerCapabilityProvider.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.buuz135.functionalstorage.inventory.item; - -import net.minecraft.core.Direction; -import net.minecraft.world.item.ItemStack; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.items.IItemHandler; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class CompactingDrawerCapabilityProvider implements ICapabilityProvider { - - private final ItemStack stack; - private final CompactingStackItemHandler drawerStackItemHandler; - private final LazyOptional itemHandler; - - public CompactingDrawerCapabilityProvider(ItemStack stack, int slots) { - this.stack = stack; - this.drawerStackItemHandler = new CompactingStackItemHandler(stack, slots); - this.itemHandler = LazyOptional.of(() -> this.drawerStackItemHandler); - } - - @NotNull - @Override - public LazyOptional getCapability(@NotNull Capability cap, @Nullable Direction side) { - if (cap.equals(ForgeCapabilities.ITEM_HANDLER)) return this.itemHandler.cast(); - return LazyOptional.empty(); - } - - @NotNull - @Override - public LazyOptional getCapability(@NotNull Capability cap) { - if (cap.equals(ForgeCapabilities.ITEM_HANDLER)) return this.itemHandler.cast(); - return LazyOptional.empty(); - } -} diff --git a/src/main/java/com/buuz135/functionalstorage/inventory/item/CompactingStackItemHandler.java b/src/main/java/com/buuz135/functionalstorage/inventory/item/CompactingStackItemHandler.java index 43a2b7ae..0cf394b2 100644 --- a/src/main/java/com/buuz135/functionalstorage/inventory/item/CompactingStackItemHandler.java +++ b/src/main/java/com/buuz135/functionalstorage/inventory/item/CompactingStackItemHandler.java @@ -1,15 +1,16 @@ package com.buuz135.functionalstorage.inventory.item; import com.buuz135.functionalstorage.FunctionalStorage; +import com.buuz135.functionalstorage.item.FSAttachments; import com.buuz135.functionalstorage.item.StorageUpgradeItem; import com.buuz135.functionalstorage.util.CompactingUtil; +import com.buuz135.functionalstorage.util.Utils; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.Tag; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.common.util.INBTSerializable; -import net.minecraftforge.items.IItemHandler; -import net.minecraftforge.items.ItemHandlerHelper; - +import net.neoforged.neoforge.common.util.INBTSerializable; +import net.neoforged.neoforge.items.IItemHandler; +import net.neoforged.neoforge.items.ItemHandlerHelper; import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; @@ -49,10 +50,11 @@ public CompactingStackItemHandler(ItemStack stack, int slots) { this.downgrade = false; this.isVoid = false; this.isCreative = false; - if (stack.hasTag()) { - deserializeNBT(stack.getTag().getCompound("Tile").getCompound("handler")); - for (Tag tag : stack.getOrCreateTag().getCompound("Tile").getCompound("storageUpgrades").getList("Items", Tag.TAG_COMPOUND)) { - ItemStack itemStack = ItemStack.of((CompoundTag) tag); + if (stack.has(FSAttachments.TILE)) { + var tile = stack.get(FSAttachments.TILE); + deserializeNBT(Utils.registryAccess(), tile.getCompound("handler")); + for (Tag tag : tile.getCompound("storageUpgrades").getList("Items", Tag.TAG_COMPOUND)) { + ItemStack itemStack = Utils.deserialize(Utils.registryAccess(), (CompoundTag) tag); if (itemStack.getItem() instanceof StorageUpgradeItem) { if (multiplier == 1) multiplier = ((StorageUpgradeItem) itemStack.getItem()).getStorageMultiplier(); else multiplier *= ((StorageUpgradeItem) itemStack.getItem()).getStorageMultiplier(); @@ -64,8 +66,8 @@ public CompactingStackItemHandler(ItemStack stack, int slots) { this.isCreative = true; } } - for (Tag tag : stack.getOrCreateTag().getCompound("Tile").getCompound("utilityUpgrades").getList("Items", Tag.TAG_COMPOUND)) { - ItemStack itemStack = ItemStack.of((CompoundTag) tag); + for (Tag tag : tile.getCompound("utilityUpgrades").getList("Items", Tag.TAG_COMPOUND)) { + ItemStack itemStack = Utils.deserialize(Utils.registryAccess(), (CompoundTag) tag); if (itemStack.getItem().equals(FunctionalStorage.VOID_UPGRADE.get())) { this.isVoid = true; } @@ -103,14 +105,14 @@ public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate onChange(); } if (inserted == stack.getCount() * result.getNeeded() || isVoid()) return ItemStack.EMPTY; - return ItemHandlerHelper.copyStackWithSize(stack, stack.getCount() - inserted / result.getNeeded()); + return stack.copyWithCount(stack.getCount() - inserted / result.getNeeded()); } return stack; } private boolean isVoidValid(ItemStack stack) { for (CompactingUtil.Result result : this.resultList) { - if (ItemStack.isSameItemSameTags(result.getResult(), stack)) return true; + if (ItemStack.isSameItemSameComponents(result.getResult(), stack)) return true; } return false; } @@ -162,7 +164,7 @@ public ItemStack extractItem(int slot, int amount, boolean simulate) { this.amount -= stackAmount; onChange(); } - return ItemHandlerHelper.copyStackWithSize(bigStack.getResult(), amount); + return bigStack.getResult().copyWithCount(amount); } @@ -195,20 +197,20 @@ private boolean isValid(int slot, @Nonnull ItemStack stack) { if (slot < this.slots) { CompactingUtil.Result bigStack = this.resultList.get(slot); ItemStack fl = bigStack.getResult(); - return !fl.isEmpty() && ItemStack.isSameItemSameTags(fl, stack); + return !fl.isEmpty() && ItemStack.isSameItemSameComponents(fl, stack); } return false; } @Override - public CompoundTag serializeNBT() { + public CompoundTag serializeNBT(net.minecraft.core.HolderLookup.Provider provider) { CompoundTag compoundTag = new CompoundTag(); - compoundTag.put(PARENT, this.getParent().serializeNBT()); + compoundTag.put(PARENT, this.getParent().saveOptional(provider)); compoundTag.putInt(AMOUNT, this.amount); CompoundTag items = new CompoundTag(); for (int i = 0; i < this.resultList.size(); i++) { CompoundTag bigStack = new CompoundTag(); - bigStack.put(STACK, this.resultList.get(i).getResult().serializeNBT()); + bigStack.put(STACK, this.resultList.get(i).getResult().saveOptional(provider)); bigStack.putInt(AMOUNT, this.resultList.get(i).getNeeded()); items.put(i + "", bigStack); } @@ -217,19 +219,18 @@ public CompoundTag serializeNBT() { } @Override - public void deserializeNBT(CompoundTag nbt) { - this.parent = ItemStack.of(nbt.getCompound(PARENT)); + public void deserializeNBT(net.minecraft.core.HolderLookup.Provider provider, CompoundTag nbt) { + this.parent = Utils.deserialize(provider, nbt.getCompound(PARENT)); this.amount = nbt.getInt(AMOUNT); for (String allKey : nbt.getCompound(BIG_ITEMS).getAllKeys()) { - this.resultList.get(Integer.parseInt(allKey)).setResult(ItemStack.of(nbt.getCompound(BIG_ITEMS).getCompound(allKey).getCompound(STACK))); + this.resultList.get(Integer.parseInt(allKey)).setResult(Utils.deserialize(provider, nbt.getCompound(BIG_ITEMS).getCompound(allKey).getCompound(STACK))); this.resultList.get(Integer.parseInt(allKey)).setNeeded(Math.max(1, nbt.getCompound(BIG_ITEMS).getCompound(allKey).getInt(AMOUNT))); } } public void onChange() { - if (stack.getOrCreateTag().contains("Tile")) - stack.getOrCreateTag().put("Tile", new CompoundTag()); - stack.getOrCreateTag().getCompound("Tile").put("handler", serializeNBT()); + stack.set(FSAttachments.TILE, new CompoundTag()); + stack.get(FSAttachments.TILE).put("handler", serializeNBT(Utils.registryAccess())); } public int getMultiplier() { diff --git a/src/main/java/com/buuz135/functionalstorage/inventory/item/DrawerCapabilityProvider.java b/src/main/java/com/buuz135/functionalstorage/inventory/item/DrawerCapabilityProvider.java deleted file mode 100644 index 43e8a93c..00000000 --- a/src/main/java/com/buuz135/functionalstorage/inventory/item/DrawerCapabilityProvider.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.buuz135.functionalstorage.inventory.item; - -import com.buuz135.functionalstorage.FunctionalStorage; -import net.minecraft.core.Direction; -import net.minecraft.world.item.ItemStack; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.items.IItemHandler; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class DrawerCapabilityProvider implements ICapabilityProvider { - - private final ItemStack stack; - private final DrawerStackItemHandler drawerStackItemHandler; - private final LazyOptional itemHandler; - - public DrawerCapabilityProvider(ItemStack stack, FunctionalStorage.DrawerType type) { - this.stack = stack; - this.drawerStackItemHandler = new DrawerStackItemHandler(stack, type); - this.itemHandler = LazyOptional.of(() -> this.drawerStackItemHandler); - } - - @NotNull - @Override - public LazyOptional getCapability(@NotNull Capability cap, @Nullable Direction side) { - if (cap.equals(ForgeCapabilities.ITEM_HANDLER)) return this.itemHandler.cast(); - return LazyOptional.empty(); - } - - @NotNull - @Override - public LazyOptional getCapability(@NotNull Capability cap) { - if (cap.equals(ForgeCapabilities.ITEM_HANDLER)) return this.itemHandler.cast(); - return LazyOptional.empty(); - } -} diff --git a/src/main/java/com/buuz135/functionalstorage/inventory/item/DrawerStackItemHandler.java b/src/main/java/com/buuz135/functionalstorage/inventory/item/DrawerStackItemHandler.java index d8cc21ad..06df3fe9 100644 --- a/src/main/java/com/buuz135/functionalstorage/inventory/item/DrawerStackItemHandler.java +++ b/src/main/java/com/buuz135/functionalstorage/inventory/item/DrawerStackItemHandler.java @@ -2,19 +2,23 @@ import com.buuz135.functionalstorage.FunctionalStorage; import com.buuz135.functionalstorage.inventory.BigInventoryHandler; +import com.buuz135.functionalstorage.inventory.BigInventoryHandler.BigStack; +import com.buuz135.functionalstorage.item.FSAttachments; import com.buuz135.functionalstorage.item.StorageUpgradeItem; +import com.buuz135.functionalstorage.util.Utils; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.Tag; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.common.util.INBTSerializable; -import net.minecraftforge.items.IItemHandler; -import net.minecraftforge.items.ItemHandlerHelper; +import net.neoforged.neoforge.common.util.INBTSerializable; +import net.neoforged.neoforge.items.IItemHandler; import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; -import static com.buuz135.functionalstorage.inventory.BigInventoryHandler.*; +import static com.buuz135.functionalstorage.inventory.BigInventoryHandler.AMOUNT; +import static com.buuz135.functionalstorage.inventory.BigInventoryHandler.BIG_ITEMS; +import static com.buuz135.functionalstorage.inventory.BigInventoryHandler.STACK; public class DrawerStackItemHandler implements IItemHandler, INBTSerializable { @@ -35,10 +39,12 @@ public DrawerStackItemHandler(ItemStack stack, FunctionalStorage.DrawerType draw for (int i = 0; i < drawerType.getSlots(); i++) { this.storedStacks.add(i, new BigInventoryHandler.BigStack(ItemStack.EMPTY, 0)); } - if (stack.hasTag()) { - deserializeNBT(stack.getTag().getCompound("Tile").getCompound("handler")); - for (Tag tag : stack.getOrCreateTag().getCompound("Tile").getCompound("storageUpgrades").getList("Items", Tag.TAG_COMPOUND)) { - ItemStack itemStack = ItemStack.of((CompoundTag) tag); + if (stack.has(FSAttachments.TILE)) { + var tile = stack.get(FSAttachments.TILE); + var access = Utils.registryAccess(); + deserializeNBT(access, tile.getCompound("handler")); + for (Tag tag : tile.getCompound("storageUpgrades").getList("Items", Tag.TAG_COMPOUND)) { + ItemStack itemStack = Utils.deserialize(access, (CompoundTag) tag); if (itemStack.getItem() instanceof StorageUpgradeItem) { if (multiplier == 1) multiplier = ((StorageUpgradeItem) itemStack.getItem()).getStorageMultiplier(); else multiplier *= ((StorageUpgradeItem) itemStack.getItem()).getStorageMultiplier(); @@ -47,8 +53,8 @@ public DrawerStackItemHandler(ItemStack stack, FunctionalStorage.DrawerType draw this.downgrade = true; } } - for (Tag tag : stack.getOrCreateTag().getCompound("Tile").getCompound("utilityUpgrades").getList("Items", Tag.TAG_COMPOUND)) { - ItemStack itemStack = ItemStack.of((CompoundTag) tag); + for (Tag tag : tile.getCompound("utilityUpgrades").getList("Items", Tag.TAG_COMPOUND)) { + ItemStack itemStack = Utils.deserialize(access, (CompoundTag) tag); if (itemStack.getItem().equals(FunctionalStorage.VOID_UPGRADE.get())) { this.isVoid = true; } @@ -57,12 +63,12 @@ public DrawerStackItemHandler(ItemStack stack, FunctionalStorage.DrawerType draw } @Override - public CompoundTag serializeNBT() { + public CompoundTag serializeNBT(net.minecraft.core.HolderLookup.Provider provider) { CompoundTag compoundTag = new CompoundTag(); CompoundTag items = new CompoundTag(); for (int i = 0; i < this.storedStacks.size(); i++) { CompoundTag bigStack = new CompoundTag(); - bigStack.put(STACK, this.storedStacks.get(i).getStack().serializeNBT()); + bigStack.put(STACK, this.storedStacks.get(i).getStack().saveOptional(provider)); bigStack.putInt(AMOUNT, this.storedStacks.get(i).getAmount()); items.put(i + "", bigStack); } @@ -71,9 +77,9 @@ public CompoundTag serializeNBT() { } @Override - public void deserializeNBT(CompoundTag nbt) { + public void deserializeNBT(net.minecraft.core.HolderLookup.Provider provider, CompoundTag nbt) { for (String allKey : nbt.getCompound(BIG_ITEMS).getAllKeys()) { - this.storedStacks.get(Integer.parseInt(allKey)).setStack(ItemStack.of(nbt.getCompound(BIG_ITEMS).getCompound(allKey).getCompound(STACK))); + this.storedStacks.get(Integer.parseInt(allKey)).setStack(Utils.deserialize(provider, nbt.getCompound(BIG_ITEMS).getCompound(allKey).getCompound(STACK))); this.storedStacks.get(Integer.parseInt(allKey)).setAmount(nbt.getCompound(BIG_ITEMS).getCompound(allKey).getInt(AMOUNT)); } } @@ -104,7 +110,7 @@ public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate onChange(); } if (inserted == stack.getCount() || isVoid()) return ItemStack.EMPTY; - return ItemHandlerHelper.copyStackWithSize(stack, stack.getCount() - inserted); + return stack.copyWithCount(stack.getCount() - inserted); } return stack; } @@ -114,16 +120,15 @@ private boolean isVoid() { } private void onChange() { - if (stack.getOrCreateTag().contains("Tile")) - stack.getOrCreateTag().put("Tile", new CompoundTag()); - stack.getOrCreateTag().getCompound("Tile").put("handler", serializeNBT()); + stack.set(FSAttachments.TILE, new CompoundTag()); + stack.get(FSAttachments.TILE).put("handler", serializeNBT(Utils.registryAccess())); } private boolean isValid(int slot, @Nonnull ItemStack stack) { if (slot < type.getSlots()) { BigStack bigStack = this.storedStacks.get(slot); ItemStack fl = bigStack.getStack(); - return fl.isEmpty() || ItemStack.isSameItemSameTags(fl, stack); + return fl.isEmpty() || ItemStack.isSameItemSameComponents(fl, stack); } return false; } @@ -150,7 +155,7 @@ public ItemStack extractItem(int slot, int amount, boolean simulate) { bigStack.setAmount(bigStack.getAmount() - amount); onChange(); } - return ItemHandlerHelper.copyStackWithSize(bigStack.getStack(), amount); + return bigStack.getStack().copyWithCount(amount); } } return ItemStack.EMPTY; diff --git a/src/main/java/com/buuz135/functionalstorage/item/ConfigurationToolItem.java b/src/main/java/com/buuz135/functionalstorage/item/ConfigurationToolItem.java index 0a011bcd..690c50fc 100644 --- a/src/main/java/com/buuz135/functionalstorage/item/ConfigurationToolItem.java +++ b/src/main/java/com/buuz135/functionalstorage/item/ConfigurationToolItem.java @@ -3,38 +3,33 @@ import com.buuz135.functionalstorage.FunctionalStorage; import com.buuz135.functionalstorage.block.tile.ControllableDrawerTile; import com.hrznstudio.titanium.item.BasicItem; +import com.mojang.serialization.Codec; import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; -import net.minecraft.core.NonNullList; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Style; import net.minecraft.network.chat.TextColor; import net.minecraft.sounds.SoundEvents; +import net.minecraft.util.StringRepresentable; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; import org.jetbrains.annotations.Nullable; -import java.awt.*; +import java.awt.Color; import java.util.Arrays; import java.util.List; import java.util.Locale; public class ConfigurationToolItem extends BasicItem { - public static final String NBT_MODE = "Mode"; - public static ConfigurationAction getAction(ItemStack stack) { - if (stack.hasTag()) { - return ConfigurationAction.valueOf(stack.getOrCreateTag().getString(NBT_MODE)); - } - return ConfigurationAction.LOCKING; + return stack.getOrDefault(FSAttachments.CONFIGURATION_ACTION, ConfigurationAction.LOCKING); } public ConfigurationToolItem() { @@ -42,17 +37,6 @@ public ConfigurationToolItem() { setItemGroup(FunctionalStorage.TAB); } - @Override - public void onCraftedBy(ItemStack p_41447_, Level p_41448_, Player p_41449_) { - super.onCraftedBy(p_41447_, p_41448_, p_41449_); - initNbt(p_41447_); - } - - private ItemStack initNbt(ItemStack stack) { - stack.getOrCreateTag().putString(NBT_MODE, ConfigurationAction.LOCKING.name()); - return stack; - } - @Override public InteractionResult useOn(UseOnContext context) { BlockPos pos = context.getClickedPos(); @@ -82,7 +66,7 @@ public InteractionResultHolder use(Level p_41432_, Player player, Int if (player.isShiftKeyDown()) { ConfigurationAction action = getAction(stack); ConfigurationAction newAction = ConfigurationAction.values()[(Arrays.asList(ConfigurationAction.values()).indexOf(action) + 1) % ConfigurationAction.values().length]; - stack.getOrCreateTag().putString(NBT_MODE, newAction.name()); + stack.set(FSAttachments.CONFIGURATION_ACTION, newAction); player.displayClientMessage(Component.literal("Swapped mode to ").setStyle(Style.EMPTY.withColor(newAction.getColor())) .append(Component.translatable("configurationtool.configmode." + newAction.name().toLowerCase(Locale.ROOT))), true); player.playSound(SoundEvents.ITEM_FRAME_REMOVE_ITEM, 0.5f, 1); @@ -109,7 +93,7 @@ public boolean hasTooltipDetails(@Nullable BasicItem.Key key) { return key == null; } - public enum ConfigurationAction { + public enum ConfigurationAction implements StringRepresentable { LOCKING(TextColor.fromRgb(new Color(40, 131, 250).getRGB()), 1), TOGGLE_NUMBERS(TextColor.fromRgb(new Color(250, 145, 40).getRGB()), 1), TOGGLE_RENDER(TextColor.fromRgb(new Color(100, 250, 40).getRGB()), 1), @@ -117,6 +101,7 @@ public enum ConfigurationAction { INDICATOR(TextColor.fromRgb(new Color(255, 40, 40).getRGB()), 3); //0 NO , 1 - PROGRESS, 2 - ONLY FULL, 3 - ONLY FULL WITHOUT BG + public static final Codec CODEC = StringRepresentable.fromValues(ConfigurationAction::values); private final TextColor color; private final int max; @@ -132,5 +117,10 @@ public TextColor getColor() { public int getMax() { return max; } + + @Override + public String getSerializedName() { + return name().toLowerCase(Locale.ROOT); + } } } diff --git a/src/main/java/com/buuz135/functionalstorage/item/FSAttachments.java b/src/main/java/com/buuz135/functionalstorage/item/FSAttachments.java new file mode 100644 index 00000000..5c5fe1c7 --- /dev/null +++ b/src/main/java/com/buuz135/functionalstorage/item/FSAttachments.java @@ -0,0 +1,67 @@ +package com.buuz135.functionalstorage.item; + +import com.buuz135.functionalstorage.FunctionalStorage; +import com.google.common.base.Suppliers; +import com.mojang.serialization.Codec; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.component.DataComponentType; +import net.minecraft.core.registries.Registries; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.util.Unit; +import net.minecraft.world.item.ItemStack; +import net.neoforged.neoforge.registries.DeferredRegister; + +import java.util.function.Supplier; +import java.util.function.UnaryOperator; + +public class FSAttachments { + public static final DeferredRegister> DR = DeferredRegister.create(Registries.DATA_COMPONENT_TYPE, FunctionalStorage.MOD_ID); + + public static final Supplier> CONFIGURATION_ACTION = + register("configuration_action", () -> ConfigurationToolItem.ConfigurationAction.LOCKING, builder -> builder.persistent(ConfigurationToolItem.ConfigurationAction.CODEC)); + + public static final Supplier> ACTION_MODE = + register("action_mode", () -> LinkingToolItem.ActionMode.ADD, builder -> builder.persistent(LinkingToolItem.ActionMode.CODEC)); + + public static final Supplier> LINKING_MODE = + register("linking_mode", () -> LinkingToolItem.LinkingMode.SINGLE, builder -> builder.persistent(LinkingToolItem.LinkingMode.CODEC)); + + public static final Supplier> FIRST_POSITION = + register("first_pos", () -> BlockPos.ZERO, builder -> builder.persistent(BlockPos.CODEC)); + public static final ComponentSupplier CONTROLLER = + register("controller_position", () -> BlockPos.ZERO, builder -> builder.persistent(BlockPos.CODEC)); + + public static final Supplier> ENDER_FREQUENCY = register("ender_frequency", () -> "", op -> op.persistent(Codec.STRING)); + public static final Supplier> ENDER_SAFETY = register("ender_safety", () -> Unit.INSTANCE, op -> op.persistent(Codec.unit(Unit.INSTANCE))); + public static final Supplier> DIRECTION = register("direction", () -> Direction.NORTH, op -> op.persistent(Direction.CODEC)); + public static final Supplier> SLOT = register("slot", () -> 0, op -> op.persistent(Codec.intRange(0, UpgradeItem.MAX_SLOT - 1))); + public static final Supplier> LOCKED = register("locked", () -> false, op -> op.persistent(Codec.BOOL)); + + public static final Supplier> TILE = register("tile", CompoundTag::new, op -> op.persistent(CompoundTag.CODEC)); + public static final Supplier> STYLE = register("style", CompoundTag::new, op -> op.persistent(CompoundTag.CODEC)); + + private static ComponentSupplier register(String name, Supplier defaultVal, UnaryOperator> op) { + var registered = DR.register(name, () -> op.apply(DataComponentType.builder()).build()); + return new ComponentSupplier<>(registered, defaultVal); + } + + public static class ComponentSupplier implements Supplier> { + private final Supplier> type; + private final Supplier defaultSupplier; + + public ComponentSupplier(Supplier> type, Supplier defaultSupplier) { + this.type = type; + this.defaultSupplier = Suppliers.memoize(defaultSupplier::get); + } + + public T get(ItemStack stack) { + return stack.getOrDefault(type, defaultSupplier.get()); + } + + @Override + public DataComponentType get() { + return type.get(); + } + } +} diff --git a/src/main/java/com/buuz135/functionalstorage/item/LinkingToolItem.java b/src/main/java/com/buuz135/functionalstorage/item/LinkingToolItem.java index 39fc6fcf..31a53383 100644 --- a/src/main/java/com/buuz135/functionalstorage/item/LinkingToolItem.java +++ b/src/main/java/com/buuz135/functionalstorage/item/LinkingToolItem.java @@ -1,69 +1,58 @@ package com.buuz135.functionalstorage.item; import com.buuz135.functionalstorage.FunctionalStorage; -import com.buuz135.functionalstorage.block.tile.*; +import com.buuz135.functionalstorage.block.tile.ControllableDrawerTile; +import com.buuz135.functionalstorage.block.tile.EnderDrawerTile; +import com.buuz135.functionalstorage.block.tile.StorageControllerTile; import com.buuz135.functionalstorage.inventory.EnderInventoryHandler; import com.buuz135.functionalstorage.world.EnderSavedData; import com.hrznstudio.titanium.event.handler.EventManager; import com.hrznstudio.titanium.item.BasicItem; +import com.mojang.serialization.Codec; import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; -import net.minecraft.core.NonNullList; -import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.Style; import net.minecraft.network.chat.TextColor; import net.minecraft.sounds.SoundEvents; +import net.minecraft.util.StringRepresentable; +import net.minecraft.util.Unit; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; -import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import net.minecraftforge.fml.LogicalSide; +import net.neoforged.fml.LogicalSide; +import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent; import org.jetbrains.annotations.Nullable; -import java.awt.*; +import java.awt.Color; import java.util.ArrayList; import java.util.List; import java.util.Locale; public class LinkingToolItem extends BasicItem { - public static final String NBT_MODE = "Mode"; - public static final String NBT_CONTROLLER = "Controller"; - public static final String NBT_ACTION = "Action"; - public static final String NBT_FIRST = "First"; - public static final String NBT_ENDER = "Ender"; - public static final String NBT_ENDER_SAFETY = "EnderSafety"; - public static LinkingMode getLinkingMode(ItemStack stack) { - if (stack.hasTag() && stack.getTag().contains(NBT_MODE)) { - return LinkingMode.valueOf(stack.getOrCreateTag().getString(NBT_MODE)); - } - return LinkingMode.SINGLE; + return stack.getOrDefault(FSAttachments.LINKING_MODE, LinkingMode.SINGLE); } public static ActionMode getActionMode(ItemStack stack) { - if (stack.hasTag() && stack.getTag().contains(NBT_ACTION)) { - return ActionMode.valueOf(stack.getOrCreateTag().getString(NBT_ACTION)); - } - return ActionMode.ADD; + return stack.getOrDefault(FSAttachments.ACTION_MODE, ActionMode.ADD); } static { EventManager.forge(PlayerInteractEvent.LeftClickBlock.class).filter(leftClickBlock -> leftClickBlock.getSide() == LogicalSide.SERVER && leftClickBlock.getItemStack().is(FunctionalStorage.LINKING_TOOL.get())).process(leftClickBlock -> { ItemStack stack = leftClickBlock.getItemStack(); BlockEntity blockEntity = leftClickBlock.getLevel().getBlockEntity(leftClickBlock.getPos()); - if (blockEntity instanceof EnderDrawerTile){ - stack.getOrCreateTag().putString(NBT_ENDER, ((EnderDrawerTile) blockEntity).getFrequency()); + if (blockEntity instanceof EnderDrawerTile tile) { + stack.set(FSAttachments.ENDER_FREQUENCY, tile.getFrequency()); leftClickBlock.getEntity().displayClientMessage(Component.literal("Stored frequency in the tool").setStyle(Style.EMPTY.withColor(LinkingMode.SINGLE.color)), true); leftClickBlock.setCanceled(true); } @@ -75,29 +64,17 @@ public LinkingToolItem() { setItemGroup(FunctionalStorage.TAB); } - @Override - public void onCraftedBy(ItemStack p_41447_, Level p_41448_, Player p_41449_) { - super.onCraftedBy(p_41447_, p_41448_, p_41449_); - initNbt(p_41447_); - } - - private ItemStack initNbt(ItemStack stack) { - stack.getOrCreateTag().putString(NBT_MODE, LinkingMode.SINGLE.name()); - stack.getOrCreateTag().putString(NBT_ACTION, ActionMode.ADD.name()); - return stack; - } - @Override public boolean isFoil(ItemStack stack) { - return stack.getOrCreateTag().contains(NBT_ENDER); + return stack.has(FSAttachments.ENDER_FREQUENCY); } @Override public boolean canAttackBlock(BlockState state, Level level, BlockPos pos, Player player) { ItemStack stack = player.getItemInHand(InteractionHand.MAIN_HAND); BlockEntity blockEntity = level.getBlockEntity(pos); - if (blockEntity instanceof EnderDrawerTile){ - stack.getOrCreateTag().putString(NBT_ENDER, ((EnderDrawerTile) blockEntity).getFrequency()); + if (blockEntity instanceof EnderDrawerTile tile) { + stack.set(FSAttachments.ENDER_FREQUENCY, tile.getFrequency()); player.displayClientMessage(Component.literal("Stored frequency in the tool").setStyle(Style.EMPTY.withColor(LinkingMode.SINGLE.color)), true); return false; } @@ -113,33 +90,28 @@ public InteractionResult useOn(UseOnContext context) { LinkingMode linkingMode = getLinkingMode(stack); ActionMode linkingAction = getActionMode(stack); if (blockEntity instanceof EnderDrawerTile){ - if (stack.getOrCreateTag().contains(NBT_ENDER)){ - String frequency = stack.getOrCreateTag().getString(NBT_ENDER); + if (stack.has(FSAttachments.ENDER_FREQUENCY)){ + String frequency = stack.get(FSAttachments.ENDER_FREQUENCY); EnderInventoryHandler inventory = EnderSavedData.getInstance(context.getLevel()).getFrequency(((EnderDrawerTile) blockEntity).getFrequency()); - if (inventory.getStackInSlot(0).isEmpty() || (context.getPlayer().isShiftKeyDown() && stack.getOrCreateTag().contains(NBT_ENDER))){ + if (inventory.getStackInSlot(0).isEmpty() || (context.getPlayer().isShiftKeyDown() && stack.has(FSAttachments.ENDER_SAFETY))) { ((EnderDrawerTile) blockEntity).setFrequency(frequency); context.getPlayer().displayClientMessage(Component.literal("Changed drawer frequency").setStyle(Style.EMPTY.withColor(linkingMode.color)), true); - stack.getOrCreateTag().remove(NBT_ENDER_SAFETY); + stack.remove(FSAttachments.ENDER_SAFETY); } else { context.getPlayer().displayClientMessage(Component.literal("Cannot change frequency, there are items in the drawer. Sneak + Right Click again to ignore this safety").withStyle(ChatFormatting.RED), true); - stack.getOrCreateTag().putBoolean(NBT_ENDER_SAFETY, true); + stack.set(FSAttachments.ENDER_SAFETY, Unit.INSTANCE); } return InteractionResult.SUCCESS; } } if (blockEntity instanceof StorageControllerTile) { - CompoundTag controller = new CompoundTag(); - controller.putInt("X", pos.getX()); - controller.putInt("Y", pos.getY()); - controller.putInt("Z", pos.getZ()); - stack.getOrCreateTag().put(NBT_CONTROLLER, controller); + stack.set(FSAttachments.CONTROLLER, pos); context.getPlayer().playSound(SoundEvents.ITEM_FRAME_ADD_ITEM, 0.5f, 1); context.getPlayer().displayClientMessage(Component.literal("Controller configured to the tool").withStyle(ChatFormatting.GREEN), true); - stack.getOrCreateTag().remove(NBT_ENDER); + stack.remove(FSAttachments.ENDER_FREQUENCY); return InteractionResult.SUCCESS; - } else if (blockEntity instanceof ControllableDrawerTile && stack.getOrCreateTag().contains(NBT_CONTROLLER)) { - CompoundTag controllerNBT = stack.getOrCreateTag().getCompound(NBT_CONTROLLER); - BlockEntity controller = level.getBlockEntity(new BlockPos(controllerNBT.getInt("X"), controllerNBT.getInt("Y"), controllerNBT.getInt("Z"))); + } else if (blockEntity instanceof ControllableDrawerTile && stack.has(FSAttachments.CONTROLLER)) { + BlockEntity controller = level.getBlockEntity(stack.get(FSAttachments.CONTROLLER)); if (controller instanceof StorageControllerTile) { if (linkingMode == LinkingMode.SINGLE) { if (((StorageControllerTile) controller).addConnectedDrawers(linkingAction, pos)){ @@ -150,9 +122,8 @@ public InteractionResult useOn(UseOnContext context) { } } } else { - if (stack.getOrCreateTag().contains(NBT_FIRST)) { - CompoundTag firstpos = stack.getOrCreateTag().getCompound(NBT_FIRST); - BlockPos firstPos = new BlockPos(firstpos.getInt("X"), firstpos.getInt("Y"), firstpos.getInt("Z")); + if (stack.has(FSAttachments.FIRST_POSITION)) { + BlockPos firstPos = stack.get(FSAttachments.FIRST_POSITION); AABB aabb = new AABB(Math.min(firstPos.getX(), pos.getX()), Math.min(firstPos.getY(), pos.getY()), Math.min(firstPos.getZ(), pos.getZ()), Math.max(firstPos.getX(), pos.getX()) + 1, Math.max(firstPos.getY(), pos.getY()) + 1, Math.max(firstPos.getZ(), pos.getZ()) + 1); if (((StorageControllerTile) controller).addConnectedDrawers(linkingAction, getBlockPosInAABB(aabb).toArray(BlockPos[]::new))){ if (linkingAction == ActionMode.ADD){ @@ -161,13 +132,9 @@ public InteractionResult useOn(UseOnContext context) { context.getPlayer().displayClientMessage(Component.literal("Removed drawers from the controller").setStyle(Style.EMPTY.withColor(linkingMode.color)), true); } } - stack.getOrCreateTag().remove(NBT_FIRST); + stack.remove(FSAttachments.FIRST_POSITION); } else { - CompoundTag firstPos = new CompoundTag(); - firstPos.putInt("X", pos.getX()); - firstPos.putInt("Y", pos.getY()); - firstPos.putInt("Z", pos.getZ()); - stack.getOrCreateTag().put(NBT_FIRST, firstPos); + stack.set(FSAttachments.FIRST_POSITION, pos); } } context.getPlayer().playSound(SoundEvents.ITEM_FRAME_ROTATE_ITEM, 0.5f, 1); @@ -181,31 +148,23 @@ public InteractionResult useOn(UseOnContext context) { public InteractionResultHolder use(Level p_41432_, Player player, InteractionHand hand) { ItemStack stack = player.getItemInHand(hand); if (!stack.isEmpty()) { - if (stack.getOrCreateTag().contains(NBT_ENDER)){ - if (player.isShiftKeyDown()){ - stack.getOrCreateTag().remove(NBT_ENDER); + if (stack.has(FSAttachments.ENDER_FREQUENCY)) { + if (player.isShiftKeyDown()) { + stack.remove(FSAttachments.ENDER_FREQUENCY); player.displayClientMessage(Component.literal("Cleared drawer frequency").setStyle(Style.EMPTY.withColor(ActionMode.ADD.getColor())), true); } } else { if (player.isShiftKeyDown()) { LinkingMode linkingMode = getLinkingMode(stack); - if (linkingMode == LinkingMode.SINGLE) { - stack.getOrCreateTag().putString(NBT_MODE, LinkingMode.MULTIPLE.name()); - player.displayClientMessage(Component.literal("Swapped mode to " + LinkingMode.MULTIPLE.name().toLowerCase(Locale.ROOT)).setStyle(Style.EMPTY.withColor(LinkingMode.MULTIPLE.getColor())), true); - } else { - stack.getOrCreateTag().putString(NBT_MODE, LinkingMode.SINGLE.name()); - player.displayClientMessage(Component.literal("Swapped mode to " + LinkingMode.SINGLE.name().toLowerCase(Locale.ROOT)).setStyle(Style.EMPTY.withColor(LinkingMode.SINGLE.getColor())), true); - } - stack.getOrCreateTag().remove(NBT_FIRST); + LinkingMode newMode = linkingMode == LinkingMode.SINGLE ? LinkingMode.MULTIPLE : LinkingMode.SINGLE; + stack.set(FSAttachments.LINKING_MODE, newMode); + player.displayClientMessage(Component.literal("Swapped mode to " + newMode.name().toLowerCase(Locale.ROOT)).setStyle(Style.EMPTY.withColor(LinkingMode.MULTIPLE.getColor())), true); + stack.remove(FSAttachments.FIRST_POSITION); } else { ActionMode linkingMode = getActionMode(stack); - if (linkingMode == ActionMode.ADD) { - stack.getOrCreateTag().putString(NBT_ACTION, ActionMode.REMOVE.name()); - player.displayClientMessage(Component.literal("Swapped action to " + ActionMode.REMOVE.name().toLowerCase(Locale.ROOT)).setStyle(Style.EMPTY.withColor(ActionMode.REMOVE.getColor())), true); - } else { - stack.getOrCreateTag().putString(NBT_ACTION, ActionMode.ADD.name()); - player.displayClientMessage(Component.literal("Swapped action to " + ActionMode.ADD.name().toLowerCase(Locale.ROOT)).setStyle(Style.EMPTY.withColor(ActionMode.ADD.getColor())), true); - } + ActionMode newMode = linkingMode == ActionMode.ADD ? ActionMode.REMOVE : ActionMode.ADD; + stack.set(FSAttachments.ACTION_MODE, newMode); + player.displayClientMessage(Component.literal("Swapped action to " + newMode.name().toLowerCase(Locale.ROOT)).setStyle(Style.EMPTY.withColor(ActionMode.REMOVE.getColor())), true); } } player.playSound(SoundEvents.ITEM_FRAME_REMOVE_ITEM, 0.5f, 1); @@ -220,7 +179,7 @@ public void addTooltipDetails(@Nullable BasicItem.Key key, ItemStack stack, List LinkingMode linkingMode = getLinkingMode(stack); ActionMode linkingAction = getActionMode(stack); if (key == null) { - if (stack.getOrCreateTag().contains(NBT_ENDER)) { + if (stack.has(FSAttachments.ENDER_FREQUENCY)) { MutableComponent text = Component.translatable("linkingtool.ender.frequency"); //frequencyDisplay.forEach(item -> text.append(item.getName(new ItemStack(item)))); tooltip.add(text.withStyle(ChatFormatting.GRAY)); @@ -232,9 +191,10 @@ public void addTooltipDetails(@Nullable BasicItem.Key key, ItemStack stack, List .append(Component.translatable("linkingtool.linkingmode." + linkingMode.name().toLowerCase(Locale.ROOT)).withStyle(Style.EMPTY.withColor(linkingMode.getColor())))); tooltip.add(Component.translatable("linkingtool.linkingaction").withStyle(ChatFormatting.YELLOW) .append(Component.translatable("linkingtool.linkingaction." + linkingAction.name().toLowerCase(Locale.ROOT)).withStyle(Style.EMPTY.withColor(linkingAction.getColor())))); - if (stack.getOrCreateTag().contains(NBT_CONTROLLER)) { + if (stack.has(FSAttachments.CONTROLLER)) { + var pos = stack.get(FSAttachments.CONTROLLER); tooltip.add(Component.translatable("linkingtool.controller").withStyle(ChatFormatting.YELLOW) - .append(Component.literal(stack.getOrCreateTag().getCompound(NBT_CONTROLLER).getInt("X") + "" + ChatFormatting.WHITE + ", " + ChatFormatting.DARK_AQUA + stack.getOrCreateTag().getCompound(NBT_CONTROLLER).getInt("Y") + ChatFormatting.WHITE + ", " + ChatFormatting.DARK_AQUA + stack.getOrCreateTag().getCompound(NBT_CONTROLLER).getInt("Z")).withStyle(ChatFormatting.DARK_AQUA))); + .append(Component.literal(pos.getX() + "" + ChatFormatting.WHITE + ", " + ChatFormatting.DARK_AQUA + pos.getY() + ChatFormatting.WHITE + ", " + ChatFormatting.DARK_AQUA + pos.getZ()).withStyle(ChatFormatting.DARK_AQUA))); } else { tooltip.add(Component.translatable("linkingtool.controller").withStyle(ChatFormatting.YELLOW).append(Component.literal("???").withStyle(ChatFormatting.DARK_AQUA))); } @@ -262,10 +222,12 @@ public boolean hasTooltipDetails(@Nullable BasicItem.Key key) { return key == null; } - public enum LinkingMode { + public enum LinkingMode implements StringRepresentable { SINGLE(TextColor.fromRgb(Color.cyan.getRGB())), MULTIPLE(TextColor.fromRgb(Color.GREEN.getRGB())); + public static final Codec CODEC = StringRepresentable.fromValues(LinkingMode::values); + private final TextColor color; LinkingMode(TextColor color) { @@ -275,12 +237,19 @@ public enum LinkingMode { public TextColor getColor() { return color; } + + @Override + public String getSerializedName() { + return name().toLowerCase(Locale.ROOT); + } } - public enum ActionMode { + public enum ActionMode implements StringRepresentable { ADD(TextColor.fromRgb(new Color(40, 131, 250).getRGB())), REMOVE(TextColor.fromRgb(new Color(250, 145, 40).getRGB())); + public static final Codec CODEC = StringRepresentable.fromValues(ActionMode::values); + private final TextColor color; ActionMode(TextColor color) { @@ -290,5 +259,10 @@ public enum ActionMode { public TextColor getColor() { return color; } + + @Override + public String getSerializedName() { + return name().toLowerCase(Locale.ROOT); + } } } diff --git a/src/main/java/com/buuz135/functionalstorage/item/StorageUpgradeItem.java b/src/main/java/com/buuz135/functionalstorage/item/StorageUpgradeItem.java index 7f4ace77..e579f4dd 100644 --- a/src/main/java/com/buuz135/functionalstorage/item/StorageUpgradeItem.java +++ b/src/main/java/com/buuz135/functionalstorage/item/StorageUpgradeItem.java @@ -9,14 +9,14 @@ import net.minecraft.network.chat.Style; import net.minecraft.util.Mth; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; import org.jetbrains.annotations.Nullable; import java.text.DecimalFormat; import java.util.List; -public class StorageUpgradeItem extends UpgradeItem{ +public class StorageUpgradeItem extends UpgradeItem { private final StorageTier storageTier; diff --git a/src/main/java/com/buuz135/functionalstorage/item/UpgradeItem.java b/src/main/java/com/buuz135/functionalstorage/item/UpgradeItem.java index 4f14919d..becd8c94 100644 --- a/src/main/java/com/buuz135/functionalstorage/item/UpgradeItem.java +++ b/src/main/java/com/buuz135/functionalstorage/item/UpgradeItem.java @@ -1,17 +1,20 @@ package com.buuz135.functionalstorage.item; import com.buuz135.functionalstorage.FunctionalStorage; +import com.buuz135.functionalstorage.block.tile.ControllableDrawerTile; +import com.buuz135.functionalstorage.block.tile.FluidDrawerTile; +import com.hrznstudio.titanium.block.RotatableBlock; import com.hrznstudio.titanium.item.BasicItem; +import com.hrznstudio.titanium.util.FacingUtil; import net.minecraft.ChatFormatting; import net.minecraft.core.Direction; -import net.minecraft.core.NonNullList; import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; import net.minecraft.sounds.SoundEvents; import net.minecraft.world.entity.SlotAccess; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.ClickAction; import net.minecraft.world.inventory.Slot; -import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; @@ -24,14 +27,13 @@ public class UpgradeItem extends BasicItem { - public static int MAX_SLOT = 4; + public static final int MAX_SLOT = 4; public static Direction getDirection(ItemStack stack){ - if (stack.hasTag() && stack.getTag().contains("Direction")) { + if (stack.has(FSAttachments.DIRECTION)) { Item item = stack.getItem(); if (item.equals(FunctionalStorage.PULLING_UPGRADE.get()) || item.equals(FunctionalStorage.PUSHING_UPGRADE.get()) || item.equals(FunctionalStorage.COLLECTOR_UPGRADE.get())) { - var direction = Direction.byName(stack.getOrCreateTag().getString("Direction")); - return direction == null ? Direction.NORTH : direction; + return stack.get(FSAttachments.DIRECTION); } } return Direction.NORTH; @@ -54,10 +56,10 @@ public void onCraftedBy(ItemStack p_41447_, Level p_41448_, Player p_41449_) { private ItemStack initNbt(ItemStack stack){ Item item = stack.getItem(); if (item.equals(FunctionalStorage.PULLING_UPGRADE.get()) || item.equals(FunctionalStorage.PUSHING_UPGRADE.get()) || item.equals(FunctionalStorage.COLLECTOR_UPGRADE.get())){ - stack.getOrCreateTag().putString("Direction", Direction.values()[0].getName()); + stack.set(FSAttachments.DIRECTION, Direction.NORTH); } if (item.equals(FunctionalStorage.REDSTONE_UPGRADE.get())){ - stack.getOrCreateTag().putInt("Slot", 0); + stack.set(FSAttachments.SLOT, 0); } return stack; } @@ -74,14 +76,14 @@ public boolean overrideOtherStackedOnMe(ItemStack first, ItemStack second, Slot if (item.equals(FunctionalStorage.PULLING_UPGRADE.get()) || item.equals(FunctionalStorage.PUSHING_UPGRADE.get()) || item.equals(FunctionalStorage.COLLECTOR_UPGRADE.get())){ Direction direction = getDirection(first); Direction next = Direction.values()[(Arrays.asList(Direction.values()).indexOf(direction) + 1 ) % Direction.values().length]; - first.getOrCreateTag().putString("Direction", next.getName()); - p_150896_.playSound(SoundEvents.UI_BUTTON_CLICK.get(), 0.5f, 1); + first.set(FSAttachments.DIRECTION, next); + p_150896_.playSound(SoundEvents.UI_BUTTON_CLICK.value(), 0.5f, 1); return true; } if (item.equals(FunctionalStorage.REDSTONE_UPGRADE.get())){ - int slot = first.getOrCreateTag().getInt("Slot"); - first.getOrCreateTag().putInt("Slot", (slot + 1) % MAX_SLOT); - p_150896_.playSound(SoundEvents.UI_BUTTON_CLICK.get(), 0.5f, 1); + int slot = first.getOrDefault(FSAttachments.SLOT, 0); + first.set(FSAttachments.SLOT, (slot + 1) % MAX_SLOT); + p_150896_.playSound(SoundEvents.UI_BUTTON_CLICK.value(), 0.5f, 1); return true; } } @@ -93,19 +95,52 @@ public void addTooltipDetails(@Nullable BasicItem.Key key, ItemStack stack, List super.addTooltipDetails(key, stack, tooltip, advanced); tooltip.add(Component.translatable("upgrade.type").withStyle(ChatFormatting.YELLOW).append(Component.translatable("upgrade.type." + getType().name().toLowerCase(Locale.ROOT)).withStyle(ChatFormatting.WHITE))); Item item = stack.getItem(); - if (stack.hasTag()) { - if (item.equals(FunctionalStorage.PULLING_UPGRADE.get()) || item.equals(FunctionalStorage.PUSHING_UPGRADE.get()) || item.equals(FunctionalStorage.COLLECTOR_UPGRADE.get())) { - tooltip.add(Component.translatable("item.utility.direction").withStyle(ChatFormatting.YELLOW).append(Component.translatable(WordUtils.capitalize(getDirection(stack).getName().toLowerCase(Locale.ROOT))).withStyle(ChatFormatting.WHITE))); - tooltip.add(Component.literal("")); - tooltip.add(Component.translatable("item.utility.direction.desc").withStyle(ChatFormatting.GRAY)); - } - if (item.equals(FunctionalStorage.REDSTONE_UPGRADE.get())) { - tooltip.add(Component.translatable("item.utility.slot").withStyle(ChatFormatting.YELLOW).append(Component.literal(stack.getOrCreateTag().getInt("Slot") + "").withStyle(ChatFormatting.WHITE))); - tooltip.add(Component.literal("")); - tooltip.add(Component.translatable("item.utility.direction.desc").withStyle(ChatFormatting.GRAY)); - } + if (isDirectionUpgrade(item) && stack.has(FSAttachments.DIRECTION)) { + tooltip.add(Component.translatable("item.utility.direction").withStyle(ChatFormatting.YELLOW).append(Component.translatable(WordUtils.capitalize(getDirection(stack).getName().toLowerCase(Locale.ROOT))).withStyle(ChatFormatting.WHITE))); + tooltip.add(Component.literal("")); + tooltip.add(Component.translatable("item.utility.direction.desc").withStyle(ChatFormatting.GRAY)); } + if (item.equals(FunctionalStorage.REDSTONE_UPGRADE.get()) && stack.has(FSAttachments.SLOT)) { + tooltip.add(Component.translatable("item.utility.slot").withStyle(ChatFormatting.YELLOW).append(Component.literal(stack.get(FSAttachments.SLOT).toString()).withStyle(ChatFormatting.WHITE))); + tooltip.add(Component.literal("")); + tooltip.add(Component.translatable("item.utility.direction.desc").withStyle(ChatFormatting.GRAY)); + } + + } + + public static boolean isDirectionUpgrade(Item item) { + return (item.equals(FunctionalStorage.PULLING_UPGRADE.get()) || item.equals(FunctionalStorage.PUSHING_UPGRADE.get()) || item.equals(FunctionalStorage.COLLECTOR_UPGRADE.get())); + } + + @Nullable + public Component getDescription(ItemStack stack, ControllableDrawerTile tile) { + var dir = tile.getBlockState().getValue(RotatableBlock.FACING_HORIZONTAL); + var type = tile instanceof FluidDrawerTile ? "fluid" : "item"; + if (this == FunctionalStorage.PUSHING_UPGRADE.get()) { + return Component.translatable("drawer_upgrade.functionalstorage.push." + type, getRelativeDirection( + getDirection(stack), dir + ).withStyle(ChatFormatting.GOLD)); + } else if (this == FunctionalStorage.PULLING_UPGRADE.get()) { + return Component.translatable("drawer_upgrade.functionalstorage.pull." + type, getRelativeDirection( + getDirection(stack), dir + ).withStyle(ChatFormatting.GOLD)); + } else if (this == FunctionalStorage.COLLECTOR_UPGRADE.get()) { + return Component.translatable("drawer_upgrade.functionalstorage.collect." + type, getRelativeDirection( + getDirection(stack), dir + ).withStyle(ChatFormatting.GOLD)); + } else if (this == FunctionalStorage.VOID_UPGRADE.get()) { + return Component.translatable("drawer_upgrade.functionalstorage.void." + type); + } else if (this == FunctionalStorage.REDSTONE_UPGRADE.get()) { + return Component.translatable("drawer_upgrade.functionalstorage.redstone", Component.literal( + String.valueOf(stack.getOrDefault(FSAttachments.SLOT, 0)) + ).withStyle(ChatFormatting.RED)); + } + return null; + } + public static MutableComponent getRelativeDirection(Direction upgrade, Direction facing) { + return Component.translatable( + "tooltip.titanium.facing_handler." + FacingUtil.getFacingRelative(upgrade, facing).name().toLowerCase()).withStyle(ChatFormatting.WHITE); } @Override diff --git a/src/main/java/com/buuz135/functionalstorage/network/EnderDrawerSyncMessage.java b/src/main/java/com/buuz135/functionalstorage/network/EnderDrawerSyncMessage.java index e57eccca..4301cfc2 100644 --- a/src/main/java/com/buuz135/functionalstorage/network/EnderDrawerSyncMessage.java +++ b/src/main/java/com/buuz135/functionalstorage/network/EnderDrawerSyncMessage.java @@ -4,20 +4,18 @@ import com.buuz135.functionalstorage.world.EnderSavedData; import com.hrznstudio.titanium.network.CompoundSerializableDataHandler; import com.hrznstudio.titanium.network.Message; -import net.minecraft.client.Minecraft; -import net.minecraftforge.items.IItemHandler; -import net.minecraftforge.network.NetworkEvent; +import net.neoforged.neoforge.network.handling.IPayloadContext; public class EnderDrawerSyncMessage extends Message { static { CompoundSerializableDataHandler.map(EnderInventoryHandler.class, buf -> { EnderInventoryHandler handler = new EnderInventoryHandler(buf.readUtf(), EnderSavedData.CLIENT); - handler.deserializeNBT(buf.readNbt()); + handler.deserializeNBT(buf.registryAccess(), buf.readNbt()); return handler; }, (buf, handler1) -> { buf.writeUtf(handler1.getFrequency()); - buf.writeNbt(handler1.serializeNBT()); + buf.writeNbt(handler1.serializeNBT(buf.registryAccess())); }); } @@ -34,9 +32,7 @@ public EnderDrawerSyncMessage() { } @Override - protected void handleMessage(NetworkEvent.Context context) { - context.enqueueWork(() -> { - EnderSavedData.getInstance(Minecraft.getInstance().level).setFrenquency(frequency, handler); - }); + protected void handleMessage(IPayloadContext context) { + EnderSavedData.getInstance(context.player().level()).setFrenquency(frequency, handler); } } diff --git a/src/main/java/com/buuz135/functionalstorage/recipe/CustomCompactingRecipe.java b/src/main/java/com/buuz135/functionalstorage/recipe/CustomCompactingRecipe.java index 7d0c0d6c..690546a8 100644 --- a/src/main/java/com/buuz135/functionalstorage/recipe/CustomCompactingRecipe.java +++ b/src/main/java/com/buuz135/functionalstorage/recipe/CustomCompactingRecipe.java @@ -1,43 +1,52 @@ package com.buuz135.functionalstorage.recipe; import com.buuz135.functionalstorage.FunctionalStorage; -import com.hrznstudio.titanium.recipe.serializer.GenericSerializer; -import com.hrznstudio.titanium.recipe.serializer.SerializableRecipe; +import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.core.HolderLookup; import net.minecraft.core.RegistryAccess; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.data.recipes.RecipeOutput; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.Container; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.CraftingInput; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.level.Level; import java.util.ArrayList; import java.util.List; -public class CustomCompactingRecipe extends SerializableRecipe { +public class CustomCompactingRecipe implements Recipe { + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec(in -> in.group( + ItemStack.CODEC.fieldOf("lower_input").forGetter(CustomCompactingRecipe::getLower_input), + ItemStack.CODEC.fieldOf("higher_input").forGetter(CustomCompactingRecipe::getHigher_input) + ).apply(in, CustomCompactingRecipe::new)); public static List RECIPES = new ArrayList<>(); public ItemStack lower_input = ItemStack.EMPTY; public ItemStack higher_input = ItemStack.EMPTY; - public CustomCompactingRecipe(ResourceLocation resourceLocation) { - super(resourceLocation); + public CustomCompactingRecipe() { } - public CustomCompactingRecipe(ResourceLocation resourceLocation, ItemStack lower_input, ItemStack higher_input) { - super(resourceLocation); + public CustomCompactingRecipe(ItemStack lower_input, ItemStack higher_input) { this.lower_input = lower_input; this.higher_input = higher_input; RECIPES.add(this); } @Override - public boolean matches(Container inv, Level worldIn) { + public boolean matches(CraftingInput input, Level level) { return false; } @Override - public ItemStack assemble(Container inv, RegistryAccess access) { + public ItemStack assemble(CraftingInput input, HolderLookup.Provider registries) { return ItemStack.EMPTY; } @@ -47,20 +56,29 @@ public boolean canCraftInDimensions(int width, int height) { } @Override - public ItemStack getResultItem(RegistryAccess access) { + public ItemStack getResultItem(HolderLookup.Provider access) { return ItemStack.EMPTY; } @Override - public GenericSerializer getSerializer() { - return (GenericSerializer) FunctionalStorage.CUSTOM_COMPACTING_RECIPE_SERIALIZER.get(); + public RecipeSerializer getSerializer() { + return FunctionalStorage.CUSTOM_COMPACTING_RECIPE_SERIALIZER.value(); } @Override public RecipeType getType() { - return FunctionalStorage.CUSTOM_COMPACTING_RECIPE_TYPE.get(); + return FunctionalStorage.CUSTOM_COMPACTING_RECIPE_TYPE.value(); } + public void save(RecipeOutput output, ResourceLocation id) { + output.accept(id, this, null); + } + + public void save(RecipeOutput output) { + save(output, BuiltInRegistries.ITEM.getKey(higher_input.getItem())); + } + + public ItemStack getLower_input() { return lower_input; } diff --git a/src/main/java/com/buuz135/functionalstorage/recipe/DrawerlessWoodIngredient.java b/src/main/java/com/buuz135/functionalstorage/recipe/DrawerlessWoodIngredient.java index 2909cdc6..c9b6c962 100644 --- a/src/main/java/com/buuz135/functionalstorage/recipe/DrawerlessWoodIngredient.java +++ b/src/main/java/com/buuz135/functionalstorage/recipe/DrawerlessWoodIngredient.java @@ -1,17 +1,18 @@ package com.buuz135.functionalstorage.recipe; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import com.hrznstudio.titanium.util.TagUtil; -import net.minecraft.network.FriendlyByteBuf; +import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; +import net.minecraft.core.Holder; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.ItemTags; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.Ingredient; -import net.minecraftforge.common.crafting.IIngredientSerializer; -import net.minecraftforge.registries.ForgeRegistries; +import net.neoforged.neoforge.common.crafting.ICustomIngredient; +import net.neoforged.neoforge.common.crafting.IngredientType; import org.jetbrains.annotations.Nullable; import java.util.List; @@ -20,20 +21,16 @@ import static com.buuz135.functionalstorage.FunctionalStorage.MOD_ID; -public class DrawerlessWoodIngredient extends Ingredient { - - public static WoodlessIngredientSerializer SERIALIZER = new WoodlessIngredientSerializer(); - public static ResourceLocation NAME = new ResourceLocation(MOD_ID, "woodless"); +public class DrawerlessWoodIngredient implements ICustomIngredient { + public static final MapCodec CODEC = MapCodec.unit(DrawerlessWoodIngredient::new); + public static Holder> TYPE; + public static final ResourceLocation NAME = com.buuz135.functionalstorage.util.Utils.resourceLocation(MOD_ID, "woodless"); private List woodless; - public DrawerlessWoodIngredient() { - super(Stream.empty()); - } - @Override - public ItemStack[] getItems() { - return getWoods().stream().map(ItemStack::new).toArray(ItemStack[]::new); + public Stream getItems() { + return getWoods().stream().map(ItemStack::new); } @Override @@ -42,13 +39,18 @@ public boolean test(@Nullable ItemStack stack) { } @Override - public IIngredientSerializer getSerializer() { - return SERIALIZER; + public boolean isSimple() { + return false; + } + + @Override + public IngredientType getType() { + return TYPE.value(); } private List getWoods(){ if (woodless == null){ - woodless = TagUtil.getAllEntries(ForgeRegistries.ITEMS, ItemTags.PLANKS).stream().filter(item -> !ForgeRegistries.ITEMS.getKey(item).getNamespace().equalsIgnoreCase("minecraft")).collect(Collectors.toList()); + woodless = TagUtil.getAllEntries(BuiltInRegistries.ITEM, ItemTags.PLANKS).stream().filter(item -> !BuiltInRegistries.ITEM.getKey(item).getNamespace().equalsIgnoreCase("minecraft")).collect(Collectors.toList()); if (woodless.isEmpty()){ woodless.add(Items.OAK_PLANKS); } @@ -56,34 +58,4 @@ private List getWoods(){ return woodless; } - @Override - public JsonElement toJson() { - JsonObject element = new JsonObject(); - element.addProperty("type", NAME.toString()); - return element; - } - - @Override - protected void invalidate() { - super.invalidate(); - this.woodless = null; - } - - public static class WoodlessIngredientSerializer implements IIngredientSerializer{ - - @Override - public Ingredient parse(FriendlyByteBuf buffer) { - return new DrawerlessWoodIngredient(); - } - - @Override - public Ingredient parse(JsonObject json) { - return new DrawerlessWoodIngredient(); - } - - @Override - public void write(FriendlyByteBuf buffer, Ingredient ingredient) { - - } - } } diff --git a/src/main/java/com/buuz135/functionalstorage/recipe/FramedDrawerRecipe.java b/src/main/java/com/buuz135/functionalstorage/recipe/FramedDrawerRecipe.java index f19fae40..4d304884 100644 --- a/src/main/java/com/buuz135/functionalstorage/recipe/FramedDrawerRecipe.java +++ b/src/main/java/com/buuz135/functionalstorage/recipe/FramedDrawerRecipe.java @@ -1,26 +1,29 @@ package com.buuz135.functionalstorage.recipe; -import com.buuz135.functionalstorage.block.*; +import com.buuz135.functionalstorage.FunctionalStorage; +import com.buuz135.functionalstorage.block.CompactingFramedDrawerBlock; +import com.buuz135.functionalstorage.block.FramedControllerExtensionBlock; +import com.buuz135.functionalstorage.block.FramedDrawerBlock; +import com.buuz135.functionalstorage.block.FramedDrawerControllerBlock; +import com.buuz135.functionalstorage.block.FramedSimpleCompactingDrawerBlock; +import net.minecraft.core.HolderLookup; import net.minecraft.core.RegistryAccess; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.inventory.CraftingContainer; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.CraftingBookCategory; +import net.minecraft.world.item.crafting.CraftingInput; import net.minecraft.world.item.crafting.CustomRecipe; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.SimpleCraftingRecipeSerializer; import net.minecraft.world.level.Level; -import java.util.List; - public class FramedDrawerRecipe extends CustomRecipe { - public static RecipeSerializer SERIALIZER = new SimpleCraftingRecipeSerializer<>((p_250892_, p_249920_) -> new FramedDrawerRecipe(p_250892_)); - public FramedDrawerRecipe(ResourceLocation idIn) { - super(idIn, CraftingBookCategory.MISC); + public FramedDrawerRecipe() { + super(CraftingBookCategory.MISC); } @@ -48,7 +51,8 @@ public static boolean matchesSimpleCompacting(ItemStack first, ItemStack second, } @Override - public boolean matches(CraftingContainer inv, Level worldIn) { + public boolean matches(CraftingInput inv, Level worldIn) { + if (inv.size() < 3) return false; return matches(inv.getItem(0), inv.getItem(1), inv.getItem(2)) || matchesCompacting(inv.getItem(0), inv.getItem(1), inv.getItem(2)) || matchesSimpleCompacting(inv.getItem(0), inv.getItem(1), inv.getItem(2)) || @@ -57,14 +61,13 @@ public boolean matches(CraftingContainer inv, Level worldIn) { } @Override - public ItemStack assemble(CraftingContainer inv, RegistryAccess registryAccess) { + public ItemStack assemble(CraftingInput inv, HolderLookup.Provider registryAccess) { if (matches(inv.getItem(0), inv.getItem(1), inv.getItem(2)) || matchesCompacting(inv.getItem(0), inv.getItem(1), inv.getItem(2)) || matchesSimpleCompacting(inv.getItem(0), inv.getItem(1), inv.getItem(2)) || matchesController(inv.getItem(0), inv.getItem(1), inv.getItem(2)) || - matchesControllerExtension(inv.getItem(0), inv.getItem(1), inv.getItem(2))) - { - return FramedDrawerBlock.fill(inv.getItem(0), inv.getItem(1), inv.getItem(2).copy(), inv.getItem(3)); + matchesControllerExtension(inv.getItem(0), inv.getItem(1), inv.getItem(2))) { + return FramedDrawerBlock.fill(inv.getItem(0), inv.getItem(1), inv.getItem(2).copy(), inv.size() >= 4 ? inv.getItem(3) : ItemStack.EMPTY); } return ItemStack.EMPTY; @@ -77,6 +80,6 @@ public boolean canCraftInDimensions(int width, int height) { @Override public RecipeSerializer getSerializer() { - return SERIALIZER; + return FunctionalStorage.FRAMED_RECIPE_SERIALIZER.value(); } } diff --git a/src/main/java/com/buuz135/functionalstorage/util/CompactingUtil.java b/src/main/java/com/buuz135/functionalstorage/util/CompactingUtil.java index c2758f83..d86495b8 100644 --- a/src/main/java/com/buuz135/functionalstorage/util/CompactingUtil.java +++ b/src/main/java/com/buuz135/functionalstorage/util/CompactingUtil.java @@ -4,20 +4,21 @@ import com.buuz135.functionalstorage.recipe.CustomCompactingRecipe; import com.hrznstudio.titanium.util.RecipeUtil; import net.minecraft.core.NonNullList; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.CraftingContainer; -import net.minecraft.world.inventory.TransientCraftingContainer; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.CraftingRecipe; +import net.minecraft.world.item.crafting.CraftingInput; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.level.Level; -import net.minecraftforge.items.ItemHandlerHelper; -import net.minecraftforge.registries.ForgeRegistries; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.IntStream; /** @@ -38,7 +39,7 @@ public CompactingUtil(Level level, int resultAmount) { this.level = level; this.resultAmount = resultAmount; this.results = new ArrayList<>(); - this.recipes = (List) RecipeUtil.getRecipes(level, FunctionalStorage.CUSTOM_COMPACTING_RECIPE_TYPE.get()); + this.recipes = (List) RecipeUtil.getRecipes(level, FunctionalStorage.CUSTOM_COMPACTING_RECIPE_TYPE.value()); } public void setup(ItemStack stack){ @@ -80,12 +81,12 @@ public List getResults() { private Result findUpperTier(ItemStack stack){ for (CustomCompactingRecipe recipe : this.recipes) { if (ItemStack.isSameItem(recipe.lower_input, stack)) { - return new Result(ItemHandlerHelper.copyStackWithSize(recipe.higher_input, 1), recipe.lower_input.getCount()); + return new Result(recipe.higher_input.copyWithCount(1), recipe.lower_input.getCount()); } } //Checking 3x3 int sizeCheck = 9; - CraftingContainer container = createContainerAndFill(3, stack); + var container = createContainerAndFill(3, stack); List outputs = findAllMatchingRecipes(container); List realOutputs = new ArrayList<>(); if (outputs.size() == 0){ @@ -122,12 +123,13 @@ private Result findUpperTier(ItemStack stack){ private Result findLowerTier(ItemStack stack){ for (CustomCompactingRecipe recipe : this.recipes) { if (ItemStack.isSameItem(recipe.higher_input, stack)) { - return new Result(ItemHandlerHelper.copyStackWithSize(recipe.lower_input, 1), recipe.lower_input.getCount()); + return new Result(recipe.lower_input.copyWithCount(1), recipe.lower_input.getCount()); } } List candidates = new ArrayList<>(); Map candidatesRate = new HashMap<>(); - for (CraftingRecipe craftingRecipe : level.getRecipeManager().getAllRecipesFor(RecipeType.CRAFTING)) { + for (var rcp : level.getRecipeManager().getAllRecipesFor(RecipeType.CRAFTING)) { + var craftingRecipe = rcp.value(); ItemStack output = craftingRecipe.getResultItem(this.level.registryAccess()); if (!ItemStack.isSameItem(stack, output)) continue; ItemStack match = tryMatch(stack, craftingRecipe.getIngredients()); @@ -137,7 +139,7 @@ private Result findLowerTier(ItemStack stack){ candidates.add(match); candidatesRate.put(match, recipeSize); } - CraftingContainer container = createContainerAndFill(1, output); + var container = createContainerAndFill(1, output); List matchStacks = findAllMatchingRecipes(container); for (ItemStack matchStack : matchStacks) { if (ItemStack.isSameItem(match, matchStack) && matchStack.getCount() == recipeSize) { @@ -159,9 +161,10 @@ private Result findLowerTier(ItemStack stack){ return new Result(ItemStack.EMPTY, 0); } - private List findAllMatchingRecipes(CraftingContainer crafting) { + private List findAllMatchingRecipes(CraftingInput crafting) { List candidates = new ArrayList<>(); - for (CraftingRecipe recipe : level.getRecipeManager().getRecipesFor(RecipeType.CRAFTING, crafting, level)) { + for (var rcp : level.getRecipeManager().getRecipesFor(RecipeType.CRAFTING, crafting, level)) { + var recipe = rcp.value(); if (recipe.matches(crafting, level)) { ItemStack result = recipe.assemble(crafting, this.level.registryAccess()); if (!result.isEmpty()) @@ -172,17 +175,13 @@ private List findAllMatchingRecipes(CraftingContainer crafting) { } private ItemStack findSimilar(ItemStack reference, List candidates) { - ResourceLocation referenceName = ForgeRegistries.ITEMS.getKey(reference.getItem()); - if (referenceName != null) { - for (ItemStack candidate : candidates) { - ResourceLocation matchName = ForgeRegistries.ITEMS.getKey(candidate.getItem()); - if (matchName != null) { - if (referenceName.getNamespace().equals(matchName.getNamespace())) - return candidate; - } - } + ResourceLocation referenceName = BuiltInRegistries.ITEM.getKey(reference.getItem()); + for (ItemStack candidate : candidates) { + ResourceLocation matchName = BuiltInRegistries.ITEM.getKey(candidate.getItem()); + if (referenceName.getNamespace().equals(matchName.getNamespace())) + return candidate; } - return candidates.size() > 0 ? candidates.get(0) : ItemStack.EMPTY; + return !candidates.isEmpty() ? candidates.get(0) : ItemStack.EMPTY; } @@ -217,22 +216,9 @@ private ItemStack tryMatch(ItemStack stack, NonNullList ingredients) return match; } - private CraftingContainer createContainerAndFill(int size, ItemStack stack){ - CraftingContainer inventoryCrafting = new TransientCraftingContainer(new AbstractContainerMenu(null, 0) { - @Override - public ItemStack quickMoveStack(Player p_38941_, int p_38942_) { - return ItemStack.EMPTY; - } - - @Override - public boolean stillValid(Player playerIn) { - return false; - } - }, size, size); - for (int i = 0; i < size * size; i++) { - inventoryCrafting.setItem(i, stack.copy()); - } - return inventoryCrafting; + private CraftingInput createContainerAndFill(int size, ItemStack stack){ + return CraftingInput.of(size, size, IntStream.range(0, size * size) + .mapToObj(i -> stack.copy()).toList()); } public static class Result{ diff --git a/src/main/java/com/buuz135/functionalstorage/util/ConnectedDrawers.java b/src/main/java/com/buuz135/functionalstorage/util/ConnectedDrawers.java index 21fe9874..657a7634 100644 --- a/src/main/java/com/buuz135/functionalstorage/util/ConnectedDrawers.java +++ b/src/main/java/com/buuz135/functionalstorage/util/ConnectedDrawers.java @@ -14,17 +14,16 @@ import net.minecraft.world.phys.shapes.BooleanOp; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; -import net.minecraftforge.common.util.INBTSerializable; -import net.minecraftforge.fluids.capability.IFluidHandler; -import net.minecraftforge.items.IItemHandler; - +import net.neoforged.neoforge.common.util.INBTSerializable; +import net.neoforged.neoforge.fluids.capability.IFluidHandler; +import net.neoforged.neoforge.items.IItemHandler; import java.util.ArrayList; import java.util.Comparator; import java.util.List; public class ConnectedDrawers implements INBTSerializable { - private StorageControllerTile controllerTile; + private final StorageControllerTile controllerTile; private List connectedDrawers; private List itemHandlers; @@ -33,7 +32,7 @@ public class ConnectedDrawers implements INBTSerializable { private int extensions; private VoxelShape cachedVoxelShape; - public ConnectedDrawers(Level level, StorageControllerTile controllerTile) { + public ConnectedDrawers(Level level, StorageControllerTile controllerTile) { this.controllerTile = controllerTile; this.connectedDrawers = new ArrayList<>(); @@ -90,7 +89,7 @@ public void rebuildShapes() { } @Override - public CompoundTag serializeNBT() { + public CompoundTag serializeNBT(net.minecraft.core.HolderLookup.Provider provider) { CompoundTag compoundTag = new CompoundTag(); for (int i = 0; i < this.connectedDrawers.size(); i++) { compoundTag.putLong(i + "", this.connectedDrawers.get(i)); @@ -99,7 +98,7 @@ public CompoundTag serializeNBT() { } @Override - public void deserializeNBT(CompoundTag nbt) { + public void deserializeNBT(net.minecraft.core.HolderLookup.Provider provider, CompoundTag nbt) { this.connectedDrawers = new ArrayList<>(); for (String allKey : nbt.getAllKeys()) { connectedDrawers.add(nbt.getLong(allKey)); diff --git a/src/main/java/com/buuz135/functionalstorage/util/NumberUtils.java b/src/main/java/com/buuz135/functionalstorage/util/NumberUtils.java index 6e0d2823..59fc2151 100644 --- a/src/main/java/com/buuz135/functionalstorage/util/NumberUtils.java +++ b/src/main/java/com/buuz135/functionalstorage/util/NumberUtils.java @@ -4,7 +4,7 @@ public class NumberUtils { - private static DecimalFormat formatterWithUnits = new DecimalFormat("####0.#"); + private static final DecimalFormat formatterWithUnits = new DecimalFormat("####0.#"); public static String getFormatedBigNumber(int number) { if (number >= 1000000000) { //BILLION diff --git a/src/main/java/com/buuz135/functionalstorage/util/StorageTags.java b/src/main/java/com/buuz135/functionalstorage/util/StorageTags.java index 66ae3fa8..abae327b 100644 --- a/src/main/java/com/buuz135/functionalstorage/util/StorageTags.java +++ b/src/main/java/com/buuz135/functionalstorage/util/StorageTags.java @@ -5,11 +5,10 @@ import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; -import net.minecraftforge.common.Tags; public class StorageTags { - public static TagKey DRAWER = ItemTags.create(new ResourceLocation(FunctionalStorage.MOD_ID, "drawer")); - public static TagKey IGNORE_CRAFTING_CHECK = ItemTags.create(new ResourceLocation(FunctionalStorage.MOD_ID, "ignore_crafting_check")); + public static final TagKey DRAWER = ItemTags.create(com.buuz135.functionalstorage.util.Utils.resourceLocation(FunctionalStorage.MOD_ID, "drawer")); + public static final TagKey IGNORE_CRAFTING_CHECK = ItemTags.create(com.buuz135.functionalstorage.util.Utils.resourceLocation(FunctionalStorage.MOD_ID, "ignore_crafting_check")); } diff --git a/src/main/java/com/buuz135/functionalstorage/util/TooltipUtil.java b/src/main/java/com/buuz135/functionalstorage/util/TooltipUtil.java index 221a8794..95260454 100644 --- a/src/main/java/com/buuz135/functionalstorage/util/TooltipUtil.java +++ b/src/main/java/com/buuz135/functionalstorage/util/TooltipUtil.java @@ -3,13 +3,11 @@ import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.Lighting; import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.resources.model.BakedModel; @@ -17,8 +15,8 @@ import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; import javax.annotation.Nullable; import java.util.List; @@ -36,8 +34,11 @@ public static void renderItemIntoGUI(GuiGraphics guiGraphics, ItemStack stack, i } public static void renderItemAdvanced(GuiGraphics guiGraphics, ItemStack stack, int x, int y, int z, String amount) { + guiGraphics.pose().pushPose(); + guiGraphics.pose().translate(0, 0, z); renderItemModelIntoGUI(guiGraphics, stack, x, y, z, Minecraft.getInstance().getItemRenderer().getModel(stack, (Level) null, (LivingEntity) null, 0)); renderItemStackOverlay(guiGraphics, Minecraft.getInstance().font, stack, x, y, amount, amount.length() - 2); + guiGraphics.pose().popPose(); } public static void renderItemStackOverlay(GuiGraphics guiGraphics, Font fr, ItemStack stack, int xPosition, int yPosition, @Nullable String text, int scaled) { diff --git a/src/main/java/com/buuz135/functionalstorage/util/Utils.java b/src/main/java/com/buuz135/functionalstorage/util/Utils.java new file mode 100644 index 00000000..d0df8b72 --- /dev/null +++ b/src/main/java/com/buuz135/functionalstorage/util/Utils.java @@ -0,0 +1,38 @@ +package com.buuz135.functionalstorage.util; + +import net.minecraft.core.HolderLookup; +import net.minecraft.core.RegistryAccess; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtOps; +import net.minecraft.resources.RegistryOps; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.neoforged.fml.LogicalSide; +import net.neoforged.neoforge.common.util.LogicalSidedProvider; +import net.neoforged.neoforge.fluids.FluidStack; +import net.neoforged.neoforge.server.ServerLifecycleHooks; + +public class Utils { + public static ResourceLocation resourceLocation(String toParse) { + return ResourceLocation.parse(toParse); + } + + public static ResourceLocation resourceLocation(String namespace, String path) { + return ResourceLocation.fromNamespaceAndPath(namespace, path); + } + + public static ItemStack deserialize(HolderLookup.Provider provider, CompoundTag tag) { + return ItemStack.OPTIONAL_CODEC.decode(RegistryOps.create(NbtOps.INSTANCE, provider), tag).getOrThrow().getFirst(); + } + + public static FluidStack deserializeFluid(HolderLookup.Provider provider, CompoundTag tag) { + return FluidStack.OPTIONAL_CODEC.decode(RegistryOps.create(NbtOps.INSTANCE, provider), tag).getOrThrow().getFirst(); + } + + public static RegistryAccess registryAccess() { + if (ServerLifecycleHooks.getCurrentServer() != null) { + return ServerLifecycleHooks.getCurrentServer().registryAccess(); + } + return LogicalSidedProvider.CLIENTWORLD.get(LogicalSide.CLIENT).orElseThrow().registryAccess(); + } +} diff --git a/src/main/java/com/buuz135/functionalstorage/world/EnderSavedData.java b/src/main/java/com/buuz135/functionalstorage/world/EnderSavedData.java index 11e10993..ce8783a0 100644 --- a/src/main/java/com/buuz135/functionalstorage/world/EnderSavedData.java +++ b/src/main/java/com/buuz135/functionalstorage/world/EnderSavedData.java @@ -2,6 +2,7 @@ import com.buuz135.functionalstorage.inventory.EnderInventoryHandler; import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.Level; @@ -28,7 +29,8 @@ public EnderSavedData(Level level) { public static EnderSavedData getInstance(LevelAccessor accessor){ if (accessor instanceof ServerLevel){ ServerLevel serverWorld = ((ServerLevel) accessor).getServer().getLevel(Level.OVERWORLD); - EnderSavedData data = serverWorld.getDataStorage().computeIfAbsent(tag -> EnderSavedData.load(tag, (ServerLevel) accessor), () -> new EnderSavedData((ServerLevel)accessor), NAME); + EnderSavedData data = serverWorld.getDataStorage().computeIfAbsent( + new Factory<>(() -> new EnderSavedData((ServerLevel)accessor), (tag, prov) -> EnderSavedData.load(tag, (ServerLevel) accessor)), NAME); return data; } else if (accessor instanceof ClientLevel){ return CLIENT; @@ -42,7 +44,7 @@ private static EnderSavedData load(CompoundTag compoundTag, Level level) { CompoundTag backpacks = compoundTag.getCompound("Ender"); for (String s : backpacks.getAllKeys()) { EnderInventoryHandler hander = new EnderInventoryHandler(s, manager); - hander.deserializeNBT(backpacks.getCompound(s)); + hander.deserializeNBT(level.registryAccess(), backpacks.getCompound(s)); manager.itemHandlers.put(s, hander); } @@ -58,9 +60,9 @@ public void setFrenquency(String frequency, EnderInventoryHandler handler){ } @Override - public CompoundTag save(CompoundTag tag) { + public CompoundTag save(CompoundTag tag, HolderLookup.Provider provider) { CompoundTag nbt = new CompoundTag(); - itemHandlers.forEach((s, iItemHandler) -> nbt.put(s, iItemHandler.serializeNBT())); + itemHandlers.forEach((s, iItemHandler) -> nbt.put(s, iItemHandler.serializeNBT(provider))); tag.put("Ender", nbt); return tag; } diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index aac003ac..4b55dc60 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -1,7 +1,2 @@ public net.minecraft.client.renderer.RenderStateShard$LineStateShard -public net.minecraft.client.renderer.block.model.BlockModel f_111419_ # parentLocation -public net.minecraft.client.renderer.block.model.BlockModel m_111437_(Lnet/minecraft/client/renderer/block/model/BlockElement;Lnet/minecraft/client/renderer/block/model/BlockElementFace;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/core/Direction;Lnet/minecraft/client/resources/model/ModelState;Lnet/minecraft/resources/ResourceLocation;)Lnet/minecraft/client/renderer/block/model/BakedQuad; # bakeFace -public net.minecraft.client.renderer.block.model.BlockModel$Deserializer m_111503_(Lnet/minecraft/resources/ResourceLocation;Ljava/lang/String;)Lcom/mojang/datafixers/util/Either; # findTexture - -public net.minecraft.client.resources.model.WeightedBakedModel f_119542_ # baseModel -public net.minecraft.client.resources.model.MultiPartBakedModel f_119459_ # selectors \ No newline at end of file +public net.minecraft.client.renderer.LevelRenderer renderShape(Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;Lnet/minecraft/world/phys/shapes/VoxelShape;DDDFFFF)V diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/neoforge.mods.toml similarity index 90% rename from src/main/resources/META-INF/mods.toml rename to src/main/resources/META-INF/neoforge.mods.toml index c9b5a0f7..0eefdee3 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/neoforge.mods.toml @@ -6,7 +6,7 @@ # The name of the mod loader type to load - for regular FML @Mod mods it should be javafml modLoader = "javafml" #mandatory # A version range to match for said mod loader - for regular FML @Mod it will be the forge version -loaderVersion = "[43,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. +loaderVersion = "[2,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. # The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties. # Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here. license = "MIT" @@ -39,11 +39,11 @@ Functional Storage # A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. [[dependencies.functionalstorage]] #optional # the modid of the dependency -modId = "forge" #mandatory +modId = "neoforge" #mandatory # Does this dependency have to exist - if not, ordering below must be specified -mandatory = true #mandatory +type = "required" # The version range of the dependency -versionRange = "[43.2.3,)" #mandatory +versionRange = "[21,)" #mandatory # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory ordering = "NONE" # Side this dependency is applied on - BOTH, CLIENT or SERVER @@ -51,15 +51,15 @@ side = "BOTH" # Here's another dependency [[dependencies.functionalstorage]] modId = "minecraft" -mandatory = true +type = "required" # This version range declares a minimum of the current minecraft version up to but not including the next major version -versionRange = "[1.19.2,)" +versionRange = "[1.21,)" ordering = "NONE" side = "BOTH" [[dependencies.functionalstorage]] modId = "titanium" -mandatory = true -versionRange = "[3.8.0,)" +type = "required" +versionRange = "[1.20.4-4,)" # This version range declares a minimum of the current minecraft version up to but not including the next major version ordering = "NONE" -side = "BOTH" \ No newline at end of file +side = "BOTH" diff --git a/src/main/resources/data/functionalstorage/recipe/framed.json b/src/main/resources/data/functionalstorage/recipe/framed.json new file mode 100644 index 00000000..086a4cdf --- /dev/null +++ b/src/main/resources/data/functionalstorage/recipe/framed.json @@ -0,0 +1,4 @@ +{ + "type": "functionalstorage:framed_recipe", + "category": "misc" +} \ No newline at end of file diff --git a/src/main/resources/data/functionalstorage/recipes/framed.json b/src/main/resources/data/functionalstorage/recipes/framed.json deleted file mode 100644 index d05b81a7..00000000 --- a/src/main/resources/data/functionalstorage/recipes/framed.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "functionalstorage:framed_recipe" -} \ No newline at end of file