diff --git a/build.gradle b/build.gradle index 9d08ae2dd..3a98c5c27 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,8 @@ apply plugin: 'org.parchmentmc.librarian.forgegradle' apply plugin: 'java' apply plugin: 'idea' apply plugin: 'maven-publish' - +apply from: 'https://raw.githubusercontent.com/SizableShrimp/Forge-Class-Remapper/main/classremapper.gradle' +apply from: 'https://raw.githubusercontent.com/SizableShrimp/ForgeUpdatesRemapper/main/remapper.gradle' version = "$mod_version" group = "de.ellpeck.actuallyadditions" archivesBaseName = "ActuallyAdditions-$game_version" @@ -26,7 +27,7 @@ if (System.getenv('BUILD_NUMBER') != null) { version += "." + System.getenv('BUILD_NUMBER') } -java.toolchain.languageVersion = JavaLanguageVersion.of(8) +java.toolchain.languageVersion = JavaLanguageVersion.of(17) minecraft { mappings channel: 'parchment', version: "${parchment_version}-${game_version}" @@ -88,8 +89,8 @@ dependencies { compileOnly fg.deobf("mezz.jei:jei-${jei_version}:api") runtimeOnly fg.deobf("mezz.jei:jei-${jei_version}") - runtimeOnly fg.deobf("curse.maven:TOP-245211:3319255") - runtimeOnly fg.deobf("curse.maven:MEK-268560:3590099") + runtimeOnly fg.deobf("curse.maven:the-one-probe-245211:3965688") + runtimeOnly fg.deobf("curse.maven:mekanism-268560:3875976") } // not sure if this is still needed diff --git a/gradle.properties b/gradle.properties index 09d348238..92fe44a8c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,11 +6,11 @@ org.gradle.daemon=false mod_version=1.1.52 # Forge -game_version=1.16.5 -forge_version=36.2.34 +game_version=1.18.2 +forge_version=40.2.17 # Parchment (Mappings) -parchment_version=2021.10.17 +parchment_version=2022.11.06 # Other mods -jei_version=1.16.5:7.7.1.153 +jei_version=1.18.2:9.7.1.255 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e708b1c02..41d9927a4 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 05679dc3c..41dfb8790 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index cccdd3d51..1b6c78733 100755 --- a/gradlew +++ b/gradlew @@ -1,78 +1,129 @@ -#!/usr/bin/env sh +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/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/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${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="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -81,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -89,84 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + 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 fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done fi +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index e95643d6a..ac1b06f93 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@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 @@ -13,15 +29,18 @@ 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= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -35,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -45,28 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index f4508cc6a..6851543b7 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -454,145 +454,145 @@ f657eabc7321de0b05cf92d9ebdd6f5215a685b5 assets/actuallyadditions/models/item/wo 09674f706bebd8f2631450f1c07f1376b2c3ba01 assets/actuallyadditions/models/item/worm.json 0b1ab8963077c90a5104b516eab36e56c8a07057 assets/actuallyadditions/models/item/xp_solidifier.json ecf1cc8efe1f425334e8e07a6c747641c714c92c assets/actuallyadditions/sounds.json -56048fd14b61c03380903460ec55fabc2df3eaac data/actuallyadditions/advancements/craft_coal_generator.json -58d03f96a5c20611e22d8cec90c972d7218064e8 data/actuallyadditions/advancements/craft_coffee_machine.json -681bfd8939b4a7843700fe00382f703e80070a38 data/actuallyadditions/advancements/craft_crusher.json -3dfef9d6252198582a16fcc85a1abca2f6bad2e3 data/actuallyadditions/advancements/craft_double_crusher.json -04bc0214d706d2011d6450803e406579f2e132f4 data/actuallyadditions/advancements/craft_empowerer.json -889c1be4720a7da3887cd378e3f98d446af25ae3 data/actuallyadditions/advancements/craft_energyface.json -45a78c57fcbbced57321c420e1d0dc050a1b2ff5 data/actuallyadditions/advancements/craft_item_interface.json -ef2c3abb1f2dcb31baa00fa6e70d8d8846440266 data/actuallyadditions/advancements/craft_laser_relay.json -8f81eeffa15e291e4a7cae6f7464746cd0bc834b data/actuallyadditions/advancements/craft_laser_relay_advanced.json -fc1c59cc804274b36d757c59529269bb14841f4a data/actuallyadditions/advancements/craft_laser_relay_extreme.json -aff73cb2465d85abf92d94b5843167166c9b2820 data/actuallyadditions/advancements/craft_laser_relay_item.json -69532a7bd1b199dacb08f4541fc0c27633b391da data/actuallyadditions/advancements/craft_leaf_generator.json -56c4431e4d61926e07073f5265086e67312c0023 data/actuallyadditions/advancements/craft_liquiface.json -f1e0c56dab5fd3516e9d1da7c16831bf4bd3364e data/actuallyadditions/advancements/craft_phantom_face.json -ef621cca24fa11382b856a70fa6f432f081007d7 data/actuallyadditions/advancements/craft_reconstructor.json +78a1e3bec8bf9830c1ca098af7e2a9213426f75b data/actuallyadditions/advancements/craft_coal_generator.json +2c8657e98263866b87520fe3de4aaa900cee1758 data/actuallyadditions/advancements/craft_coffee_machine.json +8746592eda56b4027e896c20fe1a6d0dbcb24bc9 data/actuallyadditions/advancements/craft_crusher.json +0c699699a50df43acac86490b3d238c04984c6bb data/actuallyadditions/advancements/craft_double_crusher.json +367027f64ba66fd1757c3391c3cd27336ff954c5 data/actuallyadditions/advancements/craft_empowerer.json +0f1e0ac963635b25299c99ebcbe66823985f0f1b data/actuallyadditions/advancements/craft_energyface.json +c5ed52b759d2a4d61b12d07b57c859c9c0ce8e3a data/actuallyadditions/advancements/craft_item_interface.json +8fcb90f479e353a6b251c62cb323a151a12182c0 data/actuallyadditions/advancements/craft_laser_relay.json +8010e063762d9ad376ef6efd02bc9c6bd30004b9 data/actuallyadditions/advancements/craft_laser_relay_advanced.json +1f9f9b227ebea65d04b3c448bb06c875cfcc746a data/actuallyadditions/advancements/craft_laser_relay_extreme.json +5fef10815f29597800e9015e95af190ca8501bf7 data/actuallyadditions/advancements/craft_laser_relay_item.json +c72fcdc4c2b6dc7f757b41b61f6e5063c7dcf49a data/actuallyadditions/advancements/craft_leaf_generator.json +d8a218723094bc01575a7e0b197f1676347bce57 data/actuallyadditions/advancements/craft_liquiface.json +9d1f0abf32f1200920ba83933511f01cfc7ac203 data/actuallyadditions/advancements/craft_phantom_face.json +d476883cb50537b8058c08df2d8b2ee42cd66c7a data/actuallyadditions/advancements/craft_reconstructor.json d09f28dfb125fc0d58f4e23287d19877db73c0b7 data/actuallyadditions/advancements/make_first_crystal.json -58c901fc6a544f800e641b2ab9f1f4b25d6dce53 data/actuallyadditions/advancements/pickup_coffee.json +4d77ce02dec4e2092a6e9e739e85dc0768928a4a data/actuallyadditions/advancements/pickup_coffee.json 1326c214451f5fef68e330a37bfa0433de723f4c data/actuallyadditions/advancements/root.json -b679296118ae905d4a15b6bc658cfa7b8048e57f data/actuallyadditions/loot_tables/blocks/atomic_reconstructor.json -de3c64d6a363f8e27078d7f7df1a67e4931fd81c data/actuallyadditions/loot_tables/blocks/battery_box.json -fb968dc63f2d0a467eff504f3f6ff386080e2433 data/actuallyadditions/loot_tables/blocks/bio_reactor.json -a1b62291e361451916e45a97bb499ecb1b6eb595 data/actuallyadditions/loot_tables/blocks/black_quartz_block.json -88d06540d7db61a5f12d4ae728b298978c175528 data/actuallyadditions/loot_tables/blocks/black_quartz_brick_block.json -758ea9d573bad6eb5a9baa480e6ac7cdb3086801 data/actuallyadditions/loot_tables/blocks/black_quartz_brick_slab.json -25999ba6adebccd8f8c9aaeac4d569b561c10ff6 data/actuallyadditions/loot_tables/blocks/black_quartz_brick_stair.json -83eae2a8058606f8fd7ad48b4f18b2dd4cf25f91 data/actuallyadditions/loot_tables/blocks/black_quartz_brick_wall.json -de831ee9fb899a2698a15aa792798e8bc8cec6cd data/actuallyadditions/loot_tables/blocks/black_quartz_ore.json -284190bea6fa9fefeeb5aa942830fbd8999a4446 data/actuallyadditions/loot_tables/blocks/black_quartz_pillar_block.json -9fa02c71612918d38900fb401c15975cb43a7443 data/actuallyadditions/loot_tables/blocks/black_quartz_pillar_slab.json -7a5c8a64366e6302647efa0f6ce033f24e74af89 data/actuallyadditions/loot_tables/blocks/black_quartz_pillar_stair.json -b12f24fa635a72ea41c5cab68015b47b01e85846 data/actuallyadditions/loot_tables/blocks/black_quartz_pillar_wall.json -1fe5db6af5243d718867a3aed2915f60a074420f data/actuallyadditions/loot_tables/blocks/black_quartz_slab.json -59363fb1bf29cc3eaeda51267d7a3d3451659b85 data/actuallyadditions/loot_tables/blocks/black_quartz_stair.json -9ff4e9ed368bc6c84c8a4a6faf7557eb23856fe0 data/actuallyadditions/loot_tables/blocks/black_quartz_wall.json -8cd0a700e62111e5a4351788072bf816731ab493 data/actuallyadditions/loot_tables/blocks/breaker.json -91fae25a55c4f58e5871c6008c5c13f89cb62198 data/actuallyadditions/loot_tables/blocks/canola.json -f3df22f203e8c00ee7ee004bb9b4edfd522f069a data/actuallyadditions/loot_tables/blocks/canola_press.json -55e8641b836aab36848edf7d0eab33e647571fc8 data/actuallyadditions/loot_tables/blocks/chiseled_black_quartz_block.json -7b10afffb30390977f1729356e0b4959ccb4cf1c data/actuallyadditions/loot_tables/blocks/chiseled_black_quartz_slab.json -6df5538ba7cf057d19728f8e615862a84b9d4bb1 data/actuallyadditions/loot_tables/blocks/chiseled_black_quartz_stair.json -092e8773d46f16d80d0c489c4a2d2f8bd5a78799 data/actuallyadditions/loot_tables/blocks/chiseled_black_quartz_wall.json -bf7743c27757cf5b0dbab9b3e15d1d5ca1ece818 data/actuallyadditions/loot_tables/blocks/coal_generator.json -01ed45d18335029de7725ae4490077c9280eedd1 data/actuallyadditions/loot_tables/blocks/coffee.json -3285202e3f840d091b8d85dc2c721199fcc96240 data/actuallyadditions/loot_tables/blocks/coffee_machine.json -317d0377327250f2fe15ff549a1ffa1b7bdade14 data/actuallyadditions/loot_tables/blocks/crusher.json -b087c6f44cf0236f52471ec54c026ee30ba0d273 data/actuallyadditions/loot_tables/blocks/crusher_double.json -6336ca572b8d81f6e06b43bb925b48bb915b6574 data/actuallyadditions/loot_tables/blocks/diamatine_crystal_block.json -b9ed4007fec7a382a02b08b231f072df6aa40049 data/actuallyadditions/loot_tables/blocks/diamatine_crystal_cluster.json -7476dbc0cbb3c1a8ce5a3c1562f73fcfb4adcd10 data/actuallyadditions/loot_tables/blocks/display_stand.json -162331b9fbc67309820a20377575336e63ed3e74 data/actuallyadditions/loot_tables/blocks/dropper.json -3b93e666ae7c49a182e771063901b27da8dcfb3f data/actuallyadditions/loot_tables/blocks/emeradic_crystal_block.json -9fec34737374133601990074c4156334ab3841ad data/actuallyadditions/loot_tables/blocks/emeradic_crystal_cluster.json -aeb229c0c9a5d5f4682430ed4ec78c123e7e871b data/actuallyadditions/loot_tables/blocks/empowered_diamatine_crystal_block.json -04f1075d01a9467a6ad00373b73b94869af7a799 data/actuallyadditions/loot_tables/blocks/empowered_emeradic_crystal_block.json -00e52dcccbf05f4d332b650ce9374691983b32f1 data/actuallyadditions/loot_tables/blocks/empowered_enori_crystal_block.json -4c9d1217bab479d6b28c2c2b6a12b8dea9625ca7 data/actuallyadditions/loot_tables/blocks/empowered_palis_crystal_block.json -000a65e96a8f3d79f37671a42e00c5700c46cc79 data/actuallyadditions/loot_tables/blocks/empowered_restonia_crystal_block.json -3b23c1416f7227cdd3c05033cd097e4e95048a12 data/actuallyadditions/loot_tables/blocks/empowered_void_crystal_block.json -e0ae0923455cc2eedfdfc826d8c408b23373997c data/actuallyadditions/loot_tables/blocks/empowerer.json -8b9f76383b14f0d814126a3279fcf4d4b84867e3 data/actuallyadditions/loot_tables/blocks/ender_casing.json -872ba64002408040096e08a340b956b35c261f57 data/actuallyadditions/loot_tables/blocks/energizer.json -ce52e2261acccd8092f6033eaa24cb7eb0ace776 data/actuallyadditions/loot_tables/blocks/enervator.json -0310ab57594d1bbbdfc20043a4bbf6a522207e74 data/actuallyadditions/loot_tables/blocks/enori_crystal_block.json -58de0ea0cc68ec93bf488557e880b9e5f839a338 data/actuallyadditions/loot_tables/blocks/enori_crystal_cluster.json -24ad472bcaa4536e32865de339ec932f55399de6 data/actuallyadditions/loot_tables/blocks/ethetic_green_block.json -5e2a9930efaa4c815a2874405876878b96478efb data/actuallyadditions/loot_tables/blocks/ethetic_green_slab.json -978541de7caae92254b402d85a6fa28be92a2446 data/actuallyadditions/loot_tables/blocks/ethetic_green_stairs.json -6cd9d8105bebca9bb7bd054fa54e60aa7f7229a8 data/actuallyadditions/loot_tables/blocks/ethetic_green_wall.json -5d20584eddc3887ee6bda8cbb9312ae549dc5307 data/actuallyadditions/loot_tables/blocks/ethetic_white_block.json -bf9c3a7ae7a9f3a6450403292cbcecd922f6aa3b data/actuallyadditions/loot_tables/blocks/ethetic_white_slab.json -35c33041660cc162e8283a94ac0be3208a7958ea data/actuallyadditions/loot_tables/blocks/ethetic_white_stairs.json -d98534f21c56b8d11f722c8c3c9d0acbeb323554 data/actuallyadditions/loot_tables/blocks/ethetic_white_wall.json -de23e0f60c9ea67e554f6e21425c29a45c205378 data/actuallyadditions/loot_tables/blocks/farmer.json -0b617808ed4788bbe97fe81efc37290e19ab257d data/actuallyadditions/loot_tables/blocks/feeder.json -91a2dd39bb797fb3270367ab77524733fc8aab47 data/actuallyadditions/loot_tables/blocks/fermenting_barrel.json -0bcee59a3bdf86cbb604b65a6c9013d21d16c13c data/actuallyadditions/loot_tables/blocks/firework_box.json -537ecc108b85896c89bbb50583c15b602bc5d3a9 data/actuallyadditions/loot_tables/blocks/flax.json -2c276ba10bd5655d38bb52e5670ba046cf5783b9 data/actuallyadditions/loot_tables/blocks/fluid_collector.json -0d1f81f93d2bbb37b6ce9a645a1a4ee34bdd0c41 data/actuallyadditions/loot_tables/blocks/fluid_placer.json -a6e2a7783e597f97780fd144706e66b5fdb7d9e0 data/actuallyadditions/loot_tables/blocks/greenhouse_glass.json -299f001df502fa1aa34384370d06cc698a51c39e data/actuallyadditions/loot_tables/blocks/heat_collector.json -e116e77ea6f45d0d4b93cde1084c75086413315e data/actuallyadditions/loot_tables/blocks/hopping_item_interface.json -12c27a8021c6b61cf4304bca94edd2aa5d1ff658 data/actuallyadditions/loot_tables/blocks/iron_casing.json -a5d03812083bf4091fdc87b5cca597d8d585c59a data/actuallyadditions/loot_tables/blocks/item_interface.json -d4daeb47a3b5382cf636d64564741f10f4ecf8a2 data/actuallyadditions/loot_tables/blocks/lamp_black.json -c2dd60733559f76897ad6c03844fe988dcab421c data/actuallyadditions/loot_tables/blocks/lamp_blue.json -012d9cec7b02bef10fd80dd620d28b6f1a83a2ca data/actuallyadditions/loot_tables/blocks/lamp_brown.json -f77f61f3ddc8c7802e8d914ec03eb422faff4505 data/actuallyadditions/loot_tables/blocks/lamp_controller.json -329deb1561247fa9151b819642f9ad47e0dd3e04 data/actuallyadditions/loot_tables/blocks/lamp_cyan.json -d08755883b87abce91cca2566ee731246277cef5 data/actuallyadditions/loot_tables/blocks/lamp_gray.json -0e31ac904f2b973f0233025b33ff4c1db82ef298 data/actuallyadditions/loot_tables/blocks/lamp_green.json -0f2923754794ffadd5cacbe28431b0ca2c0c72b9 data/actuallyadditions/loot_tables/blocks/lamp_light_blue.json -d0e7e5aa858caa5044f72c1e46c627f63491ff92 data/actuallyadditions/loot_tables/blocks/lamp_light_gray.json -db0e768bed8364ef7ef2d3a48fa61c05432e3481 data/actuallyadditions/loot_tables/blocks/lamp_lime.json -88162fb4d9dc914d044dbb5d61566683817feac3 data/actuallyadditions/loot_tables/blocks/lamp_magenta.json -39e11ae9abdbadf8acbc106b6cd2717cddf72989 data/actuallyadditions/loot_tables/blocks/lamp_orange.json -27a2b2515786a16cc6486a871007eb425b643301 data/actuallyadditions/loot_tables/blocks/lamp_pink.json -30cb4e72f47203629d58c0e94e00bcb0af59a2b0 data/actuallyadditions/loot_tables/blocks/lamp_purple.json -67644d8e96d1ae860485da3167bcba6405c5e95e data/actuallyadditions/loot_tables/blocks/lamp_red.json -8045cc7dcbf30fef588f759b5e59d26ddc43f93a data/actuallyadditions/loot_tables/blocks/lamp_white.json -569ac4635188b06901e4a4cf103061c4a39e1a15 data/actuallyadditions/loot_tables/blocks/lamp_yellow.json -c779aee00da69c0a0b77d10666744717786a42c9 data/actuallyadditions/loot_tables/blocks/laser_relay.json -a75b6c99f51263dc08a3989b0db7ebb6429d19f0 data/actuallyadditions/loot_tables/blocks/laser_relay_advanced.json -d97afdaa98f4202a2fc767599a4e5e34ffbefa71 data/actuallyadditions/loot_tables/blocks/laser_relay_extreme.json -3d3b5214b393427238da936b2090f9db08503994 data/actuallyadditions/loot_tables/blocks/laser_relay_fluids.json -7ed6dd90358646ca2e7c13801e0679182e30bf9f data/actuallyadditions/loot_tables/blocks/laser_relay_item.json -4f0c866450d6ce434ee5fba6ad0141b2e5f73b2e data/actuallyadditions/loot_tables/blocks/laser_relay_item_advanced.json -427c0ab203d6e946069912f0f8d5d744d9fe6a54 data/actuallyadditions/loot_tables/blocks/lava_factory_casing.json -a26c16e8bf499948ef947d5e7e2e6691e0c7e1a8 data/actuallyadditions/loot_tables/blocks/lava_factory_controller.json -d2cfb9e1d68cfabcf21f2847cf66760b514bb510 data/actuallyadditions/loot_tables/blocks/leaf_generator.json -644aab55582d80b4b1fb9857b1b136b3f50bbe79 data/actuallyadditions/loot_tables/blocks/long_range_breaker.json -0317d1a12de12767cac13a5a2c9d173198b7e600 data/actuallyadditions/loot_tables/blocks/oil_generator.json -8a49a3773ea9ac5f56b68373671fbf535a33ae0b data/actuallyadditions/loot_tables/blocks/palis_crystal_block.json -101ae500268810b6ec90bfcbbecc6ddfdd843e74 data/actuallyadditions/loot_tables/blocks/palis_crystal_cluster.json -84e7d1632faf9762a0112e3d7ba7e83f49a8707a data/actuallyadditions/loot_tables/blocks/phantom_booster.json -388205fa694060ef81e9fd04bcc773a611bde10b data/actuallyadditions/loot_tables/blocks/phantom_breaker.json -fe259af8c76c75cdd9a2a47d2334528e08e98021 data/actuallyadditions/loot_tables/blocks/phantom_energyface.json -81723ca7bdf062c206faa947a4ca839c18e14a0b data/actuallyadditions/loot_tables/blocks/phantom_itemface.json -2c59c6d9eb85fb3ec3218262404d2a2cf1efcadb data/actuallyadditions/loot_tables/blocks/phantom_liquiface.json -d6c0f113ea7c3cc0e8c3a11860792966d516211b data/actuallyadditions/loot_tables/blocks/phantom_placer.json -a365f2f0d80e070d281a7b839c961d36f115abeb data/actuallyadditions/loot_tables/blocks/phantom_redstoneface.json -13f0d4587dac4822a26fd063a22f6f46c83e9af6 data/actuallyadditions/loot_tables/blocks/placer.json -6d9a73f94513ed92c1697d25c5d89145b016ab5d data/actuallyadditions/loot_tables/blocks/player_interface.json -bb5b9781aa9c64a1330eff6d7bb3e6c2c7f3a645 data/actuallyadditions/loot_tables/blocks/powered_furnace.json -a92f9584164335ecbcf769bc668289d76cea5d6c data/actuallyadditions/loot_tables/blocks/ranged_collector.json -d497fdb4936e1f3fdaa556da79e39f6fcbb405ed data/actuallyadditions/loot_tables/blocks/restonia_crystal_block.json -7d025b370ad83e847619627002ca835901faf235 data/actuallyadditions/loot_tables/blocks/restonia_crystal_cluster.json -bd374b67213a7ac097fa7586cfa3ec00474816b9 data/actuallyadditions/loot_tables/blocks/rice.json -4f42c1d3f01d17c22ab71bd3c33b3161fbe90de7 data/actuallyadditions/loot_tables/blocks/shock_suppressor.json -7b6d8282ee5863485614a8aa4d3cde7c712a034b data/actuallyadditions/loot_tables/blocks/smooth_black_quartz_block.json -f44b900f61f7210d15533c2e757395c3d767e21b data/actuallyadditions/loot_tables/blocks/smooth_black_quartz_slab.json -7b7cc361433b751446f6c01da60798458d978c07 data/actuallyadditions/loot_tables/blocks/smooth_black_quartz_stair.json -31300f6a16f9d76ad7af7892e76fd31fdacaea39 data/actuallyadditions/loot_tables/blocks/smooth_black_quartz_wall.json -4b6d8000f56553da02fef8f780ae6eec4dd3e4a0 data/actuallyadditions/loot_tables/blocks/tiny_torch.json -2b5543d91fe161b3b5c9cc9f657262791cb8957c data/actuallyadditions/loot_tables/blocks/vertical_digger.json -24602858f30273d46f0dd2082779e9544d7a87a6 data/actuallyadditions/loot_tables/blocks/void_crystal_block.json -45cb53d2b6f2a05bd3a44b1acfc0482d11094222 data/actuallyadditions/loot_tables/blocks/void_crystal_cluster.json -069aca316e282ab12ad8ddbcfa3c389f1a13d673 data/actuallyadditions/loot_tables/blocks/wood_casing.json -218c99fd547620a1e6ee186d427dca486212eae0 data/actuallyadditions/loot_tables/blocks/xp_solidifier.json +7c476ba0444784e06a50633e488f20deac84b989 data/actuallyadditions/loot_tables/blocks/atomic_reconstructor.json +bb5d55da383e21ce9cd6c05703ae9b16ff59b085 data/actuallyadditions/loot_tables/blocks/battery_box.json +3c4661088ed15818d8c4b4c63f74175a8b7f5b91 data/actuallyadditions/loot_tables/blocks/bio_reactor.json +67c5066a4cc1de2775574bb70707b179489511a7 data/actuallyadditions/loot_tables/blocks/black_quartz_block.json +74a0519c8b958bbcf26ede292849a8e5435f381f data/actuallyadditions/loot_tables/blocks/black_quartz_brick_block.json +d91bbca6576c922b016299fa88c7a89c9c1fbdc0 data/actuallyadditions/loot_tables/blocks/black_quartz_brick_slab.json +0d91d745894803c2a0ee7fae8242fff85b63bfbb data/actuallyadditions/loot_tables/blocks/black_quartz_brick_stair.json +6e60f0b3ba9672668a9bb017f39ded02774d64f0 data/actuallyadditions/loot_tables/blocks/black_quartz_brick_wall.json +51eb09f165b4e7f9221823ff1a7b1398042dd5fc data/actuallyadditions/loot_tables/blocks/black_quartz_ore.json +ad79549ec1bb16cb81b1c17efd3cc24d901c0d66 data/actuallyadditions/loot_tables/blocks/black_quartz_pillar_block.json +e3e0187a5a3c56469f4719450673fa6f8ed013e5 data/actuallyadditions/loot_tables/blocks/black_quartz_pillar_slab.json +ccb53f7ab56df2dc28c290dd996e3c317346d146 data/actuallyadditions/loot_tables/blocks/black_quartz_pillar_stair.json +8e2fe41c346ca3cba6d98bdd41a00feafaf2fad7 data/actuallyadditions/loot_tables/blocks/black_quartz_pillar_wall.json +e6e88f9aa1a0ee0171b96ab327e4faf58ab93fbb data/actuallyadditions/loot_tables/blocks/black_quartz_slab.json +41bbe28a14e07beccfa18914bf2e95410265ebf5 data/actuallyadditions/loot_tables/blocks/black_quartz_stair.json +d4b51e2228f12cfd5aa51d4e72b83307656f8607 data/actuallyadditions/loot_tables/blocks/black_quartz_wall.json +57031055419efa50a97d1653c3227afe9cf8ceed data/actuallyadditions/loot_tables/blocks/breaker.json +83319db556d5b892ff8ab33bce62c8282d1bbf08 data/actuallyadditions/loot_tables/blocks/canola.json +6d7c7d717df570c9b661db11a861483b4fa253e8 data/actuallyadditions/loot_tables/blocks/canola_press.json +195eab69b32f2e36f815c66e0f2e88b653fedb0f data/actuallyadditions/loot_tables/blocks/chiseled_black_quartz_block.json +6b640079b13b9f20bd883df17f763d086e64d11d data/actuallyadditions/loot_tables/blocks/chiseled_black_quartz_slab.json +2acba6eb2a214292df2d0db3fa46701ca7c9508a data/actuallyadditions/loot_tables/blocks/chiseled_black_quartz_stair.json +b1998a958433d4e5f9ff2a5aa49b4d7cea198393 data/actuallyadditions/loot_tables/blocks/chiseled_black_quartz_wall.json +6eb4516ae49ddc777468da4adffb2fd3b562a9cc data/actuallyadditions/loot_tables/blocks/coal_generator.json +3c5adae363db644f6e24c9bab93f8b98e58debeb data/actuallyadditions/loot_tables/blocks/coffee.json +3a5fb14238fded1a5bd33163328d02f334a4a5fc data/actuallyadditions/loot_tables/blocks/coffee_machine.json +56f4a5c8420dc8b69782204a2e7af552e37cd5ab data/actuallyadditions/loot_tables/blocks/crusher.json +17d4d4e009c822f4dc4617ff1a8d51fcf9933429 data/actuallyadditions/loot_tables/blocks/crusher_double.json +4c6d8c53c2ac6ee0a08a4c9e7f0f0a046bf19e18 data/actuallyadditions/loot_tables/blocks/diamatine_crystal_block.json +83ae77fd9d3cd2c7c38d3a9f30ef555b4507ac52 data/actuallyadditions/loot_tables/blocks/diamatine_crystal_cluster.json +c69a0c113a49beda5c4a7721d4a7af5b9d2c452c data/actuallyadditions/loot_tables/blocks/display_stand.json +e5a3c083bef3c3819599d6c71ddce4a3d0f257b4 data/actuallyadditions/loot_tables/blocks/dropper.json +3bb4d9f95ddd88b7e4a004fa8f4727a0e613efde data/actuallyadditions/loot_tables/blocks/emeradic_crystal_block.json +eec807466d0e33b52685a8d9bc776317a013303b data/actuallyadditions/loot_tables/blocks/emeradic_crystal_cluster.json +ebae1c4d56e3b5dd5d213ccae4a1ac8237780aa6 data/actuallyadditions/loot_tables/blocks/empowered_diamatine_crystal_block.json +a2d6ac504f0a09bca011f704ca2f25be6ebb0962 data/actuallyadditions/loot_tables/blocks/empowered_emeradic_crystal_block.json +a7162ee24237ef45f265c5c473da53cede9ff4c8 data/actuallyadditions/loot_tables/blocks/empowered_enori_crystal_block.json +cab369964320a3b66f90a835919e669cb0a5ec9a data/actuallyadditions/loot_tables/blocks/empowered_palis_crystal_block.json +fcd1cbd35d0bbc06e3e71303476857cae5e40c68 data/actuallyadditions/loot_tables/blocks/empowered_restonia_crystal_block.json +b7b4cd0a896af8a6df7233427040c094afc7889e data/actuallyadditions/loot_tables/blocks/empowered_void_crystal_block.json +95fcc7dcb49d7a35ff73d6978e97394034a5a219 data/actuallyadditions/loot_tables/blocks/empowerer.json +9e52c96a713a82d3589cd52b7d43544d1d927d3e data/actuallyadditions/loot_tables/blocks/ender_casing.json +e83a71b615f0e1b1972a819395296e13c7be56be data/actuallyadditions/loot_tables/blocks/energizer.json +be35fcd78bcb7eb299625c3a62456c34184ec21f data/actuallyadditions/loot_tables/blocks/enervator.json +6ce6b9e6ae9ee02906cd9410d53bf9b975c628b2 data/actuallyadditions/loot_tables/blocks/enori_crystal_block.json +0c8c4e819bced6cdc1a887d6b00a07b76452fe36 data/actuallyadditions/loot_tables/blocks/enori_crystal_cluster.json +e9ad8228fa30d5f8d56088d57c445073fa9d380b data/actuallyadditions/loot_tables/blocks/ethetic_green_block.json +9ef0bf1effdb5f3732fbd27617f50fb1672b3ee3 data/actuallyadditions/loot_tables/blocks/ethetic_green_slab.json +23656b1068400b349adf5ed3fb62265beae1b4ec data/actuallyadditions/loot_tables/blocks/ethetic_green_stairs.json +dcf88d90a7c0aaed3745222140dd7762285e4a99 data/actuallyadditions/loot_tables/blocks/ethetic_green_wall.json +3817a07ac3d8e6b7295185b5b30e945c836bd86e data/actuallyadditions/loot_tables/blocks/ethetic_white_block.json +6560b21185ffa6fdc540136cf8e223bc6883202b data/actuallyadditions/loot_tables/blocks/ethetic_white_slab.json +cc80737398b55d3244a76b461fcbe71520a1584a data/actuallyadditions/loot_tables/blocks/ethetic_white_stairs.json +49605a5bbb985781710584647b3e8c7e4b5a5813 data/actuallyadditions/loot_tables/blocks/ethetic_white_wall.json +f4cc5421009f16223f505379189260b4b6204ec2 data/actuallyadditions/loot_tables/blocks/farmer.json +08959a6e9cdac1b59d8015db38d36fb24a04bc7f data/actuallyadditions/loot_tables/blocks/feeder.json +650409e01fc826b133e41e1041c8d1d521b9fd40 data/actuallyadditions/loot_tables/blocks/fermenting_barrel.json +c91f4678917231a691a00716f8cc76f7c0511627 data/actuallyadditions/loot_tables/blocks/firework_box.json +096fc3f758f0b02557bce73588c5f143e908544d data/actuallyadditions/loot_tables/blocks/flax.json +88fa30109d1ae55999ded8ff6559cc624d9c98fb data/actuallyadditions/loot_tables/blocks/fluid_collector.json +cf193f4e8ff7cd8ad3a1a1b1101bcf5445814ecb data/actuallyadditions/loot_tables/blocks/fluid_placer.json +390934605a8630a35993bfa30e47cc3aca2ad595 data/actuallyadditions/loot_tables/blocks/greenhouse_glass.json +dc57d4928bf987ce6a3ca4f10201bbd9dfeccb60 data/actuallyadditions/loot_tables/blocks/heat_collector.json +6d711189bf7dc33281d08f8a90c8383233e3217c data/actuallyadditions/loot_tables/blocks/hopping_item_interface.json +733e0d4226ae2775e8c619e8bba71f1515906b31 data/actuallyadditions/loot_tables/blocks/iron_casing.json +251b67acc2885871d7f9f3e90bb58653028221e1 data/actuallyadditions/loot_tables/blocks/item_interface.json +616213a5f05126c426b9c086fbd80b7c417a0676 data/actuallyadditions/loot_tables/blocks/lamp_black.json +0882989c2d2fa73d9b7eb1134b3bdd39931f7461 data/actuallyadditions/loot_tables/blocks/lamp_blue.json +695c0d10ab6b8dee27e21154a84e24e758560da5 data/actuallyadditions/loot_tables/blocks/lamp_brown.json +1462d92d68a90eb29c71c0925ba13cbd7ceb3aec data/actuallyadditions/loot_tables/blocks/lamp_controller.json +b057482b4f89b58b92271b88977e6238a3ebe2f9 data/actuallyadditions/loot_tables/blocks/lamp_cyan.json +cffcbd28f1980e562962ea005f8c58b1e5ad9fd0 data/actuallyadditions/loot_tables/blocks/lamp_gray.json +41be9d52cfee4ef7b84253bddab902f51924ffa7 data/actuallyadditions/loot_tables/blocks/lamp_green.json +7a971b3c9384a24ba199b5fad794a7a381dc6fa9 data/actuallyadditions/loot_tables/blocks/lamp_light_blue.json +3638cb431eccbadb84af54a04643324780da45e9 data/actuallyadditions/loot_tables/blocks/lamp_light_gray.json +4bc4f90b90b378a1e5bd4ac3af7452f11733cae5 data/actuallyadditions/loot_tables/blocks/lamp_lime.json +9a1301e0d404659ce76e178d198a61e79dbf48a8 data/actuallyadditions/loot_tables/blocks/lamp_magenta.json +6321365d03d3d9e89e00ce956206d919fb34fe70 data/actuallyadditions/loot_tables/blocks/lamp_orange.json +363ca3423176fd84e4ed0e2f754755340064119a data/actuallyadditions/loot_tables/blocks/lamp_pink.json +bd78ccea95b84d4274e1a1837c5a93982624742b data/actuallyadditions/loot_tables/blocks/lamp_purple.json +7793353acbcdcf245efa93e6d3d11be22a79a384 data/actuallyadditions/loot_tables/blocks/lamp_red.json +b3e7ddf1c7b1d464a265b4aa352e0b79126723f9 data/actuallyadditions/loot_tables/blocks/lamp_white.json +d30f652cdb2150ca9d0f47166dc00609f37f5581 data/actuallyadditions/loot_tables/blocks/lamp_yellow.json +2998b41fd240776f6b2f751cbbf21d1ca3c95820 data/actuallyadditions/loot_tables/blocks/laser_relay.json +dd5dc8470140a9b0f776b8058aa242e037ee0b04 data/actuallyadditions/loot_tables/blocks/laser_relay_advanced.json +3f2a6f0a5fb52bd916de8cd3a343526b21c9e6bc data/actuallyadditions/loot_tables/blocks/laser_relay_extreme.json +500635b445c60a503f8a920c672fb11fa890019a data/actuallyadditions/loot_tables/blocks/laser_relay_fluids.json +d1a32f911e62430f4fbd464775f6381d213d2d04 data/actuallyadditions/loot_tables/blocks/laser_relay_item.json +ddd6ee3c8820d67e5acc1e67acceb8ff99a9351a data/actuallyadditions/loot_tables/blocks/laser_relay_item_advanced.json +951f738b1ef07b6a626a3c5c39c5cb1c412f2edd data/actuallyadditions/loot_tables/blocks/lava_factory_casing.json +f3cf4d36f16e08e030c25de5cdfa93976d156a22 data/actuallyadditions/loot_tables/blocks/lava_factory_controller.json +ff91dda525da8b68aba564bfe88555d6c676d595 data/actuallyadditions/loot_tables/blocks/leaf_generator.json +1e745ced069d8181f0ea3d1b132bbb84db8efbac data/actuallyadditions/loot_tables/blocks/long_range_breaker.json +a339b6b2a9caa625029385e9604870f5a4f378ea data/actuallyadditions/loot_tables/blocks/oil_generator.json +47ab98d1402e17a205ec8865f6f7f0d704d9e7a1 data/actuallyadditions/loot_tables/blocks/palis_crystal_block.json +a1b2464021b0a0aa0401ace533dda2d92edacfc9 data/actuallyadditions/loot_tables/blocks/palis_crystal_cluster.json +72c97009f21477806dde65eff46eb1758ce224ee data/actuallyadditions/loot_tables/blocks/phantom_booster.json +1425c19c5cacf71294ddbb2c12383bb141fcc2f5 data/actuallyadditions/loot_tables/blocks/phantom_breaker.json +de00666ae75aa71f352d5b9d3c7c4ea9f62874c6 data/actuallyadditions/loot_tables/blocks/phantom_energyface.json +36746cc3164805ab46d34892c8206eee0212edb5 data/actuallyadditions/loot_tables/blocks/phantom_itemface.json +0eb15c4cdfdccb5207577be061b773852d715d93 data/actuallyadditions/loot_tables/blocks/phantom_liquiface.json +8bbc2c05cd1cc0d8cc1d5ec7230056f0691e3bed data/actuallyadditions/loot_tables/blocks/phantom_placer.json +27e84fefae09c6f00d88918223be693f43f8f754 data/actuallyadditions/loot_tables/blocks/phantom_redstoneface.json +51293067f66de14942faa14105f099d931b73885 data/actuallyadditions/loot_tables/blocks/placer.json +ba950fc805546f2ed7c2a4d229881dd1f93922a9 data/actuallyadditions/loot_tables/blocks/player_interface.json +f3a486718523a4cbfad968849e2e68433e629ec5 data/actuallyadditions/loot_tables/blocks/powered_furnace.json +91f5fc461c294bcb386fc207d5d286b0eb30dd48 data/actuallyadditions/loot_tables/blocks/ranged_collector.json +91bc0ca71f77559edeb53a1890a9101e705f69f8 data/actuallyadditions/loot_tables/blocks/restonia_crystal_block.json +03058b2216c8e6ba63b8d03d085958265177f767 data/actuallyadditions/loot_tables/blocks/restonia_crystal_cluster.json +7088d02cc3db67b5b0bdafb11238f70c46d8a1ec data/actuallyadditions/loot_tables/blocks/rice.json +5e5b0d4e5f14451d183eb1c62e824070532011fd data/actuallyadditions/loot_tables/blocks/shock_suppressor.json +0d1bb5c5ee2cbd625edd9696e4ec3112df41d800 data/actuallyadditions/loot_tables/blocks/smooth_black_quartz_block.json +300ea1d06816038e03e2e6ec236b9bb6af757364 data/actuallyadditions/loot_tables/blocks/smooth_black_quartz_slab.json +852df54c2c4b4409ee9fd5d9336f2bf6ce95951a data/actuallyadditions/loot_tables/blocks/smooth_black_quartz_stair.json +2ab70e5e713d0cbb22a321d5f1862479bb692dfa data/actuallyadditions/loot_tables/blocks/smooth_black_quartz_wall.json +fc971ee4bff8fbcca6cfc0e0ef5e0d5120be45c1 data/actuallyadditions/loot_tables/blocks/tiny_torch.json +a2ea79148f316e1c330774cc5b3de2f7fce0fa73 data/actuallyadditions/loot_tables/blocks/vertical_digger.json +e6ca4acfe5b66ae48056f102c2356ff78aecca64 data/actuallyadditions/loot_tables/blocks/void_crystal_block.json +03f30533040961eff84f574ddb7b546d185b9fc3 data/actuallyadditions/loot_tables/blocks/void_crystal_cluster.json +a3323427ca7c75ad3a86614f25eda7a9bd483814 data/actuallyadditions/loot_tables/blocks/wood_casing.json +818b5655b0c35661f41abb8f94b600f910f992be data/actuallyadditions/loot_tables/blocks/xp_solidifier.json 64711e28d6fb7579f1ba2fed4a46440e213a2fac data/actuallyadditions/recipes/advanced_coil.json d2666ce077d5892a3bffde70ddf53492ec876900 data/actuallyadditions/recipes/advanced_leaf_blower.json a91ac0f76c7b325ac3ef0eefe5614d17f1f533d3 data/actuallyadditions/recipes/atomic_reconstructor.json @@ -842,7 +842,7 @@ f2692c35f23f12a2468dd84a1e66c1c9219a7048 data/actuallyadditions/recipes/laser_wr e51e98b13f1949ce31485b93133568792745243c data/actuallyadditions/recipes/leaf_blower.json ec31df01057ad65de89068b01f96b3fb9f837bb4 data/actuallyadditions/recipes/lens.json 634680e59ff81f293e3c44fd871e84fca96336ea data/actuallyadditions/recipes/lens_of_disenchanting.json -9a958fc55ca0f759841f9813a8449639e175bbcc data/actuallyadditions/recipes/lens_of_the_killer.json +46bd3a03bb46db005c8de2dcb563d36c01a5210b data/actuallyadditions/recipes/lens_of_the_killer.json 1d560167a16962d870f0a4bf0cf9e74ac1431b3c data/actuallyadditions/recipes/lens_of_the_miner.json 701af1122ed158e5d162815a9f744169031698f4 data/actuallyadditions/recipes/liquid_fuel/canola_oil.json 0c908206a367aa9c04f751d1f69aa50d6d09ce3a data/actuallyadditions/recipes/liquid_fuel/crystallized_canola_oil.json @@ -892,8 +892,13 @@ d8611ae9f616794678bb7f2d0c253383f09e8b27 data/actuallyadditions/recipes/vertical 17503be947b6e654606f28e6d07d197eb91abc88 data/actuallyadditions/recipes/wings_of_the_bats.json c562b938e29b85572f1b30952f5711bca2c9c899 data/actuallyadditions/recipes/wood_casing.json 5d0b3e0b27c0a7f82438fd24673866ce087d47f0 data/actuallyadditions/recipes/wooden_aiot.json +f25af32614eaea3e33bbbe473df3768ed1575261 data/actuallyadditions/tags/blocks/mineable/aio.json +f455b03ca55c4ab3e7b0e1e60a516332cfe41fa7 data/actuallyadditions/tags/blocks/mineable/drill.json a18f00e11fa55ff1b767eeab7a4756c2e0e93429 data/actuallyadditions/tags/items/coffee_beans.json 1714cd34792c6448f7316094c105e2e953b36e73 data/actuallyadditions/tags/items/crystals.json 2290b1829e049ab3002f3576379ad58f6d7b6ace data/actuallyadditions/tags/items/drills.json 8c1e24d7377b6bdf64c13643d94c3826ac925c25 data/actuallyadditions/tags/items/tiny_coals.json +6d90fc27d45eb34ac60019b82494e90acba77135 data/minecraft/tags/blocks/mineable/axe.json +be19b436d177039f96f3dea1ce5a8e6e749d4844 data/minecraft/tags/blocks/mineable/pickaxe.json +925347d0ff7e8c38945bb9782564e5321f2846bd data/minecraft/tags/blocks/needs_stone_tool.json 84fb4202cf40368e8c1a1d36bca0a4952aa05866 data/minecraft/tags/blocks/walls.json diff --git a/src/generated/resources/data/actuallyadditions/advancements/craft_coal_generator.json b/src/generated/resources/data/actuallyadditions/advancements/craft_coal_generator.json index 10b90820f..31a04ed84 100644 --- a/src/generated/resources/data/actuallyadditions/advancements/craft_coal_generator.json +++ b/src/generated/resources/data/actuallyadditions/advancements/craft_coal_generator.json @@ -21,7 +21,9 @@ "conditions": { "items": [ { - "item": "actuallyadditions:coal_generator" + "items": [ + "actuallyadditions:coal_generator" + ] } ] } diff --git a/src/generated/resources/data/actuallyadditions/advancements/craft_coffee_machine.json b/src/generated/resources/data/actuallyadditions/advancements/craft_coffee_machine.json index 3ad10d567..e488c7c76 100644 --- a/src/generated/resources/data/actuallyadditions/advancements/craft_coffee_machine.json +++ b/src/generated/resources/data/actuallyadditions/advancements/craft_coffee_machine.json @@ -21,7 +21,9 @@ "conditions": { "items": [ { - "item": "actuallyadditions:coffee_machine" + "items": [ + "actuallyadditions:coffee_machine" + ] } ] } diff --git a/src/generated/resources/data/actuallyadditions/advancements/craft_crusher.json b/src/generated/resources/data/actuallyadditions/advancements/craft_crusher.json index d3b5a240f..715e683ea 100644 --- a/src/generated/resources/data/actuallyadditions/advancements/craft_crusher.json +++ b/src/generated/resources/data/actuallyadditions/advancements/craft_crusher.json @@ -21,7 +21,9 @@ "conditions": { "items": [ { - "item": "actuallyadditions:crusher" + "items": [ + "actuallyadditions:crusher" + ] } ] } diff --git a/src/generated/resources/data/actuallyadditions/advancements/craft_double_crusher.json b/src/generated/resources/data/actuallyadditions/advancements/craft_double_crusher.json index bb0e12447..21094f45d 100644 --- a/src/generated/resources/data/actuallyadditions/advancements/craft_double_crusher.json +++ b/src/generated/resources/data/actuallyadditions/advancements/craft_double_crusher.json @@ -21,7 +21,9 @@ "conditions": { "items": [ { - "item": "actuallyadditions:crusher_double" + "items": [ + "actuallyadditions:crusher_double" + ] } ] } diff --git a/src/generated/resources/data/actuallyadditions/advancements/craft_empowerer.json b/src/generated/resources/data/actuallyadditions/advancements/craft_empowerer.json index efe01e237..5353af633 100644 --- a/src/generated/resources/data/actuallyadditions/advancements/craft_empowerer.json +++ b/src/generated/resources/data/actuallyadditions/advancements/craft_empowerer.json @@ -21,7 +21,9 @@ "conditions": { "items": [ { - "item": "actuallyadditions:empowerer" + "items": [ + "actuallyadditions:empowerer" + ] } ] } diff --git a/src/generated/resources/data/actuallyadditions/advancements/craft_energyface.json b/src/generated/resources/data/actuallyadditions/advancements/craft_energyface.json index ae34fdf5a..555e79de5 100644 --- a/src/generated/resources/data/actuallyadditions/advancements/craft_energyface.json +++ b/src/generated/resources/data/actuallyadditions/advancements/craft_energyface.json @@ -21,7 +21,9 @@ "conditions": { "items": [ { - "item": "actuallyadditions:phantom_energyface" + "items": [ + "actuallyadditions:phantom_energyface" + ] } ] } diff --git a/src/generated/resources/data/actuallyadditions/advancements/craft_item_interface.json b/src/generated/resources/data/actuallyadditions/advancements/craft_item_interface.json index f27a264af..fa6e38e5b 100644 --- a/src/generated/resources/data/actuallyadditions/advancements/craft_item_interface.json +++ b/src/generated/resources/data/actuallyadditions/advancements/craft_item_interface.json @@ -21,7 +21,9 @@ "conditions": { "items": [ { - "item": "actuallyadditions:item_interface" + "items": [ + "actuallyadditions:item_interface" + ] } ] } diff --git a/src/generated/resources/data/actuallyadditions/advancements/craft_laser_relay.json b/src/generated/resources/data/actuallyadditions/advancements/craft_laser_relay.json index 9d921b423..67dc9581d 100644 --- a/src/generated/resources/data/actuallyadditions/advancements/craft_laser_relay.json +++ b/src/generated/resources/data/actuallyadditions/advancements/craft_laser_relay.json @@ -21,7 +21,9 @@ "conditions": { "items": [ { - "item": "actuallyadditions:laser_relay" + "items": [ + "actuallyadditions:laser_relay" + ] } ] } diff --git a/src/generated/resources/data/actuallyadditions/advancements/craft_laser_relay_advanced.json b/src/generated/resources/data/actuallyadditions/advancements/craft_laser_relay_advanced.json index 80c64d44c..9fef2a695 100644 --- a/src/generated/resources/data/actuallyadditions/advancements/craft_laser_relay_advanced.json +++ b/src/generated/resources/data/actuallyadditions/advancements/craft_laser_relay_advanced.json @@ -21,7 +21,9 @@ "conditions": { "items": [ { - "item": "actuallyadditions:laser_relay_advanced" + "items": [ + "actuallyadditions:laser_relay_advanced" + ] } ] } diff --git a/src/generated/resources/data/actuallyadditions/advancements/craft_laser_relay_extreme.json b/src/generated/resources/data/actuallyadditions/advancements/craft_laser_relay_extreme.json index 0c47c61cc..ddf4e9caa 100644 --- a/src/generated/resources/data/actuallyadditions/advancements/craft_laser_relay_extreme.json +++ b/src/generated/resources/data/actuallyadditions/advancements/craft_laser_relay_extreme.json @@ -21,7 +21,9 @@ "conditions": { "items": [ { - "item": "actuallyadditions:laser_relay_extreme" + "items": [ + "actuallyadditions:laser_relay_extreme" + ] } ] } diff --git a/src/generated/resources/data/actuallyadditions/advancements/craft_laser_relay_item.json b/src/generated/resources/data/actuallyadditions/advancements/craft_laser_relay_item.json index 92f4fa7bd..9abffffba 100644 --- a/src/generated/resources/data/actuallyadditions/advancements/craft_laser_relay_item.json +++ b/src/generated/resources/data/actuallyadditions/advancements/craft_laser_relay_item.json @@ -21,7 +21,9 @@ "conditions": { "items": [ { - "item": "actuallyadditions:laser_relay_item" + "items": [ + "actuallyadditions:laser_relay_item" + ] } ] } diff --git a/src/generated/resources/data/actuallyadditions/advancements/craft_leaf_generator.json b/src/generated/resources/data/actuallyadditions/advancements/craft_leaf_generator.json index 4e7de054b..53685adc3 100644 --- a/src/generated/resources/data/actuallyadditions/advancements/craft_leaf_generator.json +++ b/src/generated/resources/data/actuallyadditions/advancements/craft_leaf_generator.json @@ -21,7 +21,9 @@ "conditions": { "items": [ { - "item": "actuallyadditions:leaf_generator" + "items": [ + "actuallyadditions:leaf_generator" + ] } ] } diff --git a/src/generated/resources/data/actuallyadditions/advancements/craft_liquiface.json b/src/generated/resources/data/actuallyadditions/advancements/craft_liquiface.json index 782ae3951..71d4f4903 100644 --- a/src/generated/resources/data/actuallyadditions/advancements/craft_liquiface.json +++ b/src/generated/resources/data/actuallyadditions/advancements/craft_liquiface.json @@ -21,7 +21,9 @@ "conditions": { "items": [ { - "item": "actuallyadditions:phantom_liquiface" + "items": [ + "actuallyadditions:phantom_liquiface" + ] } ] } diff --git a/src/generated/resources/data/actuallyadditions/advancements/craft_phantom_face.json b/src/generated/resources/data/actuallyadditions/advancements/craft_phantom_face.json index 2c8f3334d..adaa4936e 100644 --- a/src/generated/resources/data/actuallyadditions/advancements/craft_phantom_face.json +++ b/src/generated/resources/data/actuallyadditions/advancements/craft_phantom_face.json @@ -22,7 +22,9 @@ "conditions": { "items": [ { - "item": "actuallyadditions:phantom_itemface" + "items": [ + "actuallyadditions:phantom_itemface" + ] } ] } diff --git a/src/generated/resources/data/actuallyadditions/advancements/craft_reconstructor.json b/src/generated/resources/data/actuallyadditions/advancements/craft_reconstructor.json index 405c363a0..6ce4cbf03 100644 --- a/src/generated/resources/data/actuallyadditions/advancements/craft_reconstructor.json +++ b/src/generated/resources/data/actuallyadditions/advancements/craft_reconstructor.json @@ -21,7 +21,9 @@ "conditions": { "items": [ { - "item": "actuallyadditions:atomic_reconstructor" + "items": [ + "actuallyadditions:atomic_reconstructor" + ] } ] } diff --git a/src/generated/resources/data/actuallyadditions/advancements/pickup_coffee.json b/src/generated/resources/data/actuallyadditions/advancements/pickup_coffee.json index 2b2bcada0..07803b4fa 100644 --- a/src/generated/resources/data/actuallyadditions/advancements/pickup_coffee.json +++ b/src/generated/resources/data/actuallyadditions/advancements/pickup_coffee.json @@ -21,7 +21,9 @@ "conditions": { "items": [ { - "item": "actuallyadditions:coffee_beans" + "items": [ + "actuallyadditions:coffee_beans" + ] } ] } diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/atomic_reconstructor.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/atomic_reconstructor.json index 7f8a593e1..1054ce438 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/atomic_reconstructor.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/atomic_reconstructor.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/battery_box.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/battery_box.json index cc3783fcc..3f63c6924 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/battery_box.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/battery_box.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/bio_reactor.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/bio_reactor.json index 7e53a85f6..60439a516 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/bio_reactor.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/bio_reactor.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_block.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_block.json index c349d995b..598323abb 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_block.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_block.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_brick_block.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_brick_block.json index c85c03adf..7c650b89c 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_brick_block.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_brick_block.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_brick_slab.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_brick_slab.json index f2898361b..6bbc59b94 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_brick_slab.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_brick_slab.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_brick_stair.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_brick_stair.json index 26d4ab873..d66d22c8a 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_brick_stair.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_brick_stair.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_brick_wall.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_brick_wall.json index 60bf420c5..643e7c14f 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_brick_wall.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_brick_wall.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_ore.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_ore.json index cde4868eb..d25ac3370 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_ore.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_ore.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_pillar_block.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_pillar_block.json index 7e8df5dde..02033ad87 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_pillar_block.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_pillar_block.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_pillar_slab.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_pillar_slab.json index 620008d31..6798b9899 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_pillar_slab.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_pillar_slab.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_pillar_stair.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_pillar_stair.json index 6c2943e38..bb3cf0d61 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_pillar_stair.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_pillar_stair.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_pillar_wall.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_pillar_wall.json index 17e277eb6..b20f0d41d 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_pillar_wall.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_pillar_wall.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_slab.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_slab.json index f9cc6ccfb..1bd033119 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_slab.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_slab.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_stair.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_stair.json index 1c0313302..26476d55f 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_stair.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_stair.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_wall.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_wall.json index 119bc938f..1c5410f66 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_wall.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/black_quartz_wall.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/breaker.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/breaker.json index 75b4f2e82..249eaaa8f 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/breaker.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/breaker.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/canola.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/canola.json index fee7d3116..b3b7a7828 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/canola.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/canola.json @@ -3,6 +3,7 @@ "pools": [ { "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -30,6 +31,7 @@ }, { "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/canola_press.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/canola_press.json index b051f7ea6..015c84660 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/canola_press.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/canola_press.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/chiseled_black_quartz_block.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/chiseled_black_quartz_block.json index 5d709f85d..cb9d06fee 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/chiseled_black_quartz_block.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/chiseled_black_quartz_block.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/chiseled_black_quartz_slab.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/chiseled_black_quartz_slab.json index f50eeafda..7d6b111ca 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/chiseled_black_quartz_slab.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/chiseled_black_quartz_slab.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/chiseled_black_quartz_stair.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/chiseled_black_quartz_stair.json index 0c7c22f05..df0b9dbe8 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/chiseled_black_quartz_stair.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/chiseled_black_quartz_stair.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/chiseled_black_quartz_wall.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/chiseled_black_quartz_wall.json index bafebbace..6b40fcadf 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/chiseled_black_quartz_wall.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/chiseled_black_quartz_wall.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/coal_generator.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/coal_generator.json index dbb3d389d..fa7efa496 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/coal_generator.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/coal_generator.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/coffee.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/coffee.json index a12e5c4c9..325f11ad2 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/coffee.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/coffee.json @@ -3,6 +3,7 @@ "pools": [ { "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -30,6 +31,7 @@ }, { "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/coffee_machine.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/coffee_machine.json index be08468f4..efdfc9ebe 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/coffee_machine.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/coffee_machine.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/crusher.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/crusher.json index d3cc6a7ff..2dc3ac2b1 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/crusher.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/crusher.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/crusher_double.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/crusher_double.json index 6d67d9a3f..16b1926cd 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/crusher_double.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/crusher_double.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/diamatine_crystal_block.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/diamatine_crystal_block.json index 3704715f1..8d02e3718 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/diamatine_crystal_block.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/diamatine_crystal_block.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/diamatine_crystal_cluster.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/diamatine_crystal_cluster.json index 934d71467..f94a936cb 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/diamatine_crystal_cluster.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/diamatine_crystal_cluster.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/display_stand.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/display_stand.json index 77fcb37f1..1d2356135 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/display_stand.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/display_stand.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/dropper.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/dropper.json index e453d016b..d037144f4 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/dropper.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/dropper.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/emeradic_crystal_block.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/emeradic_crystal_block.json index 95c7982a8..39745aea1 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/emeradic_crystal_block.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/emeradic_crystal_block.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/emeradic_crystal_cluster.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/emeradic_crystal_cluster.json index 49739a130..f3c1e44e6 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/emeradic_crystal_cluster.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/emeradic_crystal_cluster.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowered_diamatine_crystal_block.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowered_diamatine_crystal_block.json index 278e689e8..adeb26142 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowered_diamatine_crystal_block.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowered_diamatine_crystal_block.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowered_emeradic_crystal_block.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowered_emeradic_crystal_block.json index 1ad79f4fb..ebd0f62ed 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowered_emeradic_crystal_block.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowered_emeradic_crystal_block.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowered_enori_crystal_block.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowered_enori_crystal_block.json index ed2b3c2a7..040b109e7 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowered_enori_crystal_block.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowered_enori_crystal_block.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowered_palis_crystal_block.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowered_palis_crystal_block.json index 5d05cfaa0..66fb81542 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowered_palis_crystal_block.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowered_palis_crystal_block.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowered_restonia_crystal_block.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowered_restonia_crystal_block.json index 1162e05fc..e635129bd 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowered_restonia_crystal_block.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowered_restonia_crystal_block.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowered_void_crystal_block.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowered_void_crystal_block.json index 48e3ee045..977f40f13 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowered_void_crystal_block.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowered_void_crystal_block.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowerer.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowerer.json index 6c87a1b0d..9784699f6 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowerer.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/empowerer.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ender_casing.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ender_casing.json index b8480d0b3..8c0b34e27 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ender_casing.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ender_casing.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/energizer.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/energizer.json index 40eda9fa9..2018794d8 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/energizer.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/energizer.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/enervator.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/enervator.json index 1c2e317a7..a34c3c96c 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/enervator.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/enervator.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/enori_crystal_block.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/enori_crystal_block.json index 7812cc289..7b1c1d2f2 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/enori_crystal_block.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/enori_crystal_block.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/enori_crystal_cluster.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/enori_crystal_cluster.json index 03d13e69f..3080e00b9 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/enori_crystal_cluster.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/enori_crystal_cluster.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_green_block.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_green_block.json index 11655c60f..afb60f13f 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_green_block.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_green_block.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_green_slab.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_green_slab.json index c0f71c050..0855a601f 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_green_slab.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_green_slab.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_green_stairs.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_green_stairs.json index eb7469718..4dd260e7f 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_green_stairs.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_green_stairs.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_green_wall.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_green_wall.json index 1022b37d9..3a9e14efe 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_green_wall.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_green_wall.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_white_block.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_white_block.json index 95626507f..17f2d1365 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_white_block.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_white_block.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_white_slab.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_white_slab.json index 739231548..da141db6d 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_white_slab.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_white_slab.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_white_stairs.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_white_stairs.json index ed0b5d407..b57ea1d90 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_white_stairs.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_white_stairs.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_white_wall.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_white_wall.json index fef6318e3..334165edb 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_white_wall.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ethetic_white_wall.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/farmer.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/farmer.json index f5d7decef..cc7b4e28e 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/farmer.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/farmer.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/feeder.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/feeder.json index d8455965b..0a5418e23 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/feeder.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/feeder.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/fermenting_barrel.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/fermenting_barrel.json index 316a0fd33..5f771aa63 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/fermenting_barrel.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/fermenting_barrel.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/firework_box.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/firework_box.json index b849b5634..d4d996294 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/firework_box.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/firework_box.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/flax.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/flax.json index bbd332024..7025abdbe 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/flax.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/flax.json @@ -3,6 +3,7 @@ "pools": [ { "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -30,6 +31,7 @@ }, { "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/fluid_collector.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/fluid_collector.json index 2ef37ac61..d7f123c78 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/fluid_collector.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/fluid_collector.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/fluid_placer.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/fluid_placer.json index a26d40596..894e79fec 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/fluid_placer.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/fluid_placer.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/greenhouse_glass.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/greenhouse_glass.json index 82a4c7345..b0abe5f8d 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/greenhouse_glass.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/greenhouse_glass.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/heat_collector.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/heat_collector.json index 666cf36bc..06fab2a33 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/heat_collector.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/heat_collector.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/hopping_item_interface.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/hopping_item_interface.json index 43824b2a1..f3f59af62 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/hopping_item_interface.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/hopping_item_interface.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/iron_casing.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/iron_casing.json index 1607c5d56..157ca96d0 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/iron_casing.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/iron_casing.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/item_interface.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/item_interface.json index 33c35df22..8609b8dab 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/item_interface.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/item_interface.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_black.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_black.json index b310c2238..10f140aee 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_black.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_black.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_blue.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_blue.json index e07de6fb6..8ac9b4e3c 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_blue.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_blue.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_brown.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_brown.json index ae58a56d3..bdfd31329 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_brown.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_brown.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_controller.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_controller.json index 6e2905aad..2544bf104 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_controller.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_controller.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_cyan.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_cyan.json index 3f2534a63..8e91bdcb9 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_cyan.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_cyan.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_gray.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_gray.json index 790a33a64..7a3a6e072 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_gray.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_gray.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_green.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_green.json index 92ccdf7c0..02f1fd2f2 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_green.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_green.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_light_blue.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_light_blue.json index 1c146e07d..1364c84d4 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_light_blue.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_light_blue.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_light_gray.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_light_gray.json index 351092aca..f0feae162 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_light_gray.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_light_gray.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_lime.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_lime.json index 12dd72f26..40e4d6093 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_lime.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_lime.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_magenta.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_magenta.json index e4acf9dc6..e031695ad 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_magenta.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_magenta.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_orange.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_orange.json index aea32880b..b1f7533d8 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_orange.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_orange.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_pink.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_pink.json index 5bb862ca7..155fcf4e6 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_pink.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_pink.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_purple.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_purple.json index d4cffa594..8f8561e41 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_purple.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_purple.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_red.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_red.json index 865ba6041..e498e6d17 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_red.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_red.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_white.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_white.json index bc964510c..819009386 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_white.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_white.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_yellow.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_yellow.json index 88f7b6d7b..8b42e5419 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_yellow.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lamp_yellow.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/laser_relay.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/laser_relay.json index 974b46b05..a75c1c700 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/laser_relay.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/laser_relay.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/laser_relay_advanced.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/laser_relay_advanced.json index ed921d838..d1f1ab4e5 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/laser_relay_advanced.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/laser_relay_advanced.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/laser_relay_extreme.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/laser_relay_extreme.json index e12231e8d..730316004 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/laser_relay_extreme.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/laser_relay_extreme.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/laser_relay_fluids.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/laser_relay_fluids.json index 40ff1bf4b..d10694a22 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/laser_relay_fluids.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/laser_relay_fluids.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/laser_relay_item.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/laser_relay_item.json index 4362ae851..a4001d3fe 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/laser_relay_item.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/laser_relay_item.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/laser_relay_item_advanced.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/laser_relay_item_advanced.json index 417cf655f..c56f0f75c 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/laser_relay_item_advanced.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/laser_relay_item_advanced.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lava_factory_casing.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lava_factory_casing.json index 9203cdaf6..d65699e50 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lava_factory_casing.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lava_factory_casing.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lava_factory_controller.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lava_factory_controller.json index a51f05555..ce43b4217 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lava_factory_controller.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/lava_factory_controller.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/leaf_generator.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/leaf_generator.json index cee315d03..abd380ec7 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/leaf_generator.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/leaf_generator.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/long_range_breaker.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/long_range_breaker.json index 3aabeb3f6..a0f462673 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/long_range_breaker.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/long_range_breaker.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/oil_generator.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/oil_generator.json index 4405208c1..c393f058a 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/oil_generator.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/oil_generator.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/palis_crystal_block.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/palis_crystal_block.json index 3921c4344..d17752cc9 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/palis_crystal_block.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/palis_crystal_block.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/palis_crystal_cluster.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/palis_crystal_cluster.json index 3dff1575a..34224fbc7 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/palis_crystal_cluster.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/palis_crystal_cluster.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_booster.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_booster.json index 56a3a386c..6b7f3adf8 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_booster.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_booster.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_breaker.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_breaker.json index 3a239e439..f9a8780d4 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_breaker.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_breaker.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_energyface.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_energyface.json index 5aa30bbd6..9df709985 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_energyface.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_energyface.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_itemface.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_itemface.json index 02a9549d4..e4f4e5d83 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_itemface.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_itemface.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_liquiface.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_liquiface.json index da68bb045..7214352e8 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_liquiface.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_liquiface.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_placer.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_placer.json index ac9a9e788..d07fedb09 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_placer.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_placer.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_redstoneface.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_redstoneface.json index a3fb43b99..16a7eb941 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_redstoneface.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/phantom_redstoneface.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/placer.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/placer.json index fe6d92410..441ddf30e 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/placer.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/placer.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/player_interface.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/player_interface.json index 5f291febc..03c3a189d 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/player_interface.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/player_interface.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/powered_furnace.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/powered_furnace.json index da1571118..8086e5274 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/powered_furnace.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/powered_furnace.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ranged_collector.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ranged_collector.json index 23d55561d..b0b03792f 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ranged_collector.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/ranged_collector.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/restonia_crystal_block.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/restonia_crystal_block.json index 347561b44..315433d0c 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/restonia_crystal_block.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/restonia_crystal_block.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/restonia_crystal_cluster.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/restonia_crystal_cluster.json index bc5cf1be1..99614b795 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/restonia_crystal_cluster.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/restonia_crystal_cluster.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/rice.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/rice.json index 3ec5f7bc5..014ed3aab 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/rice.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/rice.json @@ -3,6 +3,7 @@ "pools": [ { "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", @@ -30,6 +31,7 @@ }, { "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/shock_suppressor.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/shock_suppressor.json index f9f248b51..a2ccdd18d 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/shock_suppressor.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/shock_suppressor.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/smooth_black_quartz_block.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/smooth_black_quartz_block.json index 8550f0446..5fc1b2f73 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/smooth_black_quartz_block.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/smooth_black_quartz_block.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/smooth_black_quartz_slab.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/smooth_black_quartz_slab.json index 2741e1ee2..c99cb676c 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/smooth_black_quartz_slab.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/smooth_black_quartz_slab.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/smooth_black_quartz_stair.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/smooth_black_quartz_stair.json index 5a8908830..933a915d6 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/smooth_black_quartz_stair.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/smooth_black_quartz_stair.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/smooth_black_quartz_wall.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/smooth_black_quartz_wall.json index ee414b56c..f31422f41 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/smooth_black_quartz_wall.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/smooth_black_quartz_wall.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/tiny_torch.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/tiny_torch.json index c7319da63..6a1ef52e0 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/tiny_torch.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/tiny_torch.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/vertical_digger.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/vertical_digger.json index 722ab9ea0..91dc432a6 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/vertical_digger.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/vertical_digger.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/void_crystal_block.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/void_crystal_block.json index 99f296029..c3a95c3c9 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/void_crystal_block.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/void_crystal_block.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/void_crystal_cluster.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/void_crystal_cluster.json index 8e2350932..bf676af26 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/void_crystal_cluster.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/void_crystal_cluster.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/wood_casing.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/wood_casing.json index e52db8519..8df18ba49 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/wood_casing.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/wood_casing.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/xp_solidifier.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/xp_solidifier.json index dcda55b39..27d7de05f 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/xp_solidifier.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/xp_solidifier.json @@ -2,7 +2,8 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", diff --git a/src/generated/resources/data/actuallyadditions/recipes/lens_of_the_killer.json b/src/generated/resources/data/actuallyadditions/recipes/lens_of_the_killer.json index 167322151..6e8b9284f 100644 --- a/src/generated/resources/data/actuallyadditions/recipes/lens_of_the_killer.json +++ b/src/generated/resources/data/actuallyadditions/recipes/lens_of_the_killer.json @@ -8,7 +8,10 @@ "item": "actuallyadditions:lens_of_certain_death" }, { - "item": "minecraft:enchanted_book" + "type": "forge:nbt", + "item": "minecraft:enchanted_book", + "count": 1, + "nbt": "{Enchantments:[{id:\"minecraft:sharpness\",lvl:5s}]}" } ], "result": { diff --git a/src/generated/resources/data/actuallyadditions/tags/blocks/mineable/aio.json b/src/generated/resources/data/actuallyadditions/tags/blocks/mineable/aio.json new file mode 100644 index 000000000..311da04cc --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/tags/blocks/mineable/aio.json @@ -0,0 +1,9 @@ +{ + "replace": false, + "values": [ + "#minecraft:mineable/axe", + "#minecraft:mineable/hoe", + "#minecraft:mineable/pickaxe", + "#minecraft:mineable/shovel" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/tags/blocks/mineable/drill.json b/src/generated/resources/data/actuallyadditions/tags/blocks/mineable/drill.json new file mode 100644 index 000000000..190180da3 --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/tags/blocks/mineable/drill.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "#minecraft:mineable/shovel", + "#minecraft:mineable/pickaxe" + ] +} \ 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/blocks/mineable/axe.json new file mode 100644 index 000000000..36b45d4a7 --- /dev/null +++ b/src/generated/resources/data/minecraft/tags/blocks/mineable/axe.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "actuallyadditions:fermenting_barrel" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json b/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json new file mode 100644 index 000000000..4da0c02df --- /dev/null +++ b/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json @@ -0,0 +1,92 @@ +{ + "replace": false, + "values": [ + "actuallyadditions:lamp_white", + "actuallyadditions:lamp_orange", + "actuallyadditions:lamp_magenta", + "actuallyadditions:lamp_light_blue", + "actuallyadditions:lamp_yellow", + "actuallyadditions:lamp_lime", + "actuallyadditions:lamp_pink", + "actuallyadditions:lamp_gray", + "actuallyadditions:lamp_light_gray", + "actuallyadditions:lamp_cyan", + "actuallyadditions:lamp_purple", + "actuallyadditions:lamp_blue", + "actuallyadditions:lamp_brown", + "actuallyadditions:lamp_green", + "actuallyadditions:lamp_red", + "actuallyadditions:lamp_black", + "actuallyadditions:leaf_generator", + "actuallyadditions:wood_casing", + "actuallyadditions:iron_casing", + "actuallyadditions:ender_casing", + "actuallyadditions:lava_factory_casing", + "actuallyadditions:black_quartz_ore", + "actuallyadditions:ethetic_green_block", + "actuallyadditions:ethetic_white_block", + "actuallyadditions:black_quartz_block", + "actuallyadditions:black_quartz_pillar_block", + "actuallyadditions:chiseled_black_quartz_block", + "actuallyadditions:smooth_black_quartz_block", + "actuallyadditions:black_quartz_brick_block", + "actuallyadditions:feeder", + "actuallyadditions:crusher", + "actuallyadditions:crusher_double", + "actuallyadditions:energizer", + "actuallyadditions:enervator", + "actuallyadditions:lava_factory_controller", + "actuallyadditions:lamp_controller", + "actuallyadditions:canola_press", + "actuallyadditions:oil_generator", + "actuallyadditions:coal_generator", + "actuallyadditions:xp_solidifier", + "actuallyadditions:placer", + "actuallyadditions:breaker", + "actuallyadditions:dropper", + "actuallyadditions:fluid_collector", + "actuallyadditions:farmer", + "actuallyadditions:bio_reactor", + "actuallyadditions:vertical_digger", + "actuallyadditions:atomic_reconstructor", + "actuallyadditions:ranged_collector", + "actuallyadditions:long_range_breaker", + "actuallyadditions:coffee_machine", + "actuallyadditions:powered_furnace", + "actuallyadditions:enori_crystal_block", + "actuallyadditions:restonia_crystal_block", + "actuallyadditions:palis_crystal_block", + "actuallyadditions:diamatine_crystal_block", + "actuallyadditions:void_crystal_block", + "actuallyadditions:emeradic_crystal_block", + "actuallyadditions:empowered_enori_crystal_block", + "actuallyadditions:empowered_restonia_crystal_block", + "actuallyadditions:empowered_palis_crystal_block", + "actuallyadditions:empowered_diamatine_crystal_block", + "actuallyadditions:empowered_void_crystal_block", + "actuallyadditions:empowered_emeradic_crystal_block", + "actuallyadditions:display_stand", + "actuallyadditions:empowerer", + "actuallyadditions:player_interface", + "actuallyadditions:item_interface", + "actuallyadditions:hopping_item_interface", + "actuallyadditions:phantom_itemface", + "actuallyadditions:phantom_placer", + "actuallyadditions:phantom_liquiface", + "actuallyadditions:phantom_energyface", + "actuallyadditions:phantom_redstoneface", + "actuallyadditions:phantom_breaker", + "actuallyadditions:phantom_booster", + "actuallyadditions:battery_box", + "actuallyadditions:firework_box", + "actuallyadditions:shock_suppressor", + "actuallyadditions:heat_collector", + "actuallyadditions:laser_relay", + "actuallyadditions:laser_relay_advanced", + "actuallyadditions:laser_relay_extreme", + "actuallyadditions:laser_relay_fluids", + "actuallyadditions:laser_relay_item", + "actuallyadditions:laser_relay_item_advanced", + "actuallyadditions:greenhouse_glass" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/tags/blocks/needs_stone_tool.json b/src/generated/resources/data/minecraft/tags/blocks/needs_stone_tool.json new file mode 100644 index 000000000..08bee803a --- /dev/null +++ b/src/generated/resources/data/minecraft/tags/blocks/needs_stone_tool.json @@ -0,0 +1,29 @@ +{ + "replace": false, + "values": [ + "actuallyadditions:wood_casing", + "actuallyadditions:iron_casing", + "actuallyadditions:ender_casing", + "actuallyadditions:lava_factory_casing", + "actuallyadditions:black_quartz_ore", + "actuallyadditions:ethetic_green_block", + "actuallyadditions:ethetic_white_block", + "actuallyadditions:black_quartz_block", + "actuallyadditions:black_quartz_pillar_block", + "actuallyadditions:chiseled_black_quartz_block", + "actuallyadditions:smooth_black_quartz_block", + "actuallyadditions:black_quartz_brick_block", + "actuallyadditions:enori_crystal_block", + "actuallyadditions:restonia_crystal_block", + "actuallyadditions:palis_crystal_block", + "actuallyadditions:diamatine_crystal_block", + "actuallyadditions:void_crystal_block", + "actuallyadditions:emeradic_crystal_block", + "actuallyadditions:empowered_enori_crystal_block", + "actuallyadditions:empowered_restonia_crystal_block", + "actuallyadditions:empowered_palis_crystal_block", + "actuallyadditions:empowered_diamatine_crystal_block", + "actuallyadditions:empowered_void_crystal_block", + "actuallyadditions:empowered_emeradic_crystal_block" + ] +} \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java b/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java index 44d4e5608..692d4d5ba 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java @@ -18,20 +18,29 @@ import de.ellpeck.actuallyadditions.api.internal.IMethodHandler; import de.ellpeck.actuallyadditions.api.laser.ILaserRelayConnectionHandler; import de.ellpeck.actuallyadditions.api.lens.Lens; import de.ellpeck.actuallyadditions.api.lens.LensConversion; -import de.ellpeck.actuallyadditions.api.recipe.*; -import de.ellpeck.actuallyadditions.mod.crafting.*; -import de.ellpeck.actuallyadditions.mod.items.lens.*; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.util.ResourceLocation; +import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient; +import de.ellpeck.actuallyadditions.api.recipe.WeightedOre; +import de.ellpeck.actuallyadditions.mod.crafting.ColorChangeRecipe; +import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe; +import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe; +import de.ellpeck.actuallyadditions.mod.crafting.FermentingRecipe; +import de.ellpeck.actuallyadditions.mod.crafting.LaserRecipe; +import de.ellpeck.actuallyadditions.mod.crafting.LiquidFuelRecipe; +import de.ellpeck.actuallyadditions.mod.crafting.MiningLensRecipe; +import de.ellpeck.actuallyadditions.mod.crafting.PressingRecipe; +import de.ellpeck.actuallyadditions.mod.crafting.SolidFuelRecipe; +import de.ellpeck.actuallyadditions.mod.items.lens.LensColor; +import de.ellpeck.actuallyadditions.mod.items.lens.LensDeath; +import de.ellpeck.actuallyadditions.mod.items.lens.LensDetonation; +import de.ellpeck.actuallyadditions.mod.items.lens.LensDisenchanting; +import de.ellpeck.actuallyadditions.mod.items.lens.LensKiller; +import de.ellpeck.actuallyadditions.mod.items.lens.LensMining; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; public final class ActuallyAdditionsAPI { diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyTags.java b/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyTags.java index afb2c435c..d55b04435 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyTags.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyTags.java @@ -1,10 +1,13 @@ package de.ellpeck.actuallyadditions.api; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import net.minecraft.item.Item; -import net.minecraft.tags.ITag; +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.BlockTags; import net.minecraft.tags.ItemTags; -import net.minecraft.util.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; public final class ActuallyTags { public static final void init() { @@ -15,14 +18,34 @@ public final class ActuallyTags { public static void touch() { // load the stupid tags } - public static final ITag.INamedTag DRILLS = tag("drills"); - public static final ITag.INamedTag COFFEE_BEANS = tag("coffee_beans"); - public static final ITag.INamedTag TINY_COALS = tag("tiny_coals"); - public static final ITag.INamedTag HOLDS_ITEMS = ItemTags.createOptional(new ResourceLocation("forge", "holds_items")); - public static final ITag.INamedTag CRYSTALS = tag("crystals"); + public static final TagKey DRILLS = tag("drills"); + public static final TagKey COFFEE_BEANS = tag("coffee_beans"); + public static final TagKey TINY_COALS = tag("tiny_coals"); + public static final TagKey HOLDS_ITEMS = ItemTags.create(new ResourceLocation("forge", "holds_items")); + public static final TagKey CRYSTALS = tag("crystals"); - private static ITag.INamedTag tag(String name) { - return ItemTags.bind(String.format("%s:%s", ActuallyAdditions.MODID, name)); + private static TagKey tag(String name) { + return TagKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(ActuallyAdditions.MODID, name)); + } + } + + public static class Blocks { + public static void touch() { + // load the stupid tags + } + + public static final TagKey MINEABLE_WITH_DRILL = tag("mineable/drill"); + public static final TagKey MINEABLE_WITH_AIO = tag("mineable/aio"); + public static final TagKey NEEDS_BLACK_QUARTZ_TOOL = tag("needs_black_quartz_tool"); + public static final TagKey NEEDS_RESTONIA_TOOL = tag("needs_restonia_tool"); + public static final TagKey NEEDS_PALIS_TOOL = tag("needs_palis_tool"); + public static final TagKey NEEDS_DIAMATINE_TOOL = tag("needs_diamatine_tool"); + public static final TagKey NEEDS_VOID_TOOL = tag("needs_void_tool"); + public static final TagKey NEEDS_EMERADIC_TOOL = tag("needs_emeradic_tool"); + public static final TagKey NEEDS_ENORI_TOOL = tag("needs_enori_tool"); + + private static TagKey tag(String name) { + return TagKey.create(Registry.BLOCK_REGISTRY, new ResourceLocation(ActuallyAdditions.MODID, name)); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletChapter.java b/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletChapter.java index d43607114..bac2207da 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletChapter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletChapter.java @@ -10,7 +10,7 @@ package de.ellpeck.actuallyadditions.api.booklet; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.ItemStack; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletPage.java b/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletPage.java index 35939ea51..ca84df9b8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletPage.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletPage.java @@ -11,8 +11,8 @@ package de.ellpeck.actuallyadditions.api.booklet; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; -import net.minecraft.client.gui.widget.button.Button; -import net.minecraft.item.ItemStack; +import net.minecraft.client.gui.components.Button; +import net.minecraft.world.item.ItemStack; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fluids.FluidStack; diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/internal/GuiBookletBase.java b/src/main/java/de/ellpeck/actuallyadditions/api/booklet/internal/GuiBookletBase.java index dad853253..fb90777e5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/internal/GuiBookletBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/booklet/internal/GuiBookletBase.java @@ -10,16 +10,16 @@ package de.ellpeck.actuallyadditions.api.booklet.internal; -import net.minecraft.client.gui.IGuiEventListener; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.item.ItemStack; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.client.gui.components.events.GuiEventListener; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.ItemStack; import java.util.List; public abstract class GuiBookletBase extends Screen { - protected GuiBookletBase(ITextComponent titleIn) { + protected GuiBookletBase(Component titleIn) { super(titleIn); } @@ -27,7 +27,7 @@ public abstract class GuiBookletBase extends Screen { public abstract void renderSplitScaledAsciiString(String text, int x, int y, int color, boolean shadow, float scale, int length); - public abstract List getButtonList(); + public abstract List getButtonList(); public abstract int getGuiLeft(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/farmer/IFarmerBehavior.java b/src/main/java/de/ellpeck/actuallyadditions/api/farmer/IFarmerBehavior.java index 6ae0616a8..910eb750e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/farmer/IFarmerBehavior.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/farmer/IFarmerBehavior.java @@ -12,11 +12,15 @@ package de.ellpeck.actuallyadditions.api.farmer; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.internal.IFarmer; -import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.*; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraft.world.server.ServerWorld; +import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.CactusFarmerBehavior; +import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.DefaultFarmerBehavior; +import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.MelonPumpkinFarmerBehavior; +import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.NetherWartFarmerBehavior; +import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.ReedFarmerBehavior; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; public interface IFarmerBehavior { @@ -31,7 +35,7 @@ public interface IFarmerBehavior { * @param farmer The Farmer doing this action. Can be used to query and extract energy and add items to the slots * @return If planting was successful */ - FarmerResult tryPlantSeed(ItemStack seed, World world, BlockPos pos, IFarmer farmer); + FarmerResult tryPlantSeed(ItemStack seed, Level world, BlockPos pos, IFarmer farmer); /** * Try to harvest a plant with this behavior @@ -41,7 +45,7 @@ public interface IFarmerBehavior { * @param farmer The Farmer doing this action. Can be used to query and extract energy and add items to the slots * @return If harvesting was successful */ - FarmerResult tryHarvestPlant(ServerWorld world, BlockPos pos, IFarmer farmer); + FarmerResult tryHarvestPlant(ServerLevel world, BlockPos pos, IFarmer farmer); int getPriority(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/internal/IAtomicReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IAtomicReconstructor.java index aefa0ec0b..f7d97a910 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/internal/IAtomicReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IAtomicReconstructor.java @@ -11,7 +11,7 @@ package de.ellpeck.actuallyadditions.api.internal; import de.ellpeck.actuallyadditions.api.lens.Lens; -import net.minecraft.util.Direction; +import net.minecraft.core.Direction; /** * This is a helper interface for Lens' invoke() method. diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/internal/IEnergyTile.java b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IEnergyTile.java index cffde8875..a05c96761 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/internal/IEnergyTile.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IEnergyTile.java @@ -10,8 +10,8 @@ package de.ellpeck.actuallyadditions.api.internal; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; /** * This is not supposed to be implemented. @@ -28,7 +28,7 @@ public interface IEnergyTile { int getZ(); //TODO: Rename to getWorld - World getWorldObject(); + Level getWorldObject(); void extractEnergy(int amount); diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/internal/IFarmer.java b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IFarmer.java index 2796cff84..39ef0f948 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/internal/IFarmer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IFarmer.java @@ -10,10 +10,10 @@ package de.ellpeck.actuallyadditions.api.internal; -import java.util.List; +import net.minecraft.core.Direction; +import net.minecraft.world.item.ItemStack; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Direction; +import java.util.List; /** * This is a helper interface for IFarmerBehavior. diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/internal/IMethodHandler.java b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IMethodHandler.java index 21ff53c89..896ed12c1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/internal/IMethodHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IMethodHandler.java @@ -11,10 +11,10 @@ package de.ellpeck.actuallyadditions.api.internal; import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient; -import net.minecraft.block.BlockState; -import net.minecraft.item.ItemStack; -import net.minecraft.potion.EffectInstance; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.state.BlockState; import java.util.List; @@ -27,13 +27,13 @@ public interface IMethodHandler { boolean addEffectToStack(ItemStack stack, CoffeeIngredient ingredient); - EffectInstance getSameEffectFromStack(ItemStack stack, EffectInstance effect); + MobEffectInstance getSameEffectFromStack(ItemStack stack, MobEffectInstance effect); - void addEffectProperties(ItemStack stack, EffectInstance effect, boolean addDur, boolean addAmp); + void addEffectProperties(ItemStack stack, MobEffectInstance effect, boolean addDur, boolean addAmp); - void addEffectToStack(ItemStack stack, EffectInstance effect); + void addEffectToStack(ItemStack stack, MobEffectInstance effect); - EffectInstance[] getEffectsFromStack(ItemStack stack); + MobEffectInstance[] getEffectsFromStack(ItemStack stack); boolean invokeConversionLens(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile); diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/laser/IConnectionPair.java b/src/main/java/de/ellpeck/actuallyadditions/api/laser/IConnectionPair.java index 5d1c9f6f0..d54522c1a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/laser/IConnectionPair.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/laser/IConnectionPair.java @@ -10,14 +10,14 @@ package de.ellpeck.actuallyadditions.api.laser; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; public interface IConnectionPair { - void writeToNBT(CompoundNBT compound); + void writeToNBT(CompoundTag compound); - void readFromNBT(CompoundNBT compound); + void readFromNBT(CompoundTag compound); BlockPos[] getPositions(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/laser/ILaserRelayConnectionHandler.java b/src/main/java/de/ellpeck/actuallyadditions/api/laser/ILaserRelayConnectionHandler.java index 700eed229..47a75558e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/laser/ILaserRelayConnectionHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/laser/ILaserRelayConnectionHandler.java @@ -11,9 +11,9 @@ package de.ellpeck.actuallyadditions.api.laser; import io.netty.util.internal.ConcurrentSet; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; /** * This is the internal laser relay connection handler. @@ -25,21 +25,21 @@ import net.minecraft.world.World; */ public interface ILaserRelayConnectionHandler { - ConcurrentSet getConnectionsFor(BlockPos relay, World world); + ConcurrentSet getConnectionsFor(BlockPos relay, Level world); - void removeRelayFromNetwork(BlockPos relay, World world); + void removeRelayFromNetwork(BlockPos relay, Level world); - Network getNetworkFor(BlockPos relay, World world); + Network getNetworkFor(BlockPos relay, Level world); - boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, World world); + boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, Level world); - boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, World world, boolean suppressConnectionRender); + boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, Level world, boolean suppressConnectionRender); - boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, World world, boolean suppressConnectionRender, boolean removeIfConnected); + boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, Level world, boolean suppressConnectionRender, boolean removeIfConnected); - void removeConnection(World world, BlockPos firstRelay, BlockPos secondRelay); + void removeConnection(Level world, BlockPos firstRelay, BlockPos secondRelay); - LaserType getTypeFromLaser(TileEntity tile); + LaserType getTypeFromLaser(BlockEntity tile); - LaserType getTypeFromLaser(BlockPos pos, World world); + LaserType getTypeFromLaser(BlockPos pos, Level world); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java b/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java index 9337f3272..06f237217 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java @@ -11,9 +11,9 @@ package de.ellpeck.actuallyadditions.api.lens; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; -import net.minecraft.block.BlockState; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.block.state.BlockState; /** * This is the base class for a Reconstructor Lens Type (NOT THE ITEM!) diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/lens/LensConversion.java b/src/main/java/de/ellpeck/actuallyadditions/api/lens/LensConversion.java index b77f4587b..722189d3b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/lens/LensConversion.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/lens/LensConversion.java @@ -12,8 +12,8 @@ package de.ellpeck.actuallyadditions.api.lens; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; -import net.minecraft.block.BlockState; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.state.BlockState; /** * This is the base class for a Reconstructor Lens Type that converts two items diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/misc/IDisplayStandItem.java b/src/main/java/de/ellpeck/actuallyadditions/api/misc/IDisplayStandItem.java index 21605c82b..e176667dd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/misc/IDisplayStandItem.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/misc/IDisplayStandItem.java @@ -10,12 +10,12 @@ package de.ellpeck.actuallyadditions.api.misc; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.entity.BlockEntity; public interface IDisplayStandItem { - boolean update(ItemStack stack, TileEntity tile, int elapsedTicks); + boolean update(ItemStack stack, BlockEntity tile, int elapsedTicks); - int getUsePerTick(ItemStack stack, TileEntity tile, int elapsedTicks); + int getUsePerTick(ItemStack stack, BlockEntity tile, int elapsedTicks); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CoffeeIngredient.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CoffeeIngredient.java index 6a1fa6381..c787f4027 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CoffeeIngredient.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CoffeeIngredient.java @@ -11,23 +11,23 @@ package de.ellpeck.actuallyadditions.api.recipe; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.potion.EffectInstance; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; @Deprecated public class CoffeeIngredient { protected final Ingredient input; protected final int maxAmplifier; - protected EffectInstance[] effects; + protected MobEffectInstance[] effects; @Deprecated - public CoffeeIngredient(ItemStack input, EffectInstance[] effects, int maxAmplifier) { + public CoffeeIngredient(ItemStack input, MobEffectInstance[] effects, int maxAmplifier) { this(Ingredient.of(input), maxAmplifier, effects); } - public CoffeeIngredient(Ingredient input, int maxAmplifier, EffectInstance... effects) { + public CoffeeIngredient(Ingredient input, int maxAmplifier, MobEffectInstance... effects) { this.input = input; this.effects = effects; this.maxAmplifier = maxAmplifier; @@ -41,7 +41,7 @@ public class CoffeeIngredient { return this.input; } - public EffectInstance[] getEffects() { + public MobEffectInstance[] getEffects() { return this.effects; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/WeightedOre.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/WeightedOre.java index 9cd0a93dd..7883793d8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/WeightedOre.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/WeightedOre.java @@ -10,14 +10,21 @@ package de.ellpeck.actuallyadditions.api.recipe; -import net.minecraft.util.WeightedRandom; +import net.minecraft.util.random.Weight; +import net.minecraft.util.random.WeightedEntry; -public class WeightedOre extends WeightedRandom.Item { +public class WeightedOre implements WeightedEntry { public final String name; + public final Weight weight; public WeightedOre(String name, int weight) { - super(weight); + this.weight = Weight.of(weight); this.name = name; } + + @Override + public Weight getWeight() { + return this.weight; + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/tile/IPhantomTile.java b/src/main/java/de/ellpeck/actuallyadditions/api/tile/IPhantomTile.java index 7fb45a1c2..5546a8d2c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/tile/IPhantomTile.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/tile/IPhantomTile.java @@ -10,7 +10,7 @@ package de.ellpeck.actuallyadditions.api.tile; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; /** * Extending this will cause a TileEntity to be able to be connected via a Phantom Connector diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/ActuallyAdditionsData.java b/src/main/java/de/ellpeck/actuallyadditions/data/ActuallyAdditionsData.java index 5f6bddd82..3a3605df9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/ActuallyAdditionsData.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/ActuallyAdditionsData.java @@ -7,7 +7,7 @@ import net.minecraftforge.common.crafting.CraftingHelper; import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.event.lifecycle.GatherDataEvent; +import net.minecraftforge.forge.event.lifecycle.GatherDataEvent; @Mod.EventBusSubscriber(modid = ActuallyAdditions.MODID, bus = Mod.EventBusSubscriber.Bus.MOD) public class ActuallyAdditionsData { diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/AdvancementGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/AdvancementGenerator.java index 3edadddfd..52744ad97 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/AdvancementGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/AdvancementGenerator.java @@ -6,13 +6,13 @@ import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import net.minecraft.advancements.Advancement; import net.minecraft.advancements.DisplayInfo; import net.minecraft.advancements.FrameType; -import net.minecraft.advancements.criterion.ImpossibleTrigger; -import net.minecraft.advancements.criterion.InventoryChangeTrigger; -import net.minecraft.advancements.criterion.ItemPredicate; -import net.minecraft.data.AdvancementProvider; +import net.minecraft.advancements.critereon.ImpossibleTrigger; +import net.minecraft.advancements.critereon.InventoryChangeTrigger; +import net.minecraft.advancements.critereon.ItemPredicate; import net.minecraft.data.DataGenerator; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.data.advancements.AdvancementProvider; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.resources.ResourceLocation; import net.minecraftforge.common.data.ExistingFileHelper; import java.util.function.Consumer; @@ -26,10 +26,10 @@ public class AdvancementGenerator extends AdvancementProvider { protected void registerAdvancements(Consumer consumer, ExistingFileHelper exFileHelper) { Advancement root = Advancement.Builder.advancement() .display(new DisplayInfo(ActuallyItems.ITEM_BOOKLET.get().getDefaultInstance(), - new TranslationTextComponent("achievement.actuallyadditions.openBooklet"), - new TranslationTextComponent("achievement.actuallyadditions.openBooklet.desc"), + new TranslatableComponent("achievement.actuallyadditions.openBooklet"), + new TranslatableComponent("achievement.actuallyadditions.openBooklet.desc"), new ResourceLocation("textures/gui/advancements/backgrounds/stone.png"), FrameType.TASK, true, true, false)) - .addCriterion("right_click", new ImpossibleTrigger.Instance()) + .addCriterion("right_click", new ImpossibleTrigger.TriggerInstance()) .save(consumer, "actuallyadditions:root"); //TODO: Underwater Treasure Chest Advancement? @@ -37,84 +37,84 @@ public class AdvancementGenerator extends AdvancementProvider { Advancement phantomFace = Advancement.Builder.advancement() .parent(root) .display(new DisplayInfo(ActuallyBlocks.PHANTOM_ITEMFACE.get().asItem().getDefaultInstance(), - new TranslationTextComponent("achievement.actuallyadditions.craftPhantomface"), - new TranslationTextComponent("achievement.actuallyadditions.craftPhantomface.desc"), + new TranslatableComponent("achievement.actuallyadditions.craftPhantomface"), + new TranslatableComponent("achievement.actuallyadditions.craftPhantomface.desc"), new ResourceLocation("textures/blocks/stone.png"), FrameType.TASK, true, true, false)) - .addCriterion("phantom_face", InventoryChangeTrigger.Instance.hasItems(ActuallyBlocks.PHANTOM_ITEMFACE.get())) + .addCriterion("phantom_face", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.PHANTOM_ITEMFACE.get())) .save(consumer, "actuallyadditions:craft_phantom_face"); Advancement.Builder.advancement() .parent(phantomFace) .display(new DisplayInfo(ActuallyBlocks.PHANTOM_LIQUIFACE.get().asItem().getDefaultInstance(), - new TranslationTextComponent("achievement.actuallyadditions.craftLiquiface"), - new TranslationTextComponent("achievement.actuallyadditions.craftLiquiface.desc"), + new TranslatableComponent("achievement.actuallyadditions.craftLiquiface"), + new TranslatableComponent("achievement.actuallyadditions.craftLiquiface.desc"), null, FrameType.TASK, true, true, false)) - .addCriterion("liquiface", InventoryChangeTrigger.Instance.hasItems(ActuallyBlocks.PHANTOM_LIQUIFACE.get())) + .addCriterion("liquiface", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.PHANTOM_LIQUIFACE.get())) .save(consumer, "actuallyadditions:craft_liquiface"); Advancement.Builder.advancement() .parent(phantomFace) .display(new DisplayInfo(ActuallyBlocks.PHANTOM_ENERGYFACE.get().asItem().getDefaultInstance(), - new TranslationTextComponent("achievement.actuallyadditions.craftEnergyface"), - new TranslationTextComponent("achievement.actuallyadditions.craftEnergyface.desc"), + new TranslatableComponent("achievement.actuallyadditions.craftEnergyface"), + new TranslatableComponent("achievement.actuallyadditions.craftEnergyface.desc"), null, FrameType.TASK, true, true, false)) - .addCriterion("energyface", InventoryChangeTrigger.Instance.hasItems(ActuallyBlocks.PHANTOM_ENERGYFACE.get())) + .addCriterion("energyface", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.PHANTOM_ENERGYFACE.get())) .save(consumer, "actuallyadditions:craft_energyface"); Advancement coalGenerator = Advancement.Builder.advancement() .parent(root) .display(new DisplayInfo(ActuallyBlocks.COAL_GENERATOR.get().asItem().getDefaultInstance(), - new TranslationTextComponent("achievement.actuallyadditions.craftCoalGen"), - new TranslationTextComponent("achievement.actuallyadditions.craftCoalGen.desc"), + new TranslatableComponent("achievement.actuallyadditions.craftCoalGen"), + new TranslatableComponent("achievement.actuallyadditions.craftCoalGen.desc"), null, FrameType.TASK, true, true, false)) - .addCriterion("coal_generator", InventoryChangeTrigger.Instance.hasItems(ActuallyBlocks.COAL_GENERATOR.get())) + .addCriterion("coal_generator", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.COAL_GENERATOR.get())) .save(consumer, "actuallyadditions:craft_coal_generator"); Advancement.Builder.advancement() .parent(coalGenerator) .display(new DisplayInfo(ActuallyBlocks.LEAF_GENERATOR.get().asItem().getDefaultInstance(), - new TranslationTextComponent("achievement.actuallyadditions.craftLeafGen"), - new TranslationTextComponent("achievement.actuallyadditions.craftLeafGen.desc"), + new TranslatableComponent("achievement.actuallyadditions.craftLeafGen"), + new TranslatableComponent("achievement.actuallyadditions.craftLeafGen.desc"), null, FrameType.TASK, true, true, false)) - .addCriterion("leaf_generator", InventoryChangeTrigger.Instance.hasItems(ActuallyBlocks.LEAF_GENERATOR.get())) + .addCriterion("leaf_generator", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.LEAF_GENERATOR.get())) .save(consumer, "actuallyadditions:craft_leaf_generator"); Advancement coffeeBeans = Advancement.Builder.advancement() .parent(coalGenerator) .display(new DisplayInfo(ActuallyItems.COFFEE_BEANS.get().getDefaultInstance(), - new TranslationTextComponent("achievement.actuallyadditions.pickUpCoffee"), - new TranslationTextComponent("achievement.actuallyadditions.pickUpCoffee.desc"), + new TranslatableComponent("achievement.actuallyadditions.pickUpCoffee"), + new TranslatableComponent("achievement.actuallyadditions.pickUpCoffee.desc"), null, FrameType.TASK, true, true, false)) - .addCriterion("coffee_beans", InventoryChangeTrigger.Instance.hasItems(ActuallyItems.COFFEE_BEANS.get())) + .addCriterion("coffee_beans", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyItems.COFFEE_BEANS.get())) .save(consumer, "actuallyadditions:pickup_coffee"); Advancement.Builder.advancement() .parent(coffeeBeans) .display(new DisplayInfo(ActuallyBlocks.COFFEE_MACHINE.get().asItem().getDefaultInstance(), - new TranslationTextComponent("achievement.actuallyadditions.craftCoffeeMachine"), - new TranslationTextComponent("achievement.actuallyadditions.craftCoffeeMachine.desc"), + new TranslatableComponent("achievement.actuallyadditions.craftCoffeeMachine"), + new TranslatableComponent("achievement.actuallyadditions.craftCoffeeMachine.desc"), null, FrameType.TASK, true, true, false)) - .addCriterion("coffee_machine", InventoryChangeTrigger.Instance.hasItems(ActuallyBlocks.COFFEE_MACHINE.get())) + .addCriterion("coffee_machine", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.COFFEE_MACHINE.get())) .save(consumer, "actuallyadditions:craft_coffee_machine"); Advancement reconstructor = Advancement.Builder.advancement() .parent(coalGenerator) .display(new DisplayInfo(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get().asItem().getDefaultInstance(), - new TranslationTextComponent("achievement.actuallyadditions.craftReconstructor"), - new TranslationTextComponent("achievement.actuallyadditions.craftReconstructor.desc"), + new TranslatableComponent("achievement.actuallyadditions.craftReconstructor"), + new TranslatableComponent("achievement.actuallyadditions.craftReconstructor.desc"), null, FrameType.TASK, true, true, false)) - .addCriterion("atomic_reconstructor", InventoryChangeTrigger.Instance.hasItems(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get())) + .addCriterion("atomic_reconstructor", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get())) .save(consumer, "actuallyadditions:craft_reconstructor"); Advancement makeFirstCrystal = Advancement.Builder.advancement() .parent(reconstructor) .display(new DisplayInfo(ActuallyItems.EMERADIC_CRYSTAL.get().getDefaultInstance(), - new TranslationTextComponent("achievement.actuallyadditions.makeCrystal"), - new TranslationTextComponent("achievement.actuallyadditions.makeCrystal.desc"), + new TranslatableComponent("achievement.actuallyadditions.makeCrystal"), + new TranslatableComponent("achievement.actuallyadditions.makeCrystal.desc"), null, FrameType.TASK, true, true, false)) - .addCriterion("crystal", InventoryChangeTrigger.Instance.hasItems( + .addCriterion("crystal", InventoryChangeTrigger.TriggerInstance.hasItems( ItemPredicate.Builder.item().of(ActuallyTags.Items.CRYSTALS).build()) ) .save(consumer, "actuallyadditions:make_first_crystal"); @@ -122,19 +122,19 @@ public class AdvancementGenerator extends AdvancementProvider { Advancement.Builder.advancement() .parent(makeFirstCrystal) .display(new DisplayInfo(ActuallyBlocks.EMPOWERER.get().asItem().getDefaultInstance(), - new TranslationTextComponent("achievement.actuallyadditions.craftEmpowerer"), - new TranslationTextComponent("achievement.actuallyadditions.craftEmpowerer.desc"), + new TranslatableComponent("achievement.actuallyadditions.craftEmpowerer"), + new TranslatableComponent("achievement.actuallyadditions.craftEmpowerer.desc"), null, FrameType.TASK, true, true, false)) - .addCriterion("empowerer", InventoryChangeTrigger.Instance.hasItems(ActuallyBlocks.EMPOWERER.get())) + .addCriterion("empowerer", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.EMPOWERER.get())) .save(consumer, "actuallyadditions:craft_empowerer"); Advancement craftCrusher = Advancement.Builder.advancement() .parent(reconstructor) .display(new DisplayInfo(ActuallyBlocks.CRUSHER.get().asItem().getDefaultInstance(), - new TranslationTextComponent("achievement.actuallyadditions.craftCrusher"), - new TranslationTextComponent("achievement.actuallyadditions.craftCrusher.desc"), + new TranslatableComponent("achievement.actuallyadditions.craftCrusher"), + new TranslatableComponent("achievement.actuallyadditions.craftCrusher.desc"), null, FrameType.TASK, true, true, false)) - .addCriterion("crystal", InventoryChangeTrigger.Instance.hasItems( + .addCriterion("crystal", InventoryChangeTrigger.TriggerInstance.hasItems( ItemPredicate.Builder.item().of(ActuallyBlocks.CRUSHER.get()).build()) ) .save(consumer, "actuallyadditions:craft_crusher"); @@ -142,10 +142,10 @@ public class AdvancementGenerator extends AdvancementProvider { Advancement craftDoubleCrusher = Advancement.Builder.advancement() .parent(craftCrusher) .display(new DisplayInfo(ActuallyBlocks.CRUSHER_DOUBLE.get().asItem().getDefaultInstance(), - new TranslationTextComponent("achievement.actuallyadditions.craftDoubleCrusher"), - new TranslationTextComponent("achievement.actuallyadditions.craftDoubleCrusher.desc"), + new TranslatableComponent("achievement.actuallyadditions.craftDoubleCrusher"), + new TranslatableComponent("achievement.actuallyadditions.craftDoubleCrusher.desc"), null, FrameType.TASK, true, true, false)) - .addCriterion("crystal", InventoryChangeTrigger.Instance.hasItems( + .addCriterion("crystal", InventoryChangeTrigger.TriggerInstance.hasItems( ItemPredicate.Builder.item().of(ActuallyBlocks.CRUSHER_DOUBLE.get()).build()) ) .save(consumer, "actuallyadditions:craft_double_crusher"); @@ -153,10 +153,10 @@ public class AdvancementGenerator extends AdvancementProvider { Advancement craftLaserRelay = Advancement.Builder.advancement() .parent(reconstructor) .display(new DisplayInfo(ActuallyBlocks.LASER_RELAY.get().asItem().getDefaultInstance(), - new TranslationTextComponent("achievement.actuallyadditions.craftLaserRelay"), - new TranslationTextComponent("achievement.actuallyadditions.craftLaserRelay.desc"), + new TranslatableComponent("achievement.actuallyadditions.craftLaserRelay"), + new TranslatableComponent("achievement.actuallyadditions.craftLaserRelay.desc"), null, FrameType.TASK, true, true, false)) - .addCriterion("laser_relay", InventoryChangeTrigger.Instance.hasItems( + .addCriterion("laser_relay", InventoryChangeTrigger.TriggerInstance.hasItems( ItemPredicate.Builder.item().of(ActuallyBlocks.LASER_RELAY.get()).build()) ) .save(consumer, "actuallyadditions:craft_laser_relay"); @@ -164,10 +164,10 @@ public class AdvancementGenerator extends AdvancementProvider { Advancement craftLaserRelayAdvanced = Advancement.Builder.advancement() .parent(craftLaserRelay) .display(new DisplayInfo(ActuallyBlocks.LASER_RELAY_ADVANCED.get().asItem().getDefaultInstance(), - new TranslationTextComponent("achievement.actuallyadditions.craftLaserRelayAdvanced"), - new TranslationTextComponent("achievement.actuallyadditions.craftLaserRelayAdvanced.desc"), + new TranslatableComponent("achievement.actuallyadditions.craftLaserRelayAdvanced"), + new TranslatableComponent("achievement.actuallyadditions.craftLaserRelayAdvanced.desc"), null, FrameType.TASK, true, true, false)) - .addCriterion("laser_relay_advanced", InventoryChangeTrigger.Instance.hasItems( + .addCriterion("laser_relay_advanced", InventoryChangeTrigger.TriggerInstance.hasItems( ItemPredicate.Builder.item().of(ActuallyBlocks.LASER_RELAY_ADVANCED.get()).build()) ) .save(consumer, "actuallyadditions:craft_laser_relay_advanced"); @@ -175,10 +175,10 @@ public class AdvancementGenerator extends AdvancementProvider { Advancement craftLaserRelayExtreme = Advancement.Builder.advancement() .parent(craftLaserRelayAdvanced) .display(new DisplayInfo(ActuallyBlocks.LASER_RELAY_EXTREME.get().asItem().getDefaultInstance(), - new TranslationTextComponent("achievement.actuallyadditions.craftLaserRelayExtreme"), - new TranslationTextComponent("achievement.actuallyadditions.craftLaserRelayExtreme.desc"), + new TranslatableComponent("achievement.actuallyadditions.craftLaserRelayExtreme"), + new TranslatableComponent("achievement.actuallyadditions.craftLaserRelayExtreme.desc"), null, FrameType.TASK, true, true, false)) - .addCriterion("laser_relay_extreme", InventoryChangeTrigger.Instance.hasItems( + .addCriterion("laser_relay_extreme", InventoryChangeTrigger.TriggerInstance.hasItems( ItemPredicate.Builder.item().of(ActuallyBlocks.LASER_RELAY_EXTREME.get()).build()) ) .save(consumer, "actuallyadditions:craft_laser_relay_extreme"); @@ -186,10 +186,10 @@ public class AdvancementGenerator extends AdvancementProvider { Advancement craftLaserRelayItem = Advancement.Builder.advancement() .parent(craftLaserRelay) .display(new DisplayInfo(ActuallyBlocks.LASER_RELAY_ITEM.get().asItem().getDefaultInstance(), - new TranslationTextComponent("achievement.actuallyadditions.craftLaserRelayItem"), - new TranslationTextComponent("achievement.actuallyadditions.craftLaserRelayItem.desc"), + new TranslatableComponent("achievement.actuallyadditions.craftLaserRelayItem"), + new TranslatableComponent("achievement.actuallyadditions.craftLaserRelayItem.desc"), null, FrameType.TASK, true, true, false)) - .addCriterion("laser_relay_item", InventoryChangeTrigger.Instance.hasItems( + .addCriterion("laser_relay_item", InventoryChangeTrigger.TriggerInstance.hasItems( ItemPredicate.Builder.item().of(ActuallyBlocks.LASER_RELAY_ITEM.get()).build()) ) .save(consumer, "actuallyadditions:craft_laser_relay_item"); @@ -197,10 +197,10 @@ public class AdvancementGenerator extends AdvancementProvider { Advancement craftItemInterface = Advancement.Builder.advancement() .parent(craftLaserRelay) .display(new DisplayInfo(ActuallyBlocks.ITEM_INTERFACE.get().asItem().getDefaultInstance(), - new TranslationTextComponent("achievement.actuallyadditions.craftItemInterface"), - new TranslationTextComponent("achievement.actuallyadditions.craftItemInterface.desc"), + new TranslatableComponent("achievement.actuallyadditions.craftItemInterface"), + new TranslatableComponent("achievement.actuallyadditions.craftItemInterface.desc"), null, FrameType.TASK, true, true, false)) - .addCriterion("item_interface", InventoryChangeTrigger.Instance.hasItems( + .addCriterion("item_interface", InventoryChangeTrigger.TriggerInstance.hasItems( ItemPredicate.Builder.item().of(ActuallyBlocks.ITEM_INTERFACE.get()).build()) ) .save(consumer, "actuallyadditions:craft_item_interface"); diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/BlockRecipeGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/BlockRecipeGenerator.java index 1937dcf6a..b745f7f76 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/BlockRecipeGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/BlockRecipeGenerator.java @@ -4,10 +4,15 @@ import com.google.gson.JsonObject; import de.ellpeck.actuallyadditions.api.ActuallyTags; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; -import net.minecraft.data.*; -import net.minecraft.item.Items; +import net.minecraft.data.DataGenerator; +import net.minecraft.data.HashCache; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.data.recipes.RecipeProvider; +import net.minecraft.data.recipes.ShapedRecipeBuilder; +import net.minecraft.data.recipes.ShapelessRecipeBuilder; import net.minecraft.tags.ItemTags; -import net.minecraft.util.IItemProvider; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.ItemLike; import net.minecraftforge.common.Tags; import javax.annotation.Nonnull; @@ -21,7 +26,7 @@ public class BlockRecipeGenerator extends RecipeProvider { } @Override - protected void buildShapelessRecipes(@Nonnull Consumer consumer) { + protected void buildCraftingRecipes(@Nonnull Consumer consumer) { //Battery Box Recipe.shapeless(ActuallyBlocks.BATTERY_BOX.getItem()).ingredients(ActuallyBlocks.ENERGIZER.get(), ActuallyBlocks.ENERVATOR.get(), ActuallyItems.BASIC_COIL.get()).save(consumer); @@ -226,66 +231,66 @@ public class BlockRecipeGenerator extends RecipeProvider { } @Override - protected void saveAdvancement(DirectoryCache p_208310_1_, JsonObject p_208310_2_, Path p_208310_3_) { + protected void saveAdvancement(HashCache p_208310_1_, JsonObject p_208310_2_, Path p_208310_3_) { //Nope... maybe later... } public static class Recipe { - public static Shapeless shapeless(IItemProvider result) { + public static Shapeless shapeless(ItemLike result) { return new Shapeless(result); } - public static Shapeless shapeless(IItemProvider result, int count) { + public static Shapeless shapeless(ItemLike result, int count) { return new Shapeless(result, count); } - public static Shaped shaped(IItemProvider result) { + public static Shaped shaped(ItemLike result) { return new Shaped(result); } - public static Shaped shaped(IItemProvider result, int count) { + public static Shaped shaped(ItemLike result, int count) { return new Shaped(result, count); } - public static void stairs(IItemProvider result, IItemProvider resource, Consumer consumer) { + public static void stairs(ItemLike result, ItemLike resource, Consumer consumer) { Recipe.shaped(result).patternSingleKey('Q', resource, "Q ", "QQ ", "QQQ").save(consumer); } - public static void wall(IItemProvider result, IItemProvider resource, Consumer consumer) { + public static void wall(ItemLike result, ItemLike resource, Consumer consumer) { Recipe.shaped(result).patternSingleKey('Q', resource, "QQQ", "QQQ").save(consumer); } - public static void slab(IItemProvider result, IItemProvider resource, Consumer consumer) { + public static void slab(ItemLike result, ItemLike resource, Consumer consumer) { Recipe.shaped(result).patternSingleKey('Q', resource, "QQQ").save(consumer); } private static class Shapeless extends ShapelessRecipeBuilder { - public Shapeless(IItemProvider result) { + public Shapeless(ItemLike result) { this(result, 1); } - public Shapeless(IItemProvider result, int countIn) { + public Shapeless(ItemLike result, int countIn) { super(result, countIn); } - public Shapeless ingredients(IItemProvider... ingredients) { + public Shapeless ingredients(ItemLike... ingredients) { Arrays.asList(ingredients).forEach(this::requires); return this; } @Override - public void save(Consumer consumer) { + public void save(Consumer consumer) { this.unlockedBy("has_book", has(ActuallyItems.ITEM_BOOKLET.get())); super.save(consumer); } } private static class Shaped extends ShapedRecipeBuilder { - public Shaped(IItemProvider resultIn) { + public Shaped(ItemLike resultIn) { this(resultIn, 1); } - public Shaped(IItemProvider resultIn, int countIn) { + public Shaped(ItemLike resultIn, int countIn) { super(resultIn, countIn); } @@ -302,7 +307,7 @@ public class BlockRecipeGenerator extends RecipeProvider { return this; } - public Shaped patternSingleKey(char key, IItemProvider resource, String... lines) { + public Shaped patternSingleKey(char key, ItemLike resource, String... lines) { this.define(key, resource); for (String line : lines) { this.pattern(line); @@ -312,7 +317,7 @@ public class BlockRecipeGenerator extends RecipeProvider { } @Override - public void save(Consumer consumerIn) { + public void save(Consumer consumerIn) { this.unlockedBy("has_book", has(ActuallyItems.ITEM_BOOKLET.get())); super.save(consumerIn); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/BlockStateGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/BlockStateGenerator.java index b3e3ff6a5..41f2af837 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/BlockStateGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/BlockStateGenerator.java @@ -2,10 +2,14 @@ package de.ellpeck.actuallyadditions.data; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; -import net.minecraft.block.*; import net.minecraft.data.DataGenerator; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.util.ResourceLocation; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.CropBlock; +import net.minecraft.world.level.block.SlabBlock; +import net.minecraft.world.level.block.StairBlock; +import net.minecraft.world.level.block.WallBlock; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraftforge.client.model.generators.BlockStateProvider; import net.minecraftforge.client.model.generators.ConfiguredModel; import net.minecraftforge.client.model.generators.ModelFile; @@ -114,44 +118,44 @@ public class BlockStateGenerator extends BlockStateProvider { // TO BE SORTED getVariantBuilder(ActuallyBlocks.CANOLA.get()).partialState() - .with(CropsBlock.AGE, 0).modelForState().modelFile(models().crop("canola_1", modLoc("block/canola_stage_1"))).addModel() - .partialState().with(CropsBlock.AGE, 1).modelForState().modelFile(models().crop("canola_2", modLoc("block/canola_stage_2"))).addModel() - .partialState().with(CropsBlock.AGE, 2).modelForState().modelFile(models().crop("canola_2", modLoc("block/canola_stage_2"))).addModel() - .partialState().with(CropsBlock.AGE, 3).modelForState().modelFile(models().crop("canola_2", modLoc("block/canola_stage_2"))).addModel() - .partialState().with(CropsBlock.AGE, 4).modelForState().modelFile(models().crop("canola_3", modLoc("block/canola_stage_3"))).addModel() - .partialState().with(CropsBlock.AGE, 5).modelForState().modelFile(models().crop("canola_3", modLoc("block/canola_stage_3"))).addModel() - .partialState().with(CropsBlock.AGE, 6).modelForState().modelFile(models().crop("canola_3", modLoc("block/canola_stage_3"))).addModel() - .partialState().with(CropsBlock.AGE, 7).modelForState().modelFile(models().crop("canola_4", modLoc("block/canola_stage_4"))).addModel(); + .with(CropBlock.AGE, 0).modelForState().modelFile(models().crop("canola_1", modLoc("block/canola_stage_1"))).addModel() + .partialState().with(CropBlock.AGE, 1).modelForState().modelFile(models().crop("canola_2", modLoc("block/canola_stage_2"))).addModel() + .partialState().with(CropBlock.AGE, 2).modelForState().modelFile(models().crop("canola_2", modLoc("block/canola_stage_2"))).addModel() + .partialState().with(CropBlock.AGE, 3).modelForState().modelFile(models().crop("canola_2", modLoc("block/canola_stage_2"))).addModel() + .partialState().with(CropBlock.AGE, 4).modelForState().modelFile(models().crop("canola_3", modLoc("block/canola_stage_3"))).addModel() + .partialState().with(CropBlock.AGE, 5).modelForState().modelFile(models().crop("canola_3", modLoc("block/canola_stage_3"))).addModel() + .partialState().with(CropBlock.AGE, 6).modelForState().modelFile(models().crop("canola_3", modLoc("block/canola_stage_3"))).addModel() + .partialState().with(CropBlock.AGE, 7).modelForState().modelFile(models().crop("canola_4", modLoc("block/canola_stage_4"))).addModel(); getVariantBuilder(ActuallyBlocks.RICE.get()).partialState() - .with(CropsBlock.AGE, 0).modelForState().modelFile(models().crop("rice_1", modLoc("block/rice_stage_1"))).addModel() - .partialState().with(CropsBlock.AGE, 1).modelForState().modelFile(models().crop("rice_2", modLoc("block/rice_stage_2"))).addModel() - .partialState().with(CropsBlock.AGE, 2).modelForState().modelFile(models().crop("rice_2", modLoc("block/rice_stage_2"))).addModel() - .partialState().with(CropsBlock.AGE, 3).modelForState().modelFile(models().crop("rice_2", modLoc("block/rice_stage_3"))).addModel() - .partialState().with(CropsBlock.AGE, 4).modelForState().modelFile(models().crop("rice_3", modLoc("block/rice_stage_4"))).addModel() - .partialState().with(CropsBlock.AGE, 5).modelForState().modelFile(models().crop("rice_3", modLoc("block/rice_stage_4"))).addModel() - .partialState().with(CropsBlock.AGE, 6).modelForState().modelFile(models().crop("rice_3", modLoc("block/rice_stage_5"))).addModel() - .partialState().with(CropsBlock.AGE, 7).modelForState().modelFile(models().crop("rice_4", modLoc("block/rice_stage_6"))).addModel(); + .with(CropBlock.AGE, 0).modelForState().modelFile(models().crop("rice_1", modLoc("block/rice_stage_1"))).addModel() + .partialState().with(CropBlock.AGE, 1).modelForState().modelFile(models().crop("rice_2", modLoc("block/rice_stage_2"))).addModel() + .partialState().with(CropBlock.AGE, 2).modelForState().modelFile(models().crop("rice_2", modLoc("block/rice_stage_2"))).addModel() + .partialState().with(CropBlock.AGE, 3).modelForState().modelFile(models().crop("rice_2", modLoc("block/rice_stage_3"))).addModel() + .partialState().with(CropBlock.AGE, 4).modelForState().modelFile(models().crop("rice_3", modLoc("block/rice_stage_4"))).addModel() + .partialState().with(CropBlock.AGE, 5).modelForState().modelFile(models().crop("rice_3", modLoc("block/rice_stage_4"))).addModel() + .partialState().with(CropBlock.AGE, 6).modelForState().modelFile(models().crop("rice_3", modLoc("block/rice_stage_5"))).addModel() + .partialState().with(CropBlock.AGE, 7).modelForState().modelFile(models().crop("rice_4", modLoc("block/rice_stage_6"))).addModel(); getVariantBuilder(ActuallyBlocks.FLAX.get()).partialState() - .with(CropsBlock.AGE, 0).modelForState().modelFile(models().crop("flax_1", modLoc("block/flax_stage_1"))).addModel() - .partialState().with(CropsBlock.AGE, 1).modelForState().modelFile(models().crop("flax_2", modLoc("block/flax_stage_2"))).addModel() - .partialState().with(CropsBlock.AGE, 2).modelForState().modelFile(models().crop("flax_2", modLoc("block/flax_stage_2"))).addModel() - .partialState().with(CropsBlock.AGE, 3).modelForState().modelFile(models().crop("flax_2", modLoc("block/flax_stage_3"))).addModel() - .partialState().with(CropsBlock.AGE, 4).modelForState().modelFile(models().crop("flax_3", modLoc("block/flax_stage_4"))).addModel() - .partialState().with(CropsBlock.AGE, 5).modelForState().modelFile(models().crop("flax_3", modLoc("block/flax_stage_4"))).addModel() - .partialState().with(CropsBlock.AGE, 6).modelForState().modelFile(models().crop("flax_3", modLoc("block/flax_stage_5"))).addModel() - .partialState().with(CropsBlock.AGE, 7).modelForState().modelFile(models().crop("flax_4", modLoc("block/flax_stage_6"))).addModel(); + .with(CropBlock.AGE, 0).modelForState().modelFile(models().crop("flax_1", modLoc("block/flax_stage_1"))).addModel() + .partialState().with(CropBlock.AGE, 1).modelForState().modelFile(models().crop("flax_2", modLoc("block/flax_stage_2"))).addModel() + .partialState().with(CropBlock.AGE, 2).modelForState().modelFile(models().crop("flax_2", modLoc("block/flax_stage_2"))).addModel() + .partialState().with(CropBlock.AGE, 3).modelForState().modelFile(models().crop("flax_2", modLoc("block/flax_stage_3"))).addModel() + .partialState().with(CropBlock.AGE, 4).modelForState().modelFile(models().crop("flax_3", modLoc("block/flax_stage_4"))).addModel() + .partialState().with(CropBlock.AGE, 5).modelForState().modelFile(models().crop("flax_3", modLoc("block/flax_stage_4"))).addModel() + .partialState().with(CropBlock.AGE, 6).modelForState().modelFile(models().crop("flax_3", modLoc("block/flax_stage_5"))).addModel() + .partialState().with(CropBlock.AGE, 7).modelForState().modelFile(models().crop("flax_4", modLoc("block/flax_stage_6"))).addModel(); getVariantBuilder(ActuallyBlocks.COFFEE.get()).partialState() - .with(CropsBlock.AGE, 0).modelForState().modelFile(models().crop("coffee_1", modLoc("block/coffee_stage_1"))).addModel() - .partialState().with(CropsBlock.AGE, 1).modelForState().modelFile(models().crop("coffee_2", modLoc("block/coffee_stage_2"))).addModel() - .partialState().with(CropsBlock.AGE, 2).modelForState().modelFile(models().crop("coffee_2", modLoc("block/coffee_stage_2"))).addModel() - .partialState().with(CropsBlock.AGE, 3).modelForState().modelFile(models().crop("coffee_2", modLoc("block/coffee_stage_3"))).addModel() - .partialState().with(CropsBlock.AGE, 4).modelForState().modelFile(models().crop("coffee_3", modLoc("block/coffee_stage_4"))).addModel() - .partialState().with(CropsBlock.AGE, 5).modelForState().modelFile(models().crop("coffee_3", modLoc("block/coffee_stage_4"))).addModel() - .partialState().with(CropsBlock.AGE, 6).modelForState().modelFile(models().crop("coffee_3", modLoc("block/coffee_stage_5"))).addModel() - .partialState().with(CropsBlock.AGE, 7).modelForState().modelFile(models().crop("coffee_4", modLoc("block/coffee_stage_6"))).addModel(); + .with(CropBlock.AGE, 0).modelForState().modelFile(models().crop("coffee_1", modLoc("block/coffee_stage_1"))).addModel() + .partialState().with(CropBlock.AGE, 1).modelForState().modelFile(models().crop("coffee_2", modLoc("block/coffee_stage_2"))).addModel() + .partialState().with(CropBlock.AGE, 2).modelForState().modelFile(models().crop("coffee_2", modLoc("block/coffee_stage_2"))).addModel() + .partialState().with(CropBlock.AGE, 3).modelForState().modelFile(models().crop("coffee_2", modLoc("block/coffee_stage_3"))).addModel() + .partialState().with(CropBlock.AGE, 4).modelForState().modelFile(models().crop("coffee_3", modLoc("block/coffee_stage_4"))).addModel() + .partialState().with(CropBlock.AGE, 5).modelForState().modelFile(models().crop("coffee_3", modLoc("block/coffee_stage_4"))).addModel() + .partialState().with(CropBlock.AGE, 6).modelForState().modelFile(models().crop("coffee_3", modLoc("block/coffee_stage_5"))).addModel() + .partialState().with(CropBlock.AGE, 7).modelForState().modelFile(models().crop("coffee_4", modLoc("block/coffee_stage_6"))).addModel(); buildCubeAll(ActuallyBlocks.ENDER_CASING); @@ -179,13 +183,13 @@ public class BlockStateGenerator extends BlockStateProvider { wallBlock((WallBlock) ActuallyBlocks.ETHETIC_WHITE_WALL.get(), modLoc("block/ethetic_white_block")); // Stairs - stairsBlock((StairsBlock) ActuallyBlocks.BLACK_QUARTZ_STAIR.get(), modLoc("block/black_quartz_block")); - stairsBlock((StairsBlock) ActuallyBlocks.SMOOTH_BLACK_QUARTZ_STAIR.get(), modLoc("block/smooth_black_quartz_block")); - stairsBlock((StairsBlock) ActuallyBlocks.CHISELED_BLACK_QUARTZ_STAIR.get(), modLoc("block/chiseled_black_quartz_block")); - stairsBlock((StairsBlock) ActuallyBlocks.BLACK_QUARTZ_PILLAR_STAIR.get(), modLoc("block/black_quartz_pillar_block")); - stairsBlock((StairsBlock) ActuallyBlocks.BLACK_QUARTZ_BRICK_STAIR.get(), modLoc("block/black_quartz_brick_block")); - stairsBlock((StairsBlock) ActuallyBlocks.ETHETIC_GREEN_STAIRS.get(), modLoc("block/ethetic_green_block")); - stairsBlock((StairsBlock) ActuallyBlocks.ETHETIC_WHITE_STAIRS.get(), modLoc("block/ethetic_white_block")); + stairsBlock((StairBlock) ActuallyBlocks.BLACK_QUARTZ_STAIR.get(), modLoc("block/black_quartz_block")); + stairsBlock((StairBlock) ActuallyBlocks.SMOOTH_BLACK_QUARTZ_STAIR.get(), modLoc("block/smooth_black_quartz_block")); + stairsBlock((StairBlock) ActuallyBlocks.CHISELED_BLACK_QUARTZ_STAIR.get(), modLoc("block/chiseled_black_quartz_block")); + stairsBlock((StairBlock) ActuallyBlocks.BLACK_QUARTZ_PILLAR_STAIR.get(), modLoc("block/black_quartz_pillar_block")); + stairsBlock((StairBlock) ActuallyBlocks.BLACK_QUARTZ_BRICK_STAIR.get(), modLoc("block/black_quartz_brick_block")); + stairsBlock((StairBlock) ActuallyBlocks.ETHETIC_GREEN_STAIRS.get(), modLoc("block/ethetic_green_block")); + stairsBlock((StairBlock) ActuallyBlocks.ETHETIC_WHITE_STAIRS.get(), modLoc("block/ethetic_white_block")); // Slabs slabBlock((SlabBlock) ActuallyBlocks.BLACK_QUARTZ_SLAB.get(), modLoc("block/black_quartz_block"), modLoc("block/black_quartz_block")); diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/BlockTagsGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/BlockTagsGenerator.java index 9e40e3d3e..4cbbd38ac 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/BlockTagsGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/BlockTagsGenerator.java @@ -1,11 +1,12 @@ package de.ellpeck.actuallyadditions.data; +import de.ellpeck.actuallyadditions.api.ActuallyTags; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; -import net.minecraft.data.BlockTagsProvider; import net.minecraft.data.DataGenerator; +import net.minecraft.data.tags.BlockTagsProvider; +import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; -import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.data.ExistingFileHelper; import javax.annotation.Nullable; @@ -27,6 +28,138 @@ public class BlockTagsGenerator extends BlockTagsProvider { ActuallyBlocks.CHISELED_BLACK_QUARTZ_WALL.get(), ActuallyBlocks.BLACK_QUARTZ_BRICK_WALL.get() ); + + tag(BlockTags.MINEABLE_WITH_AXE).add( + ActuallyBlocks.FERMENTING_BARREL.get() + ); + tag(BlockTags.MINEABLE_WITH_PICKAXE).add( + ActuallyBlocks.LAMP_WHITE.get(), + ActuallyBlocks.LAMP_ORANGE.get(), + ActuallyBlocks.LAMP_MAGENTA.get(), + ActuallyBlocks.LAMP_LIGHT_BLUE.get(), + ActuallyBlocks.LAMP_YELLOW.get(), + ActuallyBlocks.LAMP_LIME.get(), + ActuallyBlocks.LAMP_PINK.get(), + ActuallyBlocks.LAMP_GRAY.get(), + ActuallyBlocks.LAMP_LIGHT_GRAY.get(), + ActuallyBlocks.LAMP_CYAN.get(), + ActuallyBlocks.LAMP_PURPLE.get(), + ActuallyBlocks.LAMP_BLUE.get(), + ActuallyBlocks.LAMP_BROWN.get(), + ActuallyBlocks.LAMP_GREEN.get(), + ActuallyBlocks.LAMP_RED.get(), + ActuallyBlocks.LAMP_BLACK.get(), + ActuallyBlocks.LEAF_GENERATOR.get(), + ActuallyBlocks.WOOD_CASING.get(), + ActuallyBlocks.IRON_CASING.get(), + ActuallyBlocks.ENDER_CASING.get(), + ActuallyBlocks.LAVA_FACTORY_CASING.get(), + ActuallyBlocks.BLACK_QUARTZ_ORE.get(), + ActuallyBlocks.ETHETIC_GREEN_BLOCK.get(), + ActuallyBlocks.ETHETIC_WHITE_BLOCK.get(), + ActuallyBlocks.BLACK_QUARTZ.get(), + ActuallyBlocks.BLACK_QUARTZ_PILLAR.get(), + ActuallyBlocks.CHISELED_BLACK_QUARTZ.get(), + ActuallyBlocks.SMOOTH_BLACK_QUARTZ.get(), + ActuallyBlocks.BLACK_QUARTZ_BRICK.get(), + ActuallyBlocks.FEEDER.get(), + ActuallyBlocks.CRUSHER.get(), + ActuallyBlocks.CRUSHER_DOUBLE.get(), + ActuallyBlocks.ENERGIZER.get(), + ActuallyBlocks.ENERVATOR.get(), + ActuallyBlocks.LAVA_FACTORY_CONTROLLER.get(), + ActuallyBlocks.LAMP_CONTROLLER.get(), + ActuallyBlocks.CANOLA_PRESS.get(), + ActuallyBlocks.OIL_GENERATOR.get(), + ActuallyBlocks.COAL_GENERATOR.get(), + ActuallyBlocks.XP_SOLIDIFIER.get(), + ActuallyBlocks.PLACER.get(), + ActuallyBlocks.BREAKER.get(), + ActuallyBlocks.DROPPER.get(), + ActuallyBlocks.FLUID_COLLECTOR.get(), + ActuallyBlocks.FARMER.get(), + ActuallyBlocks.BIOREACTOR.get(), + ActuallyBlocks.VERTICAL_DIGGER.get(), + ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get(), + ActuallyBlocks.RANGED_COLLECTOR.get(), + ActuallyBlocks.LONG_RANGE_BREAKER.get(), + ActuallyBlocks.COFFEE_MACHINE.get(), + ActuallyBlocks.POWERED_FURNACE.get(), + ActuallyBlocks.ENORI_CRYSTAL.get(), + ActuallyBlocks.RESTONIA_CRYSTAL.get(), + ActuallyBlocks.PALIS_CRYSTAL.get(), + ActuallyBlocks.DIAMATINE_CRYSTAL.get(), + ActuallyBlocks.VOID_CRYSTAL.get(), + ActuallyBlocks.EMERADIC_CRYSTAL.get(), + ActuallyBlocks.EMPOWERED_ENORI_CRYSTAL.get(), + ActuallyBlocks.EMPOWERED_RESTONIA_CRYSTAL.get(), + ActuallyBlocks.EMPOWERED_PALIS_CRYSTAL.get(), + ActuallyBlocks.EMPOWERED_DIAMATINE_CRYSTAL.get(), + ActuallyBlocks.EMPOWERED_VOID_CRYSTAL.get(), + ActuallyBlocks.EMPOWERED_EMERADIC_CRYSTAL.get(), + ActuallyBlocks.DISPLAY_STAND.get(), + ActuallyBlocks.EMPOWERER.get(), + ActuallyBlocks.PLAYER_INTERFACE.get(), + ActuallyBlocks.ITEM_INTERFACE.get(), + ActuallyBlocks.ITEM_INTERFACE_HOPPING.get(), + ActuallyBlocks.PHANTOM_ITEMFACE.get(), + ActuallyBlocks.PHANTOM_PLACER.get(), + ActuallyBlocks.PHANTOM_LIQUIFACE.get(), + ActuallyBlocks.PHANTOM_ENERGYFACE.get(), + ActuallyBlocks.PHANTOM_REDSTONEFACE.get(), + ActuallyBlocks.PHANTOM_BREAKER.get(), + ActuallyBlocks.PHANTOM_BOOSTER.get(), + ActuallyBlocks.BATTERY_BOX.get(), + ActuallyBlocks.FIREWORK_BOX.get(), + ActuallyBlocks.SHOCK_SUPPRESSOR.get(), + ActuallyBlocks.HEAT_COLLECTOR.get(), + ActuallyBlocks.LASER_RELAY.get(), + ActuallyBlocks.LASER_RELAY_ADVANCED.get(), + ActuallyBlocks.LASER_RELAY_EXTREME.get(), + ActuallyBlocks.LASER_RELAY_FLUIDS.get(), + ActuallyBlocks.LASER_RELAY_ITEM.get(), + ActuallyBlocks.LASER_RELAY_ITEM_ADVANCED.get(), + ActuallyBlocks.GREENHOUSE_GLASS.get() + ); + + tag(BlockTags.NEEDS_STONE_TOOL).add( + ActuallyBlocks.WOOD_CASING.get(), + ActuallyBlocks.IRON_CASING.get(), + ActuallyBlocks.ENDER_CASING.get(), + ActuallyBlocks.LAVA_FACTORY_CASING.get(), + ActuallyBlocks.BLACK_QUARTZ_ORE.get(), + ActuallyBlocks.ETHETIC_GREEN_BLOCK.get(), + ActuallyBlocks.ETHETIC_WHITE_BLOCK.get(), + ActuallyBlocks.BLACK_QUARTZ.get(), + ActuallyBlocks.BLACK_QUARTZ_PILLAR.get(), + ActuallyBlocks.CHISELED_BLACK_QUARTZ.get(), + ActuallyBlocks.SMOOTH_BLACK_QUARTZ.get(), + ActuallyBlocks.BLACK_QUARTZ_BRICK.get(), + ActuallyBlocks.ENORI_CRYSTAL.get(), + ActuallyBlocks.RESTONIA_CRYSTAL.get(), + ActuallyBlocks.PALIS_CRYSTAL.get(), + ActuallyBlocks.DIAMATINE_CRYSTAL.get(), + ActuallyBlocks.VOID_CRYSTAL.get(), + ActuallyBlocks.EMERADIC_CRYSTAL.get(), + ActuallyBlocks.EMPOWERED_ENORI_CRYSTAL.get(), + ActuallyBlocks.EMPOWERED_RESTONIA_CRYSTAL.get(), + ActuallyBlocks.EMPOWERED_PALIS_CRYSTAL.get(), + ActuallyBlocks.EMPOWERED_DIAMATINE_CRYSTAL.get(), + ActuallyBlocks.EMPOWERED_VOID_CRYSTAL.get(), + ActuallyBlocks.EMPOWERED_EMERADIC_CRYSTAL.get() + ); + + this.tag(ActuallyTags.Blocks.MINEABLE_WITH_DRILL).addTags( + BlockTags.MINEABLE_WITH_SHOVEL, + BlockTags.MINEABLE_WITH_PICKAXE + ); + + this.tag(ActuallyTags.Blocks.MINEABLE_WITH_AIO).addTags( + BlockTags.MINEABLE_WITH_AXE, + BlockTags.MINEABLE_WITH_HOE, + BlockTags.MINEABLE_WITH_PICKAXE, + BlockTags.MINEABLE_WITH_SHOVEL + ); } /** diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/ColorChangeGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/ColorChangeGenerator.java index 37d7611b2..5a1ce8aa3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/ColorChangeGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/ColorChangeGenerator.java @@ -5,14 +5,14 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.crafting.ColorChangeRecipe; import net.minecraft.data.DataGenerator; -import net.minecraft.data.DirectoryCache; -import net.minecraft.data.IFinishedRecipe; -import net.minecraft.data.RecipeProvider; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.util.IItemProvider; -import net.minecraft.util.ResourceLocation; +import net.minecraft.data.HashCache; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.data.recipes.RecipeProvider; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.level.ItemLike; import javax.annotation.Nonnull; import java.nio.file.Path; @@ -23,11 +23,11 @@ public class ColorChangeGenerator extends RecipeProvider { super(p_i48262_1_); } @Override - protected void saveAdvancement(@Nonnull DirectoryCache pCache, @Nonnull JsonObject pAdvancementJson, @Nonnull Path pPath) { + protected void saveAdvancement(@Nonnull HashCache pCache, @Nonnull JsonObject pAdvancementJson, @Nonnull Path pPath) { } @Override - protected void buildShapelessRecipes(@Nonnull Consumer consumer) { + protected void buildCraftingRecipes(@Nonnull Consumer consumer) { buildWool(consumer); buildStainedGlass(consumer); buildStainedGlassPane(consumer); @@ -38,7 +38,7 @@ public class ColorChangeGenerator extends RecipeProvider { buildDye(consumer); } - private void buildWool(@Nonnull Consumer c) { + private void buildWool(@Nonnull Consumer c) { //Wool changeColor(c, Items.WHITE_WOOL, Items.BLACK_WOOL); changeColor(c, Items.ORANGE_WOOL, Items.WHITE_WOOL); @@ -58,7 +58,7 @@ public class ColorChangeGenerator extends RecipeProvider { changeColor(c, Items.BLACK_WOOL, Items.RED_WOOL); } - private void buildStainedGlass(@Nonnull Consumer c) { + private void buildStainedGlass(@Nonnull Consumer c) { changeColor(c, Items.WHITE_STAINED_GLASS, Items.BLACK_STAINED_GLASS); changeColor(c, Items.ORANGE_STAINED_GLASS, Items.WHITE_STAINED_GLASS); changeColor(c, Items.MAGENTA_STAINED_GLASS, Items.ORANGE_STAINED_GLASS); @@ -77,7 +77,7 @@ public class ColorChangeGenerator extends RecipeProvider { changeColor(c, Items.BLACK_STAINED_GLASS, Items.RED_STAINED_GLASS); } - private void buildStainedGlassPane(@Nonnull Consumer c) { + private void buildStainedGlassPane(@Nonnull Consumer c) { changeColor(c, Items.WHITE_STAINED_GLASS_PANE, Items.BLACK_STAINED_GLASS_PANE); changeColor(c, Items.ORANGE_STAINED_GLASS_PANE, Items.WHITE_STAINED_GLASS_PANE); changeColor(c, Items.MAGENTA_STAINED_GLASS_PANE, Items.ORANGE_STAINED_GLASS_PANE); @@ -96,7 +96,7 @@ public class ColorChangeGenerator extends RecipeProvider { changeColor(c, Items.BLACK_STAINED_GLASS_PANE, Items.RED_STAINED_GLASS_PANE); } - private void buildTerracotta(@Nonnull Consumer c) { + private void buildTerracotta(@Nonnull Consumer c) { changeColor(c, Items.WHITE_TERRACOTTA, Items.BLACK_TERRACOTTA); changeColor(c, Items.ORANGE_TERRACOTTA, Items.WHITE_TERRACOTTA); changeColor(c, Items.MAGENTA_TERRACOTTA, Items.ORANGE_TERRACOTTA); @@ -115,7 +115,7 @@ public class ColorChangeGenerator extends RecipeProvider { changeColor(c, Items.BLACK_TERRACOTTA, Items.RED_TERRACOTTA); } - private void buildGlazedTerracotta(@Nonnull Consumer c) { + private void buildGlazedTerracotta(@Nonnull Consumer c) { changeColor(c, Items.WHITE_GLAZED_TERRACOTTA, Items.BLACK_GLAZED_TERRACOTTA); changeColor(c, Items.ORANGE_GLAZED_TERRACOTTA, Items.WHITE_GLAZED_TERRACOTTA); changeColor(c, Items.MAGENTA_GLAZED_TERRACOTTA, Items.ORANGE_GLAZED_TERRACOTTA); @@ -134,7 +134,7 @@ public class ColorChangeGenerator extends RecipeProvider { changeColor(c, Items.BLACK_GLAZED_TERRACOTTA, Items.RED_GLAZED_TERRACOTTA); } - private void buildCarpet(@Nonnull Consumer c) { + private void buildCarpet(@Nonnull Consumer c) { changeColor(c, Items.WHITE_CARPET, Items.BLACK_CARPET); changeColor(c, Items.ORANGE_CARPET, Items.WHITE_CARPET); changeColor(c, Items.MAGENTA_CARPET, Items.ORANGE_CARPET); @@ -153,7 +153,7 @@ public class ColorChangeGenerator extends RecipeProvider { changeColor(c, Items.BLACK_CARPET, Items.RED_CARPET); } - private void buildLamps(@Nonnull Consumer c) { + private void buildLamps(@Nonnull Consumer c) { changeColor(c, ActuallyBlocks.LAMP_WHITE.getItem(), ActuallyBlocks.LAMP_BLACK.getItem()); changeColor(c, ActuallyBlocks.LAMP_ORANGE.getItem(), ActuallyBlocks.LAMP_WHITE.getItem()); changeColor(c, ActuallyBlocks.LAMP_MAGENTA.getItem(), ActuallyBlocks.LAMP_ORANGE.getItem()); @@ -172,7 +172,7 @@ public class ColorChangeGenerator extends RecipeProvider { changeColor(c, ActuallyBlocks.LAMP_BLACK.getItem(), ActuallyBlocks.LAMP_RED.getItem()); } - private void buildDye(@Nonnull Consumer c) { + private void buildDye(@Nonnull Consumer c) { changeColor(c, Items.WHITE_DYE, Items.BLACK_DYE); changeColor(c, Items.ORANGE_DYE, Items.WHITE_DYE); changeColor(c, Items.MAGENTA_DYE, Items.ORANGE_DYE); @@ -192,16 +192,16 @@ public class ColorChangeGenerator extends RecipeProvider { } - private void changeColor(Consumer consumer, IItemProvider output, Ingredient input) { - consumer.accept(new ColorChangeRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "colorchange/" + output.asItem().getRegistryName().getPath()), + private void changeColor(Consumer consumer, ItemLike output, Ingredient input) { + consumer.accept(new ColorChangeRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "colorchange/" + output.asItem().getRegistryName().getPath()), input, output)); } - private void changeColor(Consumer consumer, IItemProvider output, IItemProvider input) { - consumer.accept(new ColorChangeRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "colorchange/" + output.asItem().getRegistryName().getPath()), + private void changeColor(Consumer consumer, ItemLike output, ItemLike input) { + consumer.accept(new ColorChangeRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "colorchange/" + output.asItem().getRegistryName().getPath()), Ingredient.of(input), output)); } - private void changeColor(Consumer consumer, IItemProvider output, ItemStack input) { - consumer.accept(new ColorChangeRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "colorchange/" + output.asItem().getRegistryName().getPath()), + private void changeColor(Consumer consumer, ItemLike output, ItemStack input) { + consumer.accept(new ColorChangeRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "colorchange/" + output.asItem().getRegistryName().getPath()), Ingredient.of(input), output)); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/CrushingRecipeGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/CrushingRecipeGenerator.java index 7a6a2ebde..9c1a88427 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/CrushingRecipeGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/CrushingRecipeGenerator.java @@ -4,12 +4,12 @@ import com.google.gson.JsonObject; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe; import net.minecraft.data.DataGenerator; -import net.minecraft.data.DirectoryCache; -import net.minecraft.data.IFinishedRecipe; -import net.minecraft.data.RecipeProvider; -import net.minecraft.item.Items; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.util.ResourceLocation; +import net.minecraft.data.HashCache; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.data.recipes.RecipeProvider; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.Ingredient; import javax.annotation.Nonnull; import java.nio.file.Path; @@ -21,12 +21,12 @@ public class CrushingRecipeGenerator extends RecipeProvider { } @Override - protected void saveAdvancement(@Nonnull DirectoryCache p_208310_1_, @Nonnull JsonObject p_208310_2_, @Nonnull Path p_208310_3_) { + protected void saveAdvancement(@Nonnull HashCache p_208310_1_, @Nonnull JsonObject p_208310_2_, @Nonnull Path p_208310_3_) { } @Override - protected void buildShapelessRecipes(Consumer consumer) { - consumer.accept(new CrushingRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "crushing/bone_crusher"), + protected void buildCraftingRecipes(Consumer consumer) { + consumer.accept(new CrushingRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "crushing/bone_crusher"), Ingredient.of(Items.BONE), Items.BONE_MEAL, 6, 1.0f , Items.AIR, 0, 0.0f)); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/EmpoweringRecipeGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/EmpoweringRecipeGenerator.java index 20d961664..86ab36c19 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/EmpoweringRecipeGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/EmpoweringRecipeGenerator.java @@ -7,17 +7,18 @@ import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import de.ellpeck.actuallyadditions.mod.items.metalists.Crystals; import net.minecraft.data.DataGenerator; -import net.minecraft.data.DirectoryCache; -import net.minecraft.data.IFinishedRecipe; -import net.minecraft.data.RecipeProvider; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.tags.ITag; +import net.minecraft.data.HashCache; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.data.recipes.RecipeProvider; +import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.ItemTags; -import net.minecraft.util.IItemProvider; -import net.minecraft.util.ResourceLocation; +import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; +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.minecraft.world.level.ItemLike; import net.minecraftforge.common.Tags; import java.nio.file.Path; @@ -31,11 +32,11 @@ public class EmpoweringRecipeGenerator extends RecipeProvider { } @Override - protected void saveAdvancement(DirectoryCache pCache, JsonObject pAdvancementJson, Path pPath) { + protected void saveAdvancement(HashCache pCache, JsonObject pAdvancementJson, Path pPath) { } @Override - protected void buildShapelessRecipes(Consumer consumer) { + protected void buildCraftingRecipes(Consumer consumer) { EmpoweringBuilder.builder(ActuallyItems.EMPOWERED_RESTONIA_CRYSTAL.get(), ActuallyItems.RESTONIA_CRYSTAL.get(), 5000, 50, Crystals.REDSTONE.conversionColorParticles) .addModifier(Tags.Items.DYES_RED) .addModifier(Items.NETHER_BRICK) @@ -118,7 +119,7 @@ public class EmpoweringRecipeGenerator extends RecipeProvider { private final int color; private final List modifiers = new ArrayList<>(); - public EmpoweringBuilder(IItemProvider resultIn, Ingredient baseIn, int energyIn, int timeIn, int colorIn) { + public EmpoweringBuilder(ItemLike resultIn, Ingredient baseIn, int energyIn, int timeIn, int colorIn) { result = resultIn.asItem(); base = baseIn; energy = energyIn; @@ -126,11 +127,11 @@ public class EmpoweringRecipeGenerator extends RecipeProvider { color = colorIn; } - public static EmpoweringBuilder builder(IItemProvider resultIn, IItemProvider base, int energyIn, int timeIn, int colorIn) { + public static EmpoweringBuilder builder(ItemLike resultIn, ItemLike base, int energyIn, int timeIn, int colorIn) { return new EmpoweringBuilder(resultIn, Ingredient.of(base), energyIn, timeIn, colorIn); } - public EmpoweringBuilder addModifier(IItemProvider input) { + public EmpoweringBuilder addModifier(ItemLike input) { if (modifiers.size() >= 4) throw new IllegalStateException("too many modifiers for empowering recipe, input: " + input.asItem().getRegistryName()); modifiers.add(Ingredient.of(input)); @@ -144,24 +145,24 @@ public class EmpoweringRecipeGenerator extends RecipeProvider { return this; } - public EmpoweringBuilder addModifier(ITag input) { + public EmpoweringBuilder addModifier(TagKey input) { if (modifiers.size() >= 4) throw new IllegalStateException("too many modifiers for empowering recipe, input: " + input.toString()); modifiers.add(Ingredient.of(input)); return this; } - public void save(Consumer consumer, ResourceLocation name) { + public void save(Consumer consumer, ResourceLocation name) { if (modifiers.size() != 4) throw new IllegalStateException("invalid modifier count: " + modifiers.size() + ", recipe: " + name.toString()); - consumer.accept(new EmpowererRecipe.FinishedRecipe(name, result, base, modifiers.get(0), modifiers.get(1), modifiers.get(2), modifiers.get(3), energy, color, time)); + consumer.accept(new EmpowererRecipe.Result(name, result, base, modifiers.get(0), modifiers.get(1), modifiers.get(2), modifiers.get(3), energy, color, time)); } - public void save(Consumer consumer, String name) { + public void save(Consumer consumer, String name) { ResourceLocation res = new ResourceLocation(ActuallyAdditions.MODID, "empowering/" + name); if (modifiers.size() != 4) throw new IllegalStateException("invalid modifier count: " + modifiers.size() + ", recipe: " + res); - consumer.accept(new EmpowererRecipe.FinishedRecipe(res, result, base, modifiers.get(0), modifiers.get(1), modifiers.get(2), modifiers.get(3), energy, color, time)); + consumer.accept(new EmpowererRecipe.Result(res, result, base, modifiers.get(0), modifiers.get(1), modifiers.get(2), modifiers.get(3), energy, color, time)); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/FuelRecipeGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/FuelRecipeGenerator.java index 2eb67e966..528ec0b66 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/FuelRecipeGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/FuelRecipeGenerator.java @@ -3,19 +3,18 @@ package de.ellpeck.actuallyadditions.data; import com.google.gson.JsonObject; import de.ellpeck.actuallyadditions.api.ActuallyTags; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.crafting.LiquidFuelRecipe; import de.ellpeck.actuallyadditions.mod.crafting.SolidFuelRecipe; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import net.minecraft.data.DataGenerator; -import net.minecraft.data.DirectoryCache; -import net.minecraft.data.IFinishedRecipe; -import net.minecraft.data.RecipeProvider; -import net.minecraft.item.Item; -import net.minecraft.item.Items; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.tags.ITag; -import net.minecraft.util.ResourceLocation; +import net.minecraft.data.HashCache; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.data.recipes.RecipeProvider; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.Ingredient; import net.minecraftforge.fluids.FluidStack; import javax.annotation.Nonnull; @@ -28,12 +27,12 @@ public class FuelRecipeGenerator extends RecipeProvider { } @Override - protected void saveAdvancement(@Nonnull DirectoryCache pCache, @Nonnull JsonObject pAdvancementJson, @Nonnull Path pPath) { + protected void saveAdvancement(@Nonnull HashCache pCache, @Nonnull JsonObject pAdvancementJson, @Nonnull Path pPath) { //Nah } @Override - protected void buildShapelessRecipes(@Nonnull Consumer consumer) { + protected void buildCraftingRecipes(@Nonnull Consumer consumer) { addSolid(consumer, "coal", Items.COAL, 32000, 1600); addSolid(consumer, "stick", Items.STICK, 2000, 100); addSolid(consumer, "tiny-coal", ActuallyTags.Items.TINY_COALS, 4000, 200); @@ -41,26 +40,26 @@ public class FuelRecipeGenerator extends RecipeProvider { addSolid(consumer, "coal-block", Items.COAL_BLOCK, 320000, 16000); addSolid(consumer, "lava", Items.LAVA_BUCKET, 400000, 20000); - consumer.accept(new LiquidFuelRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/canola_oil"), + consumer.accept(new LiquidFuelRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/canola_oil"), new FluidStack(InitFluids.CANOLA_OIL.get(), 50), 4000, 100)); - consumer.accept(new LiquidFuelRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/refined_canola_oil"), + consumer.accept(new LiquidFuelRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/refined_canola_oil"), new FluidStack(InitFluids.REFINED_CANOLA_OIL.get(), 50), 9600, 120)); - consumer.accept(new LiquidFuelRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/crystallized_canola_oil"), + consumer.accept(new LiquidFuelRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/crystallized_canola_oil"), new FluidStack(InitFluids.CRYSTALLIZED_OIL.get(), 50), 28000, 280)); - consumer.accept(new LiquidFuelRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/empowered_canola_oil"), + consumer.accept(new LiquidFuelRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/empowered_canola_oil"), new FluidStack(InitFluids.EMPOWERED_OIL.get(), 50), 48000, 400)); } - private void addSolid(Consumer consumer, String name, Item item, int energy, int burnTime) { - consumer.accept(new SolidFuelRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name), Ingredient.of(item), energy, burnTime)); + private void addSolid(Consumer consumer, String name, Item item, int energy, int burnTime) { + consumer.accept(new SolidFuelRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name), Ingredient.of(item), energy, burnTime)); } - private void addSolid(Consumer consumer, String name, Ingredient item, int energy, int burnTime) { - consumer.accept(new SolidFuelRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name), item, energy, burnTime)); + private void addSolid(Consumer consumer, String name, Ingredient item, int energy, int burnTime) { + consumer.accept(new SolidFuelRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name), item, energy, burnTime)); } - private void addSolid(Consumer consumer, String name, ITag tag, int energy, int burnTime) { - consumer.accept(new SolidFuelRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name), Ingredient.of(tag), energy, burnTime)); + private void addSolid(Consumer consumer, String name, TagKey tag, int energy, int burnTime) { + consumer.accept(new SolidFuelRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name), Ingredient.of(tag), energy, burnTime)); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/ItemModelGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/ItemModelGenerator.java index 151361d6a..3c5500894 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/ItemModelGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/ItemModelGenerator.java @@ -6,16 +6,16 @@ import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.fluids.FluidAA; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; -import net.minecraft.block.Block; -import net.minecraft.block.WallBlock; import net.minecraft.data.DataGenerator; -import net.minecraft.item.Item; -import net.minecraft.util.ResourceLocation; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.WallBlock; import net.minecraftforge.client.model.generators.ItemModelProvider; import net.minecraftforge.client.model.generators.ModelFile; import net.minecraftforge.client.model.generators.loaders.DynamicBucketModelBuilder; import net.minecraftforge.common.data.ExistingFileHelper; -import net.minecraftforge.fml.RegistryObject; +import net.minecraftforge.registries.RegistryObject; import java.util.Set; import java.util.function.Supplier; diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/ItemRecipeGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/ItemRecipeGenerator.java index a2ac7a125..8ac3bf6c4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/ItemRecipeGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/ItemRecipeGenerator.java @@ -8,19 +8,24 @@ import de.ellpeck.actuallyadditions.mod.crafting.ActuallyRecipes; import de.ellpeck.actuallyadditions.mod.crafting.TargetNBTIngredient; import de.ellpeck.actuallyadditions.mod.crafting.WrappedRecipe; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; -import net.minecraft.data.*; -import net.minecraft.enchantment.Enchantments; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; +import net.minecraft.data.DataGenerator; +import net.minecraft.data.HashCache; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.data.recipes.RecipeProvider; +import net.minecraft.data.recipes.ShapedRecipeBuilder; +import net.minecraft.data.recipes.ShapelessRecipeBuilder; +import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.ItemTags; -import net.minecraft.util.IItemProvider; -import net.minecraft.util.ResourceLocation; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.enchantment.Enchantments; +import net.minecraft.world.level.ItemLike; import net.minecraftforge.common.Tags; import net.minecraftforge.common.crafting.ConditionalRecipe; import net.minecraftforge.common.crafting.NBTIngredient; -import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; import javax.annotation.Nonnull; import java.nio.file.Path; @@ -33,7 +38,7 @@ public class ItemRecipeGenerator extends RecipeProvider { } @Override - protected void buildShapelessRecipes(Consumer consumer) { + protected void buildCraftingRecipes(Consumer consumer) { generatePaxels(consumer); //Goggles @@ -504,7 +509,7 @@ public class ItemRecipeGenerator extends RecipeProvider { // GameRegistry.addSmelting(new ItemStack(InitItems.itemDust, 1, TheDusts.COAL.ordinal()), new ItemStack(Items.COAL), 1F); } - protected void generatePaxels(Consumer consumer) { + protected void generatePaxels(Consumer consumer) { addPaxel(consumer, ActuallyItems.WOODEN_AIOT, Items.WOODEN_AXE, Items.WOODEN_PICKAXE, Items.WOODEN_SWORD, Items.WOODEN_SHOVEL, Items.WOODEN_HOE); addPaxel(consumer, ActuallyItems.STONE_AIOT, Items.STONE_AXE, Items.STONE_PICKAXE, Items.STONE_SWORD, Items.STONE_SHOVEL, Items.STONE_HOE); addPaxel(consumer, ActuallyItems.IRON_AIOT, Items.IRON_AXE, Items.IRON_PICKAXE, Items.IRON_SWORD, Items.IRON_SHOVEL, Items.IRON_HOE); @@ -513,7 +518,7 @@ public class ItemRecipeGenerator extends RecipeProvider { addPaxel(consumer, ActuallyItems.NETHERITE_AIOT, Items.NETHERITE_AXE, Items.NETHERITE_PICKAXE, Items.NETHERITE_SWORD, Items.NETHERITE_SHOVEL, Items.NETHERITE_HOE); } - public static void addPaxel(Consumer consumer, RegistryObject output, Item axe, Item pickaxe, Item sword, Item shovel, Item hoe) { + public static void addPaxel(Consumer consumer, RegistryObject output, Item axe, Item pickaxe, Item sword, Item shovel, Item hoe) { Recipe.shapeless(output.get()) .requires(axe) .requires(pickaxe) @@ -523,7 +528,7 @@ public class ItemRecipeGenerator extends RecipeProvider { .save(consumer); } - public static void addPaxel(Consumer consumer, RegistryObject output, RegistryObject axe, RegistryObject pickaxe, RegistryObject sword, RegistryObject shovel, RegistryObject hoe) { + public static void addPaxel(Consumer consumer, RegistryObject output, RegistryObject axe, RegistryObject pickaxe, RegistryObject sword, RegistryObject shovel, RegistryObject hoe) { Recipe.shapeless(output.get()) .requires(axe.get()) .requires(pickaxe.get()) @@ -533,26 +538,26 @@ public class ItemRecipeGenerator extends RecipeProvider { .save(consumer); } - public static void decompress(Consumer consumer, RegistryObject output, RegistryObject input) { + public static void decompress(Consumer consumer, RegistryObject output, RegistryObject input) { ResourceLocation key = ForgeRegistries.ITEMS.getKey(output.get()); Recipe.shapeless(output.get(), 9).requires(input.get()).save(consumer, new ResourceLocation(key.getNamespace(), "decompress/" + key.getPath())); } - public static void compress(Consumer consumer, RegistryObject output, RegistryObject input) { + public static void compress(Consumer consumer, RegistryObject output, RegistryObject input) { ResourceLocation key = ForgeRegistries.ITEMS.getKey(output.get()); Recipe.shaped(output.get()).pattern("xxx","xxx", "xxx").define('x', input.get()).save(consumer, new ResourceLocation(key.getNamespace(), "compress/" + key.getPath())); } - public static void addShard(Consumer consumer, RegistryObject shard, RegistryObject crystal) { + public static void addShard(Consumer consumer, RegistryObject shard, RegistryObject crystal) { compress(consumer, crystal, shard); decompress(consumer, shard, crystal); } @Override - protected void saveAdvancement(DirectoryCache cache, JsonObject cache2, Path advancementJson) { + protected void saveAdvancement(HashCache cache, JsonObject cache2, Path advancementJson) { //Nope... } - public static void addToolAndArmorRecipes(Consumer consumer, RegistryObject base, RegistryObject pickaxe, RegistryObject sword, RegistryObject axe, RegistryObject shovel, RegistryObject hoe, RegistryObject helm, RegistryObject chest, RegistryObject pants, RegistryObject boots) { + public static void addToolAndArmorRecipes(Consumer consumer, RegistryObject base, RegistryObject pickaxe, RegistryObject sword, RegistryObject axe, RegistryObject shovel, RegistryObject hoe, RegistryObject helm, RegistryObject chest, RegistryObject pants, RegistryObject boots) { //Pickaxe Recipe.shaped(pickaxe.get()) .pattern("EEE", " S ", " S ") @@ -614,33 +619,33 @@ public class ItemRecipeGenerator extends RecipeProvider { } public static class Recipe { - public static ItemRecipeGenerator.Recipe.Shapeless shapeless(IItemProvider result) { + public static ItemRecipeGenerator.Recipe.Shapeless shapeless(ItemLike result) { return new ItemRecipeGenerator.Recipe.Shapeless(result); } - public static ItemRecipeGenerator.Recipe.Shapeless shapeless(IItemProvider result, int count) { + public static ItemRecipeGenerator.Recipe.Shapeless shapeless(ItemLike result, int count) { return new ItemRecipeGenerator.Recipe.Shapeless(result, count); } - public static ItemRecipeGenerator.Recipe.Shaped shaped(IItemProvider result) { + public static ItemRecipeGenerator.Recipe.Shaped shaped(ItemLike result) { return new ItemRecipeGenerator.Recipe.Shaped(result); } - public static ItemRecipeGenerator.Recipe.Shaped shaped(IItemProvider result, int count) { + public static ItemRecipeGenerator.Recipe.Shaped shaped(ItemLike result, int count) { return new ItemRecipeGenerator.Recipe.Shaped(result, count); } private static class Shapeless extends ShapelessRecipeBuilder { private ResourceLocation name; - public Shapeless(IItemProvider result) { + public Shapeless(ItemLike result) { this(result, 1); } - public Shapeless(IItemProvider result, int countIn) { + public Shapeless(ItemLike result, int countIn) { super(result, countIn); } - public ItemRecipeGenerator.Recipe.Shapeless ingredients(IItemProvider... ingredients) { + public ItemRecipeGenerator.Recipe.Shapeless ingredients(ItemLike... ingredients) { Arrays.asList(ingredients).forEach(this::requires); return this; } @@ -651,7 +656,7 @@ public class ItemRecipeGenerator extends RecipeProvider { } @Override - public void save(@Nonnull Consumer consumer) { + public void save(@Nonnull Consumer consumer) { this.unlockedBy("has_book", has(ActuallyItems.ITEM_BOOKLET.get())); if (this.name != null) { this.save(consumer, this.name); @@ -660,18 +665,18 @@ public class ItemRecipeGenerator extends RecipeProvider { } } @Override - public void save(@Nonnull Consumer consumer, @Nonnull ResourceLocation location) { + public void save(@Nonnull Consumer consumer, @Nonnull ResourceLocation location) { this.unlockedBy("", has(Items.AIR)); super.save(consumer, location); } } private static class Shaped extends ShapedRecipeBuilder { - public Shaped(IItemProvider resultIn) { + public Shaped(ItemLike resultIn) { this(resultIn, 1); } - public Shaped(IItemProvider resultIn, int countIn) { + public Shaped(ItemLike resultIn, int countIn) { super(resultIn, countIn); } @@ -688,7 +693,7 @@ public class ItemRecipeGenerator extends RecipeProvider { return this; } - public ItemRecipeGenerator.Recipe.Shaped patternSingleKey(char key, IItemProvider resource, String... lines) { + public ItemRecipeGenerator.Recipe.Shaped patternSingleKey(char key, ItemLike resource, String... lines) { this.define(key, resource); for (String line : lines) { this.pattern(line); @@ -703,13 +708,13 @@ public class ItemRecipeGenerator extends RecipeProvider { } @Override - public void save(@Nonnull Consumer consumerIn) { + public void save(@Nonnull Consumer consumerIn) { this.unlockedBy("has_book", has(ActuallyItems.ITEM_BOOKLET.get())); super.save(consumerIn); } @Override - public void save(@Nonnull Consumer consumer, @Nonnull ResourceLocation location) { + public void save(@Nonnull Consumer consumer, @Nonnull ResourceLocation location) { this.unlockedBy("", has(Items.AIR)); super.save(consumer, location); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/ItemTagsGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/ItemTagsGenerator.java index 1bb00ffc3..20bb76439 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/ItemTagsGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/ItemTagsGenerator.java @@ -3,9 +3,9 @@ package de.ellpeck.actuallyadditions.data; import de.ellpeck.actuallyadditions.api.ActuallyTags; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; -import net.minecraft.data.BlockTagsProvider; import net.minecraft.data.DataGenerator; -import net.minecraft.data.ItemTagsProvider; +import net.minecraft.data.tags.BlockTagsProvider; +import net.minecraft.data.tags.ItemTagsProvider; import net.minecraftforge.common.data.ExistingFileHelper; import javax.annotation.Nullable; diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/LaserRecipeGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/LaserRecipeGenerator.java index 3af08eb2a..88e8676b7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/LaserRecipeGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/LaserRecipeGenerator.java @@ -6,16 +6,17 @@ import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.crafting.LaserRecipe; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import net.minecraft.data.DataGenerator; -import net.minecraft.data.DirectoryCache; -import net.minecraft.data.IFinishedRecipe; -import net.minecraft.data.RecipeProvider; -import net.minecraft.item.Item; -import net.minecraft.item.Items; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.tags.ITag; +import net.minecraft.data.HashCache; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.data.recipes.RecipeProvider; +import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.ItemTags; -import net.minecraft.util.IItemProvider; -import net.minecraft.util.ResourceLocation; +import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.level.ItemLike; import net.minecraftforge.common.Tags; import java.nio.file.Path; @@ -27,11 +28,11 @@ public class LaserRecipeGenerator extends RecipeProvider { } @Override - protected void saveAdvancement(DirectoryCache pCache, JsonObject pAdvancementJson, Path pPath) { + protected void saveAdvancement(HashCache pCache, JsonObject pAdvancementJson, Path pPath) { } @Override - protected void buildShapelessRecipes(Consumer consumer) { + protected void buildCraftingRecipes(Consumer consumer) { //Crystal Blocks laserCrystalizeRecipe(consumer, ActuallyBlocks.RESTONIA_CRYSTAL.getItem(), Tags.Items.STORAGE_BLOCKS_REDSTONE, 400); laserCrystalizeRecipe(consumer, ActuallyBlocks.PALIS_CRYSTAL.getItem(), Tags.Items.STORAGE_BLOCKS_LAPIS, 400); @@ -70,28 +71,28 @@ public class LaserRecipeGenerator extends RecipeProvider { } - private void laserRecipe(Consumer consumer, IItemProvider output, Ingredient input, int energy) { - consumer.accept(new LaserRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "laser/" + output.asItem().getRegistryName().getPath()), + private void laserRecipe(Consumer consumer, ItemLike output, Ingredient input, int energy) { + consumer.accept(new LaserRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "laser/" + output.asItem().getRegistryName().getPath()), input, energy, output)); } - private void laserRecipe(Consumer consumer, IItemProvider output, ITag input, int energy) { - consumer.accept(new LaserRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "laser/" + output.asItem().getRegistryName().getPath()), + private void laserRecipe(Consumer consumer, ItemLike output, TagKey input, int energy) { + consumer.accept(new LaserRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "laser/" + output.asItem().getRegistryName().getPath()), Ingredient.of(input), energy, output)); } - private void laserRecipe(Consumer consumer, IItemProvider output, IItemProvider input, int energy) { - consumer.accept(new LaserRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "laser/" + output.asItem().getRegistryName().getPath()), + private void laserRecipe(Consumer consumer, ItemLike output, ItemLike input, int energy) { + consumer.accept(new LaserRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "laser/" + output.asItem().getRegistryName().getPath()), Ingredient.of(input), energy, output)); } - private void laserCrystalizeRecipe(Consumer consumer, IItemProvider output, Ingredient input, int energy) { - consumer.accept(new LaserRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_" + output.asItem().getRegistryName().getPath()), + private void laserCrystalizeRecipe(Consumer consumer, ItemLike output, Ingredient input, int energy) { + consumer.accept(new LaserRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_" + output.asItem().getRegistryName().getPath()), input, energy, output)); } - private void laserCrystalizeRecipe(Consumer consumer, IItemProvider output, ITag input, int energy) { - consumer.accept(new LaserRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_" + output.asItem().getRegistryName().getPath()), + private void laserCrystalizeRecipe(Consumer consumer, ItemLike output, TagKey input, int energy) { + consumer.accept(new LaserRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_" + output.asItem().getRegistryName().getPath()), Ingredient.of(input), energy, output)); } - private void laserCrystalizeRecipe(Consumer consumer, IItemProvider output, IItemProvider input, int energy) { - consumer.accept(new LaserRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_" + output.asItem().getRegistryName().getPath()), + private void laserCrystalizeRecipe(Consumer consumer, ItemLike output, ItemLike input, int energy) { + consumer.accept(new LaserRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_" + output.asItem().getRegistryName().getPath()), Ingredient.of(input), energy, output)); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/LootTableGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/LootTableGenerator.java index 25754afb6..f09b3ccc6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/LootTableGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/LootTableGenerator.java @@ -7,20 +7,27 @@ import com.mojang.datafixers.util.Pair; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; -import net.minecraft.advancements.criterion.StatePropertiesPredicate; -import net.minecraft.block.Block; -import net.minecraft.block.CropsBlock; +import net.minecraft.advancements.critereon.StatePropertiesPredicate; import net.minecraft.data.DataGenerator; -import net.minecraft.data.LootTableProvider; -import net.minecraft.data.loot.BlockLootTables; -import net.minecraft.item.Item; -import net.minecraft.item.Items; -import net.minecraft.loot.*; -import net.minecraft.loot.conditions.BlockStateProperty; -import net.minecraft.loot.functions.CopyName; -import net.minecraft.loot.functions.CopyNbt; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.RegistryObject; +import net.minecraft.data.loot.BlockLoot; +import net.minecraft.data.loot.LootTableProvider; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.CropBlock; +import net.minecraft.world.level.storage.loot.LootPool; +import net.minecraft.world.level.storage.loot.LootTable; +import net.minecraft.world.level.storage.loot.LootTables; +import net.minecraft.world.level.storage.loot.ValidationContext; +import net.minecraft.world.level.storage.loot.entries.LootItem; +import net.minecraft.world.level.storage.loot.functions.CopyNbtFunction; +import net.minecraft.world.level.storage.loot.parameters.LootContextParamSet; +import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; +import net.minecraft.world.level.storage.loot.predicates.LootItemBlockStatePropertyCondition; +import net.minecraft.world.level.storage.loot.providers.nbt.ContextNbtProvider; +import net.minecraft.world.level.storage.loot.providers.number.ConstantValue; +import net.minecraftforge.registries.RegistryObject; import javax.annotation.Nonnull; import java.util.List; @@ -37,20 +44,20 @@ public class LootTableGenerator extends LootTableProvider { } @Nonnull @Override - protected List>>, LootParameterSet>> getTables() { - return ImmutableList.of(Pair.of(Blocks::new, LootParameterSets.BLOCK)); + protected List>>, LootContextParamSet>> getTables() { + return ImmutableList.of(Pair.of(Blocks::new, LootContextParamSets.BLOCK)); } @Override - protected void validate(Map map, @Nonnull ValidationTracker validationtracker) { - map.forEach((name, table) -> LootTableManager.validate(validationtracker, name, table)); + protected void validate(Map map, @Nonnull ValidationContext validationtracker) { + map.forEach((name, table) -> LootTables.validate(validationtracker, name, table)); } - public static class Blocks extends BlockLootTables { + public static class Blocks extends BlockLoot { @Override protected void addTables() { - CopyNbt.Builder copyEnergy = CopyNbt.copyData(CopyNbt.Source.BLOCK_ENTITY).copy("Energy", "BlockEntityTag.Energy"); - CopyNbt.Builder copyPulseMode = CopyNbt.copyData(CopyNbt.Source.BLOCK_ENTITY).copy("IsPulseMode", "BlockEntityTag.IsPulseMode"); + CopyNbtFunction.Builder copyEnergy = CopyNbtFunction.copyData(ContextNbtProvider.BLOCK_ENTITY).copy("Energy", "BlockEntityTag.Energy"); + CopyNbtFunction.Builder copyPulseMode = CopyNbtFunction.copyData(ContextNbtProvider.BLOCK_ENTITY).copy("IsPulseMode", "BlockEntityTag.IsPulseMode"); //Special Drops dropNBT(ActuallyBlocks.ATOMIC_RECONSTRUCTOR, $ -> $.apply(copyEnergy).apply(copyPulseMode)); @@ -195,19 +202,19 @@ public class LootTableGenerator extends LootTableProvider { private void addCrop(Supplier block, Supplier item, Supplier seed) { add(block.get(), createCropDrops(block.get(), item.get(), seed.get(), - BlockStateProperty.hasBlockStateProperties(block.get()).setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(CropsBlock.AGE, 7)))); + LootItemBlockStatePropertyCondition.hasBlockStateProperties(block.get()).setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(CropBlock.AGE, 7)))); } private void dropNBT(Supplier blockSupplier, Consumer lootFunctionProvider) { - LootPool.Builder lootpool = LootPool.lootPool().setRolls(ConstantRange.exactly(1)).add(ItemLootEntry.lootTableItem(blockSupplier.get())); + LootPool.Builder lootpool = LootPool.lootPool().setRolls(ConstantValue.exactly(1)).add(LootItem.lootTableItem(blockSupplier.get())); lootFunctionProvider.accept(lootpool); add(blockSupplier.get(), LootTable.lootTable().withPool(applyExplosionCondition(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get(), lootpool))); } private void dropKeepEnergy(Supplier blockSupplier) { - dropNBT(blockSupplier, $ -> $.apply(CopyNbt.copyData(CopyNbt.Source.BLOCK_ENTITY).copy("Energy", "BlockEntityTag.Energy"))); + dropNBT(blockSupplier, $ -> $.apply(CopyNbtFunction.copyData(ContextNbtProvider.BLOCK_ENTITY).copy("Energy", "BlockEntityTag.Energy"))); } /* // This isn't quite right :cry: fortune doesn't change it diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/MiningLensGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/MiningLensGenerator.java index 42c6e1cac..9b2e70442 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/MiningLensGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/MiningLensGenerator.java @@ -4,14 +4,16 @@ import com.google.gson.JsonObject; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.crafting.MiningLensRecipe; import net.minecraft.data.DataGenerator; -import net.minecraft.data.DirectoryCache; -import net.minecraft.data.IFinishedRecipe; -import net.minecraft.data.RecipeProvider; -import net.minecraft.item.Items; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.tags.ITag; -import net.minecraft.util.IItemProvider; -import net.minecraft.util.ResourceLocation; +import net.minecraft.data.HashCache; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.data.recipes.RecipeProvider; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.level.ItemLike; import net.minecraftforge.common.Tags; import net.minecraftforge.registries.ForgeRegistries; @@ -24,31 +26,31 @@ public class MiningLensGenerator extends RecipeProvider { } @Override - protected void saveAdvancement(DirectoryCache pCache, JsonObject pAdvancementJson, Path pPath) { + protected void saveAdvancement(HashCache pCache, JsonObject pAdvancementJson, Path pPath) { } @Override - protected void buildShapelessRecipes(Consumer consumer) { + protected void buildCraftingRecipes(Consumer consumer) { buildMiningLens(consumer); } - private String getItemName(IItemProvider item) { - return ForgeRegistries.ITEMS.getKey(item.asItem()).getPath(); - } +// private String getItemName(ItemLike item) { +// return ForgeRegistries.ITEMS.getKey(item.asItem()).getPath(); +// } private ResourceLocation folderRecipe(String folder, String recipe) { return new ResourceLocation(ActuallyAdditions.MODID, folder + "/" + recipe); } - private void buildStoneOre(Consumer consumer, int weight, IItemProvider output) { + private void buildStoneOre(Consumer consumer, int weight, ItemLike output) { buildTagOre(consumer, Tags.Items.STONE, "stone", weight, output); } - private void buildNetherOre(Consumer consumer, int weight, IItemProvider output) { + private void buildNetherOre(Consumer consumer, int weight, ItemLike output) { buildTagOre(consumer, Tags.Items.NETHERRACK, "nether", weight, output); } - private void buildTagOre(Consumer consumer, ITag tag, String prefix, int weight, IItemProvider output) { - consumer.accept(new MiningLensRecipe.FinishedRecipe( + private void buildTagOre(Consumer consumer, TagKey tag, String prefix, int weight, ItemLike output) { + consumer.accept(new MiningLensRecipe.Result( folderRecipe("mininglens", prefix + "_" + getItemName(output)), Ingredient.of(tag), weight, @@ -56,7 +58,7 @@ public class MiningLensGenerator extends RecipeProvider { )); } - private void buildMiningLens(Consumer consumer) { + private void buildMiningLens(Consumer consumer) { buildStoneOre(consumer, 5000, Items.COAL_ORE); buildStoneOre(consumer, 3000, Items.IRON_ORE); buildStoneOre(consumer, 500, Items.GOLD_ORE); diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/MiscMachineRecipeGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/MiscMachineRecipeGenerator.java index 9f106df61..d3255f594 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/MiscMachineRecipeGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/MiscMachineRecipeGenerator.java @@ -3,22 +3,16 @@ package de.ellpeck.actuallyadditions.data; import com.google.gson.JsonObject; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.crafting.FermentingRecipe; -import de.ellpeck.actuallyadditions.mod.crafting.MiningLensRecipe; import de.ellpeck.actuallyadditions.mod.crafting.PressingRecipe; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import net.minecraft.data.DataGenerator; -import net.minecraft.data.DirectoryCache; -import net.minecraft.data.IFinishedRecipe; -import net.minecraft.data.RecipeProvider; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.Items; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.tags.ITag; -import net.minecraft.util.IItemProvider; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.registry.Registry; -import net.minecraftforge.common.Tags; +import net.minecraft.data.HashCache; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.data.recipes.RecipeProvider; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.level.ItemLike; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.registries.ForgeRegistries; @@ -31,21 +25,21 @@ public class MiscMachineRecipeGenerator extends RecipeProvider { } @Override - protected void saveAdvancement(DirectoryCache pCache, JsonObject pAdvancementJson, Path pPath) { + protected void saveAdvancement(HashCache pCache, JsonObject pAdvancementJson, Path pPath) { } @Override - protected void buildShapelessRecipes(Consumer consumer) { - consumer.accept(new PressingRecipe.FinishedRecipe(folderRecipe("pressing", "canola"), + protected void buildCraftingRecipes(Consumer consumer) { + consumer.accept(new PressingRecipe.Result(folderRecipe("pressing", "canola"), Ingredient.of(ActuallyItems.CANOLA.get()), new FluidStack(InitFluids.CANOLA_OIL.get(), 80))); - consumer.accept(new FermentingRecipe.FinishedRecipe(folderRecipe("fermenting", "refined_canola"), + consumer.accept(new FermentingRecipe.Result(folderRecipe("fermenting", "refined_canola"), new FluidStack(InitFluids.CANOLA_OIL.get(), 80), new FluidStack(InitFluids.REFINED_CANOLA_OIL.get(), 80), 100)); } - private String getItemName(IItemProvider item) { - return ForgeRegistries.ITEMS.getKey(item.asItem()).getPath(); - } +// private String getItemName(ItemLike item) { +// return ForgeRegistries.ITEMS.getKey(item.asItem()).getPath(); +// } private ResourceLocation folderRecipe(String folder, String recipe) { return new ResourceLocation(ActuallyAdditions.MODID, folder + "/" + recipe); diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/SoundsGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/SoundsGenerator.java index 594930017..260cd0af0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/SoundsGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/SoundsGenerator.java @@ -3,7 +3,7 @@ package de.ellpeck.actuallyadditions.data; import de.ellpeck.actuallyadditions.mod.AASounds; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import net.minecraft.data.DataGenerator; -import net.minecraft.util.ResourceLocation; +import net.minecraft.resources.ResourceLocation; import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.common.data.SoundDefinitionsProvider; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/AASounds.java b/src/main/java/de/ellpeck/actuallyadditions/mod/AASounds.java index d6b6fef83..811ab818b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/AASounds.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/AASounds.java @@ -1,11 +1,11 @@ package de.ellpeck.actuallyadditions.mod; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.SoundEvent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundEvent; import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; public class AASounds { public static final DeferredRegister SOUNDS = DeferredRegister.create(ForgeRegistries.SOUND_EVENTS, ActuallyAdditions.MODID); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java index af7b5f03e..2f86bea70 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java @@ -36,31 +36,33 @@ import de.ellpeck.actuallyadditions.mod.network.PacketHandler; import de.ellpeck.actuallyadditions.mod.particle.ActuallyParticles; import de.ellpeck.actuallyadditions.mod.update.UpdateChecker; import de.ellpeck.actuallyadditions.mod.util.ResourceReloader; -import net.minecraft.entity.EntityClassification; -import net.minecraft.entity.EntityType; -import net.minecraft.item.Item; -import net.minecraft.item.ItemGroup; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.util.ResourceLocation; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.MobCategory; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.event.ParticleFactoryRegisterEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.crafting.CraftingHelper; import net.minecraftforge.event.AddReloadListenerEvent; +import net.minecraftforge.event.server.ServerStartedEvent; +import net.minecraftforge.event.server.ServerStoppedEvent; import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.ModLoadingContext; -import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.config.ModConfig; +import net.minecraftforge.fml.event.config.ModConfigEvent; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; -import net.minecraftforge.fml.event.server.FMLServerStartedEvent; -import net.minecraftforge.fml.event.server.FMLServerStoppedEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -77,7 +79,7 @@ public class ActuallyAdditions { public static final String GUIFACTORY = "de.ellpeck.actuallyadditions.mod.config.GuiFactory"; public static final String DEPS = "required:forge@[14.23.5.2836,);before:craftingtweaks;after:fastbench@[1.3.2,)"; - public static final ItemGroup GROUP = new ItemGroup(MODID) { + public static final CreativeModeTab GROUP = new CreativeModeTab(MODID) { @OnlyIn(Dist.CLIENT) @Override public ItemStack makeIcon() { @@ -87,7 +89,7 @@ public class ActuallyAdditions { public static final Logger LOGGER = LogManager.getLogger(NAME); public static final DeferredRegister> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITIES, MODID); - public static final RegistryObject> ENTITY_WORM = ENTITIES.register("worm", () -> EntityType.Builder.of(EntityWorm::new, EntityClassification.MISC).build(MODID + ":worm")); + public static final RegistryObject> ENTITY_WORM = ENTITIES.register("worm", () -> EntityType.Builder.of(EntityWorm::new, MobCategory.MISC).build(MODID + ":worm")); public static boolean commonCapsLoaded; @@ -115,13 +117,17 @@ public class ActuallyAdditions { InitFluids.init(eventBus); eventBus.addListener(this::setup); - eventBus.addListener(this::clientSetup); - eventBus.addListener(this::particleFactoryRegister); + + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> { + eventBus.addListener(this::clientSetup); + eventBus.addListener(ActuallyAdditionsClient::setupSpecialRenders); + eventBus.addListener(this::particleFactoryRegister); + }); IFarmerBehavior.initBehaviors(); } private static void reloadEvent(AddReloadListenerEvent event) { - event.addListener(new ResourceReloader(event.getDataPackRegistries())); + event.addListener(new ResourceReloader(event.getServerResources())); } private void setup(FMLCommonSetupEvent event) { @@ -148,7 +154,7 @@ public class ActuallyAdditions { //LensMining.init(); } - private void onConfigReload(ModConfig.ModConfigEvent event) { + private void onConfigReload(ModConfigEvent event) { Item item1 = ForgeRegistries.ITEMS.getValue(new ResourceLocation(CommonConfig.Other.REDSTONECONFIGURATOR.get())); Item item2 = ForgeRegistries.ITEMS.getValue(new ResourceLocation(CommonConfig.Other.RELAYCONFIGURATOR.get())); CommonConfig.Other.redstoneConfigureItem = item1 != null?item1: Items.AIR; @@ -163,7 +169,7 @@ public class ActuallyAdditions { ActuallyAdditionsClient.registerParticleFactories(); } - public void serverStarted(FMLServerStartedEvent event) { + public void serverStarted(ServerStartedEvent event) { // TODO: [port] check if this is needed // if (event.getServer() != null) { @@ -174,7 +180,7 @@ public class ActuallyAdditions { // } } - public void serverStopped(FMLServerStoppedEvent event) { + public void serverStopped(ServerStoppedEvent event) { // TODO: [port] check if this is needed WorldData.clear(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditionsClient.java b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditionsClient.java index 698b6fd01..ac36911f3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditionsClient.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditionsClient.java @@ -11,104 +11,129 @@ package de.ellpeck.actuallyadditions.mod; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; -import de.ellpeck.actuallyadditions.mod.blocks.render.*; +import de.ellpeck.actuallyadditions.mod.blocks.render.ReconstructorRenderer; +import de.ellpeck.actuallyadditions.mod.blocks.render.RenderBatteryBox; +import de.ellpeck.actuallyadditions.mod.blocks.render.RenderDisplayStand; +import de.ellpeck.actuallyadditions.mod.blocks.render.RenderEmpowerer; +import de.ellpeck.actuallyadditions.mod.blocks.render.RenderLaserRelay; import de.ellpeck.actuallyadditions.mod.entity.RenderWorm; import de.ellpeck.actuallyadditions.mod.event.ClientEvents; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.inventory.ActuallyContainers; -import de.ellpeck.actuallyadditions.mod.inventory.gui.*; +import de.ellpeck.actuallyadditions.mod.inventory.gui.CrusherScreen; +import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiBioReactor; +import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiBreaker; +import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiCanolaPress; +import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiCoalGenerator; +import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiCoffeeMachine; +import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiDirectionalBreaker; +import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiDrill; +import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiDropper; +import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiEnergizer; +import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiEnervator; +import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFarmer; +import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFeeder; +import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFermentingBarrel; +import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFilter; +import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFireworkBox; +import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFluidCollector; +import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFurnaceDouble; +import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiLaserRelayItemWhitelist; +import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiMiner; +import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiOilGenerator; +import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiPhantomPlacer; +import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiRangedCollector; +import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiXPSolidifier; +import de.ellpeck.actuallyadditions.mod.inventory.gui.SackGui; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import de.ellpeck.actuallyadditions.mod.misc.special.SpecialRenderInit; import de.ellpeck.actuallyadditions.mod.particle.ActuallyParticles; import de.ellpeck.actuallyadditions.mod.particle.ParticleBeam; import de.ellpeck.actuallyadditions.mod.particle.ParticleLaserItem; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.ScreenManager; -import net.minecraft.client.network.play.ClientPlayNetHandler; +import net.minecraft.client.gui.screens.MenuScreens; +import net.minecraft.client.multiplayer.ClientPacketListener; +import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.RenderTypeLookup; -import net.minecraft.item.ItemModelsProperties; -import net.minecraft.network.play.client.CPlayerDiggingPacket; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; +import net.minecraft.client.renderer.item.ItemProperties; +import net.minecraft.core.BlockPos; +import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraftforge.client.event.EntityRenderersEvent; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.client.registry.ClientRegistry; -import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; public class ActuallyAdditionsClient { public static void setup(FMLClientSetupEvent event) { - ScreenManager.register(ActuallyContainers.BAG_CONTAINER.get(), SackGui::new); - ScreenManager.register(ActuallyContainers.BIO_REACTOR_CONTAINER.get(), GuiBioReactor::new); - ScreenManager.register(ActuallyContainers.BREAKER_CONTAINER.get(), GuiBreaker::new); - ScreenManager.register(ActuallyContainers.CANOLA_PRESS_CONTAINER.get(), GuiCanolaPress::new); - ScreenManager.register(ActuallyContainers.COAL_GENERATOR_CONTAINER.get(), GuiCoalGenerator::new); - ScreenManager.register(ActuallyContainers.COFFEE_MACHINE_CONTAINER.get(), GuiCoffeeMachine::new); - ScreenManager.register(ActuallyContainers.DIRECTIONAL_BREAKER_CONTAINER.get(), GuiDirectionalBreaker::new); - ScreenManager.register(ActuallyContainers.DRILL_CONTAINER.get(), GuiDrill::new); - ScreenManager.register(ActuallyContainers.DROPPER_CONTAINER.get(), GuiDropper::new); - ScreenManager.register(ActuallyContainers.ENERVATOR_CONTAINER.get(), GuiEnervator::new); - ScreenManager.register(ActuallyContainers.ENERGIZER_CONTAINER.get(), GuiEnergizer::new); - ScreenManager.register(ActuallyContainers.FARMER_CONTAINER.get(), GuiFarmer::new); - ScreenManager.register(ActuallyContainers.FEEDER_CONTAINER.get(), GuiFeeder::new); - ScreenManager.register(ActuallyContainers.FERMENTING_BARREL_CONTAINER.get(), GuiFermentingBarrel::new); - ScreenManager.register(ActuallyContainers.FILTER_CONTAINER.get(), GuiFilter::new); - ScreenManager.register(ActuallyContainers.FIREWORK_BOX_CONTAINER.get(), GuiFireworkBox::new); - ScreenManager.register(ActuallyContainers.FLUID_COLLECTOR_CONTAINER.get(), GuiFluidCollector::new); - ScreenManager.register(ActuallyContainers.FURNACE_DOUBLE_CONTAINER.get(), GuiFurnaceDouble::new); - ScreenManager.register(ActuallyContainers.GRINDER_CONTAINER.get(), CrusherScreen::new); - ScreenManager.register(ActuallyContainers.LASER_RELAY_ITEM_WHITELIST_CONTAINER.get(), GuiLaserRelayItemWhitelist::new); - ScreenManager.register(ActuallyContainers.MINER_CONTAINER.get(), GuiMiner::new); - ScreenManager.register(ActuallyContainers.OIL_GENERATOR_CONTAINER.get(), GuiOilGenerator::new); - ScreenManager.register(ActuallyContainers.PHANTOM_PLACER_CONTAINER.get(), GuiPhantomPlacer::new); - ScreenManager.register(ActuallyContainers.RANGED_COLLECTOR_CONTAINER.get(), GuiRangedCollector::new); - ScreenManager.register(ActuallyContainers.XPSOLIDIFIER_CONTAINER.get(), GuiXPSolidifier::new); + MenuScreens.register(ActuallyContainers.BAG_CONTAINER.get(), SackGui::new); + MenuScreens.register(ActuallyContainers.BIO_REACTOR_CONTAINER.get(), GuiBioReactor::new); + MenuScreens.register(ActuallyContainers.BREAKER_CONTAINER.get(), GuiBreaker::new); + MenuScreens.register(ActuallyContainers.CANOLA_PRESS_CONTAINER.get(), GuiCanolaPress::new); + MenuScreens.register(ActuallyContainers.COAL_GENERATOR_CONTAINER.get(), GuiCoalGenerator::new); + MenuScreens.register(ActuallyContainers.COFFEE_MACHINE_CONTAINER.get(), GuiCoffeeMachine::new); + MenuScreens.register(ActuallyContainers.DIRECTIONAL_BREAKER_CONTAINER.get(), GuiDirectionalBreaker::new); + MenuScreens.register(ActuallyContainers.DRILL_CONTAINER.get(), GuiDrill::new); + MenuScreens.register(ActuallyContainers.DROPPER_CONTAINER.get(), GuiDropper::new); + MenuScreens.register(ActuallyContainers.ENERVATOR_CONTAINER.get(), GuiEnervator::new); + MenuScreens.register(ActuallyContainers.ENERGIZER_CONTAINER.get(), GuiEnergizer::new); + MenuScreens.register(ActuallyContainers.FARMER_CONTAINER.get(), GuiFarmer::new); + MenuScreens.register(ActuallyContainers.FEEDER_CONTAINER.get(), GuiFeeder::new); + MenuScreens.register(ActuallyContainers.FERMENTING_BARREL_CONTAINER.get(), GuiFermentingBarrel::new); + MenuScreens.register(ActuallyContainers.FILTER_CONTAINER.get(), GuiFilter::new); + MenuScreens.register(ActuallyContainers.FIREWORK_BOX_CONTAINER.get(), GuiFireworkBox::new); + MenuScreens.register(ActuallyContainers.FLUID_COLLECTOR_CONTAINER.get(), GuiFluidCollector::new); + MenuScreens.register(ActuallyContainers.FURNACE_DOUBLE_CONTAINER.get(), GuiFurnaceDouble::new); + MenuScreens.register(ActuallyContainers.GRINDER_CONTAINER.get(), CrusherScreen::new); + MenuScreens.register(ActuallyContainers.LASER_RELAY_ITEM_WHITELIST_CONTAINER.get(), GuiLaserRelayItemWhitelist::new); + MenuScreens.register(ActuallyContainers.MINER_CONTAINER.get(), GuiMiner::new); + MenuScreens.register(ActuallyContainers.OIL_GENERATOR_CONTAINER.get(), GuiOilGenerator::new); + MenuScreens.register(ActuallyContainers.PHANTOM_PLACER_CONTAINER.get(), GuiPhantomPlacer::new); + MenuScreens.register(ActuallyContainers.RANGED_COLLECTOR_CONTAINER.get(), GuiRangedCollector::new); + MenuScreens.register(ActuallyContainers.XPSOLIDIFIER_CONTAINER.get(), GuiXPSolidifier::new); // From old proxy MinecraftForge.EVENT_BUS.register(new ClientEvents()); MinecraftForge.EVENT_BUS.register(new ClientRegistryHandler()); MinecraftForge.EVENT_BUS.register(new SpecialRenderInit()); - setupSpecialRenders(); - event.enqueueWork(() -> - ItemModelsProperties.register(ActuallyItems.WORM.get(), new ResourceLocation(ActuallyAdditions.MODID, "snail"), - (stack, world, entity) -> "snail mail".equalsIgnoreCase(stack.getHoverName().getString()) ? 1F : 0F)); + ItemProperties.register(ActuallyItems.WORM.get(), new ResourceLocation(ActuallyAdditions.MODID, "snail"), + (stack, level, entity, tintIndex) -> "snail mail".equalsIgnoreCase(stack.getHoverName().getString()) ? 1F : 0F)); setupRenderLayers(); } private static void setupRenderLayers() { - RenderTypeLookup.setRenderLayer(InitFluids.CANOLA_OIL.get(), RenderType.translucent()); - RenderTypeLookup.setRenderLayer(InitFluids.CANOLA_OIL.getFlowing(), RenderType.translucent()); - RenderTypeLookup.setRenderLayer(InitFluids.REFINED_CANOLA_OIL.get(), RenderType.translucent()); - RenderTypeLookup.setRenderLayer(InitFluids.REFINED_CANOLA_OIL.getFlowing(), RenderType.translucent()); - RenderTypeLookup.setRenderLayer(InitFluids.CRYSTALLIZED_OIL.get(), RenderType.translucent()); - RenderTypeLookup.setRenderLayer(InitFluids.CRYSTALLIZED_OIL.getFlowing(), RenderType.translucent()); - RenderTypeLookup.setRenderLayer(InitFluids.EMPOWERED_OIL.get(), RenderType.translucent()); - RenderTypeLookup.setRenderLayer(InitFluids.EMPOWERED_OIL.getFlowing(), RenderType.translucent()); + ItemBlockRenderTypes.setRenderLayer(InitFluids.CANOLA_OIL.get(), RenderType.translucent()); + ItemBlockRenderTypes.setRenderLayer(InitFluids.CANOLA_OIL.getFlowing(), RenderType.translucent()); + ItemBlockRenderTypes.setRenderLayer(InitFluids.REFINED_CANOLA_OIL.get(), RenderType.translucent()); + ItemBlockRenderTypes.setRenderLayer(InitFluids.REFINED_CANOLA_OIL.getFlowing(), RenderType.translucent()); + ItemBlockRenderTypes.setRenderLayer(InitFluids.CRYSTALLIZED_OIL.get(), RenderType.translucent()); + ItemBlockRenderTypes.setRenderLayer(InitFluids.CRYSTALLIZED_OIL.getFlowing(), RenderType.translucent()); + ItemBlockRenderTypes.setRenderLayer(InitFluids.EMPOWERED_OIL.get(), RenderType.translucent()); + ItemBlockRenderTypes.setRenderLayer(InitFluids.EMPOWERED_OIL.getFlowing(), RenderType.translucent()); - RenderTypeLookup.setRenderLayer(ActuallyBlocks.CANOLA.get(), RenderType.cutout()); - RenderTypeLookup.setRenderLayer(ActuallyBlocks.RICE.get(), RenderType.cutout()); - RenderTypeLookup.setRenderLayer(ActuallyBlocks.FLAX.get(), RenderType.cutout()); - RenderTypeLookup.setRenderLayer(ActuallyBlocks.COFFEE.get(), RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ActuallyBlocks.CANOLA.get(), RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ActuallyBlocks.RICE.get(), RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ActuallyBlocks.FLAX.get(), RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ActuallyBlocks.COFFEE.get(), RenderType.cutout()); } - private static void setupSpecialRenders() { - ClientRegistry.bindTileEntityRenderer(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.getTileEntityType(), ReconstructorRenderer::new); - ClientRegistry.bindTileEntityRenderer(ActuallyBlocks.DISPLAY_STAND.getTileEntityType(), RenderDisplayStand::new); - ClientRegistry.bindTileEntityRenderer(ActuallyBlocks.EMPOWERER.getTileEntityType(), RenderEmpowerer::new); - ClientRegistry.bindTileEntityRenderer(ActuallyBlocks.BATTERY_BOX.getTileEntityType(), RenderBatteryBox::new); + public static void setupSpecialRenders(EntityRenderersEvent.RegisterRenderers event) { + event.registerBlockEntityRenderer(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.getTileEntityType(), ReconstructorRenderer::new); + event.registerBlockEntityRenderer(ActuallyBlocks.DISPLAY_STAND.getTileEntityType(), RenderDisplayStand::new); + event.registerBlockEntityRenderer(ActuallyBlocks.EMPOWERER.getTileEntityType(), RenderEmpowerer::new); + event.registerBlockEntityRenderer(ActuallyBlocks.BATTERY_BOX.getTileEntityType(), RenderBatteryBox::new); - ClientRegistry.bindTileEntityRenderer(ActuallyBlocks.LASER_RELAY.getTileEntityType(), RenderLaserRelay::new); - ClientRegistry.bindTileEntityRenderer(ActuallyBlocks.LASER_RELAY_ADVANCED.getTileEntityType(), RenderLaserRelay::new); - ClientRegistry.bindTileEntityRenderer(ActuallyBlocks.LASER_RELAY_EXTREME.getTileEntityType(), RenderLaserRelay::new); - ClientRegistry.bindTileEntityRenderer(ActuallyBlocks.LASER_RELAY_ITEM.getTileEntityType(), RenderLaserRelay::new); - ClientRegistry.bindTileEntityRenderer(ActuallyBlocks.LASER_RELAY_ITEM_ADVANCED.getTileEntityType(), RenderLaserRelay::new); - ClientRegistry.bindTileEntityRenderer(ActuallyBlocks.LASER_RELAY_FLUIDS.getTileEntityType(), RenderLaserRelay::new); + event.registerBlockEntityRenderer(ActuallyBlocks.LASER_RELAY.getTileEntityType(), RenderLaserRelay::new); + event.registerBlockEntityRenderer(ActuallyBlocks.LASER_RELAY_ADVANCED.getTileEntityType(), RenderLaserRelay::new); + event.registerBlockEntityRenderer(ActuallyBlocks.LASER_RELAY_EXTREME.getTileEntityType(), RenderLaserRelay::new); + event.registerBlockEntityRenderer(ActuallyBlocks.LASER_RELAY_ITEM.getTileEntityType(), RenderLaserRelay::new); + event.registerBlockEntityRenderer(ActuallyBlocks.LASER_RELAY_ITEM_ADVANCED.getTileEntityType(), RenderLaserRelay::new); + event.registerBlockEntityRenderer(ActuallyBlocks.LASER_RELAY_FLUIDS.getTileEntityType(), RenderLaserRelay::new); - RenderingRegistry.registerEntityRenderingHandler(ActuallyAdditions.ENTITY_WORM.get(), RenderWorm::new); + event.registerEntityRenderer(ActuallyAdditions.ENTITY_WORM.get(), RenderWorm::new); } public static void registerParticleFactories() { @@ -118,9 +143,9 @@ public class ActuallyAdditionsClient { // TODO: [port] validate that this works public static void sendBreakPacket(BlockPos pos) { - ClientPlayNetHandler connection = Minecraft.getInstance().getConnection(); + ClientPacketListener connection = Minecraft.getInstance().getConnection(); assert connection != null; assert Minecraft.getInstance().hitResult != null; - connection.send(new CPlayerDiggingPacket(CPlayerDiggingPacket.Action.STOP_DESTROY_BLOCK, pos, ((BlockRayTraceResult) Minecraft.getInstance().hitResult).getDirection())); + connection.send(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.STOP_DESTROY_BLOCK, pos, ((BlockHitResult) Minecraft.getInstance().hitResult).getDirection())); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/ClientRegistryHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/ClientRegistryHandler.java index 9fb2eb56d..1190516b9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/ClientRegistryHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/ClientRegistryHandler.java @@ -1,8 +1,8 @@ package de.ellpeck.actuallyadditions.mod; -import net.minecraft.client.renderer.model.ModelResourceLocation; -import net.minecraft.fluid.Fluid; -import net.minecraft.item.ItemStack; +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.material.Fluid; import net.minecraftforge.client.event.ModelBakeEvent; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/AABlockItem.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/AABlockItem.java index c13afa46d..5ed14c274 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/AABlockItem.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/AABlockItem.java @@ -1,15 +1,14 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import net.minecraft.block.Block; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.item.BlockItem; -import net.minecraft.item.BlockNamedItem; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.World; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.ItemNameBlockItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; import javax.annotation.Nullable; import java.text.NumberFormat; @@ -20,7 +19,7 @@ public class AABlockItem extends BlockItem { super(blockIn, builder); } - public static class AASeedItem extends BlockNamedItem { + public static class AASeedItem extends ItemNameBlockItem { public AASeedItem(Block block, Properties properties) { super(block, properties); } @@ -37,17 +36,17 @@ public class AABlockItem extends BlockItem { } @Override - public void appendHoverText(ItemStack pStack, @Nullable World pLevel, List pTooltip, ITooltipFlag pFlag) { + public void appendHoverText(ItemStack pStack, @Nullable Level pLevel, List pTooltip, TooltipFlag pFlag) { super.appendHoverText(pStack, pLevel, pTooltip, pFlag); if (pStack.hasTag() && pStack.getTag().contains("BlockEntityTag")) { - CompoundNBT BET = pStack.getTag().getCompound("BlockEntityTag"); + CompoundTag BET = pStack.getTag().getCompound("BlockEntityTag"); int energy = 0; if (BET.contains("Energy")) { energy = BET.getInt("Energy"); } NumberFormat format = NumberFormat.getInstance(); - pTooltip.add(new TranslationTextComponent("misc.actuallyadditions.power_single", format.format(energy))); + pTooltip.add(new TranslatableComponent("misc.actuallyadditions.power_single", format.format(energy))); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/ActuallyBlock.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/ActuallyBlock.java index 908594aa4..3e83bcc53 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/ActuallyBlock.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/ActuallyBlock.java @@ -1,11 +1,11 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.SlabBlock; -import net.minecraft.block.StairsBlock; -import net.minecraft.item.Item; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.SlabBlock; +import net.minecraft.world.level.block.StairBlock; +import net.minecraft.world.level.block.state.BlockState; import java.util.function.Supplier; @@ -30,7 +30,7 @@ public class ActuallyBlock extends Block implements IActuallyBlock { return new Item.Properties().tab(ActuallyAdditions.GROUP); } - public static class Stairs extends StairsBlock implements IActuallyBlock { + public static class Stairs extends StairBlock implements IActuallyBlock { public Stairs(Supplier state, Properties properties) { super(state, properties); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/ActuallyBlocks.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/ActuallyBlocks.java index 7dabd3532..48f96bb33 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/ActuallyBlocks.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/ActuallyBlocks.java @@ -12,17 +12,65 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.base.AACrops; -import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import de.ellpeck.actuallyadditions.mod.items.metalists.Crystals; -import de.ellpeck.actuallyadditions.mod.tile.*; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBatteryBox; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBioReactor; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBreaker; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityCrusher; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityCrusherDouble; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityDisplayStand; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityEmpowerer; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityFireworkBox; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidPlacer; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityHeatCollector; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemInterface; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemInterfaceHopping; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergy; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergyAdvanced; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergyExtreme; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayFluids; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItem; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemAdvanced; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityLavaFactoryController; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityLeafGenerator; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityLongRangeBreaker; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomBooster; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomBreaker; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomEnergyface; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomItemface; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomLiquiface; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomPlacer; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomRedstoneface; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityPlacer; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityPlayerInterface; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityPoweredFurnace; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityShockSuppressor; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityVerticalDigger; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier; import de.ellpeck.actuallyadditions.registration.AABlockReg; -import net.minecraft.block.*; -import net.minecraft.block.material.Material; -import net.minecraft.item.Item; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.IItemProvider; -import net.minecraftforge.common.ToolType; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.SlabBlock; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.StairBlock; +import net.minecraft.world.level.block.WallBlock; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.material.Material; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; @@ -31,11 +79,11 @@ import java.util.function.Supplier; public final class ActuallyBlocks { public static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, ActuallyAdditions.MODID); - public static final DeferredRegister> TILES = DeferredRegister.create(ForgeRegistries.TILE_ENTITIES, ActuallyAdditions.MODID); + public static final DeferredRegister> TILES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITIES, ActuallyAdditions.MODID); public static final Item.Properties defaultBlockItemProperties = new Item.Properties().tab(ActuallyAdditions.GROUP).stacksTo(64); - public static final AbstractBlock.Properties miscBlockProperties = AbstractBlock.Properties.of(Material.STONE).harvestLevel(1).harvestTool(ToolType.PICKAXE).strength(1.5f, 10f); + public static final BlockBehaviour.Properties miscBlockProperties = BlockBehaviour.Properties.of(Material.STONE).requiresCorrectToolForDrops().strength(1.5f, 10f); // Casings public static final AABlockReg WOOD_CASING = new AABlockReg<>("wood_casing", () -> new ActuallyBlock(miscBlockProperties), ActuallyBlock::createBlockItem); @@ -52,8 +100,8 @@ public final class ActuallyBlocks { public static final AABlockReg ENERGIZER = new AABlockReg<>("energizer", () -> new BlockEnergizer(true), (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityEnergizer::new); - public static final AABlockReg ENERVATOR = new AABlockReg<>("enervator", () -> new BlockEnergizer(false), - (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityEnergizer::new); + public static final AABlockReg ENERVATOR = new AABlockReg<>("enervator", () -> new BlockEnergizer(false), + (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityEnervator::new); public static final AABlockReg LAVA_FACTORY_CONTROLLER = new AABlockReg<>("lava_factory_controller", BlockLavaFactoryController::new, (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityLavaFactoryController::new); @@ -224,32 +272,32 @@ public final class ActuallyBlocks { public static final AABlockReg BLACK_QUARTZ_BRICK = new AABlockReg<>("black_quartz_brick_block", () -> new ActuallyBlock(miscBlockProperties), (b) -> new AABlockItem(b, defaultBlockItemProperties)); //Walls - public static final AABlockReg ETHETIC_GREEN_WALL = new AABlockReg<>("ethetic_green_wall", () -> new WallBlock(AbstractBlock.Properties.copy(ETHETIC_GREEN_BLOCK.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); - public static final AABlockReg ETHETIC_WHITE_WALL = new AABlockReg<>("ethetic_white_wall", () -> new WallBlock(AbstractBlock.Properties.copy(ETHETIC_WHITE_BLOCK.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); - public static final AABlockReg BLACK_QUARTZ_WALL = new AABlockReg<>("black_quartz_wall", () -> new WallBlock(AbstractBlock.Properties.copy(BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); - public static final AABlockReg CHISELED_BLACK_QUARTZ_WALL = new AABlockReg<>("chiseled_black_quartz_wall", () -> new WallBlock(AbstractBlock.Properties.copy(CHISELED_BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); - public static final AABlockReg SMOOTH_BLACK_QUARTZ_WALL = new AABlockReg<>("smooth_black_quartz_wall", () -> new WallBlock(AbstractBlock.Properties.copy(CHISELED_BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); - public static final AABlockReg BLACK_QUARTZ_BRICK_WALL = new AABlockReg<>("black_quartz_brick_wall", () -> new WallBlock(AbstractBlock.Properties.copy(CHISELED_BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); - public static final AABlockReg BLACK_QUARTZ_PILLAR_WALL = new AABlockReg<>("black_quartz_pillar_wall", () -> new WallBlock(AbstractBlock.Properties.copy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg ETHETIC_GREEN_WALL = new AABlockReg<>("ethetic_green_wall", () -> new WallBlock(BlockBehaviour.Properties.copy(ETHETIC_GREEN_BLOCK.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg ETHETIC_WHITE_WALL = new AABlockReg<>("ethetic_white_wall", () -> new WallBlock(BlockBehaviour.Properties.copy(ETHETIC_WHITE_BLOCK.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg BLACK_QUARTZ_WALL = new AABlockReg<>("black_quartz_wall", () -> new WallBlock(BlockBehaviour.Properties.copy(BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg CHISELED_BLACK_QUARTZ_WALL = new AABlockReg<>("chiseled_black_quartz_wall", () -> new WallBlock(BlockBehaviour.Properties.copy(CHISELED_BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg SMOOTH_BLACK_QUARTZ_WALL = new AABlockReg<>("smooth_black_quartz_wall", () -> new WallBlock(BlockBehaviour.Properties.copy(CHISELED_BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg BLACK_QUARTZ_BRICK_WALL = new AABlockReg<>("black_quartz_brick_wall", () -> new WallBlock(BlockBehaviour.Properties.copy(CHISELED_BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg BLACK_QUARTZ_PILLAR_WALL = new AABlockReg<>("black_quartz_pillar_wall", () -> new WallBlock(BlockBehaviour.Properties.copy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); //Slabs - public static final AABlockReg ETHETIC_GREEN_SLAB = new AABlockReg<>("ethetic_green_slab", () -> new SlabBlock(AbstractBlock.Properties.copy(ETHETIC_GREEN_BLOCK.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); - public static final AABlockReg ETHETIC_WHITE_SLAB = new AABlockReg<>("ethetic_white_slab", () -> new SlabBlock(AbstractBlock.Properties.copy(ETHETIC_WHITE_BLOCK.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); - public static final AABlockReg BLACK_QUARTZ_SLAB = new AABlockReg<>("black_quartz_slab", () -> new SlabBlock(AbstractBlock.Properties.copy(BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); - public static final AABlockReg CHISELED_BLACK_QUARTZ_SLAB = new AABlockReg<>("chiseled_black_quartz_slab", () -> new SlabBlock(AbstractBlock.Properties.copy(CHISELED_BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); - public static final AABlockReg BLACK_QUARTZ_PILLAR_SLAB = new AABlockReg<>("black_quartz_pillar_slab", () -> new SlabBlock(AbstractBlock.Properties.copy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); - public static final AABlockReg SMOOTH_BLACK_QUARTZ_SLAB = new AABlockReg<>("smooth_black_quartz_slab", () -> new SlabBlock(AbstractBlock.Properties.copy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); - public static final AABlockReg BLACK_QUARTZ_BRICK_SLAB = new AABlockReg<>("black_quartz_brick_slab", () -> new SlabBlock(AbstractBlock.Properties.copy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg ETHETIC_GREEN_SLAB = new AABlockReg<>("ethetic_green_slab", () -> new SlabBlock(BlockBehaviour.Properties.copy(ETHETIC_GREEN_BLOCK.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg ETHETIC_WHITE_SLAB = new AABlockReg<>("ethetic_white_slab", () -> new SlabBlock(BlockBehaviour.Properties.copy(ETHETIC_WHITE_BLOCK.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg BLACK_QUARTZ_SLAB = new AABlockReg<>("black_quartz_slab", () -> new SlabBlock(BlockBehaviour.Properties.copy(BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg CHISELED_BLACK_QUARTZ_SLAB = new AABlockReg<>("chiseled_black_quartz_slab", () -> new SlabBlock(BlockBehaviour.Properties.copy(CHISELED_BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg BLACK_QUARTZ_PILLAR_SLAB = new AABlockReg<>("black_quartz_pillar_slab", () -> new SlabBlock(BlockBehaviour.Properties.copy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg SMOOTH_BLACK_QUARTZ_SLAB = new AABlockReg<>("smooth_black_quartz_slab", () -> new SlabBlock(BlockBehaviour.Properties.copy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg BLACK_QUARTZ_BRICK_SLAB = new AABlockReg<>("black_quartz_brick_slab", () -> new SlabBlock(BlockBehaviour.Properties.copy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); //Stairs - public static final AABlockReg ETHETIC_GREEN_STAIRS = new AABlockReg<>("ethetic_green_stairs", () -> new StairsBlock(() -> ETHETIC_GREEN_BLOCK.get().defaultBlockState(), AbstractBlock.Properties.copy(ETHETIC_GREEN_BLOCK.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); - public static final AABlockReg ETHETIC_WHITE_STAIRS = new AABlockReg<>("ethetic_white_stairs", () -> new StairsBlock(() -> ETHETIC_WHITE_BLOCK.get().defaultBlockState(), AbstractBlock.Properties.copy(ETHETIC_WHITE_BLOCK.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); - public static final AABlockReg BLACK_QUARTZ_STAIR = new AABlockReg<>("black_quartz_stair", () -> new StairsBlock(() -> BLACK_QUARTZ.get().defaultBlockState(), AbstractBlock.Properties.copy(BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); - public static final AABlockReg CHISELED_BLACK_QUARTZ_STAIR = new AABlockReg<>("chiseled_black_quartz_stair", () -> new StairsBlock(() -> CHISELED_BLACK_QUARTZ.get().defaultBlockState(), AbstractBlock.Properties.copy(CHISELED_BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); - public static final AABlockReg BLACK_QUARTZ_PILLAR_STAIR = new AABlockReg<>("black_quartz_pillar_stair", () -> new StairsBlock(() -> BLACK_QUARTZ_PILLAR.get().defaultBlockState(), AbstractBlock.Properties.copy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); - public static final AABlockReg SMOOTH_BLACK_QUARTZ_STAIR = new AABlockReg<>("smooth_black_quartz_stair", () -> new StairsBlock(() -> BLACK_QUARTZ_PILLAR.get().defaultBlockState(), AbstractBlock.Properties.copy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); - public static final AABlockReg BLACK_QUARTZ_BRICK_STAIR = new AABlockReg<>("black_quartz_brick_stair", () -> new StairsBlock(() -> BLACK_QUARTZ_PILLAR.get().defaultBlockState(), AbstractBlock.Properties.copy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg ETHETIC_GREEN_STAIRS = new AABlockReg<>("ethetic_green_stairs", () -> new StairBlock(() -> ETHETIC_GREEN_BLOCK.get().defaultBlockState(), BlockBehaviour.Properties.copy(ETHETIC_GREEN_BLOCK.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg ETHETIC_WHITE_STAIRS = new AABlockReg<>("ethetic_white_stairs", () -> new StairBlock(() -> ETHETIC_WHITE_BLOCK.get().defaultBlockState(), BlockBehaviour.Properties.copy(ETHETIC_WHITE_BLOCK.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg BLACK_QUARTZ_STAIR = new AABlockReg<>("black_quartz_stair", () -> new StairBlock(() -> BLACK_QUARTZ.get().defaultBlockState(), BlockBehaviour.Properties.copy(BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg CHISELED_BLACK_QUARTZ_STAIR = new AABlockReg<>("chiseled_black_quartz_stair", () -> new StairBlock(() -> CHISELED_BLACK_QUARTZ.get().defaultBlockState(), BlockBehaviour.Properties.copy(CHISELED_BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg BLACK_QUARTZ_PILLAR_STAIR = new AABlockReg<>("black_quartz_pillar_stair", () -> new StairBlock(() -> BLACK_QUARTZ_PILLAR.get().defaultBlockState(), BlockBehaviour.Properties.copy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg SMOOTH_BLACK_QUARTZ_STAIR = new AABlockReg<>("smooth_black_quartz_stair", () -> new StairBlock(() -> BLACK_QUARTZ_PILLAR.get().defaultBlockState(), BlockBehaviour.Properties.copy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); + public static final AABlockReg BLACK_QUARTZ_BRICK_STAIR = new AABlockReg<>("black_quartz_brick_stair", () -> new StairBlock(() -> BLACK_QUARTZ_PILLAR.get().defaultBlockState(), BlockBehaviour.Properties.copy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties)); @@ -267,16 +315,16 @@ public final class ActuallyBlocks { public static final AABlockReg GREENHOUSE_GLASS = new AABlockReg<>("greenhouse_glass", BlockGreenhouseGlass::new, (b) -> new AABlockItem(b, defaultBlockItemProperties)); - public static AbstractBlock.Properties defaultPickProps(int harvestLevel, float hardness, float resistance) { - return AbstractBlock.Properties.of(Material.STONE).harvestLevel(harvestLevel).harvestTool(ToolType.PICKAXE).strength(hardness, resistance).sound(SoundType.STONE); + public static BlockBehaviour.Properties defaultPickProps(float hardness, float resistance) { + return BlockBehaviour.Properties.of(Material.STONE).requiresCorrectToolForDrops().strength(hardness, resistance).sound(SoundType.STONE); } - public static AbstractBlock.Properties defaultPickProps(int harvestLevel) { - return AbstractBlock.Properties.of(Material.STONE).harvestLevel(harvestLevel).harvestTool(ToolType.PICKAXE).strength(1.5F, 10.0F).sound(SoundType.STONE); + public static BlockBehaviour.Properties defaultPickProps() { + return BlockBehaviour.Properties.of(Material.STONE).requiresCorrectToolForDrops().strength(1.5F, 10.0F).sound(SoundType.STONE); } - public static AbstractBlock.Properties defaultCropProps() { - return AbstractBlock.Properties.of(Material.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.CROP); + public static BlockBehaviour.Properties defaultCropProps() { + return BlockBehaviour.Properties.of(Material.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.CROP); } public static void init(IEventBus evt) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java index 2cdf0c8d0..e51595fd6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java @@ -10,41 +10,35 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.platform.Window; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.api.lens.ILensItem; -import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.base.FullyDirectionalBlock; -import de.ellpeck.actuallyadditions.mod.config.CommonConfig; import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import de.ellpeck.actuallyadditions.mod.util.Lang; -import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import de.ellpeck.actuallyadditions.mod.util.StringUtil; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.client.MainWindow; +import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.state.DirectionProperty; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.util.Mth; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +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.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.HitResult; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -61,14 +55,14 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im public static final int NAME_FLAVOR_AMOUNTS_2 = 14; public BlockAtomicReconstructor() { - super(ActuallyBlocks.defaultPickProps(0, 10.0F, 80F)); + super(ActuallyBlocks.defaultPickProps(10.0F, 80F)); } @Override - public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { ItemStack heldItem = player.getItemInHand(hand); if (this.tryToggleRedstone(world, pos, player)) { - return ActionResultType.CONSUME; + return InteractionResult.CONSUME; } if (!world.isClientSide) { TileEntityAtomicReconstructor reconstructor = (TileEntityAtomicReconstructor) world.getBlockEntity(pos); @@ -82,52 +76,53 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im if (!player.isCreative()) { heldItem.shrink(1); } - return ActionResultType.CONSUME; + return InteractionResult.CONSUME; } } else { ItemStack slot = reconstructor.inv.getStackInSlot(0); - if (!slot.isEmpty() && hand == Hand.MAIN_HAND) { + if (!slot.isEmpty() && hand == InteractionHand.MAIN_HAND) { player.setItemInHand(hand, slot.copy()); reconstructor.inv.setStackInSlot(0, ItemStack.EMPTY); - return ActionResultType.CONSUME; + return InteractionResult.CONSUME; } } } - return ActionResultType.FAIL; + return InteractionResult.FAIL; } - return ActionResultType.CONSUME; + return InteractionResult.CONSUME; } @Nullable @Override - public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return new TileEntityAtomicReconstructor(); + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new TileEntityAtomicReconstructor(pos, state); } + @Nullable @Override - public boolean hasTileEntity(BlockState state) { - return true; + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return level.isClientSide? TileEntityAtomicReconstructor::clientTick : TileEntityAtomicReconstructor::serverTick; } @Override @OnlyIn(Dist.CLIENT) - public void displayHud(MatrixStack matrices, Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult rayCast, MainWindow resolution) { - if (!(rayCast instanceof BlockRayTraceResult) || minecraft.level == null) { + public void displayHud(PoseStack matrices, Minecraft minecraft, Player player, ItemStack stack, HitResult rayCast, Window resolution) { + if (!(rayCast instanceof BlockHitResult) || minecraft.level == null) { return; } - TileEntity tile = minecraft.level.getBlockEntity(((BlockRayTraceResult) rayCast).getBlockPos()); + BlockEntity tile = minecraft.level.getBlockEntity(((BlockHitResult) rayCast).getBlockPos()); if (tile instanceof TileEntityAtomicReconstructor) { ItemStack slot = ((TileEntityAtomicReconstructor) tile).inv.getStackInSlot(0); - ITextComponent lens_name; + Component lens_name; if (slot.isEmpty()) { - lens_name = new TranslationTextComponent("info.actuallyadditions.nolens"); + lens_name = new TranslatableComponent("info.actuallyadditions.nolens"); } else { lens_name = slot.getItem().getName(slot); AssetUtil.renderStackToGui(slot, resolution.getGuiScaledWidth() / 2 + 15, resolution.getGuiScaledHeight() / 2 - 19, 1F); } - minecraft.font.drawShadow(matrices, lens_name.plainCopy().withStyle(TextFormatting.YELLOW).withStyle(TextFormatting.ITALIC).getString(), resolution.getGuiScaledWidth() / 2.0f + 35, resolution.getGuiScaledHeight() / 2.0f - 15, 0xFFFFFF); + minecraft.font.drawShadow(matrices, lens_name.plainCopy().withStyle(ChatFormatting.YELLOW).withStyle(ChatFormatting.ITALIC).getString(), resolution.getGuiScaledWidth() / 2.0f + 35, resolution.getGuiScaledHeight() / 2.0f - 15, 0xFFFFFF); } } @@ -145,7 +140,7 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im @OnlyIn(Dist.CLIENT) @Override - public void appendHoverText(@Nonnull ItemStack pStack, @Nullable World pLevel, @Nonnull List pTooltip, @Nonnull ITooltipFlag pFlag) { + public void appendHoverText(@Nonnull ItemStack pStack, @Nullable Level pLevel, @Nonnull List pTooltip, @Nonnull TooltipFlag pFlag) { super.appendHoverText(pStack, pLevel, pTooltip, pFlag); long sysTime = System.currentTimeMillis(); @@ -160,26 +155,26 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im } String base = block.getDescriptionId() + ".info."; - pTooltip.add(new TranslationTextComponent(base + "1." + this.toPick1).append(" ").append(new TranslationTextComponent(base + "2." + this.toPick2)).withStyle(s -> s.withColor(TextFormatting.GRAY))); + pTooltip.add(new TranslatableComponent(base + "1." + this.toPick1).append(" ").append(new TranslatableComponent(base + "2." + this.toPick2)).withStyle(s -> s.withColor(ChatFormatting.GRAY))); if (pStack.hasTag() && pStack.getTag().contains("BlockEntityTag")) { - CompoundNBT BET = pStack.getTag().getCompound("BlockEntityTag"); + CompoundTag BET = pStack.getTag().getCompound("BlockEntityTag"); int energy = 0; if (BET.contains("Energy")) { energy = BET.getInt("Energy"); } NumberFormat format = NumberFormat.getInstance(); - pTooltip.add(new TranslationTextComponent("misc.actuallyadditions.power_single", format.format(energy))); + pTooltip.add(new TranslatableComponent("misc.actuallyadditions.power_single", format.format(energy))); if (BET.contains("IsPulseMode")) { - pTooltip.add(new TranslationTextComponent("info.actuallyadditions.redstoneMode").append(": ") - .append(new TranslationTextComponent(BET.getBoolean("IsPulseMode")?"info.actuallyadditions.redstoneMode.pulse":"info.actuallyadditions.redstoneMode.deactivation").withStyle($ -> $.withColor(TextFormatting.RED)))); + pTooltip.add(new TranslatableComponent("info.actuallyadditions.redstoneMode").append(": ") + .append(new TranslatableComponent(BET.getBoolean("IsPulseMode")?"info.actuallyadditions.redstoneMode.pulse":"info.actuallyadditions.redstoneMode.deactivation").withStyle($ -> $.withColor(ChatFormatting.RED)))); } } } @Override - protected boolean updateCustomBlockEntityTag(BlockPos pPos, World pLevel, @Nullable PlayerEntity pPlayer, ItemStack pStack, BlockState pState) { + protected boolean updateCustomBlockEntityTag(BlockPos pPos, Level pLevel, @Nullable Player pPlayer, ItemStack pStack, BlockState pState) { boolean ret = super.updateCustomBlockEntityTag(pPos, pLevel, pPlayer, pStack, pState); @@ -194,12 +189,12 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im } @Override - public int getAnalogOutputSignal(BlockState blockState, World world, BlockPos pos) { - TileEntity t = world.getBlockEntity(pos); + public int getAnalogOutputSignal(BlockState blockState, Level world, BlockPos pos) { + BlockEntity t = world.getBlockEntity(pos); int i = 0; if (t instanceof TileEntityAtomicReconstructor) { i = ((TileEntityAtomicReconstructor) t).getEnergy(); } - return MathHelper.clamp(i / 20000, 0, 15); + return Mth.clamp(i / 20000, 0, 15); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBatteryBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBatteryBox.java index 71c0f9799..49526030b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBatteryBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBatteryBox.java @@ -13,27 +13,27 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.items.ItemBattery; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBatteryBox; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator; -import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import javax.annotation.Nullable; public class BlockBatteryBox extends BlockContainerBase { public BlockBatteryBox() { - super(ActuallyBlocks.defaultPickProps(0)); + super(ActuallyBlocks.defaultPickProps()); } // @Override @@ -41,24 +41,25 @@ public class BlockBatteryBox extends BlockContainerBase { // return BlockSlabs.AABB_BOTTOM_HALF; // } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return Shapes.BATBOX_SHAPE; - } - - @Override - public boolean hasTileEntity(BlockState state) { - return true; + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + return VoxelShapes.BATBOX_SHAPE; } @Nullable @Override - public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return new TileEntityBatteryBox(); + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new TileEntityBatteryBox(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return level.isClientSide? TileEntityBatteryBox::clientTick : TileEntityBatteryBox::serverTick; } @Override - public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { - TileEntity tile = world.getBlockEntity(pos); + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + BlockEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityBatteryBox) { TileEntityBatteryBox box = (TileEntityBatteryBox) tile; ItemStack stack = player.getItemInHand(hand); @@ -67,17 +68,17 @@ public class BlockBatteryBox extends BlockContainerBase { if (stack.getItem() instanceof ItemBattery && box.inv.getStackInSlot(0).isEmpty()) { box.inv.setStackInSlot(0, stack.copy()); player.setItemInHand(hand, ItemStack.EMPTY); - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; } } else { ItemStack inSlot = box.inv.getStackInSlot(0); if (!inSlot.isEmpty()) { player.setItemInHand(hand, inSlot.copy()); box.inv.setStackInSlot(0, ItemStack.EMPTY); - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; } } } - return ActionResultType.PASS; + return InteractionResult.PASS; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBioReactor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBioReactor.java index 9b1a9df8e..b56a7216d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBioReactor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBioReactor.java @@ -12,29 +12,39 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBioReactor; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; + +import javax.annotation.Nullable; public class BlockBioReactor extends BlockContainerBase { public BlockBioReactor() { - super(ActuallyBlocks.defaultPickProps(0, 2.0F, 10.0F)); + super(ActuallyBlocks.defaultPickProps(2.0F, 10.0F)); } - //@Override - public TileEntity newBlockEntity(IBlockReader worldIn) { - return new TileEntityBioReactor(); + @Nullable + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new TileEntityBioReactor(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return level.isClientSide? TileEntityBioReactor::clientTick : TileEntityBioReactor::serverTick; } @Override - public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { return this.openGui(world, player, pos, TileEntityBioReactor.class); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java index 3b461ad32..73fd0a458 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java @@ -13,15 +13,16 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.FullyDirectionalBlock; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBreaker; import de.ellpeck.actuallyadditions.mod.tile.TileEntityPlacer; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; import javax.annotation.Nullable; @@ -30,27 +31,30 @@ public class BlockBreaker extends FullyDirectionalBlock.Container { private final boolean isPlacer; public BlockBreaker(boolean isPlacer) { - super(ActuallyBlocks.defaultPickProps(0)); + super(ActuallyBlocks.defaultPickProps()); this.isPlacer = isPlacer; } - @Override - public boolean hasTileEntity(BlockState state) { - return true; - } - @Nullable @Override - public TileEntity createTileEntity(BlockState state, IBlockReader world) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return this.isPlacer - ? new TileEntityPlacer() - : new TileEntityBreaker(); + ? new TileEntityPlacer(pos, state) + : new TileEntityBreaker(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return this.isPlacer + ? level.isClientSide? TileEntityPlacer::clientTick : TileEntityPlacer::serverTick + : level.isClientSide? TileEntityBreaker::clientTick : TileEntityBreaker::serverTick; } @Override - public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { if (this.tryToggleRedstone(world, pos, player)) { - return ActionResultType.CONSUME; + return InteractionResult.CONSUME; } return this.openGui(world, player, pos, TileEntityBreaker.class); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCanolaPress.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCanolaPress.java index 89c3803c7..7a42fd0f8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCanolaPress.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCanolaPress.java @@ -12,27 +12,29 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraftforge.fluids.FluidUtil; -import net.minecraftforge.fml.network.NetworkHooks; +import net.minecraftforge.network.NetworkHooks; import javax.annotation.Nullable; public class BlockCanolaPress extends BlockContainerBase { public BlockCanolaPress() { - super(ActuallyBlocks.defaultPickProps(0)); + super(ActuallyBlocks.defaultPickProps()); } // @Override @@ -42,32 +44,33 @@ public class BlockCanolaPress extends BlockContainerBase { @Nullable @Override - public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return new TileEntityCanolaPress(); + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new TileEntityCanolaPress(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return level.isClientSide? TileEntityCanolaPress::clientTick : TileEntityCanolaPress::serverTick; } @Override - public boolean hasTileEntity(BlockState state) { - return true; - } - - @Override - public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { TileEntityCanolaPress tile = (TileEntityCanolaPress) world.getBlockEntity(pos); if (tile == null) - return ActionResultType.PASS; //TODO this logic all needs to be rechecked... + return InteractionResult.PASS; //TODO this logic all needs to be rechecked... if (world.isClientSide) - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; if (!player.isShiftKeyDown()) { if (!FluidUtil.interactWithFluidHandler(player, hand, tile.tank)) - NetworkHooks.openGui((ServerPlayerEntity) player, tile, pos); - return ActionResultType.SUCCESS; + NetworkHooks.openGui((ServerPlayer) player, tile, pos); + return InteractionResult.SUCCESS; } - return ActionResultType.PASS; + return InteractionResult.PASS; } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return Shapes.CANOLA_PRESS_SHAPE; + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + return VoxelShapes.CANOLA_PRESS_SHAPE; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java index bad352fb5..6f3fdd0f1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java @@ -12,42 +12,45 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.DirectionalBlock; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.particles.ParticleTypes; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; -import net.minecraft.world.server.ServerWorld; +import net.minecraft.core.BlockPos; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import javax.annotation.Nullable; import java.util.Random; public class BlockCoalGenerator extends DirectionalBlock.Container { public BlockCoalGenerator() { - super(ActuallyBlocks.defaultPickProps(0).randomTicks()); - } - - @Override - public boolean hasTileEntity(BlockState state) { - return true; + super(ActuallyBlocks.defaultPickProps().randomTicks()); } @Nullable @Override - public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return new TileEntityCoalGenerator(); + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new TileEntityCoalGenerator(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return level.isClientSide? TileEntityCoalGenerator::clientTick : TileEntityCoalGenerator::serverTick; } @Override - public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - TileEntity tile = world.getBlockEntity(pos); + public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) { + BlockEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityCoalGenerator) { if (((TileEntityCoalGenerator) tile).currentBurnTime > 0) { for (int i = 0; i < 5; i++) { @@ -58,21 +61,21 @@ public class BlockCoalGenerator extends DirectionalBlock.Container { } @Override - public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { return this.openGui(world, player, pos, TileEntityCoalGenerator.class); } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { switch (state.getValue(FACING)) { case EAST: - return Shapes.CoalGeneratorShapes.EAST; + return VoxelShapes.CoalGeneratorShapes.EAST; case SOUTH: - return Shapes.CoalGeneratorShapes.SOUTH; + return VoxelShapes.CoalGeneratorShapes.SOUTH; case WEST: - return Shapes.CoalGeneratorShapes.WEST; + return VoxelShapes.CoalGeneratorShapes.WEST; default: - return Shapes.CoalGeneratorShapes.NORTH; + return VoxelShapes.CoalGeneratorShapes.NORTH; } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java index 2aabe5aab..9670004c0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java @@ -12,63 +12,66 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.DirectionalBlock; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; -import net.minecraftforge.fml.network.NetworkHooks; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraftforge.network.NetworkHooks; import javax.annotation.Nullable; public class BlockCoffeeMachine extends DirectionalBlock.Container { public BlockCoffeeMachine() { - super(ActuallyBlocks.defaultPickProps(0)); + super(ActuallyBlocks.defaultPickProps()); } @Override - public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { if (!world.isClientSide) { TileEntityCoffeeMachine tile = (TileEntityCoffeeMachine) world.getBlockEntity(pos); if (tile != null) { if (!this.tryUseItemOnTank(player, hand, tile.tank)) { - NetworkHooks.openGui((ServerPlayerEntity) player, tile, pos); + NetworkHooks.openGui((ServerPlayer) player, tile, pos); } } - return ActionResultType.PASS; + return InteractionResult.PASS; } return super.use(state, world, pos, player, hand, hit); } + @Nullable @Override - public boolean hasTileEntity(BlockState state) { - return true; + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new TileEntityCoffeeMachine(pos, state); } @Nullable @Override - public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return new TileEntityCoffeeMachine(); + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return level.isClientSide? TileEntityCoffeeMachine::clientTick : TileEntityCoffeeMachine::serverTick; } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { switch (state.getValue(FACING)) { case EAST: - return Shapes.CoffeeMachineShapes.EAST; + return VoxelShapes.CoffeeMachineShapes.EAST; case SOUTH: - return Shapes.CoffeeMachineShapes.SOUTH; + return VoxelShapes.CoffeeMachineShapes.SOUTH; case WEST: - return Shapes.CoffeeMachineShapes.WEST; + return VoxelShapes.CoffeeMachineShapes.WEST; default: - return Shapes.CoffeeMachineShapes.NORTH; + return VoxelShapes.CoffeeMachineShapes.NORTH; } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java index dd23482bb..60e4071a2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java @@ -12,30 +12,26 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.material.Material; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.DyeColor; -import net.minecraft.item.DyeItem; -import net.minecraft.item.ItemStack; -import net.minecraft.state.BooleanProperty; -import net.minecraft.state.StateContainer; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; -import net.minecraftforge.common.ToolType; -import net.minecraftforge.common.util.Constants; +import net.minecraft.core.BlockPos; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.item.DyeItem; +import net.minecraft.world.item.ItemStack; +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.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.material.Material; +import net.minecraft.world.phys.BlockHitResult; import java.util.HashMap; import java.util.function.Supplier; -import net.minecraft.block.AbstractBlock.Properties; - public class BlockColoredLamp extends BlockBase { private static final HashMap> COLOR_TO_LAMP = new HashMap>() {{ this.put(DyeColor.WHITE, ActuallyBlocks.LAMP_WHITE); @@ -59,35 +55,35 @@ public class BlockColoredLamp extends BlockBase { private static final BooleanProperty LIT = BlockStateProperties.LIT; public BlockColoredLamp() { - super(Properties.of(Material.BUILDABLE_GLASS).strength(0.5F, 3.0F).harvestTool(ToolType.PICKAXE).harvestLevel(0)); + super(Properties.of(Material.BUILDABLE_GLASS).strength(0.5F, 3.0F).requiresCorrectToolForDrops()); this.registerDefaultState(this.stateDefinition.any().setValue(LIT, false)); } @Override - protected void createBlockStateDefinition(StateContainer.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(LIT); } @Override - public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { ItemStack stack = player.getItemInHand(hand); //Turning On - if (hand == Hand.MAIN_HAND && stack.isEmpty()) { - world.setBlock(pos, this.defaultBlockState().setValue(LIT, !state.getValue(LIT)), Constants.BlockFlags.NO_RERENDER); - return ActionResultType.PASS; + if (hand == InteractionHand.MAIN_HAND && stack.isEmpty()) { + world.setBlock(pos, this.defaultBlockState().setValue(LIT, !state.getValue(LIT)), Block.UPDATE_INVISIBLE); + return InteractionResult.PASS; } if (StackUtil.isValid(stack) && stack.getItem() instanceof DyeItem) { DyeColor color = DyeColor.getColor(stack); if (color == null) { - return ActionResultType.FAIL; + return InteractionResult.FAIL; } Block newColor = COLOR_TO_LAMP.get(color).get(); if (!world.isClientSide) { world.setBlock(pos, newColor.defaultBlockState().setValue(LIT, state.getValue(LIT)), 2); if (!player.isCreative()) { - player.inventory.removeItem(player.inventory.selected, 1); + player.getInventory().removeItem(player.getInventory().selected, 1); } } } @@ -95,7 +91,7 @@ public class BlockColoredLamp extends BlockBase { } @Override - public int getLightValue(BlockState state, IBlockReader world, BlockPos pos) { + public int getLightEmission(BlockState state, BlockGetter level, BlockPos pos) { return state.getValue(LIT) ? 15 : 0; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrusher.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrusher.java index 26a237e59..5b252bada 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrusher.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrusher.java @@ -10,58 +10,63 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING; -import static net.minecraft.state.properties.BlockStateProperties.LIT; - import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCrusher; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCrusherDouble; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.BlockItemUseContext; -import net.minecraft.particles.ParticleTypes; -import net.minecraft.state.StateContainer; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Direction; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; -import net.minecraft.world.server.ServerWorld; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.context.BlockPlaceContext; +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.BlockEntityTicker; +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.block.state.properties.BlockStateProperties; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import javax.annotation.Nullable; import java.util.Random; +import static net.minecraft.world.level.block.state.properties.BlockStateProperties.HORIZONTAL_FACING; +import static net.minecraft.world.level.block.state.properties.BlockStateProperties.LIT; + public class BlockCrusher extends BlockContainerBase { private final boolean isDouble; public BlockCrusher(boolean isDouble) { - super(ActuallyBlocks.defaultPickProps(0).randomTicks()); + super(ActuallyBlocks.defaultPickProps().randomTicks()); this.isDouble = isDouble; this.registerDefaultState(getStateDefinition().any().setValue(HORIZONTAL_FACING, Direction.NORTH).setValue(LIT, false)); } @Nullable @Override - public TileEntity createTileEntity(BlockState state, IBlockReader world) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return this.isDouble - ? new TileEntityCrusherDouble() - : new TileEntityCrusher(); + ? new TileEntityCrusherDouble(pos, state) + : new TileEntityCrusher(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return this.isDouble + ? level.isClientSide? TileEntityCrusherDouble::clientTick : TileEntityCrusherDouble::serverTick + : level.isClientSide? TileEntityCrusher::clientTick : TileEntityCrusher::serverTick; } @Override - public boolean hasTileEntity(BlockState state) { - return true; - } - - @Override - public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random rand) { + public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random rand) { if (state.getValue(BlockStateProperties.LIT)) { for (int i = 0; i < 5; i++) { double xRand = rand.nextDouble() / 0.75D - 0.5D; @@ -73,7 +78,7 @@ public class BlockCrusher extends BlockContainerBase { } @Override - public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { if (this.isDouble) { return this.openGui(world, player, pos, TileEntityCrusherDouble.class); } @@ -82,33 +87,33 @@ public class BlockCrusher extends BlockContainerBase { } @Override - public BlockState getStateForPlacement(BlockItemUseContext context) { + public BlockState getStateForPlacement(BlockPlaceContext context) { return defaultBlockState().setValue(HORIZONTAL_FACING, context.getHorizontalDirection().getOpposite()).setValue(LIT, false); } @Override - protected void createBlockStateDefinition(StateContainer.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(LIT).add(HORIZONTAL_FACING); } @Override - public int getLightValue(BlockState state, IBlockReader world, BlockPos pos) { + public int getLightEmission(BlockState state, BlockGetter level, BlockPos pos) { return state.getValue(LIT) - ? 12 - : 0; + ? 12 + : 0; } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { switch (state.getValue(HORIZONTAL_FACING)) { case EAST: - return Shapes.GrinderShapes.SHAPE_E; + return VoxelShapes.GrinderShapes.SHAPE_E; case SOUTH: - return Shapes.GrinderShapes.SHAPE_S; + return VoxelShapes.GrinderShapes.SHAPE_S; case WEST: - return Shapes.GrinderShapes.SHAPE_W; + return VoxelShapes.GrinderShapes.SHAPE_W; default: - return Shapes.GrinderShapes.SHAPE_N; + return VoxelShapes.GrinderShapes.SHAPE_N; } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystal.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystal.java index 781a0b544..c4f84daa9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystal.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystal.java @@ -10,13 +10,13 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.ItemStack; public class BlockCrystal extends ActuallyBlock { private final boolean isEmpowered; public BlockCrystal(boolean isEmpowered) { - super(ActuallyBlocks.defaultPickProps(1)); + super(ActuallyBlocks.defaultPickProps()); this.isEmpowered = isEmpowered; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDisplayStand.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDisplayStand.java index f84103db9..e3ede242a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDisplayStand.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDisplayStand.java @@ -16,88 +16,93 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityEmpowerer; import de.ellpeck.actuallyadditions.mod.tile.TileEntityInventoryBase; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import javax.annotation.Nullable; public class BlockDisplayStand extends BlockContainerBase { - public BlockDisplayStand(boolean empowerer) { - super(ActuallyBlocks.defaultPickProps(0)); - isEmpowerer = empowerer; - } + public BlockDisplayStand(boolean empowerer) { + super(ActuallyBlocks.defaultPickProps()); + isEmpowerer = empowerer; + } - private final boolean isEmpowerer; + private final boolean isEmpowerer; - public boolean isEmpowerer() { - return this.isEmpowerer; - } + public boolean isEmpowerer() { + return this.isEmpowerer; + } - @Nullable - @Override - public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return isEmpowerer? new TileEntityEmpowerer(): new TileEntityDisplayStand(); - } + @Nullable + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return isEmpowerer ? new TileEntityEmpowerer(pos, state) : new TileEntityDisplayStand(pos, state); + } - @Override - public boolean hasTileEntity(BlockState state) { - return true; - } + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return this.isEmpowerer + ? level.isClientSide? TileEntityEmpowerer::clientTick : TileEntityEmpowerer::serverTick + : level.isClientSide? TileEntityDisplayStand::clientTick : TileEntityDisplayStand::serverTick; + } - @Override - public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { - ItemStack heldItem = player.getItemInHand(hand); - if (!world.isClientSide) { - TileEntityInventoryBase stand = (TileEntityInventoryBase) world.getBlockEntity(pos); - if (stand != null) { - ItemStack stackThere = stand.inv.getStackInSlot(0); - if (!heldItem.isEmpty()) { - if (stackThere.isEmpty() && (!isEmpowerer || TileEntityEmpowerer.isPossibleInput(heldItem))) { - ItemStack toPut = heldItem.copy(); - toPut.setCount(1); - stand.inv.setStackInSlot(0, toPut); - if (!player.isCreative()) { - heldItem.shrink(1); - } - return ActionResultType.CONSUME; - } else if (ItemUtil.canBeStacked(heldItem, stackThere)) { - int maxTransfer = Math.min(stackThere.getCount(), heldItem.getMaxStackSize() - heldItem.getCount()); - if (maxTransfer > 0) { - if (!player.isCreative()) - player.setItemInHand(hand, StackUtil.grow(heldItem, maxTransfer)); - ItemStack newStackThere = stackThere.copy(); - newStackThere.shrink(maxTransfer); - stand.inv.setStackInSlot(0, newStackThere); - return ActionResultType.CONSUME; - } - } - } else { - if (!stackThere.isEmpty() && hand == Hand.MAIN_HAND) { - player.setItemInHand(hand, stackThere.copy()); - stand.inv.setStackInSlot(0, ItemStack.EMPTY); - return ActionResultType.CONSUME; - } - } - } - return ActionResultType.FAIL; - } + @Override + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + ItemStack heldItem = player.getItemInHand(hand); + if (!world.isClientSide) { + TileEntityInventoryBase stand = (TileEntityInventoryBase) world.getBlockEntity(pos); + if (stand != null) { + ItemStack stackThere = stand.inv.getStackInSlot(0); + if (!heldItem.isEmpty()) { + if (stackThere.isEmpty() && (!isEmpowerer || TileEntityEmpowerer.isPossibleInput(heldItem))) { + ItemStack toPut = heldItem.copy(); + toPut.setCount(1); + stand.inv.setStackInSlot(0, toPut); + if (!player.isCreative()) { + heldItem.shrink(1); + } + return InteractionResult.CONSUME; + } else if (ItemUtil.canBeStacked(heldItem, stackThere)) { + int maxTransfer = Math.min(stackThere.getCount(), heldItem.getMaxStackSize() - heldItem.getCount()); + if (maxTransfer > 0) { + if (!player.isCreative()) + player.setItemInHand(hand, StackUtil.grow(heldItem, maxTransfer)); + ItemStack newStackThere = stackThere.copy(); + newStackThere.shrink(maxTransfer); + stand.inv.setStackInSlot(0, newStackThere); + return InteractionResult.CONSUME; + } + } + } else { + if (!stackThere.isEmpty() && hand == InteractionHand.MAIN_HAND) { + player.setItemInHand(hand, stackThere.copy()); + stand.inv.setStackInSlot(0, ItemStack.EMPTY); + return InteractionResult.CONSUME; + } + } + } + return InteractionResult.FAIL; + } - return ActionResultType.CONSUME; - } + return InteractionResult.CONSUME; + } - @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return Shapes.DISPLAY_STAND_SHAPE; - } + @Override + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + return VoxelShapes.DISPLAY_STAND_SHAPE; + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java index 97e139f36..0d01777d1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java @@ -12,39 +12,41 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.FullyDirectionalBlock; import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; import javax.annotation.Nullable; public class BlockDropper extends FullyDirectionalBlock.Container { public BlockDropper() { - super(ActuallyBlocks.defaultPickProps(0)); - } - - @Override - public boolean hasTileEntity(BlockState state) { - return true; + super(ActuallyBlocks.defaultPickProps()); } @Nullable @Override - public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return new TileEntityDropper(); + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new TileEntityDropper(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return level.isClientSide? TileEntityDropper::clientTick : TileEntityDropper::serverTick; } @Override - public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { if (this.tryToggleRedstone(world, pos, player)) { - return ActionResultType.CONSUME; + return InteractionResult.CONSUME; } return this.openGui(world, player, pos, TileEntityDropper.class); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEnergizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEnergizer.java index 7af361da8..e477ce66e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEnergizer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEnergizer.java @@ -13,35 +13,48 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer; import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; + +import javax.annotation.Nullable; public class BlockEnergizer extends BlockContainerBase { private final boolean isEnergizer; public BlockEnergizer(boolean isEnergizer) { - super(ActuallyBlocks.defaultPickProps(0, 2.0F, 10.0F)); + super(ActuallyBlocks.defaultPickProps(2.0F, 10.0F)); this.isEnergizer = isEnergizer; } - //@Override - public TileEntity newBlockEntity(IBlockReader worldIn) { + @Nullable + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return this.isEnergizer - ? new TileEntityEnergizer() - : new TileEntityEnervator(); + ? new TileEntityEnergizer(pos, state) + : new TileEntityEnervator(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return this.isEnergizer + ? level.isClientSide? TileEntityEnergizer::clientTick : TileEntityEnergizer::serverTick + : level.isClientSide? TileEntityEnervator::clientTick : TileEntityEnervator::serverTick; } @Override - public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { if (this.isEnergizer) { return this.openGui(world, player, pos, TileEntityEnergizer.class); } else { @@ -50,7 +63,7 @@ public class BlockEnergizer extends BlockContainerBase { } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return Shapes.ENERGIZER_SHAPE; + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + return VoxelShapes.ENERGIZER_SHAPE; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFarmer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFarmer.java index 6e3be812d..c7ea799a5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFarmer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFarmer.java @@ -11,55 +11,57 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.DirectionalBlock; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import javax.annotation.Nullable; public class BlockFarmer extends DirectionalBlock.Container { public BlockFarmer() { - super(ActuallyBlocks.defaultPickProps(0)); + super(ActuallyBlocks.defaultPickProps()); } @Nullable @Override - public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return new TileEntityFarmer(); + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new TileEntityFarmer(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return level.isClientSide? TileEntityFarmer::clientTick : TileEntityFarmer::serverTick; } @Override - public boolean hasTileEntity(BlockState state) { - return true; - } - - @Override - public ActionResultType use(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { return this.openGui(worldIn, player, pos, TileEntityFarmer.class); } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { switch (state.getValue(FACING)) { case EAST: - return Shapes.FarmerShapes.SHAPE_E; + return VoxelShapes.FarmerShapes.SHAPE_E; case SOUTH: - return Shapes.FarmerShapes.SHAPE_S; + return VoxelShapes.FarmerShapes.SHAPE_S; case WEST: - return Shapes.FarmerShapes.SHAPE_W; + return VoxelShapes.FarmerShapes.SHAPE_W; default: - return Shapes.FarmerShapes.SHAPE_N; + return VoxelShapes.FarmerShapes.SHAPE_N; } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFeeder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFeeder.java index 4357cea88..9d98e8e4f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFeeder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFeeder.java @@ -12,36 +12,47 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; + +import javax.annotation.Nullable; public class BlockFeeder extends BlockContainerBase { public BlockFeeder() { - super(ActuallyBlocks.defaultPickProps(0, 0.5F, 6.0F)); + super(ActuallyBlocks.defaultPickProps(0.5F, 6.0F)); } - //@Override - public TileEntity newBlockEntity(IBlockReader worldIn) { - return new TileEntityFeeder(); + @Nullable + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new TileEntityFeeder(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return level.isClientSide? TileEntityFeeder::clientTick : TileEntityFeeder::serverTick; } @Override - public ActionResultType use(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { return this.openGui(worldIn, player, pos, TileEntityFeeder.class); } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return Shapes.FEEDER_SHAPE; + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + return VoxelShapes.FEEDER_SHAPE; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFermentingBarrel.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFermentingBarrel.java index bdc5f2c0c..62ca5e63f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFermentingBarrel.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFermentingBarrel.java @@ -11,69 +11,70 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel; -import net.minecraft.block.BlockState; -import net.minecraft.block.SoundType; -import net.minecraft.block.material.Material; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; -import net.minecraftforge.common.ToolType; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.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.block.SoundType; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.Material; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraftforge.fluids.FluidUtil; -import net.minecraftforge.fml.network.NetworkHooks; +import net.minecraftforge.network.NetworkHooks; import javax.annotation.Nullable; public class BlockFermentingBarrel extends BlockContainerBase { public BlockFermentingBarrel() { - super(Properties.of(Material.WOOD).harvestTool(ToolType.AXE).harvestLevel(0).strength(0.5F, 5.0F).sound(SoundType.WOOD)); + super(Properties.of(Material.WOOD).requiresCorrectToolForDrops().strength(0.5F, 5.0F).sound(SoundType.WOOD)); } @Nullable @Override - public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return new TileEntityFermentingBarrel(); + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new TileEntityFermentingBarrel(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return level.isClientSide? TileEntityFermentingBarrel::clientTick : TileEntityFermentingBarrel::serverTick; } @Override - public boolean hasTileEntity(BlockState state) { - return true; - } - - @Override - public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { TileEntityFermentingBarrel tile = (TileEntityFermentingBarrel) world.getBlockEntity(pos); if (tile == null) - return ActionResultType.PASS; //TODO this logic all needs to be rechecked... + return InteractionResult.PASS; //TODO this logic all needs to be rechecked... if (world.isClientSide) - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; if (!player.isShiftKeyDown()) { if (FluidUtil.interactWithFluidHandler(player, hand, tile.tanks)) { ItemStack stack = player.getItemInHand(hand); - world.playSound(null, pos, stack.getItem() == Items.BUCKET ? SoundEvents.BUCKET_EMPTY:SoundEvents.BUCKET_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F); + world.playSound(null, pos, stack.getItem() == Items.BUCKET ? SoundEvents.BUCKET_EMPTY:SoundEvents.BUCKET_FILL, SoundSource.BLOCKS, 1.0F, 1.0F); } else - NetworkHooks.openGui((ServerPlayerEntity) player, tile, pos); - return ActionResultType.SUCCESS; + NetworkHooks.openGui((ServerPlayer) player, tile, pos); + return InteractionResult.SUCCESS; } - return ActionResultType.PASS; + return InteractionResult.PASS; } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return Shapes.BARREL_SHAPE; + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + return VoxelShapes.BARREL_SHAPE; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFireworkBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFireworkBox.java index 78ac11a02..5ed4f2160 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFireworkBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFireworkBox.java @@ -12,39 +12,49 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFireworkBox; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; + +import javax.annotation.Nullable; public class BlockFireworkBox extends BlockContainerBase { public BlockFireworkBox() { - super(ActuallyBlocks.defaultPickProps(0)); + super(ActuallyBlocks.defaultPickProps()); } @Override - public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { if (this.tryToggleRedstone(world, pos, player)) { - return ActionResultType.PASS; + return InteractionResult.PASS; } return this.openGui(world, player, pos, TileEntityFireworkBox.class); } + @Nullable + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new TileEntityFireworkBox(pos, state); + } - //@Override - public TileEntity newBlockEntity(IBlockReader worldIn) { - return new TileEntityFireworkBox(); + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return level.isClientSide? TileEntityFireworkBox::clientTick : TileEntityFireworkBox::serverTick; } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return Shapes.FIREWORKS_BOX_SHAPE; + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + return VoxelShapes.FIREWORKS_BOX_SHAPE; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java index d6401687c..dcb613740 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java @@ -11,28 +11,22 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.FullyDirectionalBlock; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidPlacer; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraftforge.fluids.FluidUtil; -import net.minecraftforge.fml.network.NetworkHooks; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -42,34 +36,37 @@ public class BlockFluidCollector extends FullyDirectionalBlock.Container { private final boolean isPlacer; public BlockFluidCollector(boolean isPlacer) { - super(ActuallyBlocks.defaultPickProps(0)); + super(ActuallyBlocks.defaultPickProps()); this.isPlacer = isPlacer; } - @Override - public boolean hasTileEntity(BlockState state) { - return true; - } - @Nullable @Override - public TileEntity createTileEntity(BlockState state, IBlockReader world) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return this.isPlacer - ? new TileEntityFluidPlacer() - : new TileEntityFluidCollector(); + ? new TileEntityFluidPlacer(pos, state) + : new TileEntityFluidCollector(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return this.isPlacer + ? level.isClientSide? TileEntityFluidPlacer::clientTick : TileEntityFluidPlacer::serverTick + : level.isClientSide? TileEntityFluidCollector::clientTick : TileEntityFluidCollector::serverTick; } @Nonnull @Override - public ActionResultType use(@Nonnull BlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull PlayerEntity player, @Nonnull Hand handIn, @Nonnull BlockRayTraceResult hit) { + public InteractionResult use(@Nonnull BlockState state, @Nonnull Level world, @Nonnull BlockPos pos, @Nonnull Player player, @Nonnull InteractionHand handIn, @Nonnull BlockHitResult hit) { if (world.isClientSide) - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; if (this.tryToggleRedstone(world, pos, player)) { - return ActionResultType.CONSUME; + return InteractionResult.CONSUME; } if (FluidUtil.interactWithFluidHandler(player, handIn, world, pos, hit.getDirection())) { - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; } return this.openGui(world, player, pos, TileEntityFluidCollector.class); @@ -77,20 +74,20 @@ public class BlockFluidCollector extends FullyDirectionalBlock.Container { @Nonnull @Override - public VoxelShape getShape(BlockState state, @Nonnull IBlockReader worldIn, @Nonnull BlockPos pos, @Nonnull ISelectionContext context) { + public VoxelShape getShape(BlockState state, @Nonnull BlockGetter worldIn, @Nonnull BlockPos pos, @Nonnull CollisionContext context) { switch (state.getValue(FACING)) { case UP: - return Shapes.FluidCollectorShapes.SHAPE_U; + return VoxelShapes.FluidCollectorShapes.SHAPE_U; case DOWN: - return Shapes.FluidCollectorShapes.SHAPE_D; + return VoxelShapes.FluidCollectorShapes.SHAPE_D; case EAST: - return Shapes.FluidCollectorShapes.SHAPE_E; + return VoxelShapes.FluidCollectorShapes.SHAPE_E; case SOUTH: - return Shapes.FluidCollectorShapes.SHAPE_S; + return VoxelShapes.FluidCollectorShapes.SHAPE_S; case WEST: - return Shapes.FluidCollectorShapes.SHAPE_W; + return VoxelShapes.FluidCollectorShapes.SHAPE_W; default: - return Shapes.FluidCollectorShapes.SHAPE_N; + return VoxelShapes.FluidCollectorShapes.SHAPE_N; } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGeneric.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGeneric.java index 62a4fdfa5..6352ca94c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGeneric.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGeneric.java @@ -14,6 +14,6 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase; public class BlockGeneric extends BlockBase { public BlockGeneric() { - super(ActuallyBlocks.defaultPickProps(0)); + super(ActuallyBlocks.defaultPickProps()); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java index c9c4fe92c..a820a169c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java @@ -11,23 +11,23 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase; -import net.minecraft.block.BlockRenderType; -import net.minecraft.block.BlockState; -import net.minecraft.block.IGrowable; -import net.minecraft.block.SoundType; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; -import net.minecraft.world.server.ServerWorld; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.BonemealableBlock; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import org.apache.commons.lang3.tuple.Triple; import java.util.Random; public class BlockGreenhouseGlass extends BlockBase { public BlockGreenhouseGlass() { - super(ActuallyBlocks.defaultPickProps(0, 0.5F, 10.0F).sound(SoundType.GLASS).randomTicks()); + super(ActuallyBlocks.defaultPickProps(0.5F, 10.0F).sound(SoundType.GLASS).randomTicks()); } @@ -44,17 +44,17 @@ public class BlockGreenhouseGlass extends BlockBase { @Override - public BlockRenderType getRenderShape(BlockState state) { - return BlockRenderType.INVISIBLE; + public RenderShape getRenderShape(BlockState state) { + return RenderShape.INVISIBLE; } @Override - public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random rand) { + public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random rand) { if (world.isClientSide) { return; } if (world.canSeeSkyFromBelowWater(pos) && world.isDay()) { - Triple trip = this.firstBlock(world, pos); + Triple trip = this.firstBlock(world, pos); boolean once = false; if (trip != null) { for (int i = 0; i < 3; i++) { @@ -75,17 +75,17 @@ public class BlockGreenhouseGlass extends BlockBase { } } - public Triple firstBlock(World world, BlockPos glassPos) { - BlockPos.Mutable mut = new BlockPos(glassPos).mutable(); + public Triple firstBlock(Level world, BlockPos glassPos) { + BlockPos.MutableBlockPos mut = new BlockPos(glassPos).mutable(); while (true) { mut.set(mut.getX(), mut.getY() - 1, mut.getZ()); if (mut.getY() < 0) { return null; } BlockState state = world.getBlockState(mut); - if (state.isSolidRender(world, mut) || state.getBlock() instanceof IGrowable || state.getBlock() == this) { - if (state.getBlock() instanceof IGrowable) { - return Triple.of(mut.immutable(), state, (IGrowable) state.getBlock()); + if (state.isSolidRender(world, mut) || state.getBlock() instanceof BonemealableBlock || state.getBlock() == this) { + if (state.getBlock() instanceof BonemealableBlock) { + return Triple.of(mut.immutable(), state, (BonemealableBlock) state.getBlock()); } else { return null; } @@ -94,7 +94,7 @@ public class BlockGreenhouseGlass extends BlockBase { } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return Shapes.GLASS_SHAPE; + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + return VoxelShapes.GLASS_SHAPE; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockHeatCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockHeatCollector.java index 03ea2bbd1..b03998f90 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockHeatCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockHeatCollector.java @@ -12,25 +12,37 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityHeatCollector; -import net.minecraft.block.BlockState; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; + +import javax.annotation.Nullable; public class BlockHeatCollector extends BlockContainerBase { public BlockHeatCollector() { - super(ActuallyBlocks.defaultPickProps(0, 2.5F, 10.0F)); + super(ActuallyBlocks.defaultPickProps(2.5F, 10.0F)); } - //@Override - public TileEntity newBlockEntity(IBlockReader worldIn) { - return new TileEntityHeatCollector(); + @Nullable + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new TileEntityHeatCollector(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return level.isClientSide? TileEntityHeatCollector::clientTick : TileEntityHeatCollector::serverTick; } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return Shapes.HEAT_COLLECTOR_SHAPE; + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + return VoxelShapes.HEAT_COLLECTOR_SHAPE; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemInterface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemInterface.java index 66cba7948..91a35ae82 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemInterface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemInterface.java @@ -12,33 +12,37 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemInterface; -import net.minecraft.block.BlockState; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import javax.annotation.Nullable; public class BlockItemInterface extends BlockContainerBase { public BlockItemInterface() { - super(ActuallyBlocks.defaultPickProps(0)); - } - - @Override - public boolean hasTileEntity(BlockState state) { - return true; + super(ActuallyBlocks.defaultPickProps()); } @Nullable @Override - public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return new TileEntityItemInterface(); + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new TileEntityItemInterface(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return level.isClientSide? TileEntityItemInterface::clientTick : TileEntityItemInterface::serverTick; } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return Shapes.ITEM_VIEWER_SHAPE; + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + return VoxelShapes.ITEM_VIEWER_SHAPE; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemInterfaceHopping.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemInterfaceHopping.java index 8ca38b568..d14ac8a22 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemInterfaceHopping.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemInterfaceHopping.java @@ -11,12 +11,17 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemInterfaceHopping; -import net.minecraft.block.BlockState; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; + +import javax.annotation.Nullable; public class BlockItemInterfaceHopping extends BlockItemInterface { public BlockItemInterfaceHopping() { @@ -24,12 +29,19 @@ public class BlockItemInterfaceHopping extends BlockItemInterface { } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return Shapes.HOPPING_ITEM_VIEWER_SHAPE; + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + return VoxelShapes.HOPPING_ITEM_VIEWER_SHAPE; } - //@Override - public TileEntity newBlockEntity(IBlockReader worldIn) { - return new TileEntityItemInterfaceHopping(); + @Nullable + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new TileEntityItemInterfaceHopping(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return level.isClientSide? TileEntityItemInterfaceHopping::clientTick : TileEntityItemInterfaceHopping::serverTick; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampController.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampController.java index 7256ed778..dce43a34d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampController.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampController.java @@ -12,15 +12,15 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.FullyDirectionalBlock; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +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.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import java.util.ArrayList; import java.util.List; @@ -28,20 +28,20 @@ import java.util.List; public class BlockLampController extends FullyDirectionalBlock { public BlockLampController() { - super(ActuallyBlocks.defaultPickProps(0)); + super(ActuallyBlocks.defaultPickProps()); } @Override - public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving) { + public void neighborChanged(BlockState state, Level worldIn, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving) { this.updateLamp(worldIn, pos); } @Override - public void onPlace(BlockState state, World world, BlockPos pos, BlockState oldState, boolean isMoving) { + public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean isMoving) { this.updateLamp(world, pos); } - private void updateLamp(World world, BlockPos pos) { + private void updateLamp(Level world, BlockPos pos) { if (!world.isClientSide) { BlockState state = world.getBlockState(pos); BlockPos coords = pos.relative(WorldUtil.getDirectionByPistonRotation(state)); @@ -49,7 +49,7 @@ public class BlockLampController extends FullyDirectionalBlock { } } - private void updateLampsAtPos(World world, BlockPos pos, boolean powered, List updatedAlready) { + private void updateLampsAtPos(Level world, BlockPos pos, boolean powered, List updatedAlready) { BlockState state = world.getBlockState(pos); Block block = state.getBlock(); if (block instanceof BlockColoredLamp) { @@ -65,7 +65,7 @@ public class BlockLampController extends FullyDirectionalBlock { } } - private void updateSurrounding(World world, BlockPos pos, boolean powered, List updatedAlready) { + private void updateSurrounding(Level world, BlockPos pos, boolean powered, List updatedAlready) { for (Direction side : Direction.values()) { BlockPos offset = pos.relative(side); if (!updatedAlready.contains(offset)) { @@ -76,16 +76,16 @@ public class BlockLampController extends FullyDirectionalBlock { } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { switch (state.getValue(FACING)) { case EAST: - return Shapes.LampPowererShapes.SHAPE_E; + return VoxelShapes.LampPowererShapes.SHAPE_E; case SOUTH: - return Shapes.LampPowererShapes.SHAPE_S; + return VoxelShapes.LampPowererShapes.SHAPE_S; case WEST: - return Shapes.LampPowererShapes.SHAPE_W; + return VoxelShapes.LampPowererShapes.SHAPE_W; default: - return Shapes.LampPowererShapes.SHAPE_N; + return VoxelShapes.LampPowererShapes.SHAPE_N; } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java index 713bbb6ec..682362681 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java @@ -10,7 +10,8 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.platform.Window; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.laser.IConnectionPair; import de.ellpeck.actuallyadditions.api.laser.Network; @@ -20,30 +21,38 @@ import de.ellpeck.actuallyadditions.mod.config.CommonConfig; import de.ellpeck.actuallyadditions.mod.items.ItemEngineerGoggles; import de.ellpeck.actuallyadditions.mod.items.ItemLaserRelayUpgrade; import de.ellpeck.actuallyadditions.mod.items.ItemLaserWrench; -import de.ellpeck.actuallyadditions.mod.tile.*; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergy; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergyAdvanced; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergyExtreme; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayFluids; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItem; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemAdvanced; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import io.netty.util.internal.ConcurrentSet; -import net.minecraft.block.BlockState; -import net.minecraft.client.MainWindow; +import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.BlockItemUseContext; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.core.BlockPos; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; @@ -62,7 +71,7 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements private final Type type; public BlockLaserRelay(Type type) { - super(ActuallyBlocks.defaultPickProps(0)); + super(ActuallyBlocks.defaultPickProps()); this.type = type; } @@ -85,20 +94,20 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements @Override - public BlockState getStateForPlacement(BlockItemUseContext context) { + public BlockState getStateForPlacement(BlockPlaceContext context) { return this.defaultBlockState().setValue(FACING, context.getClickedFace()); } @Override - public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { ItemStack stack = player.getItemInHand(hand); - TileEntity tile = world.getBlockEntity(pos); + BlockEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityLaserRelay) { TileEntityLaserRelay relay = (TileEntityLaserRelay) tile; if (StackUtil.isValid(stack)) { if (stack.getItem() instanceof ItemLaserWrench) { - return ActionResultType.FAIL; + return InteractionResult.FAIL; } else if (stack.getItem() == CommonConfig.Other.relayConfigureItem) { if (!world.isClientSide) { relay.onCompassAction(player); @@ -112,7 +121,7 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements relay.sendUpdate(); } - return ActionResultType.PASS; + return InteractionResult.PASS; } else if (stack.getItem() instanceof ItemLaserRelayUpgrade) { ItemStack inRelay = relay.inv.getStackInSlot(0); if (!StackUtil.isValid(inRelay)) { @@ -125,7 +134,7 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements set.setCount(1); relay.inv.setStackInSlot(0, set); } - return ActionResultType.PASS; + return InteractionResult.PASS; } } @@ -137,11 +146,11 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements if (!world.isClientSide) { relay.inv.setStackInSlot(0, ItemStack.EMPTY); - if (!player.inventory.add(inRelay)) { + if (!player.getInventory().add(inRelay)) { player.spawnAtLocation(inRelay, 0); } } - return ActionResultType.PASS; + return InteractionResult.PASS; } } @@ -149,46 +158,61 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements return this.openGui(world, player, pos, TileEntityLaserRelayItemAdvanced.class); } } - return ActionResultType.FAIL; + return InteractionResult.FAIL; } + @Nullable @Override - public boolean hasTileEntity(BlockState state) { - return true; - } - - @Override - public TileEntity createTileEntity(BlockState state, IBlockReader world) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { switch (this.type) { case ITEM: - return new TileEntityLaserRelayItem(); + return new TileEntityLaserRelayItem(pos, state); case ITEM_WHITELIST: - return new TileEntityLaserRelayItemAdvanced(); + return new TileEntityLaserRelayItemAdvanced(pos, state); case ENERGY_ADVANCED: - return new TileEntityLaserRelayEnergyAdvanced(); + return new TileEntityLaserRelayEnergyAdvanced(pos, state); case ENERGY_EXTREME: - return new TileEntityLaserRelayEnergyExtreme(); + return new TileEntityLaserRelayEnergyExtreme(pos, state); case FLUIDS: - return new TileEntityLaserRelayFluids(); + return new TileEntityLaserRelayFluids(pos, state); default: - return new TileEntityLaserRelayEnergy(); + return new TileEntityLaserRelayEnergy(pos, state); + } + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + switch (this.type) { + case ITEM: + return level.isClientSide? TileEntityLaserRelayItem::clientTick : TileEntityLaserRelayItem::serverTick; + case ITEM_WHITELIST: + return level.isClientSide? TileEntityLaserRelayItemAdvanced::clientTick : TileEntityLaserRelayItemAdvanced::serverTick; + case ENERGY_ADVANCED: + return level.isClientSide? TileEntityLaserRelayEnergyAdvanced::clientTick : TileEntityLaserRelayEnergyAdvanced::serverTick; + case ENERGY_EXTREME: + return level.isClientSide? TileEntityLaserRelayEnergyExtreme::clientTick : TileEntityLaserRelayEnergyExtreme::serverTick; + case FLUIDS: + return level.isClientSide? TileEntityLaserRelayFluids::clientTick : TileEntityLaserRelayFluids::serverTick; + default: + return level.isClientSide? TileEntityLaserRelayEnergy::clientTick : TileEntityLaserRelayEnergy::serverTick; } } @Override @OnlyIn(Dist.CLIENT) - public void displayHud(MatrixStack matrices, Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult rayCast, MainWindow resolution) { - if (!(rayCast instanceof BlockRayTraceResult)) { + public void displayHud(PoseStack matrices, Minecraft minecraft, Player player, ItemStack stack, HitResult rayCast, Window resolution) { + if (!(rayCast instanceof BlockHitResult)) { return; } - BlockPos pos = ((BlockRayTraceResult) rayCast).getBlockPos(); + BlockPos pos = ((BlockHitResult) rayCast).getBlockPos(); if (minecraft.level != null) { boolean wearing = ItemEngineerGoggles.isWearing(player); if (wearing || StackUtil.isValid(stack)) { boolean compass = stack.getItem() == CommonConfig.Other.relayConfigureItem; if (wearing || compass || stack.getItem() instanceof ItemLaserWrench) { - TileEntity tile = minecraft.level.getBlockEntity(pos); + BlockEntity tile = minecraft.level.getBlockEntity(pos); if (tile instanceof TileEntityLaserRelay) { TileEntityLaserRelay relay = (TileEntityLaserRelay) tile; @@ -199,7 +223,7 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements if (compass) { expl = relay.getCompassDisplayString(); } else { - expl = TextFormatting.GRAY.toString() + TextFormatting.ITALIC + I18n.get("info." + ActuallyAdditions.MODID + ".laserRelay.mode.noCompasss", I18n.get(CommonConfig.Other.relayConfigureItem.getDescriptionId())); + expl = ChatFormatting.GRAY.toString() + ChatFormatting.ITALIC + I18n.get("info." + ActuallyAdditions.MODID + ".laserRelay.mode.noCompasss", I18n.get(CommonConfig.Other.relayConfigureItem.getDescriptionId())); } minecraft.font.draw(matrices, expl, resolution.getGuiScaledWidth() / 2f + 5, resolution.getGuiScaledHeight() / 2f + 15, 0xFFFFFF); @@ -210,7 +234,7 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements } @Override - public void onRemove(BlockState state, World world, BlockPos pos, BlockState newState, boolean isMoving) { + public void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean isMoving) { if (state != newState) { ConcurrentSet connectionPairs = ActuallyAdditionsAPI.connectionHandler.getConnectionsFor(pos, world); ActuallyAdditionsAPI.connectionHandler.removeRelayFromNetwork(pos, world); @@ -224,7 +248,7 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements }); //Update the connected relays to sync the changes to the client relayPositions.forEach(relayPos -> { - TileEntity tile = world.getBlockEntity(relayPos); + BlockEntity tile = world.getBlockEntity(relayPos); if(tile instanceof TileEntityLaserRelay) { TileEntityLaserRelay relay = (TileEntityLaserRelay) tile; relay.sendUpdate(); @@ -251,20 +275,20 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { switch (state.getValue(FACING)) { case UP: - return Shapes.LaserRelayShapes.SHAPE_U; + return VoxelShapes.LaserRelayShapes.SHAPE_U; case DOWN: - return Shapes.LaserRelayShapes.SHAPE_D; + return VoxelShapes.LaserRelayShapes.SHAPE_D; case EAST: - return Shapes.LaserRelayShapes.SHAPE_E; + return VoxelShapes.LaserRelayShapes.SHAPE_E; case SOUTH: - return Shapes.LaserRelayShapes.SHAPE_S; + return VoxelShapes.LaserRelayShapes.SHAPE_S; case WEST: - return Shapes.LaserRelayShapes.SHAPE_W; + return VoxelShapes.LaserRelayShapes.SHAPE_W; default: - return Shapes.LaserRelayShapes.SHAPE_N; + return VoxelShapes.LaserRelayShapes.SHAPE_N; } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLavaFactoryController.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLavaFactoryController.java index 3cc9efb32..ca492a490 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLavaFactoryController.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLavaFactoryController.java @@ -10,47 +10,59 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.platform.Window; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.base.DirectionalBlock; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLavaFactoryController; import de.ellpeck.actuallyadditions.mod.util.StringUtil; -import net.minecraft.block.BlockState; -import net.minecraft.client.MainWindow; import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.core.BlockPos; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import javax.annotation.Nullable; + public class BlockLavaFactoryController extends DirectionalBlock.Container implements IHudDisplay { public BlockLavaFactoryController() { - super(ActuallyBlocks.defaultPickProps(0, 4.5F, 20.0F)); + super(ActuallyBlocks.defaultPickProps(4.5F, 20.0F)); } - //@Override - public TileEntity newBlockEntity(IBlockReader worldIn) { - return new TileEntityLavaFactoryController(); + @Nullable + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new TileEntityLavaFactoryController(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return level.isClientSide? TileEntityLavaFactoryController::clientTick : TileEntityLavaFactoryController::serverTick; } @Override @OnlyIn(Dist.CLIENT) - public void displayHud(MatrixStack matrices, Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult rayCast, MainWindow resolution) { - if (!(rayCast instanceof BlockRayTraceResult)) { + public void displayHud(PoseStack matrices, Minecraft minecraft, Player player, ItemStack stack, HitResult rayCast, Window resolution) { + if (!(rayCast instanceof BlockHitResult)) { return; } - TileEntityLavaFactoryController factory = (TileEntityLavaFactoryController) minecraft.level.getBlockEntity(((BlockRayTraceResult) rayCast).getBlockPos()); + TileEntityLavaFactoryController factory = (TileEntityLavaFactoryController) minecraft.level.getBlockEntity(((BlockHitResult) rayCast).getBlockPos()); if (factory != null) { int state = factory.isMultiblock(); if (state == TileEntityLavaFactoryController.NOT_MULTI) { @@ -62,16 +74,16 @@ public class BlockLavaFactoryController extends DirectionalBlock.Container imple } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { switch (state.getValue(FACING)) { case EAST: - return Shapes.LavaFactoryShapes.SHAPE_E; + return VoxelShapes.LavaFactoryShapes.SHAPE_E; case SOUTH: - return Shapes.LavaFactoryShapes.SHAPE_S; + return VoxelShapes.LavaFactoryShapes.SHAPE_S; case WEST: - return Shapes.LavaFactoryShapes.SHAPE_W; + return VoxelShapes.LavaFactoryShapes.SHAPE_W; default: - return Shapes.LavaFactoryShapes.SHAPE_N; + return VoxelShapes.LavaFactoryShapes.SHAPE_N; } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLeafGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLeafGenerator.java index 5da468e85..af6463e62 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLeafGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLeafGenerator.java @@ -12,40 +12,49 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.DirectionalBlock; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLeafGenerator; -import net.minecraft.block.BlockState; -import net.minecraft.block.SoundType; -import net.minecraft.block.material.Material; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; -import net.minecraftforge.common.ToolType; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.Material; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; -import net.minecraft.block.AbstractBlock.Properties; +import javax.annotation.Nullable; public class BlockLeafGenerator extends DirectionalBlock.Container { public BlockLeafGenerator() { - super(Properties.of(Material.METAL).strength(5.0F, 10.0F).harvestTool(ToolType.PICKAXE).harvestLevel(0).strength(5.0F, 10.0F).sound(SoundType.METAL)); + super(Properties.of(Material.METAL).strength(5.0F, 10.0F).requiresCorrectToolForDrops().strength(5.0F, 10.0F).sound(SoundType.METAL)); } - //@Override - public TileEntity newBlockEntity(IBlockReader worldIn) { - return new TileEntityLeafGenerator(); + @Nullable + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new TileEntityLeafGenerator(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return level.isClientSide? TileEntityLeafGenerator::clientTick : TileEntityLeafGenerator::serverTick; } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { switch (state.getValue(FACING)) { case EAST: - return Shapes.LeafGeneratorShapes.SHAPE_E; + return VoxelShapes.LeafGeneratorShapes.SHAPE_E; case SOUTH: - return Shapes.LeafGeneratorShapes.SHAPE_S; + return VoxelShapes.LeafGeneratorShapes.SHAPE_S; case WEST: - return Shapes.LeafGeneratorShapes.SHAPE_W; + return VoxelShapes.LeafGeneratorShapes.SHAPE_W; default: - return Shapes.LeafGeneratorShapes.SHAPE_N; + return VoxelShapes.LeafGeneratorShapes.SHAPE_N; } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLongRangeBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLongRangeBreaker.java index 6748b01c5..68fa2a7a3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLongRangeBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLongRangeBreaker.java @@ -12,53 +12,64 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.FullyDirectionalBlock; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLongRangeBreaker; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; + +import javax.annotation.Nullable; public class BlockLongRangeBreaker extends FullyDirectionalBlock.Container { public BlockLongRangeBreaker() { - super(ActuallyBlocks.defaultPickProps(0)); + super(ActuallyBlocks.defaultPickProps()); } - //@Override - public TileEntity newBlockEntity(IBlockReader worldIn) { - return new TileEntityLongRangeBreaker(); + @Nullable + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new TileEntityLongRangeBreaker(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return level.isClientSide? TileEntityLongRangeBreaker::clientTick : TileEntityLongRangeBreaker::serverTick; } @Override - public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { if (this.tryToggleRedstone(world, pos, player)) { - return ActionResultType.PASS; + return InteractionResult.PASS; } return this.openGui(world, player, pos, TileEntityLongRangeBreaker.class); } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { switch (state.getValue(FACING)) { case UP: - return Shapes.DirectionalBlockBreakerShapes.SHAPE_U; + return VoxelShapes.DirectionalBlockBreakerShapes.SHAPE_U; case DOWN: - return Shapes.DirectionalBlockBreakerShapes.SHAPE_D; + return VoxelShapes.DirectionalBlockBreakerShapes.SHAPE_D; case EAST: - return Shapes.DirectionalBlockBreakerShapes.SHAPE_E; + return VoxelShapes.DirectionalBlockBreakerShapes.SHAPE_E; case SOUTH: - return Shapes.DirectionalBlockBreakerShapes.SHAPE_S; + return VoxelShapes.DirectionalBlockBreakerShapes.SHAPE_S; case WEST: - return Shapes.DirectionalBlockBreakerShapes.SHAPE_W; + return VoxelShapes.DirectionalBlockBreakerShapes.SHAPE_W; default: - return Shapes.DirectionalBlockBreakerShapes.SHAPE_N; + return VoxelShapes.DirectionalBlockBreakerShapes.SHAPE_N; } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java index 99adad4a0..f137f9a1f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java @@ -11,23 +11,24 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.DirectionalBlock; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator; import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.particles.ParticleTypes; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; -import net.minecraft.world.server.ServerWorld; -import net.minecraftforge.fml.network.NetworkHooks; +import net.minecraft.core.BlockPos; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraftforge.network.NetworkHooks; import javax.annotation.Nullable; import java.util.Random; @@ -35,24 +36,25 @@ import java.util.Random; public class BlockOilGenerator extends DirectionalBlock.Container { public BlockOilGenerator() { - super(ActuallyBlocks.defaultPickProps(0).randomTicks()); - } - - @Override - public boolean hasTileEntity(BlockState state) { - return true; + super(ActuallyBlocks.defaultPickProps().randomTicks()); } @Nullable @Override - public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return new TileEntityOilGenerator(); + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new TileEntityOilGenerator(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return level.isClientSide? TileEntityOilGenerator::clientTick : TileEntityOilGenerator::serverTick; } // TODO: Move all of these over to the client version @Override - public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - TileEntity tile = world.getBlockEntity(pos); + public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) { + BlockEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityOilGenerator) { if (((TileEntityOilGenerator) tile).currentBurnTime > 0) { for (int i = 0; i < 5; i++) { @@ -63,30 +65,30 @@ public class BlockOilGenerator extends DirectionalBlock.Container { } @Override - public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { if (!world.isClientSide) { TileEntityOilGenerator generator = (TileEntityOilGenerator) world.getBlockEntity(pos); if (generator != null) { if (!this.tryUseItemOnTank(player, hand, generator.tank)) { - NetworkHooks.openGui((ServerPlayerEntity) player, generator, pos); + NetworkHooks.openGui((ServerPlayer) player, generator, pos); } } } - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { switch (state.getValue(FACING)) { case EAST: - return Shapes.OilGeneratorShapes.SHAPE_E; + return VoxelShapes.OilGeneratorShapes.SHAPE_E; case SOUTH: - return Shapes.OilGeneratorShapes.SHAPE_S; + return VoxelShapes.OilGeneratorShapes.SHAPE_S; case WEST: - return Shapes.OilGeneratorShapes.SHAPE_W; + return VoxelShapes.OilGeneratorShapes.SHAPE_W; default: - return Shapes.OilGeneratorShapes.SHAPE_N; + return VoxelShapes.OilGeneratorShapes.SHAPE_N; } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java index 02376d028..135a3c651 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java @@ -10,42 +10,51 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.platform.Window; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.api.tile.IPhantomTile; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; -import de.ellpeck.actuallyadditions.mod.tile.*; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomBreaker; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomEnergyface; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomItemface; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomLiquiface; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomPlacer; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomRedstoneface; import de.ellpeck.actuallyadditions.mod.util.StringUtil; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.client.MainWindow; +import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Direction; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.Mth; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +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.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.Vec3; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import javax.annotation.Nullable; + public class BlockPhantom extends BlockContainerBase implements IHudDisplay { public final Type type; public BlockPhantom(Type type) { - super(ActuallyBlocks.defaultPickProps(0, 4.5F, 10.0F)); + super(ActuallyBlocks.defaultPickProps(4.5F, 10.0F)); this.type = type; } @@ -55,9 +64,9 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay { } @Override - public int getSignal(BlockState blockState, IBlockReader world, BlockPos pos, Direction side) { + public int getSignal(BlockState blockState, BlockGetter world, BlockPos pos, Direction side) { if (this.type == Type.REDSTONEFACE) { - TileEntity tile = world.getBlockEntity(pos); + BlockEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityPhantomRedstoneface) { return ((TileEntityPhantomRedstoneface) tile).providesWeak[side.ordinal()]; } @@ -66,9 +75,9 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay { } @Override - public int getDirectSignal(BlockState blockState, IBlockReader world, BlockPos pos, Direction side) { + public int getDirectSignal(BlockState blockState, BlockGetter world, BlockPos pos, Direction side) { if (this.type == Type.REDSTONEFACE) { - TileEntity tile = world.getBlockEntity(pos); + BlockEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityPhantomRedstoneface) { return ((TileEntityPhantomRedstoneface) tile).providesStrong[side.ordinal()]; } @@ -77,33 +86,53 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay { } @Override - public boolean shouldDropInventory(World world, BlockPos pos) { + public boolean shouldDropInventory(Level world, BlockPos pos) { return this.type == Type.PLACER || this.type == Type.BREAKER; } - //@Override - public TileEntity newBlockEntity(IBlockReader worldIn) { + @Nullable + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { switch (this.type) { case PLACER: - return new TileEntityPhantomPlacer(); + return new TileEntityPhantomPlacer(pos, state); case BREAKER: - return new TileEntityPhantomBreaker(); + return new TileEntityPhantomBreaker(pos, state); case LIQUIFACE: - return new TileEntityPhantomLiquiface(); + return new TileEntityPhantomLiquiface(pos, state); case ENERGYFACE: - return new TileEntityPhantomEnergyface(); + return new TileEntityPhantomEnergyface(pos, state); case REDSTONEFACE: - return new TileEntityPhantomRedstoneface(); + return new TileEntityPhantomRedstoneface(pos, state); default: - return new TileEntityPhantomItemface(); + return new TileEntityPhantomItemface(pos, state); + } + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + switch (this.type) { + case PLACER: + return level.isClientSide? TileEntityPhantomPlacer::clientTick : TileEntityPhantomPlacer::serverTick; + case BREAKER: + return level.isClientSide? TileEntityPhantomBreaker::clientTick : TileEntityPhantomBreaker::serverTick; + case LIQUIFACE: + return level.isClientSide? TileEntityPhantomLiquiface::clientTick : TileEntityPhantomLiquiface::serverTick; + case ENERGYFACE: + return level.isClientSide? TileEntityPhantomEnergyface::clientTick : TileEntityPhantomEnergyface::serverTick; + case REDSTONEFACE: + return level.isClientSide? TileEntityPhantomRedstoneface::clientTick : TileEntityPhantomRedstoneface::serverTick; + default: + return level.isClientSide? TileEntityPhantomItemface::clientTick : TileEntityPhantomItemface::serverTick; } } // TODO: [port] validate this works @Override - public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { if (this.tryToggleRedstone(world, pos, player)) { - return ActionResultType.PASS; + return InteractionResult.PASS; } /* if (!world.isClientSide) { @@ -113,24 +142,24 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay { } } */ - return ActionResultType.PASS; + return InteractionResult.PASS; } // TODO: [port] fix all of this, it's a mess @Override @OnlyIn(Dist.CLIENT) - public void displayHud(MatrixStack matrices, Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult rayCast, MainWindow resolution) { - if (!(rayCast instanceof BlockRayTraceResult)) { + public void displayHud(PoseStack matrices, Minecraft minecraft, Player player, ItemStack stack, HitResult rayCast, Window resolution) { + if (!(rayCast instanceof BlockHitResult)) { return; } - BlockPos pos = ((BlockRayTraceResult) rayCast).getBlockPos(); - TileEntity tile = minecraft.level.getBlockEntity(pos); + BlockPos pos = ((BlockHitResult) rayCast).getBlockPos(); + BlockEntity tile = minecraft.level.getBlockEntity(pos); if (tile != null) { if (tile instanceof IPhantomTile) { IPhantomTile phantom = (IPhantomTile) tile; - minecraft.font.drawShadow(matrices, TextFormatting.GOLD + I18n.get("tooltip." + ActuallyAdditions.MODID + ".blockPhantomRange.desc") + ": " + phantom.getRange(), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 - 40, TextFormatting.WHITE.getColor()); + minecraft.font.drawShadow(matrices, ChatFormatting.GOLD + I18n.get("tooltip." + ActuallyAdditions.MODID + ".blockPhantomRange.desc") + ": " + phantom.getRange(), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 - 40, ChatFormatting.WHITE.getColor()); if (phantom.hasBoundPosition()) { - int distance = MathHelper.ceil(new Vector3d(pos.getX(), pos.getY(), pos.getZ()).distanceTo(new Vector3d(phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ()))); + int distance = Mth.ceil(new Vec3(pos.getX(), pos.getY(), pos.getZ()).distanceTo(new Vec3(phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ()))); BlockState state = minecraft.level.getBlockState(phantom.getBoundPosition()); Block block = state.getBlock(); Item item = Item.byBlock(block); @@ -138,12 +167,12 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay { StringUtil.drawSplitString(minecraft.font, StringUtil.localizeFormatted("tooltip." + ActuallyAdditions.MODID + ".phantom.blockInfo.desc", name, phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ(), distance), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 - 30, 200, 0xFFFFFF, true); if (phantom.isBoundThingInRange()) { - StringUtil.drawSplitString(minecraft.font, TextFormatting.DARK_GREEN + I18n.get("tooltip." + ActuallyAdditions.MODID + ".phantom.connectedRange.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, 200, 0xFFFFFF, true); + StringUtil.drawSplitString(minecraft.font, ChatFormatting.DARK_GREEN + I18n.get("tooltip." + ActuallyAdditions.MODID + ".phantom.connectedRange.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, 200, 0xFFFFFF, true); } else { - StringUtil.drawSplitString(minecraft.font, TextFormatting.DARK_RED + I18n.get("tooltip." + ActuallyAdditions.MODID + ".phantom.connectedNoRange.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, 200, 0xFFFFFF, true); + StringUtil.drawSplitString(minecraft.font, ChatFormatting.DARK_RED + I18n.get("tooltip." + ActuallyAdditions.MODID + ".phantom.connectedNoRange.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, 200, 0xFFFFFF, true); } } else { - minecraft.font.drawShadow(matrices, TextFormatting.RED + I18n.get("tooltip." + ActuallyAdditions.MODID + ".phantom.notConnected.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, TextFormatting.WHITE.getColor()); + minecraft.font.drawShadow(matrices, ChatFormatting.RED + I18n.get("tooltip." + ActuallyAdditions.MODID + ".phantom.notConnected.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, ChatFormatting.WHITE.getColor()); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java index 01846a1ad..0e6f1e6b1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java @@ -12,26 +12,38 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomBooster; -import net.minecraft.block.BlockState; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; + +import javax.annotation.Nullable; public class BlockPhantomBooster extends BlockContainerBase { public BlockPhantomBooster() { - super(ActuallyBlocks.defaultPickProps(0)); + super(ActuallyBlocks.defaultPickProps()); } - //@Override - public TileEntity newBlockEntity(IBlockReader world) { - return new TileEntityPhantomBooster(); + @Nullable + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new TileEntityPhantomBooster(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return level.isClientSide? TileEntityPhantomBooster::clientTick : TileEntityPhantomBooster::serverTick; } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return Shapes.BOOSTER_SHAPE; + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + return VoxelShapes.BOOSTER_SHAPE; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPlayerInterface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPlayerInterface.java index ba0c72d55..c7188a5cb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPlayerInterface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPlayerInterface.java @@ -10,42 +10,52 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.platform.Window; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityPlayerInterface; -import de.ellpeck.actuallyadditions.mod.util.StringUtil; -import net.minecraft.block.BlockState; -import net.minecraft.client.MainWindow; +import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import javax.annotation.Nullable; + public class BlockPlayerInterface extends BlockContainerBase implements IHudDisplay { public BlockPlayerInterface() { - super(ActuallyBlocks.defaultPickProps(0, 4.5F, 10.0F)); + super(ActuallyBlocks.defaultPickProps(4.5F, 10.0F)); } - //@Override - public TileEntity newBlockEntity(IBlockReader worldIn) { - return new TileEntityPlayerInterface(); + @Nullable + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new TileEntityPlayerInterface(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return level.isClientSide? TileEntityPlayerInterface::clientTick : TileEntityPlayerInterface::serverTick; } @Override - public void setPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity player, ItemStack stack) { - TileEntity tile = world.getBlockEntity(pos); + public void setPlacedBy(Level world, BlockPos pos, BlockState state, LivingEntity player, ItemStack stack) { + BlockEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityPlayerInterface) { TileEntityPlayerInterface face = (TileEntityPlayerInterface) tile; if (face.connectedPlayer == null) { @@ -61,26 +71,26 @@ public class BlockPlayerInterface extends BlockContainerBase implements IHudDisp @Override @OnlyIn(Dist.CLIENT) - public void displayHud(MatrixStack matrices, Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult rayCast, MainWindow resolution) { - if (!(rayCast instanceof BlockRayTraceResult)) { + public void displayHud(PoseStack matrices, Minecraft minecraft, Player player, ItemStack stack, HitResult rayCast, Window resolution) { + if (!(rayCast instanceof BlockHitResult)) { return; } - TileEntity tile = minecraft.level.getBlockEntity(((BlockRayTraceResult) rayCast).getBlockPos()); + BlockEntity tile = minecraft.level.getBlockEntity(((BlockHitResult) rayCast).getBlockPos()); if (tile != null) { if (tile instanceof TileEntityPlayerInterface) { TileEntityPlayerInterface face = (TileEntityPlayerInterface) tile; String name = face.playerName == null ? "Unknown" : face.playerName; - minecraft.font.drawShadow(matrices, "Bound to: " + TextFormatting.RED + name, resolution.getGuiScaledWidth() / 2f + 5, resolution.getGuiScaledHeight() / 2f + 5, 0xFFFFFF); - minecraft.font.drawShadow(matrices, "UUID: " + TextFormatting.DARK_GREEN + face.connectedPlayer, resolution.getGuiScaledWidth() / 2f + 5, resolution.getGuiScaledHeight() / 2f + 15, 0xFFFFFF); + minecraft.font.drawShadow(matrices, "Bound to: " + ChatFormatting.RED + name, resolution.getGuiScaledWidth() / 2f + 5, resolution.getGuiScaledHeight() / 2f + 5, 0xFFFFFF); + minecraft.font.drawShadow(matrices, "UUID: " + ChatFormatting.DARK_GREEN + face.connectedPlayer, resolution.getGuiScaledWidth() / 2f + 5, resolution.getGuiScaledHeight() / 2f + 15, 0xFFFFFF); } } } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return Shapes.PLAYER_INTERFACE_SHAPE; + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + return VoxelShapes.PLAYER_INTERFACE_SHAPE; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPoweredFurnace.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPoweredFurnace.java index d04a51127..ca9f5bfeb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPoweredFurnace.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPoweredFurnace.java @@ -10,37 +10,38 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING; -import static net.minecraft.state.properties.BlockStateProperties.LIT; - -import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.blocks.base.DirectionalBlock; import de.ellpeck.actuallyadditions.mod.tile.TileEntityPoweredFurnace; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.BlockItemUseContext; -import net.minecraft.particles.ParticleTypes; -import net.minecraft.state.StateContainer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Direction; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; -import net.minecraft.world.server.ServerWorld; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.context.BlockPlaceContext; +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.BlockEntityTicker; +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.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import javax.annotation.Nullable; import java.util.Random; +import static net.minecraft.world.level.block.state.properties.BlockStateProperties.HORIZONTAL_FACING; +import static net.minecraft.world.level.block.state.properties.BlockStateProperties.LIT; + public class BlockPoweredFurnace extends DirectionalBlock.Container { public BlockPoweredFurnace() { // TODO: [port] confirm this is correct for light level... Might not be reactive. - super(ActuallyBlocks.defaultPickProps(0).randomTicks().lightLevel(state -> state.getValue(LIT) + super(ActuallyBlocks.defaultPickProps().randomTicks().lightLevel(state -> state.getValue(LIT) ? 12 : 0)); @@ -49,17 +50,18 @@ public class BlockPoweredFurnace extends DirectionalBlock.Container { @Nullable @Override - public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return new TileEntityPoweredFurnace(); + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new TileEntityPoweredFurnace(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return level.isClientSide? TileEntityPoweredFurnace::clientTick : TileEntityPoweredFurnace::serverTick; } @Override - public boolean hasTileEntity(BlockState state) { - return true; - } - - @Override - public void randomTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) { + public void randomTick(BlockState state, ServerLevel worldIn, BlockPos pos, Random random) { if (state.getValue(LIT)) { for (int i = 0; i < 5; i++) { worldIn.addParticle(ParticleTypes.SMOKE, (double) pos.getX() + 0.5F, (double) pos.getY() + 1.0F, (double) pos.getZ() + 0.5F, 0.0D, 0.0D, 0.0D); @@ -70,17 +72,17 @@ public class BlockPoweredFurnace extends DirectionalBlock.Container { @Override - public ActionResultType use(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { return this.openGui(worldIn, player, pos, TileEntityPoweredFurnace.class); } @Override - public BlockState getStateForPlacement(BlockItemUseContext context) { + public BlockState getStateForPlacement(BlockPlaceContext context) { return defaultBlockState().setValue(HORIZONTAL_FACING, context.getHorizontalDirection().getOpposite()).setValue(LIT, false); } @Override - protected void createBlockStateDefinition(StateContainer.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(LIT).add(HORIZONTAL_FACING); } @@ -100,16 +102,16 @@ public class BlockPoweredFurnace extends DirectionalBlock.Container { @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { switch (state.getValue(HORIZONTAL_FACING)) { case EAST: - return Shapes.FurnaceDoubleShapes.SHAPE_E; + return VoxelShapes.FurnaceDoubleShapes.SHAPE_E; case SOUTH: - return Shapes.FurnaceDoubleShapes.SHAPE_S; + return VoxelShapes.FurnaceDoubleShapes.SHAPE_S; case WEST: - return Shapes.FurnaceDoubleShapes.SHAPE_W; + return VoxelShapes.FurnaceDoubleShapes.SHAPE_W; default: - return Shapes.FurnaceDoubleShapes.SHAPE_N; + return VoxelShapes.FurnaceDoubleShapes.SHAPE_N; } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockRangedCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockRangedCollector.java index 9a65baa51..c263e9e9e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockRangedCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockRangedCollector.java @@ -12,40 +12,51 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; + +import javax.annotation.Nullable; public class BlockRangedCollector extends BlockContainerBase { public BlockRangedCollector() { - super(ActuallyBlocks.defaultPickProps(0)); + super(ActuallyBlocks.defaultPickProps()); } - //@Override - public TileEntity newBlockEntity(IBlockReader worldIn) { - return new TileEntityRangedCollector(); + @Nullable + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new TileEntityRangedCollector(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return level.isClientSide? TileEntityRangedCollector::clientTick : TileEntityRangedCollector::serverTick; } @Override - public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { if (this.tryToggleRedstone(world, pos, player)) { - return ActionResultType.PASS; + return InteractionResult.PASS; } return this.openGui(world, player, pos, TileEntityRangedCollector.class); } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return Shapes.COLLECTOR_SHAPE; + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + return VoxelShapes.COLLECTOR_SHAPE; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockShockSuppressor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockShockSuppressor.java index b84cb8a97..1979be1c0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockShockSuppressor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockShockSuppressor.java @@ -11,15 +11,18 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.tile.TileEntityShockSuppressor; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.entity.Entity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.entity.Entity; +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.EntityBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.world.ExplosionEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; @@ -29,16 +32,16 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -public class BlockShockSuppressor extends Block { +public class BlockShockSuppressor extends Block implements EntityBlock { public BlockShockSuppressor() { - super(ActuallyBlocks.defaultPickProps(0, 20F, 2000.0F)); + super(ActuallyBlocks.defaultPickProps(20F, 2000.0F)); MinecraftForge.EVENT_BUS.register(this); } @SubscribeEvent public void onExplosion(ExplosionEvent.Detonate event) { - World world = event.getWorld(); + Level world = event.getWorld(); if (!world.isClientSide) { List affectedBlocks = event.getAffectedBlocks(); List affectedEntities = event.getAffectedEntities(); @@ -90,17 +93,18 @@ public class BlockShockSuppressor extends Block { @Nullable @Override - public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return new TileEntityShockSuppressor(); + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new TileEntityShockSuppressor(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return level.isClientSide? TileEntityShockSuppressor::clientTick : TileEntityShockSuppressor::serverTick; } @Override - public boolean hasTileEntity(BlockState state) { - return true; - } - - @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return Shapes.SUPPRESSOR_SHAPE; + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + return VoxelShapes.SUPPRESSOR_SHAPE; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTinyTorch.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTinyTorch.java index 83c951b72..46ddf758c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTinyTorch.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTinyTorch.java @@ -11,23 +11,19 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase; -import net.minecraft.block.SoundType; -import net.minecraft.block.material.Material; -import net.minecraft.util.math.AxisAlignedBB; - -//Copied from BlockTorch. -//I have no idea what all of this means. -import net.minecraft.block.AbstractBlock.Properties; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.material.Material; +import net.minecraft.world.phys.AABB; public class BlockTinyTorch extends BlockBase { //Thanks to xdjackiexd for these. //Man, I hate numbers. - private static final AxisAlignedBB STANDING_AABB = new AxisAlignedBB(0.4375D, 0.0D, 0.4375D, 0.5625D, 0.3125D, 0.5625D); - private static final AxisAlignedBB TORCH_NORTH_AABB = new AxisAlignedBB(0.4375D, 0.25D, 0.8125D, 0.5625D, 0.5625D, 1.0D); - private static final AxisAlignedBB TORCH_SOUTH_AABB = new AxisAlignedBB(0.4375D, 0.25D, 0.0D, 0.5625D, 0.5625D, 0.1875D); - private static final AxisAlignedBB TORCH_WEST_AABB = new AxisAlignedBB(0.8125D, 0.25D, 0.4375D, 1.0D, 0.5625D, 0.5625D); - private static final AxisAlignedBB TORCH_EAST_AABB = new AxisAlignedBB(0.0D, 0.25D, 0.4375D, 0.1875D, 0.5625D, 0.5625D); + private static final AABB STANDING_AABB = new AABB(0.4375D, 0.0D, 0.4375D, 0.5625D, 0.3125D, 0.5625D); + private static final AABB TORCH_NORTH_AABB = new AABB(0.4375D, 0.25D, 0.8125D, 0.5625D, 0.5625D, 1.0D); + private static final AABB TORCH_SOUTH_AABB = new AABB(0.4375D, 0.25D, 0.0D, 0.5625D, 0.5625D, 0.1875D); + private static final AABB TORCH_WEST_AABB = new AABB(0.8125D, 0.25D, 0.4375D, 1.0D, 0.5625D, 0.5625D); + private static final AABB TORCH_EAST_AABB = new AABB(0.0D, 0.25D, 0.4375D, 0.1875D, 0.5625D, 0.5625D); public BlockTinyTorch() { super(Properties.of(Material.DECORATION).sound(SoundType.WOOD).strength(0.0F, 0.8F)); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockVerticalDigger.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockVerticalDigger.java index c8ff73331..58ae3ef0f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockVerticalDigger.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockVerticalDigger.java @@ -10,53 +10,62 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.platform.Window; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.blocks.base.DirectionalBlock; import de.ellpeck.actuallyadditions.mod.tile.TileEntityVerticalDigger; -import de.ellpeck.actuallyadditions.mod.util.StringUtil; -import net.minecraft.block.BlockState; -import net.minecraft.client.MainWindow; import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import javax.annotation.Nullable; + public class BlockVerticalDigger extends DirectionalBlock.Container implements IHudDisplay { public BlockVerticalDigger() { - super(ActuallyBlocks.defaultPickProps(0, 8F, 30F)); + super(ActuallyBlocks.defaultPickProps(8F, 30F)); } @Override - public ActionResultType use(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { return this.openGui(worldIn, player, pos, TileEntityVerticalDigger.class); } - //@Override - public TileEntity newBlockEntity(IBlockReader world) { - return new TileEntityVerticalDigger(); + @Nullable + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new TileEntityVerticalDigger(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return level.isClientSide? TileEntityVerticalDigger::clientTick : TileEntityVerticalDigger::serverTick; } @Override @OnlyIn(Dist.CLIENT) - public void displayHud(MatrixStack matrices, Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult rayCast, MainWindow resolution) { - if (!(rayCast instanceof BlockRayTraceResult)) { + public void displayHud(PoseStack matrices, Minecraft minecraft, Player player, ItemStack stack, HitResult rayCast, Window resolution) { + if (!(rayCast instanceof BlockHitResult)) { return; } - TileEntity tile = minecraft.level.getBlockEntity(((BlockRayTraceResult) rayCast).getBlockPos()); + BlockEntity tile = minecraft.level.getBlockEntity(((BlockHitResult) rayCast).getBlockPos()); if (tile instanceof TileEntityVerticalDigger) { TileEntityVerticalDigger miner = (TileEntityVerticalDigger) tile; String info = miner.checkY == 0 @@ -69,18 +78,18 @@ public class BlockVerticalDigger extends DirectionalBlock.Container implements I } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { switch (state.getValue(FACING)) { case NORTH: - return Shapes.MinerShapes.SHAPE_N; + return VoxelShapes.MinerShapes.SHAPE_N; case EAST: - return Shapes.MinerShapes.SHAPE_E; + return VoxelShapes.MinerShapes.SHAPE_E; case SOUTH: - return Shapes.MinerShapes.SHAPE_S; + return VoxelShapes.MinerShapes.SHAPE_S; case WEST: - return Shapes.MinerShapes.SHAPE_W; + return VoxelShapes.MinerShapes.SHAPE_W; default: - return Shapes.MinerShapes.SHAPE_N; + return VoxelShapes.MinerShapes.SHAPE_N; } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java index 577ffd50d..c0db3582a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java @@ -11,10 +11,8 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBushBase; -import net.minecraft.block.SoundType; -import net.minecraft.block.material.Material; - -import net.minecraft.block.AbstractBlock.Properties; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.material.Material; public class BlockWildPlant extends BlockBushBase { @@ -22,7 +20,7 @@ public class BlockWildPlant extends BlockBushBase { // public static final PropertyEnum TYPE = PropertyEnum.create("type", TheWildPlants.class); public BlockWildPlant() { - super(Properties.of(Material.PLANT).sound(SoundType.GRASS).harvestLevel(0).strength(0, 0)); + super(Properties.of(Material.PLANT).sound(SoundType.GRASS).strength(0, 0)); // this.setSoundType(SoundType.PLANT); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java index 866002174..1083434c8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java @@ -12,35 +12,46 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.DirectionalBlock; import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; + +import javax.annotation.Nullable; public class BlockXPSolidifier extends DirectionalBlock.Container { public BlockXPSolidifier() { - super(ActuallyBlocks.defaultPickProps(0, 2.5F, 10.0F)); + super(ActuallyBlocks.defaultPickProps(2.5F, 10.0F)); } - //@Override - public TileEntity newBlockEntity(IBlockReader worldIn) { - return new TileEntityXPSolidifier(); + @Nullable + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new TileEntityXPSolidifier(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType entityType) { + return level.isClientSide? TileEntityXPSolidifier::clientTick : TileEntityXPSolidifier::serverTick; } @Override - public ActionResultType use(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { return this.openGui(worldIn, player, pos, TileEntityXPSolidifier.class); } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return Shapes.SOLIDIFIER_SHAPE; + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + return VoxelShapes.SOLIDIFIER_SHAPE; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/CrystalClusterBlock.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/CrystalClusterBlock.java index 51591296b..f59725c67 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/CrystalClusterBlock.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/CrystalClusterBlock.java @@ -12,20 +12,19 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.FullyDirectionalBlock; import de.ellpeck.actuallyadditions.mod.items.metalists.Crystals; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.SoundType; -import net.minecraft.block.material.Material; -import net.minecraft.state.DirectionProperty; -import net.minecraft.state.StateContainer; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.shapes.IBooleanFunction; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.util.math.shapes.VoxelShapes; -import net.minecraft.world.IBlockReader; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.material.Material; +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 java.util.stream.Stream; @@ -43,7 +42,7 @@ public class CrystalClusterBlock extends FullyDirectionalBlock { Block.box(3, 0, 9, 4, 2, 10), Block.box(2, 0, 8, 4, 1, 10), Block.box(5, 0, 11, 7, 2, 13), Block.box(7, 0, 11, 11, 1, 13), Block.box(10, 0, 9, 13, 1, 11), Block.box(11, 0, 7, 12, 3, 9) - ).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR) ).get(); + ).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR) ).get(); public CrystalClusterBlock(Crystals crystal) { super(Block.Properties.of(Material.GLASS) @@ -59,7 +58,7 @@ public class CrystalClusterBlock extends FullyDirectionalBlock { } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { return CRYSTAL_SHAPE; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/IActuallyBlock.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/IActuallyBlock.java index fca0054a3..bbcb92191 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/IActuallyBlock.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/IActuallyBlock.java @@ -1,6 +1,6 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import net.minecraft.item.Item; +import net.minecraft.world.item.Item; public interface IActuallyBlock { /** diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/IHudDisplay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/IHudDisplay.java index 7dcd2ef8c..64e075cfa 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/IHudDisplay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/IHudDisplay.java @@ -10,18 +10,18 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import com.mojang.blaze3d.matrix.MatrixStack; -import net.minecraft.client.MainWindow; +import com.mojang.blaze3d.platform.Window; +import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.RayTraceResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.phys.HitResult; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; public interface IHudDisplay { @OnlyIn(Dist.CLIENT) - void displayHud(MatrixStack matrices, Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult rayCast, MainWindow resolution); + void displayHud(PoseStack matrices, Minecraft minecraft, Player player, ItemStack stack, HitResult rayCast, Window resolution); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/Shapes.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/VoxelShapes.java similarity index 92% rename from src/main/java/de/ellpeck/actuallyadditions/mod/blocks/Shapes.java rename to src/main/java/de/ellpeck/actuallyadditions/mod/blocks/VoxelShapes.java index 5acc6e6d6..da5fbe9b6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/Shapes.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/VoxelShapes.java @@ -1,118 +1,119 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import net.minecraft.block.Block; -import net.minecraft.util.math.shapes.IBooleanFunction; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.util.math.shapes.VoxelShapes; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.phys.shapes.BooleanOp; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import java.util.Optional; import java.util.stream.Stream; -public class Shapes { - static final VoxelShape CANOLA_PRESS_SHAPE = Stream.of(Block.box(13, 0, 1, 15, 15.5, 3), Block.box(2, 0, 2, 14, 6, 14), Block.box(2, 10, 2, 14, 15, 14), Block.box(3, 6, 3, 13, 10, 13), Block.box(1, 0, 1, 3, 15.5, 3), Block.box(1, 0, 13, 3, 15.5, 15), Block.box(13, 0, 13, 15, 15.5, 15), Block.box(0.9, 0, 0.9, 3.1, 0.5, 3.1), Block.box(0.9, 0, 12.9, 3.1, 0.5, 15.1), Block.box(0.9, 5, 12.9, 3.1, 6.5, 15.1), Block.box(0.9, 5, 0.9, 3.1, 6.5, 3.1), Block.box(12.9, 5, 12.9, 15.1, 6.5, 15.1), Block.box(12.9, 5, 0.9, 15.1, 6.5, 3.1), Block.box(0.9, 9.5, 12.9, 3.1, 11, 15.1), Block.box(0.9, 9.5, 0.9, 3.1, 11, 3.1), Block.box(12.9, 9.5, 12.9, 15.1, 11, 15.1), Block.box(12.9, 9.5, 0.9, 15.1, 11, 3.1), Block.box(12.9, 0, 0.9, 15.1, 0.5, 3.1), Block.box(12.9, 0, 12.9, 15.1, 0.5, 15.1), Block.box(12.9, 15.5, 0.9, 15.1, 16, 3.1), Block.box(12.9, 15.5, 12.9, 15.1, 16, 15.1), Block.box(0.9, 15.5, 0.9, 3.1, 16, 3.1), Block.box(0.9, 15.5, 12.9, 3.1, 16, 15.1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape CRYSTAL_CLUSTER_SHAPE = Stream.of(Block.box(5, 4, 5, 10, 19, 10), Block.box(4, 0, 4, 11, 5, 11), Block.box(3, 0, 3, 5, 4, 5), Block.box(10, 0, 3, 12, 2, 5), Block.box(12, 0, 4, 13, 1, 5), Block.box(11, 0, 5, 12, 1, 6), Block.box(10, 0, 10, 12, 3, 12), Block.box(3, 0, 10, 5, 1, 12), Block.box(9, 0, 3, 10, 3, 4), Block.box(8, 0, 2, 11, 1, 4), Block.box(4, 0, 2, 5, 2, 3), Block.box(5, 0, 3, 7, 1, 4), Block.box(2, 0, 4, 4, 1, 6), Block.box(3, 0, 5, 4, 3, 6.5), Block.box(3, 0, 9, 4, 2, 10), Block.box(2, 0, 8, 4, 1, 10), Block.box(5, 0, 11, 7, 2, 13), Block.box(7, 0, 11, 11, 1, 13), Block.box(10, 0, 9, 13, 1, 11), Block.box(11, 0, 7, 12, 3, 9)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape DISPLAY_STAND_SHAPE = Stream.of(Block.box(1, 7, 0, 15, 8, 1), Block.box(0, 0, 0, 16, 1, 16), Block.box(1, 1, 1, 15, 7, 15), Block.box(6, 7, 6, 10, 9, 10), Block.box(0, 1, 0, 1, 7, 1), Block.box(15, 1, 0, 16, 7, 1), Block.box(15, 1, 15, 16, 7, 16), Block.box(0, 1, 15, 1, 7, 16), Block.box(0, 7, 0, 1, 8, 16), Block.box(15, 7, 0, 16, 8, 16), Block.box(1, 7, 15, 15, 8, 16), Block.box(5, 7, 5, 6, 9, 6), Block.box(5, 7, 10, 6, 9, 11), Block.box(10, 7, 10, 11, 9, 11), Block.box(10, 7, 5, 11, 9, 6)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); +public class VoxelShapes { + static final VoxelShape CANOLA_PRESS_SHAPE = Stream.of(Block.box(13, 0, 1, 15, 15.5, 3), Block.box(2, 0, 2, 14, 6, 14), Block.box(2, 10, 2, 14, 15, 14), Block.box(3, 6, 3, 13, 10, 13), Block.box(1, 0, 1, 3, 15.5, 3), Block.box(1, 0, 13, 3, 15.5, 15), Block.box(13, 0, 13, 15, 15.5, 15), Block.box(0.9, 0, 0.9, 3.1, 0.5, 3.1), Block.box(0.9, 0, 12.9, 3.1, 0.5, 15.1), Block.box(0.9, 5, 12.9, 3.1, 6.5, 15.1), Block.box(0.9, 5, 0.9, 3.1, 6.5, 3.1), Block.box(12.9, 5, 12.9, 15.1, 6.5, 15.1), Block.box(12.9, 5, 0.9, 15.1, 6.5, 3.1), Block.box(0.9, 9.5, 12.9, 3.1, 11, 15.1), Block.box(0.9, 9.5, 0.9, 3.1, 11, 3.1), Block.box(12.9, 9.5, 12.9, 15.1, 11, 15.1), Block.box(12.9, 9.5, 0.9, 15.1, 11, 3.1), Block.box(12.9, 0, 0.9, 15.1, 0.5, 3.1), Block.box(12.9, 0, 12.9, 15.1, 0.5, 15.1), Block.box(12.9, 15.5, 0.9, 15.1, 16, 3.1), Block.box(12.9, 15.5, 12.9, 15.1, 16, 15.1), Block.box(0.9, 15.5, 0.9, 3.1, 16, 3.1), Block.box(0.9, 15.5, 12.9, 3.1, 16, 15.1)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + + static final VoxelShape CRYSTAL_CLUSTER_SHAPE = Stream.of(Block.box(5, 4, 5, 10, 19, 10), Block.box(4, 0, 4, 11, 5, 11), Block.box(3, 0, 3, 5, 4, 5), Block.box(10, 0, 3, 12, 2, 5), Block.box(12, 0, 4, 13, 1, 5), Block.box(11, 0, 5, 12, 1, 6), Block.box(10, 0, 10, 12, 3, 12), Block.box(3, 0, 10, 5, 1, 12), Block.box(9, 0, 3, 10, 3, 4), Block.box(8, 0, 2, 11, 1, 4), Block.box(4, 0, 2, 5, 2, 3), Block.box(5, 0, 3, 7, 1, 4), Block.box(2, 0, 4, 4, 1, 6), Block.box(3, 0, 5, 4, 3, 6.5), Block.box(3, 0, 9, 4, 2, 10), Block.box(2, 0, 8, 4, 1, 10), Block.box(5, 0, 11, 7, 2, 13), Block.box(7, 0, 11, 11, 1, 13), Block.box(10, 0, 9, 13, 1, 11), Block.box(11, 0, 7, 12, 3, 9)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape DISPLAY_STAND_SHAPE = Stream.of(Block.box(1, 7, 0, 15, 8, 1), Block.box(0, 0, 0, 16, 1, 16), Block.box(1, 1, 1, 15, 7, 15), Block.box(6, 7, 6, 10, 9, 10), Block.box(0, 1, 0, 1, 7, 1), Block.box(15, 1, 0, 16, 7, 1), Block.box(15, 1, 15, 16, 7, 16), Block.box(0, 1, 15, 1, 7, 16), Block.box(0, 7, 0, 1, 8, 16), Block.box(15, 7, 0, 16, 8, 16), Block.box(1, 7, 15, 15, 8, 16), Block.box(5, 7, 5, 6, 9, 6), Block.box(5, 7, 10, 6, 9, 11), Block.box(10, 7, 10, 11, 9, 11), Block.box(10, 7, 5, 11, 9, 6)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); static final VoxelShape BATBOX_SHAPE = Block.box(0,0,0, 16, 8, 16); - static final VoxelShape EMPOWERER_SHAPE = Stream.of(Block.box(0, 0, 0, 16, 1, 16), Block.box(1, 1, 1, 15, 6, 15), Block.box(1, 6, 1, 15, 7, 15), Block.box(0, 7, 0, 16, 8, 1), Block.box(0, 7, 15, 16, 8, 16), Block.box(0, 7, 1, 1, 8, 15), Block.box(15, 7, 1, 16, 8, 15), Block.box(4, 7, 4, 12, 9, 12), Block.box(0, 1, 0, 1, 7, 1), Block.box(15, 1, 0, 16, 7, 1), Block.box(15, 1, 15, 16, 7, 16), Block.box(0, 1, 15, 1, 7, 16), Block.box(3, 7, 4, 4, 8, 5), Block.box(3, 7, 11, 4, 8, 12), Block.box(4, 7, 12, 5, 8, 13), Block.box(11, 7, 12, 12, 8, 13), Block.box(12, 7, 11, 13, 8, 12), Block.box(12, 7, 4, 13, 8, 5), Block.box(11, 7, 3, 12, 8, 4), Block.box(4, 7, 3, 5, 8, 4)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape ENERGIZER_SHAPE = Stream.of(Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(15, 0, 0, 16, 1, 16), Block.box(0, 0, 0, 1, 1, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(1, 14, 1, 15, 15, 15), Block.box(1, 1, 1, 15, 2, 15), Block.box(14, 2, 1, 15, 14, 15), Block.box(1, 2, 1, 2, 14, 15), Block.box(2, 2, 14, 14, 14, 15), Block.box(2, 2, 1, 14, 14, 2), Block.box(9, 3, 0, 13, 4, 1), Block.box(3, 3, 15, 7, 4, 16), Block.box(9, 12, 0, 13, 13, 1), Block.box(3, 12, 15, 7, 13, 16), Block.box(10, 4, 0, 12, 12, 1), Block.box(4, 4, 15, 6, 12, 16), Block.box(0, 3, 3, 1, 4, 7), Block.box(15, 3, 9, 16, 4, 13), Block.box(0, 12, 3, 1, 13, 7), Block.box(15, 12, 9, 16, 13, 13), Block.box(0, 4, 4, 1, 12, 6), Block.box(15, 4, 10, 16, 12, 12)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape BARREL_SHAPE = Stream.of(Block.box(0, 12, 0, 16, 14, 1), Block.box(1, 0.5, 1, 15, 15, 15), Block.box(0, 2, 15, 16, 4, 16), Block.box(0, 7, 15, 16, 9, 16), Block.box(0, 12, 15, 16, 14, 16), Block.box(0, 2, 0, 16, 4, 1), Block.box(0, 7, 0, 16, 9, 1), Block.box(0, 2, 1, 1, 4, 15), Block.box(0, 7, 1, 1, 9, 15), Block.box(0, 12, 1, 1, 14, 15), Block.box(15, 12, 1, 16, 14, 15), Block.box(15, 7, 1, 16, 9, 15), Block.box(15, 2, 1, 16, 4, 15), Block.box(7, 0, 0.5, 9, 16, 1.5), Block.box(0.5, 0, 7, 1.5, 16, 9), Block.box(7, 0, 14.5, 9, 16, 15.5), Block.box(14.5, 0, 7, 15.5, 16, 9), Block.box(2, 0, 0.5, 5, 16, 1.5), Block.box(0.5, 0, 11, 1.5, 16, 14), Block.box(2, 0, 14.5, 5, 16, 15.5), Block.box(14.5, 0, 11, 15.5, 16, 14), Block.box(11, 0, 0.5, 14, 16, 1.5), Block.box(0.5, 0, 2, 1.5, 16, 5), Block.box(11, 0, 14.5, 14, 16, 15.5), Block.box(14.5, 0, 2, 15.5, 16, 5), Block.box(4, 15, 7, 6, 15.3, 9), Block.box(2, 15, 4, 3, 15.3, 12), Block.box(4, 15, 13, 12, 15.3, 14), Block.box(4, 15, 2, 12, 15.3, 3), Block.box(13, 15, 4, 14, 15.3, 12), Block.box(3, 15, 3, 4, 15.3, 4), Block.box(3, 15, 12, 4, 15.3, 13), Block.box(12, 15, 3, 13, 15.3, 4), Block.box(12, 15, 12, 13, 15.3, 13)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape FIREWORKS_BOX_SHAPE = Stream.of(Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(10, 14, 9, 12, 15, 10), Block.box(7, 14, 9, 9, 15, 10), Block.box(4, 14, 9, 6, 15, 10), Block.box(10, 14, 6, 12, 15, 7), Block.box(7, 14, 6, 9, 15, 7), Block.box(4, 14, 6, 6, 15, 7), Block.box(6, 14, 4, 7, 15, 12), Block.box(9, 14, 4, 10, 15, 12), Block.box(4, 14, 12, 12, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(12, 14, 2, 14, 15, 14), Block.box(2, 14, 2, 4, 15, 14), Block.box(2, 13, 2, 14, 14, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 1, 15, 15, 2), Block.box(1, 0, 14, 15, 15, 15)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape GLASS_SHAPE = Stream.of(Block.box(15, 0, 1, 16, 1, 15), Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape HEAT_COLLECTOR_SHAPE = Stream.of(Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(4, 13, 4, 12, 14, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(4, 14, 11, 5, 15, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(15, 11, 4, 16, 12, 12), Block.box(15, 5, 4, 16, 6, 12), Block.box(15, 7, 4, 16, 8, 12), Block.box(15, 9, 4, 16, 10, 12), Block.box(4, 11, 15, 12, 12, 16), Block.box(4, 9, 15, 12, 10, 16), Block.box(4, 7, 15, 12, 8, 16), Block.box(4, 5, 15, 12, 6, 16), Block.box(0, 11, 4, 1, 12, 12), Block.box(0, 5, 4, 1, 6, 12), Block.box(0, 7, 4, 1, 8, 12), Block.box(0, 9, 4, 1, 10, 12), Block.box(4, 11, 0, 12, 12, 1), Block.box(4, 9, 0, 12, 10, 1), Block.box(4, 7, 0, 12, 8, 1), Block.box(4, 5, 0, 12, 6, 1), Block.box(2, 14, 2, 4, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(4, 14, 12, 12, 15, 14), Block.box(12, 14, 2, 14, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 1, 15, 15, 2), Block.box(1, 0, 14, 15, 15, 15)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape ITEM_VIEWER_SHAPE = Stream.of(Block.box(15, 0, 1, 16, 1, 15), Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape HOPPING_ITEM_VIEWER_SHAPE = Stream.of(Block.box(0, 10, 0, 16, 11, 16), Block.box(1, 11, 1, 2, 15, 15), Block.box(14, 11, 1, 15, 15, 15), Block.box(2, 11, 1, 14, 15, 2), Block.box(2, 11, 14, 14, 15, 15), Block.box(4, 4, 4, 12, 10, 12), Block.box(6, 0, 6, 10, 4, 10), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 11, 0, 1, 15, 1), Block.box(0, 11, 15, 1, 15, 16), Block.box(15, 11, 15, 16, 15, 16), Block.box(15, 11, 0, 16, 15, 1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape BOOSTER_SHAPE = Stream.of(Block.box(5, 12, 12, 11, 13, 13), Block.box(6, 0, 6, 10, 16, 10), Block.box(5, 2, 5, 11, 3, 11), Block.box(5, 4, 12, 11, 5, 13), Block.box(5, 6, 12, 11, 7, 13), Block.box(5, 8, 12, 11, 9, 13), Block.box(5, 10, 12, 11, 11, 13), Block.box(5, 4, 3, 11, 5, 4), Block.box(5, 6, 3, 11, 7, 4), Block.box(5, 8, 3, 11, 9, 4), Block.box(5, 10, 3, 11, 11, 4), Block.box(5, 12, 3, 11, 13, 4), Block.box(3, 4, 5, 4, 5, 11), Block.box(3, 6, 5, 4, 7, 11), Block.box(3, 8, 5, 4, 9, 11), Block.box(3, 10, 5, 4, 11, 11), Block.box(3, 12, 5, 4, 13, 11), Block.box(12, 4, 5, 13, 5, 11), Block.box(12, 6, 5, 13, 7, 11), Block.box(12, 8, 5, 13, 9, 11), Block.box(12, 10, 5, 13, 11, 11), Block.box(12, 12, 5, 13, 13, 11), Block.box(5, 14, 5, 11, 15, 11), Block.box(4, 4, 11, 5, 5, 12), Block.box(4, 6, 11, 5, 7, 12), Block.box(4, 8, 11, 5, 9, 12), Block.box(4, 10, 11, 5, 11, 12), Block.box(4, 12, 11, 5, 13, 12), Block.box(4, 4, 4, 5, 5, 5), Block.box(4, 6, 4, 5, 7, 5), Block.box(4, 8, 4, 5, 9, 5), Block.box(4, 10, 4, 5, 11, 5), Block.box(4, 12, 4, 5, 13, 5), Block.box(11, 4, 4, 12, 5, 5), Block.box(11, 6, 4, 12, 7, 5), Block.box(11, 8, 4, 12, 9, 5), Block.box(11, 10, 4, 12, 11, 5), Block.box(11, 12, 4, 12, 13, 5), Block.box(11, 4, 11, 12, 5, 12), Block.box(11, 6, 11, 12, 7, 12), Block.box(11, 8, 11, 12, 9, 12), Block.box(11, 10, 11, 12, 11, 12), Block.box(11, 12, 11, 12, 13, 12)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape PLAYER_INTERFACE_SHAPE = Stream.of(Block.box(15, 0, 1, 16, 1, 15), Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape COLLECTOR_SHAPE = Stream.of(Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(1, 1, 4, 2, 4, 12), Block.box(14, 1, 4, 15, 4, 12), Block.box(4, 1, 1, 12, 4, 2), Block.box(4, 1, 14, 12, 4, 15), Block.box(4, 14, 12, 12, 15, 14), Block.box(1, 12, 4, 2, 15, 12), Block.box(14, 12, 4, 15, 15, 12), Block.box(4, 12, 1, 12, 15, 2), Block.box(4, 12, 14, 12, 15, 15), Block.box(4, 14, 2, 12, 15, 4), Block.box(1, 1, 12, 2, 15, 14), Block.box(14, 1, 2, 15, 15, 4), Block.box(1, 1, 1, 4, 15, 2), Block.box(12, 1, 14, 15, 15, 15), Block.box(12, 14, 2, 14, 15, 14), Block.box(1, 1, 2, 2, 15, 4), Block.box(14, 1, 12, 15, 15, 14), Block.box(12, 1, 1, 15, 15, 2), Block.box(1, 1, 14, 4, 15, 15), Block.box(2, 14, 2, 4, 15, 14), Block.box(2, 2, 2, 14, 14, 14), Block.box(1, 0, 1, 15, 1, 15)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SUPPRESSOR_SHAPE = Stream.of(Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(1, 14, 1, 15, 15, 15), Block.box(1, 1, 1, 15, 2, 15), Block.box(9, 13, 9, 13, 16, 13), Block.box(9, 2, 9, 13, 3, 13), Block.box(3, 13, 9, 7, 16, 13), Block.box(3, 2, 9, 7, 3, 13), Block.box(9, 13, 3, 13, 16, 7), Block.box(9, 2, 3, 13, 3, 7), Block.box(3, 13, 3, 7, 16, 7), Block.box(3, 2, 3, 7, 3, 7), Block.box(4, 3, 10, 6, 13, 12), Block.box(10, 3, 10, 12, 13, 12), Block.box(10, 3, 4, 12, 13, 6), Block.box(4, 3, 4, 6, 13, 6)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape RELAY_SHAPE = Stream.of(Block.box(6, 4, 6, 7, 6, 7), Block.box(1, 0, 1, 15, 1, 15), Block.box(4, 2, 4, 12, 4, 12), Block.box(9, 4, 9, 10, 6, 10), Block.box(6, 4, 9, 7, 6, 10), Block.box(3, 1, 12, 4, 5, 13), Block.box(12, 1, 12, 13, 5, 13), Block.box(3, 1, 3, 4, 5, 4), Block.box(12, 1, 3, 13, 5, 4), Block.box(3, 4, 4, 4, 5, 12), Block.box(3, 1, 4, 4, 2, 12), Block.box(12, 4, 4, 13, 5, 12), Block.box(12, 1, 4, 13, 2, 12), Block.box(4, 4, 12, 12, 5, 13), Block.box(4, 4, 3, 12, 5, 4), Block.box(4, 1, 12, 12, 2, 13), Block.box(4, 1, 3, 12, 2, 4), Block.box(9, 4, 6, 10, 6, 7), Block.box(7, 4, 7, 9, 6, 9), Block.box(7, 6, 7, 9, 10, 9), Block.box(6.5, 5, 7, 7, 6, 9), Block.box(6.5, 7, 7, 7, 7.5, 9), Block.box(6.5, 9, 7, 7, 9.5, 9), Block.box(9, 5, 7, 9.5, 6, 9), Block.box(9, 7, 7, 9.5, 7.5, 9), Block.box(9, 9, 7, 9.5, 9.5, 9), Block.box(7, 5, 6.5, 9, 6, 7), Block.box(7, 7, 6.5, 9, 7.5, 7), Block.box(7, 9, 6.5, 9, 9.5, 7), Block.box(7, 5, 9, 9, 6, 9.5), Block.box(7, 7, 9, 9, 7.5, 9.5), Block.box(7, 9, 9, 9, 9.5, 9.5)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape EMPOWERER_SHAPE = Stream.of(Block.box(0, 0, 0, 16, 1, 16), Block.box(1, 1, 1, 15, 6, 15), Block.box(1, 6, 1, 15, 7, 15), Block.box(0, 7, 0, 16, 8, 1), Block.box(0, 7, 15, 16, 8, 16), Block.box(0, 7, 1, 1, 8, 15), Block.box(15, 7, 1, 16, 8, 15), Block.box(4, 7, 4, 12, 9, 12), Block.box(0, 1, 0, 1, 7, 1), Block.box(15, 1, 0, 16, 7, 1), Block.box(15, 1, 15, 16, 7, 16), Block.box(0, 1, 15, 1, 7, 16), Block.box(3, 7, 4, 4, 8, 5), Block.box(3, 7, 11, 4, 8, 12), Block.box(4, 7, 12, 5, 8, 13), Block.box(11, 7, 12, 12, 8, 13), Block.box(12, 7, 11, 13, 8, 12), Block.box(12, 7, 4, 13, 8, 5), Block.box(11, 7, 3, 12, 8, 4), Block.box(4, 7, 3, 5, 8, 4)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape ENERGIZER_SHAPE = Stream.of(Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(15, 0, 0, 16, 1, 16), Block.box(0, 0, 0, 1, 1, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(1, 14, 1, 15, 15, 15), Block.box(1, 1, 1, 15, 2, 15), Block.box(14, 2, 1, 15, 14, 15), Block.box(1, 2, 1, 2, 14, 15), Block.box(2, 2, 14, 14, 14, 15), Block.box(2, 2, 1, 14, 14, 2), Block.box(9, 3, 0, 13, 4, 1), Block.box(3, 3, 15, 7, 4, 16), Block.box(9, 12, 0, 13, 13, 1), Block.box(3, 12, 15, 7, 13, 16), Block.box(10, 4, 0, 12, 12, 1), Block.box(4, 4, 15, 6, 12, 16), Block.box(0, 3, 3, 1, 4, 7), Block.box(15, 3, 9, 16, 4, 13), Block.box(0, 12, 3, 1, 13, 7), Block.box(15, 12, 9, 16, 13, 13), Block.box(0, 4, 4, 1, 12, 6), Block.box(15, 4, 10, 16, 12, 12)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape BARREL_SHAPE = Stream.of(Block.box(0, 12, 0, 16, 14, 1), Block.box(1, 0.5, 1, 15, 15, 15), Block.box(0, 2, 15, 16, 4, 16), Block.box(0, 7, 15, 16, 9, 16), Block.box(0, 12, 15, 16, 14, 16), Block.box(0, 2, 0, 16, 4, 1), Block.box(0, 7, 0, 16, 9, 1), Block.box(0, 2, 1, 1, 4, 15), Block.box(0, 7, 1, 1, 9, 15), Block.box(0, 12, 1, 1, 14, 15), Block.box(15, 12, 1, 16, 14, 15), Block.box(15, 7, 1, 16, 9, 15), Block.box(15, 2, 1, 16, 4, 15), Block.box(7, 0, 0.5, 9, 16, 1.5), Block.box(0.5, 0, 7, 1.5, 16, 9), Block.box(7, 0, 14.5, 9, 16, 15.5), Block.box(14.5, 0, 7, 15.5, 16, 9), Block.box(2, 0, 0.5, 5, 16, 1.5), Block.box(0.5, 0, 11, 1.5, 16, 14), Block.box(2, 0, 14.5, 5, 16, 15.5), Block.box(14.5, 0, 11, 15.5, 16, 14), Block.box(11, 0, 0.5, 14, 16, 1.5), Block.box(0.5, 0, 2, 1.5, 16, 5), Block.box(11, 0, 14.5, 14, 16, 15.5), Block.box(14.5, 0, 2, 15.5, 16, 5), Block.box(4, 15, 7, 6, 15.3, 9), Block.box(2, 15, 4, 3, 15.3, 12), Block.box(4, 15, 13, 12, 15.3, 14), Block.box(4, 15, 2, 12, 15.3, 3), Block.box(13, 15, 4, 14, 15.3, 12), Block.box(3, 15, 3, 4, 15.3, 4), Block.box(3, 15, 12, 4, 15.3, 13), Block.box(12, 15, 3, 13, 15.3, 4), Block.box(12, 15, 12, 13, 15.3, 13)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape FIREWORKS_BOX_SHAPE = Stream.of(Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(10, 14, 9, 12, 15, 10), Block.box(7, 14, 9, 9, 15, 10), Block.box(4, 14, 9, 6, 15, 10), Block.box(10, 14, 6, 12, 15, 7), Block.box(7, 14, 6, 9, 15, 7), Block.box(4, 14, 6, 6, 15, 7), Block.box(6, 14, 4, 7, 15, 12), Block.box(9, 14, 4, 10, 15, 12), Block.box(4, 14, 12, 12, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(12, 14, 2, 14, 15, 14), Block.box(2, 14, 2, 4, 15, 14), Block.box(2, 13, 2, 14, 14, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 1, 15, 15, 2), Block.box(1, 0, 14, 15, 15, 15)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape GLASS_SHAPE = Stream.of(Block.box(15, 0, 1, 16, 1, 15), Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape HEAT_COLLECTOR_SHAPE = Stream.of(Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(4, 13, 4, 12, 14, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(4, 14, 11, 5, 15, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(15, 11, 4, 16, 12, 12), Block.box(15, 5, 4, 16, 6, 12), Block.box(15, 7, 4, 16, 8, 12), Block.box(15, 9, 4, 16, 10, 12), Block.box(4, 11, 15, 12, 12, 16), Block.box(4, 9, 15, 12, 10, 16), Block.box(4, 7, 15, 12, 8, 16), Block.box(4, 5, 15, 12, 6, 16), Block.box(0, 11, 4, 1, 12, 12), Block.box(0, 5, 4, 1, 6, 12), Block.box(0, 7, 4, 1, 8, 12), Block.box(0, 9, 4, 1, 10, 12), Block.box(4, 11, 0, 12, 12, 1), Block.box(4, 9, 0, 12, 10, 1), Block.box(4, 7, 0, 12, 8, 1), Block.box(4, 5, 0, 12, 6, 1), Block.box(2, 14, 2, 4, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(4, 14, 12, 12, 15, 14), Block.box(12, 14, 2, 14, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 1, 15, 15, 2), Block.box(1, 0, 14, 15, 15, 15)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape ITEM_VIEWER_SHAPE = Stream.of(Block.box(15, 0, 1, 16, 1, 15), Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape HOPPING_ITEM_VIEWER_SHAPE = Stream.of(Block.box(0, 10, 0, 16, 11, 16), Block.box(1, 11, 1, 2, 15, 15), Block.box(14, 11, 1, 15, 15, 15), Block.box(2, 11, 1, 14, 15, 2), Block.box(2, 11, 14, 14, 15, 15), Block.box(4, 4, 4, 12, 10, 12), Block.box(6, 0, 6, 10, 4, 10), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 11, 0, 1, 15, 1), Block.box(0, 11, 15, 1, 15, 16), Block.box(15, 11, 15, 16, 15, 16), Block.box(15, 11, 0, 16, 15, 1)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape BOOSTER_SHAPE = Stream.of(Block.box(5, 12, 12, 11, 13, 13), Block.box(6, 0, 6, 10, 16, 10), Block.box(5, 2, 5, 11, 3, 11), Block.box(5, 4, 12, 11, 5, 13), Block.box(5, 6, 12, 11, 7, 13), Block.box(5, 8, 12, 11, 9, 13), Block.box(5, 10, 12, 11, 11, 13), Block.box(5, 4, 3, 11, 5, 4), Block.box(5, 6, 3, 11, 7, 4), Block.box(5, 8, 3, 11, 9, 4), Block.box(5, 10, 3, 11, 11, 4), Block.box(5, 12, 3, 11, 13, 4), Block.box(3, 4, 5, 4, 5, 11), Block.box(3, 6, 5, 4, 7, 11), Block.box(3, 8, 5, 4, 9, 11), Block.box(3, 10, 5, 4, 11, 11), Block.box(3, 12, 5, 4, 13, 11), Block.box(12, 4, 5, 13, 5, 11), Block.box(12, 6, 5, 13, 7, 11), Block.box(12, 8, 5, 13, 9, 11), Block.box(12, 10, 5, 13, 11, 11), Block.box(12, 12, 5, 13, 13, 11), Block.box(5, 14, 5, 11, 15, 11), Block.box(4, 4, 11, 5, 5, 12), Block.box(4, 6, 11, 5, 7, 12), Block.box(4, 8, 11, 5, 9, 12), Block.box(4, 10, 11, 5, 11, 12), Block.box(4, 12, 11, 5, 13, 12), Block.box(4, 4, 4, 5, 5, 5), Block.box(4, 6, 4, 5, 7, 5), Block.box(4, 8, 4, 5, 9, 5), Block.box(4, 10, 4, 5, 11, 5), Block.box(4, 12, 4, 5, 13, 5), Block.box(11, 4, 4, 12, 5, 5), Block.box(11, 6, 4, 12, 7, 5), Block.box(11, 8, 4, 12, 9, 5), Block.box(11, 10, 4, 12, 11, 5), Block.box(11, 12, 4, 12, 13, 5), Block.box(11, 4, 11, 12, 5, 12), Block.box(11, 6, 11, 12, 7, 12), Block.box(11, 8, 11, 12, 9, 12), Block.box(11, 10, 11, 12, 11, 12), Block.box(11, 12, 11, 12, 13, 12)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape PLAYER_INTERFACE_SHAPE = Stream.of(Block.box(15, 0, 1, 16, 1, 15), Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape COLLECTOR_SHAPE = Stream.of(Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(1, 1, 4, 2, 4, 12), Block.box(14, 1, 4, 15, 4, 12), Block.box(4, 1, 1, 12, 4, 2), Block.box(4, 1, 14, 12, 4, 15), Block.box(4, 14, 12, 12, 15, 14), Block.box(1, 12, 4, 2, 15, 12), Block.box(14, 12, 4, 15, 15, 12), Block.box(4, 12, 1, 12, 15, 2), Block.box(4, 12, 14, 12, 15, 15), Block.box(4, 14, 2, 12, 15, 4), Block.box(1, 1, 12, 2, 15, 14), Block.box(14, 1, 2, 15, 15, 4), Block.box(1, 1, 1, 4, 15, 2), Block.box(12, 1, 14, 15, 15, 15), Block.box(12, 14, 2, 14, 15, 14), Block.box(1, 1, 2, 2, 15, 4), Block.box(14, 1, 12, 15, 15, 14), Block.box(12, 1, 1, 15, 15, 2), Block.box(1, 1, 14, 4, 15, 15), Block.box(2, 14, 2, 4, 15, 14), Block.box(2, 2, 2, 14, 14, 14), Block.box(1, 0, 1, 15, 1, 15)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SUPPRESSOR_SHAPE = Stream.of(Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(1, 14, 1, 15, 15, 15), Block.box(1, 1, 1, 15, 2, 15), Block.box(9, 13, 9, 13, 16, 13), Block.box(9, 2, 9, 13, 3, 13), Block.box(3, 13, 9, 7, 16, 13), Block.box(3, 2, 9, 7, 3, 13), Block.box(9, 13, 3, 13, 16, 7), Block.box(9, 2, 3, 13, 3, 7), Block.box(3, 13, 3, 7, 16, 7), Block.box(3, 2, 3, 7, 3, 7), Block.box(4, 3, 10, 6, 13, 12), Block.box(10, 3, 10, 12, 13, 12), Block.box(10, 3, 4, 12, 13, 6), Block.box(4, 3, 4, 6, 13, 6)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape RELAY_SHAPE = Stream.of(Block.box(6, 4, 6, 7, 6, 7), Block.box(1, 0, 1, 15, 1, 15), Block.box(4, 2, 4, 12, 4, 12), Block.box(9, 4, 9, 10, 6, 10), Block.box(6, 4, 9, 7, 6, 10), Block.box(3, 1, 12, 4, 5, 13), Block.box(12, 1, 12, 13, 5, 13), Block.box(3, 1, 3, 4, 5, 4), Block.box(12, 1, 3, 13, 5, 4), Block.box(3, 4, 4, 4, 5, 12), Block.box(3, 1, 4, 4, 2, 12), Block.box(12, 4, 4, 13, 5, 12), Block.box(12, 1, 4, 13, 2, 12), Block.box(4, 4, 12, 12, 5, 13), Block.box(4, 4, 3, 12, 5, 4), Block.box(4, 1, 12, 12, 2, 13), Block.box(4, 1, 3, 12, 2, 4), Block.box(9, 4, 6, 10, 6, 7), Block.box(7, 4, 7, 9, 6, 9), Block.box(7, 6, 7, 9, 10, 9), Block.box(6.5, 5, 7, 7, 6, 9), Block.box(6.5, 7, 7, 7, 7.5, 9), Block.box(6.5, 9, 7, 7, 9.5, 9), Block.box(9, 5, 7, 9.5, 6, 9), Block.box(9, 7, 7, 9.5, 7.5, 9), Block.box(9, 9, 7, 9.5, 9.5, 9), Block.box(7, 5, 6.5, 9, 6, 7), Block.box(7, 7, 6.5, 9, 7.5, 7), Block.box(7, 9, 6.5, 9, 9.5, 7), Block.box(7, 5, 9, 9, 6, 9.5), Block.box(7, 7, 9, 9, 7.5, 9.5), Block.box(7, 9, 9, 9, 9.5, 9.5)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); static final class CoalGeneratorShapes { - static final VoxelShape NORTH = Stream.of(Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(2, 0, 2, 14, 1, 14), Block.box(5, 14, 6, 11, 15, 7), Block.box(5, 14, 8, 11, 15, 9), Block.box(5, 14, 10, 11, 15, 14), Block.box(5, 14, 2, 11, 15, 5), Block.box(11, 14, 2, 14, 15, 14), Block.box(2, 14, 2, 5, 15, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 14, 15, 15, 15), Block.box(3, 11, 0, 13, 12, 1), Block.box(5, 3, 1, 6, 8, 2), Block.box(10, 3, 1, 11, 8, 2), Block.box(3, 8, 1, 13, 15, 2), Block.box(3, 0, 1, 13, 3, 2), Block.box(1, 0, 1, 3, 15, 2), Block.box(13, 0, 1, 15, 15, 2), Block.box(5, 13, 5, 11, 14, 10), Block.box(2, 3, 2, 14, 8, 3), Block.box(0, 0, 15, 1, 1, 16), Block.box(15, 0, 15, 16, 1, 16), Block.box(15, 0, 0, 16, 1, 1), Block.box(0, 0, 0, 1, 1, 1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape EAST = Stream.of(Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(2, 0, 2, 14, 1, 14), Block.box(9, 14, 5, 10, 15, 11), Block.box(7, 14, 5, 8, 15, 11), Block.box(2, 14, 5, 6, 15, 11), Block.box(11, 14, 5, 14, 15, 11), Block.box(2, 14, 11, 14, 15, 14), Block.box(2, 14, 2, 14, 15, 5), Block.box(2, 0, 1, 14, 15, 2), Block.box(2, 0, 14, 14, 15, 15), Block.box(1, 0, 1, 2, 15, 15), Block.box(15, 11, 3, 16, 12, 13), Block.box(14, 3, 5, 15, 8, 6), Block.box(14, 3, 10, 15, 8, 11), Block.box(14, 8, 3, 15, 15, 13), Block.box(14, 0, 3, 15, 3, 13), Block.box(14, 0, 1, 15, 15, 3), Block.box(14, 0, 13, 15, 15, 15), Block.box(6, 13, 5, 11, 14, 11), Block.box(13, 3, 2, 14, 8, 14), Block.box(0, 0, 0, 1, 1, 1), Block.box(0, 0, 15, 1, 1, 16), Block.box(15, 0, 15, 16, 1, 16), Block.box(15, 0, 0, 16, 1, 1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SOUTH = Stream.of(Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(2, 0, 2, 14, 1, 14), Block.box(5, 14, 9, 11, 15, 10), Block.box(5, 14, 7, 11, 15, 8), Block.box(5, 14, 2, 11, 15, 6), Block.box(5, 14, 11, 11, 15, 14), Block.box(2, 14, 2, 5, 15, 14), Block.box(11, 14, 2, 14, 15, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(1, 0, 1, 15, 15, 2), Block.box(3, 11, 15, 13, 12, 16), Block.box(10, 3, 14, 11, 8, 15), Block.box(5, 3, 14, 6, 8, 15), Block.box(3, 8, 14, 13, 15, 15), Block.box(3, 0, 14, 13, 3, 15), Block.box(13, 0, 14, 15, 15, 15), Block.box(1, 0, 14, 3, 15, 15), Block.box(5, 13, 6, 11, 14, 11), Block.box(2, 3, 13, 14, 8, 14), Block.box(15, 0, 0, 16, 1, 1), Block.box(0, 0, 0, 1, 1, 1), Block.box(0, 0, 15, 1, 1, 16), Block.box(15, 0, 15, 16, 1, 16)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape WEST = Stream.of(Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(2, 0, 2, 14, 1, 14), Block.box(6, 14, 5, 7, 15, 11), Block.box(8, 14, 5, 9, 15, 11), Block.box(10, 14, 5, 14, 15, 11), Block.box(2, 14, 5, 5, 15, 11), Block.box(2, 14, 2, 14, 15, 5), Block.box(2, 14, 11, 14, 15, 14), Block.box(2, 0, 14, 14, 15, 15), Block.box(2, 0, 1, 14, 15, 2), Block.box(14, 0, 1, 15, 15, 15), Block.box(0, 11, 3, 1, 12, 13), Block.box(1, 3, 10, 2, 8, 11), Block.box(1, 3, 5, 2, 8, 6), Block.box(1, 8, 3, 2, 15, 13), Block.box(1, 0, 3, 2, 3, 13), Block.box(1, 0, 13, 2, 15, 15), Block.box(1, 0, 1, 2, 15, 3), Block.box(5, 13, 5, 10, 14, 11), Block.box(2, 3, 2, 3, 8, 14), Block.box(15, 0, 15, 16, 1, 16), Block.box(15, 0, 0, 16, 1, 1), Block.box(0, 0, 0, 1, 1, 1), Block.box(0, 0, 15, 1, 1, 16)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape NORTH = Stream.of(Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(2, 0, 2, 14, 1, 14), Block.box(5, 14, 6, 11, 15, 7), Block.box(5, 14, 8, 11, 15, 9), Block.box(5, 14, 10, 11, 15, 14), Block.box(5, 14, 2, 11, 15, 5), Block.box(11, 14, 2, 14, 15, 14), Block.box(2, 14, 2, 5, 15, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 14, 15, 15, 15), Block.box(3, 11, 0, 13, 12, 1), Block.box(5, 3, 1, 6, 8, 2), Block.box(10, 3, 1, 11, 8, 2), Block.box(3, 8, 1, 13, 15, 2), Block.box(3, 0, 1, 13, 3, 2), Block.box(1, 0, 1, 3, 15, 2), Block.box(13, 0, 1, 15, 15, 2), Block.box(5, 13, 5, 11, 14, 10), Block.box(2, 3, 2, 14, 8, 3), Block.box(0, 0, 15, 1, 1, 16), Block.box(15, 0, 15, 16, 1, 16), Block.box(15, 0, 0, 16, 1, 1), Block.box(0, 0, 0, 1, 1, 1)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape EAST = Stream.of(Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(2, 0, 2, 14, 1, 14), Block.box(9, 14, 5, 10, 15, 11), Block.box(7, 14, 5, 8, 15, 11), Block.box(2, 14, 5, 6, 15, 11), Block.box(11, 14, 5, 14, 15, 11), Block.box(2, 14, 11, 14, 15, 14), Block.box(2, 14, 2, 14, 15, 5), Block.box(2, 0, 1, 14, 15, 2), Block.box(2, 0, 14, 14, 15, 15), Block.box(1, 0, 1, 2, 15, 15), Block.box(15, 11, 3, 16, 12, 13), Block.box(14, 3, 5, 15, 8, 6), Block.box(14, 3, 10, 15, 8, 11), Block.box(14, 8, 3, 15, 15, 13), Block.box(14, 0, 3, 15, 3, 13), Block.box(14, 0, 1, 15, 15, 3), Block.box(14, 0, 13, 15, 15, 15), Block.box(6, 13, 5, 11, 14, 11), Block.box(13, 3, 2, 14, 8, 14), Block.box(0, 0, 0, 1, 1, 1), Block.box(0, 0, 15, 1, 1, 16), Block.box(15, 0, 15, 16, 1, 16), Block.box(15, 0, 0, 16, 1, 1)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SOUTH = Stream.of(Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(2, 0, 2, 14, 1, 14), Block.box(5, 14, 9, 11, 15, 10), Block.box(5, 14, 7, 11, 15, 8), Block.box(5, 14, 2, 11, 15, 6), Block.box(5, 14, 11, 11, 15, 14), Block.box(2, 14, 2, 5, 15, 14), Block.box(11, 14, 2, 14, 15, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(1, 0, 1, 15, 15, 2), Block.box(3, 11, 15, 13, 12, 16), Block.box(10, 3, 14, 11, 8, 15), Block.box(5, 3, 14, 6, 8, 15), Block.box(3, 8, 14, 13, 15, 15), Block.box(3, 0, 14, 13, 3, 15), Block.box(13, 0, 14, 15, 15, 15), Block.box(1, 0, 14, 3, 15, 15), Block.box(5, 13, 6, 11, 14, 11), Block.box(2, 3, 13, 14, 8, 14), Block.box(15, 0, 0, 16, 1, 1), Block.box(0, 0, 0, 1, 1, 1), Block.box(0, 0, 15, 1, 1, 16), Block.box(15, 0, 15, 16, 1, 16)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape WEST = Stream.of(Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(2, 0, 2, 14, 1, 14), Block.box(6, 14, 5, 7, 15, 11), Block.box(8, 14, 5, 9, 15, 11), Block.box(10, 14, 5, 14, 15, 11), Block.box(2, 14, 5, 5, 15, 11), Block.box(2, 14, 2, 14, 15, 5), Block.box(2, 14, 11, 14, 15, 14), Block.box(2, 0, 14, 14, 15, 15), Block.box(2, 0, 1, 14, 15, 2), Block.box(14, 0, 1, 15, 15, 15), Block.box(0, 11, 3, 1, 12, 13), Block.box(1, 3, 10, 2, 8, 11), Block.box(1, 3, 5, 2, 8, 6), Block.box(1, 8, 3, 2, 15, 13), Block.box(1, 0, 3, 2, 3, 13), Block.box(1, 0, 13, 2, 15, 15), Block.box(1, 0, 1, 2, 15, 3), Block.box(5, 13, 5, 10, 14, 11), Block.box(2, 3, 2, 3, 8, 14), Block.box(15, 0, 15, 16, 1, 16), Block.box(15, 0, 0, 16, 1, 1), Block.box(0, 0, 0, 1, 1, 1), Block.box(0, 0, 15, 1, 1, 16)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } static class CoffeeMachineShapes { - static final VoxelShape NORTH = Stream.of(Block.box(8, 11, 7, 13, 14, 8), Block.box(1, 0, 1, 15, 1, 15), Block.box(7, 1, 8, 14, 9, 14), Block.box(6, 9, 3, 15, 11, 15), Block.box(8, 11, 8, 13, 13, 13), Block.box(10, 8, 3.5, 11, 9, 4.5), Block.box(9, 1, 2, 12, 2, 5), Block.box(9, 2, 5, 12, 7, 6), Block.box(9, 2, 1, 12, 7, 2), Block.box(12, 2, 2, 13, 7, 5), Block.box(8, 2, 2, 9, 7, 5), Block.box(13, 2, 3, 14, 3, 4), Block.box(13, 5, 3, 14, 6, 4), Block.box(14, 3, 3, 15, 5, 4), Block.box(13, 10.2, 4.2, 14, 11.2, 5.2), Block.box(11, 10.2, 4.2, 12, 11.2, 5.2), Block.box(13, 11, 7, 14, 14, 14), Block.box(7, 11, 7, 8, 14, 14), Block.box(8, 11, 13, 13, 14, 14), Block.box(14, 1, 14, 15, 9, 15), Block.box(6, 1, 14, 7, 9, 15), Block.box(14, 1, 7, 15, 9, 8), Block.box(6, 1, 7, 7, 9, 8), Block.box(6.8, 1.9, 11.9, 7, 3.1, 13.1), Block.box(6.8, 1.9, 9.9, 7, 3.1, 11.1), Block.box(3, 3, 10, 4, 5, 11), Block.box(2.9, 4.8, 9.9, 4.1, 5, 11.1), Block.box(2.9, 4.8, 11.9, 4.1, 5, 13.1), Block.box(3, 2, 12, 7, 3, 13), Block.box(3, 2, 10, 7, 3, 11), Block.box(3, 3, 12, 4, 5, 13), Block.box(2, 5, 9, 5, 11, 14), Block.box(2, 11, 11, 4, 12, 13), Block.box(1, 1, 11, 2, 12, 13)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape EAST = Stream.of(Block.box(8, 11, 8, 9, 14, 13), Block.box(1, 0, 1, 15, 1, 15), Block.box(2, 1, 7, 8, 9, 14), Block.box(1, 9, 6, 13, 11, 15), Block.box(3, 11, 8, 8, 13, 13), Block.box(11.5, 8, 10, 12.5, 9, 11), Block.box(11, 1, 9, 14, 2, 12), Block.box(10, 2, 9, 11, 7, 12), Block.box(14, 2, 9, 15, 7, 12), Block.box(11, 2, 12, 14, 7, 13), Block.box(11, 2, 8, 14, 7, 9), Block.box(12, 2, 13, 13, 3, 14), Block.box(12, 5, 13, 13, 6, 14), Block.box(12, 3, 14, 13, 5, 15), Block.box(10.8, 10.2, 13, 11.8, 11.2, 14), Block.box(10.8, 10.2, 11, 11.8, 11.2, 12), Block.box(2, 11, 13, 9, 14, 14), Block.box(2, 11, 7, 9, 14, 8), Block.box(2, 11, 8, 3, 14, 13), Block.box(1, 1, 14, 2, 9, 15), Block.box(1, 1, 6, 2, 9, 7), Block.box(8, 1, 14, 9, 9, 15), Block.box(8, 1, 6, 9, 9, 7), Block.box(2.9000000000000004, 1.9, 6.8, 4.1, 3.1, 7), Block.box(4.9, 1.9, 6.8, 6.1, 3.1, 7), Block.box(5, 3, 3, 6, 5, 4), Block.box(4.9, 4.8, 2.9000000000000004, 6.1, 5, 4.1), Block.box(2.9000000000000004, 4.8, 2.9000000000000004, 4.1, 5, 4.1), Block.box(3, 2, 3, 4, 3, 7), Block.box(5, 2, 3, 6, 3, 7), Block.box(3, 3, 3, 4, 5, 4), Block.box(2, 5, 2, 7, 11, 5), Block.box(3, 11, 2, 5, 12, 4), Block.box(3, 1, 1, 5, 12, 2)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SOUTH = Stream.of(Block.box(3, 11, 8, 8, 14, 9), Block.box(1, 0, 1, 15, 1, 15), Block.box(2, 1, 2, 9, 9, 8), Block.box(1, 9, 1, 10, 11, 13), Block.box(3, 11, 3, 8, 13, 8), Block.box(5, 8, 11.5, 6, 9, 12.5), Block.box(4, 1, 11, 7, 2, 14), Block.box(4, 2, 10, 7, 7, 11), Block.box(4, 2, 14, 7, 7, 15), Block.box(3, 2, 11, 4, 7, 14), Block.box(7, 2, 11, 8, 7, 14), Block.box(2, 2, 12, 3, 3, 13), Block.box(2, 5, 12, 3, 6, 13), Block.box(1, 3, 12, 2, 5, 13), Block.box(2, 10.2, 10.8, 3, 11.2, 11.8), Block.box(4, 10.2, 10.8, 5, 11.2, 11.8), Block.box(2, 11, 2, 3, 14, 9), Block.box(8, 11, 2, 9, 14, 9), Block.box(3, 11, 2, 8, 14, 3), Block.box(1, 1, 1, 2, 9, 2), Block.box(9, 1, 1, 10, 9, 2), Block.box(1, 1, 8, 2, 9, 9), Block.box(9, 1, 8, 10, 9, 9), Block.box(9, 1.9, 2.9000000000000004, 9.2, 3.1, 4.1), Block.box(9, 1.9, 4.9, 9.2, 3.1, 6.1), Block.box(12, 3, 5, 13, 5, 6), Block.box(11.9, 4.8, 4.9, 13.1, 5, 6.1), Block.box(11.9, 4.8, 2.9000000000000004, 13.1, 5, 4.1), Block.box(9, 2, 3, 13, 3, 4), Block.box(9, 2, 5, 13, 3, 6), Block.box(12, 3, 3, 13, 5, 4), Block.box(11, 5, 2, 14, 11, 7), Block.box(12, 11, 3, 14, 12, 5), Block.box(14, 1, 3, 15, 12, 5)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape WEST = Stream.of(Block.box(7, 11, 3, 8, 14, 8), Block.box(1, 0, 1, 15, 1, 15), Block.box(8, 1, 2, 14, 9, 9), Block.box(3, 9, 1, 15, 11, 10), Block.box(8, 11, 3, 13, 13, 8), Block.box(3.5, 8, 5, 4.5, 9, 6), Block.box(2, 1, 4, 5, 2, 7), Block.box(5, 2, 4, 6, 7, 7), Block.box(1, 2, 4, 2, 7, 7), Block.box(2, 2, 3, 5, 7, 4), Block.box(2, 2, 7, 5, 7, 8), Block.box(3, 2, 2, 4, 3, 3), Block.box(3, 5, 2, 4, 6, 3), Block.box(3, 3, 1, 4, 5, 2), Block.box(4.199999999999999, 10.2, 2, 5.199999999999999, 11.2, 3), Block.box(4.199999999999999, 10.2, 4, 5.199999999999999, 11.2, 5), Block.box(7, 11, 2, 14, 14, 3), Block.box(7, 11, 8, 14, 14, 9), Block.box(13, 11, 3, 14, 14, 8), Block.box(14, 1, 1, 15, 9, 2), Block.box(14, 1, 9, 15, 9, 10), Block.box(7, 1, 1, 8, 9, 2), Block.box(7, 1, 9, 8, 9, 10), Block.box(11.9, 1.9, 9, 13.1, 3.1, 9.2), Block.box(9.9, 1.9, 9, 11.1, 3.1, 9.2), Block.box(10, 3, 12, 11, 5, 13), Block.box(9.9, 4.8, 11.9, 11.1, 5, 13.1), Block.box(11.9, 4.8, 11.9, 13.1, 5, 13.1), Block.box(12, 2, 9, 13, 3, 13), Block.box(10, 2, 9, 11, 3, 13), Block.box(12, 3, 12, 13, 5, 13), Block.box(9, 5, 11, 14, 11, 14), Block.box(11, 11, 12, 13, 12, 14), Block.box(11, 1, 14, 13, 12, 15)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape NORTH = Stream.of(Block.box(8, 11, 7, 13, 14, 8), Block.box(1, 0, 1, 15, 1, 15), Block.box(7, 1, 8, 14, 9, 14), Block.box(6, 9, 3, 15, 11, 15), Block.box(8, 11, 8, 13, 13, 13), Block.box(10, 8, 3.5, 11, 9, 4.5), Block.box(9, 1, 2, 12, 2, 5), Block.box(9, 2, 5, 12, 7, 6), Block.box(9, 2, 1, 12, 7, 2), Block.box(12, 2, 2, 13, 7, 5), Block.box(8, 2, 2, 9, 7, 5), Block.box(13, 2, 3, 14, 3, 4), Block.box(13, 5, 3, 14, 6, 4), Block.box(14, 3, 3, 15, 5, 4), Block.box(13, 10.2, 4.2, 14, 11.2, 5.2), Block.box(11, 10.2, 4.2, 12, 11.2, 5.2), Block.box(13, 11, 7, 14, 14, 14), Block.box(7, 11, 7, 8, 14, 14), Block.box(8, 11, 13, 13, 14, 14), Block.box(14, 1, 14, 15, 9, 15), Block.box(6, 1, 14, 7, 9, 15), Block.box(14, 1, 7, 15, 9, 8), Block.box(6, 1, 7, 7, 9, 8), Block.box(6.8, 1.9, 11.9, 7, 3.1, 13.1), Block.box(6.8, 1.9, 9.9, 7, 3.1, 11.1), Block.box(3, 3, 10, 4, 5, 11), Block.box(2.9, 4.8, 9.9, 4.1, 5, 11.1), Block.box(2.9, 4.8, 11.9, 4.1, 5, 13.1), Block.box(3, 2, 12, 7, 3, 13), Block.box(3, 2, 10, 7, 3, 11), Block.box(3, 3, 12, 4, 5, 13), Block.box(2, 5, 9, 5, 11, 14), Block.box(2, 11, 11, 4, 12, 13), Block.box(1, 1, 11, 2, 12, 13)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape EAST = Stream.of(Block.box(8, 11, 8, 9, 14, 13), Block.box(1, 0, 1, 15, 1, 15), Block.box(2, 1, 7, 8, 9, 14), Block.box(1, 9, 6, 13, 11, 15), Block.box(3, 11, 8, 8, 13, 13), Block.box(11.5, 8, 10, 12.5, 9, 11), Block.box(11, 1, 9, 14, 2, 12), Block.box(10, 2, 9, 11, 7, 12), Block.box(14, 2, 9, 15, 7, 12), Block.box(11, 2, 12, 14, 7, 13), Block.box(11, 2, 8, 14, 7, 9), Block.box(12, 2, 13, 13, 3, 14), Block.box(12, 5, 13, 13, 6, 14), Block.box(12, 3, 14, 13, 5, 15), Block.box(10.8, 10.2, 13, 11.8, 11.2, 14), Block.box(10.8, 10.2, 11, 11.8, 11.2, 12), Block.box(2, 11, 13, 9, 14, 14), Block.box(2, 11, 7, 9, 14, 8), Block.box(2, 11, 8, 3, 14, 13), Block.box(1, 1, 14, 2, 9, 15), Block.box(1, 1, 6, 2, 9, 7), Block.box(8, 1, 14, 9, 9, 15), Block.box(8, 1, 6, 9, 9, 7), Block.box(2.9000000000000004, 1.9, 6.8, 4.1, 3.1, 7), Block.box(4.9, 1.9, 6.8, 6.1, 3.1, 7), Block.box(5, 3, 3, 6, 5, 4), Block.box(4.9, 4.8, 2.9000000000000004, 6.1, 5, 4.1), Block.box(2.9000000000000004, 4.8, 2.9000000000000004, 4.1, 5, 4.1), Block.box(3, 2, 3, 4, 3, 7), Block.box(5, 2, 3, 6, 3, 7), Block.box(3, 3, 3, 4, 5, 4), Block.box(2, 5, 2, 7, 11, 5), Block.box(3, 11, 2, 5, 12, 4), Block.box(3, 1, 1, 5, 12, 2)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SOUTH = Stream.of(Block.box(3, 11, 8, 8, 14, 9), Block.box(1, 0, 1, 15, 1, 15), Block.box(2, 1, 2, 9, 9, 8), Block.box(1, 9, 1, 10, 11, 13), Block.box(3, 11, 3, 8, 13, 8), Block.box(5, 8, 11.5, 6, 9, 12.5), Block.box(4, 1, 11, 7, 2, 14), Block.box(4, 2, 10, 7, 7, 11), Block.box(4, 2, 14, 7, 7, 15), Block.box(3, 2, 11, 4, 7, 14), Block.box(7, 2, 11, 8, 7, 14), Block.box(2, 2, 12, 3, 3, 13), Block.box(2, 5, 12, 3, 6, 13), Block.box(1, 3, 12, 2, 5, 13), Block.box(2, 10.2, 10.8, 3, 11.2, 11.8), Block.box(4, 10.2, 10.8, 5, 11.2, 11.8), Block.box(2, 11, 2, 3, 14, 9), Block.box(8, 11, 2, 9, 14, 9), Block.box(3, 11, 2, 8, 14, 3), Block.box(1, 1, 1, 2, 9, 2), Block.box(9, 1, 1, 10, 9, 2), Block.box(1, 1, 8, 2, 9, 9), Block.box(9, 1, 8, 10, 9, 9), Block.box(9, 1.9, 2.9000000000000004, 9.2, 3.1, 4.1), Block.box(9, 1.9, 4.9, 9.2, 3.1, 6.1), Block.box(12, 3, 5, 13, 5, 6), Block.box(11.9, 4.8, 4.9, 13.1, 5, 6.1), Block.box(11.9, 4.8, 2.9000000000000004, 13.1, 5, 4.1), Block.box(9, 2, 3, 13, 3, 4), Block.box(9, 2, 5, 13, 3, 6), Block.box(12, 3, 3, 13, 5, 4), Block.box(11, 5, 2, 14, 11, 7), Block.box(12, 11, 3, 14, 12, 5), Block.box(14, 1, 3, 15, 12, 5)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape WEST = Stream.of(Block.box(7, 11, 3, 8, 14, 8), Block.box(1, 0, 1, 15, 1, 15), Block.box(8, 1, 2, 14, 9, 9), Block.box(3, 9, 1, 15, 11, 10), Block.box(8, 11, 3, 13, 13, 8), Block.box(3.5, 8, 5, 4.5, 9, 6), Block.box(2, 1, 4, 5, 2, 7), Block.box(5, 2, 4, 6, 7, 7), Block.box(1, 2, 4, 2, 7, 7), Block.box(2, 2, 3, 5, 7, 4), Block.box(2, 2, 7, 5, 7, 8), Block.box(3, 2, 2, 4, 3, 3), Block.box(3, 5, 2, 4, 6, 3), Block.box(3, 3, 1, 4, 5, 2), Block.box(4.199999999999999, 10.2, 2, 5.199999999999999, 11.2, 3), Block.box(4.199999999999999, 10.2, 4, 5.199999999999999, 11.2, 5), Block.box(7, 11, 2, 14, 14, 3), Block.box(7, 11, 8, 14, 14, 9), Block.box(13, 11, 3, 14, 14, 8), Block.box(14, 1, 1, 15, 9, 2), Block.box(14, 1, 9, 15, 9, 10), Block.box(7, 1, 1, 8, 9, 2), Block.box(7, 1, 9, 8, 9, 10), Block.box(11.9, 1.9, 9, 13.1, 3.1, 9.2), Block.box(9.9, 1.9, 9, 11.1, 3.1, 9.2), Block.box(10, 3, 12, 11, 5, 13), Block.box(9.9, 4.8, 11.9, 11.1, 5, 13.1), Block.box(11.9, 4.8, 11.9, 13.1, 5, 13.1), Block.box(12, 2, 9, 13, 3, 13), Block.box(10, 2, 9, 11, 3, 13), Block.box(12, 3, 12, 13, 5, 13), Block.box(9, 5, 11, 14, 11, 14), Block.box(11, 11, 12, 13, 12, 14), Block.box(11, 1, 14, 13, 12, 15)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } static class DirectionalBlockBreakerShapes { - static final VoxelShape SHAPE_U = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(0, 1, 0, 1, 15, 1), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 3, 9, 16, 13, 13), Block.box(15, 3, 3, 16, 13, 7), Block.box(0, 3, 9, 1, 13, 13), Block.box(0, 3, 3, 1, 13, 7), Block.box(5, 15, 5, 11, 16, 11), Block.box(3, 15, 6, 5, 16, 10), Block.box(11, 15, 6, 13, 16, 10)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_D = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(15, 1, 15, 16, 15, 16), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(15, 3, 3, 16, 13, 7), Block.box(15, 3, 9, 16, 13, 13), Block.box(0, 3, 3, 1, 13, 7), Block.box(0, 3, 9, 1, 13, 13), Block.box(5, 0, 5, 11, 1, 11), Block.box(3, 0, 6, 5, 1, 10), Block.box(11, 0, 6, 13, 1, 10)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_N = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(15, 9, 3, 16, 13, 13), Block.box(15, 3, 3, 16, 7, 13), Block.box(0, 9, 3, 1, 13, 13), Block.box(0, 3, 3, 1, 7, 13), Block.box(5, 5, 0, 11, 11, 1), Block.box(3, 6, 0, 5, 10, 1), Block.box(11, 6, 0, 13, 10, 1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_E = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(15, 15, 0, 16, 16, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 0, 0, 15, 1, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(3, 9, 15, 13, 13, 16), Block.box(3, 3, 15, 13, 7, 16), Block.box(3, 9, 0, 13, 13, 1), Block.box(3, 3, 0, 13, 7, 1), Block.box(15, 5, 5, 16, 11, 11), Block.box(15, 6, 3, 16, 10, 5), Block.box(15, 6, 11, 16, 10, 13)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_S = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 0, 0, 16, 1, 1), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(0, 9, 3, 1, 13, 13), Block.box(0, 3, 3, 1, 7, 13), Block.box(15, 9, 3, 16, 13, 13), Block.box(15, 3, 3, 16, 7, 13), Block.box(5, 5, 15, 11, 11, 16), Block.box(11, 6, 15, 13, 10, 16), Block.box(3, 6, 15, 5, 10, 16)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_W = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 15, 0, 1, 16, 16), Block.box(0, 0, 0, 1, 1, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(3, 9, 0, 13, 13, 1), Block.box(3, 3, 0, 13, 7, 1), Block.box(3, 9, 15, 13, 13, 16), Block.box(3, 3, 15, 13, 7, 16), Block.box(0, 5, 5, 1, 11, 11), Block.box(0, 6, 11, 1, 10, 13), Block.box(0, 6, 3, 1, 10, 5)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_U = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(0, 1, 0, 1, 15, 1), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 3, 9, 16, 13, 13), Block.box(15, 3, 3, 16, 13, 7), Block.box(0, 3, 9, 1, 13, 13), Block.box(0, 3, 3, 1, 13, 7), Block.box(5, 15, 5, 11, 16, 11), Block.box(3, 15, 6, 5, 16, 10), Block.box(11, 15, 6, 13, 16, 10)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_D = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(15, 1, 15, 16, 15, 16), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(15, 3, 3, 16, 13, 7), Block.box(15, 3, 9, 16, 13, 13), Block.box(0, 3, 3, 1, 13, 7), Block.box(0, 3, 9, 1, 13, 13), Block.box(5, 0, 5, 11, 1, 11), Block.box(3, 0, 6, 5, 1, 10), Block.box(11, 0, 6, 13, 1, 10)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_N = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(15, 9, 3, 16, 13, 13), Block.box(15, 3, 3, 16, 7, 13), Block.box(0, 9, 3, 1, 13, 13), Block.box(0, 3, 3, 1, 7, 13), Block.box(5, 5, 0, 11, 11, 1), Block.box(3, 6, 0, 5, 10, 1), Block.box(11, 6, 0, 13, 10, 1)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_E = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(15, 15, 0, 16, 16, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 0, 0, 15, 1, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(3, 9, 15, 13, 13, 16), Block.box(3, 3, 15, 13, 7, 16), Block.box(3, 9, 0, 13, 13, 1), Block.box(3, 3, 0, 13, 7, 1), Block.box(15, 5, 5, 16, 11, 11), Block.box(15, 6, 3, 16, 10, 5), Block.box(15, 6, 11, 16, 10, 13)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_S = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 0, 0, 16, 1, 1), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(0, 9, 3, 1, 13, 13), Block.box(0, 3, 3, 1, 7, 13), Block.box(15, 9, 3, 16, 13, 13), Block.box(15, 3, 3, 16, 7, 13), Block.box(5, 5, 15, 11, 11, 16), Block.box(11, 6, 15, 13, 10, 16), Block.box(3, 6, 15, 5, 10, 16)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_W = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 15, 0, 1, 16, 16), Block.box(0, 0, 0, 1, 1, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(3, 9, 0, 13, 13, 1), Block.box(3, 3, 0, 13, 7, 1), Block.box(3, 9, 15, 13, 13, 16), Block.box(3, 3, 15, 13, 7, 16), Block.box(0, 5, 5, 1, 11, 11), Block.box(0, 6, 11, 1, 10, 13), Block.box(0, 6, 3, 1, 10, 5)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } static class FarmerShapes { - static final VoxelShape SHAPE_N = Stream.of(Block.box(11, 14, 4, 12, 15, 5), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(4, 11, 4, 12, 12, 12), Block.box(4, 14, 4, 5, 15, 5), Block.box(3, 12, 5, 4, 14, 11), Block.box(12, 12, 5, 13, 14, 11), Block.box(5, 12, 3, 11, 14, 4), Block.box(5, 12, 12, 11, 14, 13), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 12, 4, 12, 14, 5), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 12, 11, 5, 14, 12), Block.box(4, 14, 11, 5, 15, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(2, 14, 2, 4, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(4, 14, 12, 12, 15, 14), Block.box(12, 14, 2, 14, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 1, 5, 15, 2), Block.box(5, 5, 2, 11, 11, 3), Block.box(5, 0, 1, 11, 5, 2), Block.box(5, 11, 1, 11, 15, 2), Block.box(11, 0, 1, 15, 15, 2), Block.box(1, 0, 14, 15, 15, 15)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_E = Stream.of(Block.box(11, 14, 11, 12, 15, 12), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 0, 15, 16, 1, 16), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(4, 11, 4, 12, 12, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(5, 12, 3, 11, 14, 4), Block.box(5, 12, 12, 11, 14, 13), Block.box(12, 12, 5, 13, 14, 11), Block.box(3, 12, 5, 4, 14, 11), Block.box(4, 12, 11, 5, 14, 12), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 12, 4, 12, 14, 5), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(4, 14, 11, 5, 15, 12), Block.box(2, 14, 2, 14, 15, 4), Block.box(12, 14, 4, 14, 15, 12), Block.box(2, 14, 4, 4, 15, 12), Block.box(2, 14, 12, 14, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(2, 0, 1, 14, 15, 2), Block.box(2, 0, 14, 14, 15, 15), Block.box(14, 0, 1, 15, 15, 5), Block.box(13, 5, 5, 14, 11, 11), Block.box(14, 0, 5, 15, 5, 11), Block.box(14, 11, 5, 15, 15, 11), Block.box(14, 0, 11, 15, 15, 15), Block.box(1, 0, 1, 2, 15, 15)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_S = Stream.of(Block.box(4, 14, 11, 5, 15, 12), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(4, 11, 4, 12, 12, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(12, 12, 5, 13, 14, 11), Block.box(3, 12, 5, 4, 14, 11), Block.box(5, 12, 12, 11, 14, 13), Block.box(5, 12, 3, 11, 14, 4), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 12, 11, 5, 14, 12), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 12, 4, 12, 14, 5), Block.box(11, 14, 4, 12, 15, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(12, 14, 2, 14, 15, 14), Block.box(4, 14, 12, 12, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(2, 14, 2, 4, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(11, 0, 14, 15, 15, 15), Block.box(5, 5, 13, 11, 11, 14), Block.box(5, 0, 14, 11, 5, 15), Block.box(5, 11, 14, 11, 15, 15), Block.box(1, 0, 14, 5, 15, 15), Block.box(1, 0, 1, 15, 15, 2)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_W = Stream.of(Block.box(4, 14, 4, 5, 15, 5), Block.box(0, 0, 15, 16, 1, 16), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(4, 11, 4, 12, 12, 12), Block.box(4, 14, 11, 5, 15, 12), Block.box(5, 12, 12, 11, 14, 13), Block.box(5, 12, 3, 11, 14, 4), Block.box(3, 12, 5, 4, 14, 11), Block.box(12, 12, 5, 13, 14, 11), Block.box(11, 12, 4, 12, 14, 5), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 12, 11, 5, 14, 12), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(2, 14, 12, 14, 15, 14), Block.box(2, 14, 4, 4, 15, 12), Block.box(12, 14, 4, 14, 15, 12), Block.box(2, 14, 2, 14, 15, 4), Block.box(2, 0, 2, 14, 1, 14), Block.box(2, 0, 14, 14, 15, 15), Block.box(2, 0, 1, 14, 15, 2), Block.box(1, 0, 11, 2, 15, 15), Block.box(2, 5, 5, 3, 11, 11), Block.box(1, 0, 5, 2, 5, 11), Block.box(1, 11, 5, 2, 15, 11), Block.box(1, 0, 1, 2, 15, 5), Block.box(14, 0, 1, 15, 15, 15)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_N = Stream.of(Block.box(11, 14, 4, 12, 15, 5), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(4, 11, 4, 12, 12, 12), Block.box(4, 14, 4, 5, 15, 5), Block.box(3, 12, 5, 4, 14, 11), Block.box(12, 12, 5, 13, 14, 11), Block.box(5, 12, 3, 11, 14, 4), Block.box(5, 12, 12, 11, 14, 13), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 12, 4, 12, 14, 5), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 12, 11, 5, 14, 12), Block.box(4, 14, 11, 5, 15, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(2, 14, 2, 4, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(4, 14, 12, 12, 15, 14), Block.box(12, 14, 2, 14, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 1, 5, 15, 2), Block.box(5, 5, 2, 11, 11, 3), Block.box(5, 0, 1, 11, 5, 2), Block.box(5, 11, 1, 11, 15, 2), Block.box(11, 0, 1, 15, 15, 2), Block.box(1, 0, 14, 15, 15, 15)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_E = Stream.of(Block.box(11, 14, 11, 12, 15, 12), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 0, 15, 16, 1, 16), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(4, 11, 4, 12, 12, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(5, 12, 3, 11, 14, 4), Block.box(5, 12, 12, 11, 14, 13), Block.box(12, 12, 5, 13, 14, 11), Block.box(3, 12, 5, 4, 14, 11), Block.box(4, 12, 11, 5, 14, 12), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 12, 4, 12, 14, 5), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(4, 14, 11, 5, 15, 12), Block.box(2, 14, 2, 14, 15, 4), Block.box(12, 14, 4, 14, 15, 12), Block.box(2, 14, 4, 4, 15, 12), Block.box(2, 14, 12, 14, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(2, 0, 1, 14, 15, 2), Block.box(2, 0, 14, 14, 15, 15), Block.box(14, 0, 1, 15, 15, 5), Block.box(13, 5, 5, 14, 11, 11), Block.box(14, 0, 5, 15, 5, 11), Block.box(14, 11, 5, 15, 15, 11), Block.box(14, 0, 11, 15, 15, 15), Block.box(1, 0, 1, 2, 15, 15)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_S = Stream.of(Block.box(4, 14, 11, 5, 15, 12), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(4, 11, 4, 12, 12, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(12, 12, 5, 13, 14, 11), Block.box(3, 12, 5, 4, 14, 11), Block.box(5, 12, 12, 11, 14, 13), Block.box(5, 12, 3, 11, 14, 4), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 12, 11, 5, 14, 12), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 12, 4, 12, 14, 5), Block.box(11, 14, 4, 12, 15, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(12, 14, 2, 14, 15, 14), Block.box(4, 14, 12, 12, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(2, 14, 2, 4, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(11, 0, 14, 15, 15, 15), Block.box(5, 5, 13, 11, 11, 14), Block.box(5, 0, 14, 11, 5, 15), Block.box(5, 11, 14, 11, 15, 15), Block.box(1, 0, 14, 5, 15, 15), Block.box(1, 0, 1, 15, 15, 2)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_W = Stream.of(Block.box(4, 14, 4, 5, 15, 5), Block.box(0, 0, 15, 16, 1, 16), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(4, 11, 4, 12, 12, 12), Block.box(4, 14, 11, 5, 15, 12), Block.box(5, 12, 12, 11, 14, 13), Block.box(5, 12, 3, 11, 14, 4), Block.box(3, 12, 5, 4, 14, 11), Block.box(12, 12, 5, 13, 14, 11), Block.box(11, 12, 4, 12, 14, 5), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 12, 11, 5, 14, 12), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(2, 14, 12, 14, 15, 14), Block.box(2, 14, 4, 4, 15, 12), Block.box(12, 14, 4, 14, 15, 12), Block.box(2, 14, 2, 14, 15, 4), Block.box(2, 0, 2, 14, 1, 14), Block.box(2, 0, 14, 14, 15, 15), Block.box(2, 0, 1, 14, 15, 2), Block.box(1, 0, 11, 2, 15, 15), Block.box(2, 5, 5, 3, 11, 11), Block.box(1, 0, 5, 2, 5, 11), Block.box(1, 11, 5, 2, 15, 11), Block.box(1, 0, 1, 2, 15, 5), Block.box(14, 0, 1, 15, 15, 15)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } static class FluidCollectorShapes { - static final VoxelShape SHAPE_U = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(0, 1, 0, 1, 15, 1), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 3, 6, 16, 13, 10), Block.box(0, 3, 6, 1, 13, 10), Block.box(5, 15, 5, 11, 16, 11), Block.box(3, 15, 6, 5, 16, 10), Block.box(11, 15, 6, 13, 16, 10), Block.box(6, 15, 11, 10, 16, 13), Block.box(6, 15, 3, 10, 16, 5)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_D = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(15, 1, 15, 16, 15, 16), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(15, 3, 6, 16, 13, 10), Block.box(0, 3, 6, 1, 13, 10), Block.box(5, 0, 5, 11, 1, 11), Block.box(3, 0, 6, 5, 1, 10), Block.box(11, 0, 6, 13, 1, 10), Block.box(6, 0, 3, 10, 1, 5), Block.box(6, 0, 11, 10, 1, 13)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_N = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(15, 6, 3, 16, 10, 13), Block.box(0, 6, 3, 1, 10, 13), Block.box(5, 5, 0, 11, 11, 1), Block.box(3, 6, 0, 5, 10, 1), Block.box(11, 6, 0, 13, 10, 1), Block.box(6, 11, 0, 10, 13, 1), Block.box(6, 3, 0, 10, 5, 1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_E = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(15, 15, 0, 16, 16, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 0, 0, 15, 1, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(3, 6, 15, 13, 10, 16), Block.box(3, 6, 0, 13, 10, 1), Block.box(15, 5, 5, 16, 11, 11), Block.box(15, 6, 3, 16, 10, 5), Block.box(15, 6, 11, 16, 10, 13), Block.box(15, 11, 6, 16, 13, 10), Block.box(15, 3, 6, 16, 5, 10)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_S = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 0, 0, 16, 1, 1), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(0, 6, 3, 1, 10, 13), Block.box(15, 6, 3, 16, 10, 13), Block.box(5, 5, 15, 11, 11, 16), Block.box(11, 6, 15, 13, 10, 16), Block.box(3, 6, 15, 5, 10, 16), Block.box(6, 11, 15, 10, 13, 16), Block.box(6, 3, 15, 10, 5, 16)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_W = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 15, 0, 1, 16, 16), Block.box(0, 0, 0, 1, 1, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(3, 6, 0, 13, 10, 1), Block.box(3, 6, 15, 13, 10, 16), Block.box(0, 5, 5, 1, 11, 11), Block.box(0, 6, 11, 1, 10, 13), Block.box(0, 6, 3, 1, 10, 5), Block.box(0, 11, 6, 1, 13, 10), Block.box(0, 3, 6, 1, 5, 10)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_U = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(0, 1, 0, 1, 15, 1), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 3, 6, 16, 13, 10), Block.box(0, 3, 6, 1, 13, 10), Block.box(5, 15, 5, 11, 16, 11), Block.box(3, 15, 6, 5, 16, 10), Block.box(11, 15, 6, 13, 16, 10), Block.box(6, 15, 11, 10, 16, 13), Block.box(6, 15, 3, 10, 16, 5)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_D = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(15, 1, 15, 16, 15, 16), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(15, 3, 6, 16, 13, 10), Block.box(0, 3, 6, 1, 13, 10), Block.box(5, 0, 5, 11, 1, 11), Block.box(3, 0, 6, 5, 1, 10), Block.box(11, 0, 6, 13, 1, 10), Block.box(6, 0, 3, 10, 1, 5), Block.box(6, 0, 11, 10, 1, 13)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_N = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(15, 6, 3, 16, 10, 13), Block.box(0, 6, 3, 1, 10, 13), Block.box(5, 5, 0, 11, 11, 1), Block.box(3, 6, 0, 5, 10, 1), Block.box(11, 6, 0, 13, 10, 1), Block.box(6, 11, 0, 10, 13, 1), Block.box(6, 3, 0, 10, 5, 1)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_E = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(15, 15, 0, 16, 16, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 0, 0, 15, 1, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(3, 6, 15, 13, 10, 16), Block.box(3, 6, 0, 13, 10, 1), Block.box(15, 5, 5, 16, 11, 11), Block.box(15, 6, 3, 16, 10, 5), Block.box(15, 6, 11, 16, 10, 13), Block.box(15, 11, 6, 16, 13, 10), Block.box(15, 3, 6, 16, 5, 10)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_S = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 0, 0, 16, 1, 1), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(0, 6, 3, 1, 10, 13), Block.box(15, 6, 3, 16, 10, 13), Block.box(5, 5, 15, 11, 11, 16), Block.box(11, 6, 15, 13, 10, 16), Block.box(3, 6, 15, 5, 10, 16), Block.box(6, 11, 15, 10, 13, 16), Block.box(6, 3, 15, 10, 5, 16)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_W = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 15, 0, 1, 16, 16), Block.box(0, 0, 0, 1, 1, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(3, 6, 0, 13, 10, 1), Block.box(3, 6, 15, 13, 10, 16), Block.box(0, 5, 5, 1, 11, 11), Block.box(0, 6, 11, 1, 10, 13), Block.box(0, 6, 3, 1, 10, 5), Block.box(0, 11, 6, 1, 13, 10), Block.box(0, 3, 6, 1, 5, 10)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } static class FurnaceDoubleShapes { - static final VoxelShape SHAPE_N = Stream.of(Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 0, 0, 16, 1, 16), Block.box(5, 14, 6, 11, 15, 7), Block.box(5, 14, 8, 11, 15, 9), Block.box(5, 14, 10, 11, 15, 14), Block.box(5, 14, 2, 11, 15, 5), Block.box(11, 14, 2, 14, 15, 14), Block.box(2, 14, 2, 5, 15, 14), Block.box(1, 1, 2, 2, 15, 14), Block.box(14, 1, 2, 15, 15, 14), Block.box(1, 1, 14, 15, 15, 15), Block.box(7, 3, 1, 9, 7, 2), Block.box(3, 7, 1, 13, 15, 2), Block.box(3, 1, 1, 13, 3, 2), Block.box(1, 1, 1, 3, 15, 2), Block.box(13, 1, 1, 15, 15, 2), Block.box(5, 13, 5, 11, 14, 10), Block.box(2, 3, 2, 14, 8, 3)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_E = Stream.of(Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 0, 0, 16, 1, 16), Block.box(9, 14, 5, 10, 15, 11), Block.box(7, 14, 5, 8, 15, 11), Block.box(2, 14, 5, 6, 15, 11), Block.box(11, 14, 5, 14, 15, 11), Block.box(2, 14, 11, 14, 15, 14), Block.box(2, 14, 2, 14, 15, 5), Block.box(2, 1, 1, 14, 15, 2), Block.box(2, 1, 14, 14, 15, 15), Block.box(1, 1, 1, 2, 15, 15), Block.box(14, 3, 7, 15, 7, 9), Block.box(14, 7, 3, 15, 15, 13), Block.box(14, 1, 3, 15, 3, 13), Block.box(14, 1, 1, 15, 15, 3), Block.box(14, 1, 13, 15, 15, 15), Block.box(6, 13, 5, 11, 14, 11), Block.box(13, 3, 2, 14, 8, 14)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_S = Stream.of(Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(0, 0, 0, 16, 1, 16), Block.box(5, 14, 9, 11, 15, 10), Block.box(5, 14, 7, 11, 15, 8), Block.box(5, 14, 2, 11, 15, 6), Block.box(5, 14, 11, 11, 15, 14), Block.box(2, 14, 2, 5, 15, 14), Block.box(11, 14, 2, 14, 15, 14), Block.box(14, 1, 2, 15, 15, 14), Block.box(1, 1, 2, 2, 15, 14), Block.box(1, 1, 1, 15, 15, 2), Block.box(7, 3, 14, 9, 7, 15), Block.box(3, 7, 14, 13, 15, 15), Block.box(3, 1, 14, 13, 3, 15), Block.box(13, 1, 14, 15, 15, 15), Block.box(1, 1, 14, 3, 15, 15), Block.box(5, 13, 6, 11, 14, 11), Block.box(2, 3, 13, 14, 8, 14)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_W = Stream.of(Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(0, 0, 0, 16, 1, 16), Block.box(6, 14, 5, 7, 15, 11), Block.box(8, 14, 5, 9, 15, 11), Block.box(10, 14, 5, 14, 15, 11), Block.box(2, 14, 5, 5, 15, 11), Block.box(2, 14, 2, 14, 15, 5), Block.box(2, 14, 11, 14, 15, 14), Block.box(2, 1, 14, 14, 15, 15), Block.box(2, 1, 1, 14, 15, 2), Block.box(14, 1, 1, 15, 15, 15), Block.box(1, 3, 7, 2, 7, 9), Block.box(1, 7, 3, 2, 15, 13), Block.box(1, 1, 3, 2, 3, 13), Block.box(1, 1, 13, 2, 15, 15), Block.box(1, 1, 1, 2, 15, 3), Block.box(5, 13, 5, 10, 14, 11), Block.box(2, 3, 2, 3, 8, 14)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_N = Stream.of(Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 0, 0, 16, 1, 16), Block.box(5, 14, 6, 11, 15, 7), Block.box(5, 14, 8, 11, 15, 9), Block.box(5, 14, 10, 11, 15, 14), Block.box(5, 14, 2, 11, 15, 5), Block.box(11, 14, 2, 14, 15, 14), Block.box(2, 14, 2, 5, 15, 14), Block.box(1, 1, 2, 2, 15, 14), Block.box(14, 1, 2, 15, 15, 14), Block.box(1, 1, 14, 15, 15, 15), Block.box(7, 3, 1, 9, 7, 2), Block.box(3, 7, 1, 13, 15, 2), Block.box(3, 1, 1, 13, 3, 2), Block.box(1, 1, 1, 3, 15, 2), Block.box(13, 1, 1, 15, 15, 2), Block.box(5, 13, 5, 11, 14, 10), Block.box(2, 3, 2, 14, 8, 3)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_E = Stream.of(Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 0, 0, 16, 1, 16), Block.box(9, 14, 5, 10, 15, 11), Block.box(7, 14, 5, 8, 15, 11), Block.box(2, 14, 5, 6, 15, 11), Block.box(11, 14, 5, 14, 15, 11), Block.box(2, 14, 11, 14, 15, 14), Block.box(2, 14, 2, 14, 15, 5), Block.box(2, 1, 1, 14, 15, 2), Block.box(2, 1, 14, 14, 15, 15), Block.box(1, 1, 1, 2, 15, 15), Block.box(14, 3, 7, 15, 7, 9), Block.box(14, 7, 3, 15, 15, 13), Block.box(14, 1, 3, 15, 3, 13), Block.box(14, 1, 1, 15, 15, 3), Block.box(14, 1, 13, 15, 15, 15), Block.box(6, 13, 5, 11, 14, 11), Block.box(13, 3, 2, 14, 8, 14)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_S = Stream.of(Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(0, 0, 0, 16, 1, 16), Block.box(5, 14, 9, 11, 15, 10), Block.box(5, 14, 7, 11, 15, 8), Block.box(5, 14, 2, 11, 15, 6), Block.box(5, 14, 11, 11, 15, 14), Block.box(2, 14, 2, 5, 15, 14), Block.box(11, 14, 2, 14, 15, 14), Block.box(14, 1, 2, 15, 15, 14), Block.box(1, 1, 2, 2, 15, 14), Block.box(1, 1, 1, 15, 15, 2), Block.box(7, 3, 14, 9, 7, 15), Block.box(3, 7, 14, 13, 15, 15), Block.box(3, 1, 14, 13, 3, 15), Block.box(13, 1, 14, 15, 15, 15), Block.box(1, 1, 14, 3, 15, 15), Block.box(5, 13, 6, 11, 14, 11), Block.box(2, 3, 13, 14, 8, 14)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_W = Stream.of(Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(0, 0, 0, 16, 1, 16), Block.box(6, 14, 5, 7, 15, 11), Block.box(8, 14, 5, 9, 15, 11), Block.box(10, 14, 5, 14, 15, 11), Block.box(2, 14, 5, 5, 15, 11), Block.box(2, 14, 2, 14, 15, 5), Block.box(2, 14, 11, 14, 15, 14), Block.box(2, 1, 14, 14, 15, 15), Block.box(2, 1, 1, 14, 15, 2), Block.box(14, 1, 1, 15, 15, 15), Block.box(1, 3, 7, 2, 7, 9), Block.box(1, 7, 3, 2, 15, 13), Block.box(1, 1, 3, 2, 3, 13), Block.box(1, 1, 13, 2, 15, 15), Block.box(1, 1, 1, 2, 15, 3), Block.box(5, 13, 5, 10, 14, 11), Block.box(2, 3, 2, 3, 8, 14)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } static final class GrinderShapes { - static final VoxelShape SHAPE_N = Stream.of(Block.box(0, 0, 0, 1, 1, 16), Block.box(14, 12, 4, 15, 15, 12), Block.box(1, 0, 4, 2, 4, 12), Block.box(14, 0, 4, 15, 4, 12), Block.box(4, 13, 4, 12, 14, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(3, 12, 5, 4, 14, 11), Block.box(12, 12, 5, 13, 14, 11), Block.box(5, 12, 3, 11, 14, 4), Block.box(5, 12, 12, 11, 14, 13), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 12, 4, 12, 14, 5), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 12, 11, 5, 14, 12), Block.box(4, 14, 11, 5, 15, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(2, 14, 2, 4, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(4, 14, 12, 12, 15, 14), Block.box(12, 14, 2, 14, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(1, 0, 2, 2, 15, 4), Block.box(14, 0, 2, 15, 15, 4), Block.box(1, 0, 12, 2, 15, 14), Block.box(14, 0, 12, 15, 15, 14), Block.box(1, 0, 1, 15, 15, 2), Block.box(1, 0, 14, 15, 15, 15), Block.box(13, 4, 4, 14, 12, 12), Block.box(2, 4, 4, 3, 12, 12), Block.box(3, 8, 0, 6, 10, 1), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(1, 12, 4, 2, 15, 12), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_E = Stream.of(Block.box(0, 0, 0, 16, 1, 1), Block.box(4, 12, 14, 12, 15, 15), Block.box(4, 0, 1, 12, 4, 2), Block.box(4, 0, 14, 12, 4, 15), Block.box(4, 13, 4, 12, 14, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(5, 12, 3, 11, 14, 4), Block.box(5, 12, 12, 11, 14, 13), Block.box(12, 12, 5, 13, 14, 11), Block.box(3, 12, 5, 4, 14, 11), Block.box(4, 12, 11, 5, 14, 12), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 12, 4, 12, 14, 5), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(4, 14, 11, 5, 15, 12), Block.box(2, 14, 2, 14, 15, 4), Block.box(12, 14, 4, 14, 15, 12), Block.box(2, 14, 4, 4, 15, 12), Block.box(2, 14, 12, 14, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(12, 0, 1, 14, 15, 2), Block.box(12, 0, 14, 14, 15, 15), Block.box(2, 0, 1, 4, 15, 2), Block.box(2, 0, 14, 4, 15, 15), Block.box(14, 0, 1, 15, 15, 15), Block.box(1, 0, 1, 2, 15, 15), Block.box(4, 4, 13, 12, 12, 14), Block.box(4, 4, 2, 12, 12, 3), Block.box(15, 8, 3, 16, 10, 6), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 0, 15, 16, 1, 16), Block.box(15, 0, 1, 16, 1, 15), Block.box(4, 12, 1, 12, 15, 2), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_S = Stream.of(Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 12, 4, 2, 15, 12), Block.box(14, 0, 4, 15, 4, 12), Block.box(1, 0, 4, 2, 4, 12), Block.box(4, 13, 4, 12, 14, 12), Block.box(4, 14, 11, 5, 15, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(12, 12, 5, 13, 14, 11), Block.box(3, 12, 5, 4, 14, 11), Block.box(5, 12, 12, 11, 14, 13), Block.box(5, 12, 3, 11, 14, 4), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 12, 11, 5, 14, 12), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 12, 4, 12, 14, 5), Block.box(11, 14, 4, 12, 15, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(12, 14, 2, 14, 15, 14), Block.box(4, 14, 12, 12, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(2, 14, 2, 4, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(14, 0, 12, 15, 15, 14), Block.box(1, 0, 12, 2, 15, 14), Block.box(14, 0, 2, 15, 15, 4), Block.box(1, 0, 2, 2, 15, 4), Block.box(1, 0, 14, 15, 15, 15), Block.box(1, 0, 1, 15, 15, 2), Block.box(2, 4, 4, 3, 12, 12), Block.box(13, 4, 4, 14, 12, 12), Block.box(10, 8, 15, 13, 10, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(14, 12, 4, 15, 15, 12), Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_W = Stream.of(Block.box(0, 0, 15, 16, 1, 16), Block.box(4, 12, 1, 12, 15, 2), Block.box(4, 0, 14, 12, 4, 15), Block.box(4, 0, 1, 12, 4, 2), Block.box(4, 13, 4, 12, 14, 12), Block.box(4, 14, 4, 5, 15, 5), Block.box(4, 14, 11, 5, 15, 12), Block.box(5, 12, 12, 11, 14, 13), Block.box(5, 12, 3, 11, 14, 4), Block.box(3, 12, 5, 4, 14, 11), Block.box(12, 12, 5, 13, 14, 11), Block.box(11, 12, 4, 12, 14, 5), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 12, 11, 5, 14, 12), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(2, 14, 12, 14, 15, 14), Block.box(2, 14, 4, 4, 15, 12), Block.box(12, 14, 4, 14, 15, 12), Block.box(2, 14, 2, 14, 15, 4), Block.box(2, 0, 2, 14, 1, 14), Block.box(2, 0, 14, 4, 15, 15), Block.box(2, 0, 1, 4, 15, 2), Block.box(12, 0, 14, 14, 15, 15), Block.box(12, 0, 1, 14, 15, 2), Block.box(1, 0, 1, 2, 15, 15), Block.box(14, 0, 1, 15, 15, 15), Block.box(4, 4, 2, 12, 12, 3), Block.box(4, 4, 13, 12, 12, 14), Block.box(0, 8, 10, 1, 10, 13), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 1, 1, 1, 15), Block.box(4, 12, 14, 12, 15, 15), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_N = Stream.of(Block.box(0, 0, 0, 1, 1, 16), Block.box(14, 12, 4, 15, 15, 12), Block.box(1, 0, 4, 2, 4, 12), Block.box(14, 0, 4, 15, 4, 12), Block.box(4, 13, 4, 12, 14, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(3, 12, 5, 4, 14, 11), Block.box(12, 12, 5, 13, 14, 11), Block.box(5, 12, 3, 11, 14, 4), Block.box(5, 12, 12, 11, 14, 13), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 12, 4, 12, 14, 5), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 12, 11, 5, 14, 12), Block.box(4, 14, 11, 5, 15, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(2, 14, 2, 4, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(4, 14, 12, 12, 15, 14), Block.box(12, 14, 2, 14, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(1, 0, 2, 2, 15, 4), Block.box(14, 0, 2, 15, 15, 4), Block.box(1, 0, 12, 2, 15, 14), Block.box(14, 0, 12, 15, 15, 14), Block.box(1, 0, 1, 15, 15, 2), Block.box(1, 0, 14, 15, 15, 15), Block.box(13, 4, 4, 14, 12, 12), Block.box(2, 4, 4, 3, 12, 12), Block.box(3, 8, 0, 6, 10, 1), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(1, 12, 4, 2, 15, 12), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_E = Stream.of(Block.box(0, 0, 0, 16, 1, 1), Block.box(4, 12, 14, 12, 15, 15), Block.box(4, 0, 1, 12, 4, 2), Block.box(4, 0, 14, 12, 4, 15), Block.box(4, 13, 4, 12, 14, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(5, 12, 3, 11, 14, 4), Block.box(5, 12, 12, 11, 14, 13), Block.box(12, 12, 5, 13, 14, 11), Block.box(3, 12, 5, 4, 14, 11), Block.box(4, 12, 11, 5, 14, 12), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 12, 4, 12, 14, 5), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(4, 14, 11, 5, 15, 12), Block.box(2, 14, 2, 14, 15, 4), Block.box(12, 14, 4, 14, 15, 12), Block.box(2, 14, 4, 4, 15, 12), Block.box(2, 14, 12, 14, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(12, 0, 1, 14, 15, 2), Block.box(12, 0, 14, 14, 15, 15), Block.box(2, 0, 1, 4, 15, 2), Block.box(2, 0, 14, 4, 15, 15), Block.box(14, 0, 1, 15, 15, 15), Block.box(1, 0, 1, 2, 15, 15), Block.box(4, 4, 13, 12, 12, 14), Block.box(4, 4, 2, 12, 12, 3), Block.box(15, 8, 3, 16, 10, 6), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 0, 15, 16, 1, 16), Block.box(15, 0, 1, 16, 1, 15), Block.box(4, 12, 1, 12, 15, 2), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_S = Stream.of(Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 12, 4, 2, 15, 12), Block.box(14, 0, 4, 15, 4, 12), Block.box(1, 0, 4, 2, 4, 12), Block.box(4, 13, 4, 12, 14, 12), Block.box(4, 14, 11, 5, 15, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(12, 12, 5, 13, 14, 11), Block.box(3, 12, 5, 4, 14, 11), Block.box(5, 12, 12, 11, 14, 13), Block.box(5, 12, 3, 11, 14, 4), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 12, 11, 5, 14, 12), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 12, 4, 12, 14, 5), Block.box(11, 14, 4, 12, 15, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(12, 14, 2, 14, 15, 14), Block.box(4, 14, 12, 12, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(2, 14, 2, 4, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(14, 0, 12, 15, 15, 14), Block.box(1, 0, 12, 2, 15, 14), Block.box(14, 0, 2, 15, 15, 4), Block.box(1, 0, 2, 2, 15, 4), Block.box(1, 0, 14, 15, 15, 15), Block.box(1, 0, 1, 15, 15, 2), Block.box(2, 4, 4, 3, 12, 12), Block.box(13, 4, 4, 14, 12, 12), Block.box(10, 8, 15, 13, 10, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(14, 12, 4, 15, 15, 12), Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_W = Stream.of(Block.box(0, 0, 15, 16, 1, 16), Block.box(4, 12, 1, 12, 15, 2), Block.box(4, 0, 14, 12, 4, 15), Block.box(4, 0, 1, 12, 4, 2), Block.box(4, 13, 4, 12, 14, 12), Block.box(4, 14, 4, 5, 15, 5), Block.box(4, 14, 11, 5, 15, 12), Block.box(5, 12, 12, 11, 14, 13), Block.box(5, 12, 3, 11, 14, 4), Block.box(3, 12, 5, 4, 14, 11), Block.box(12, 12, 5, 13, 14, 11), Block.box(11, 12, 4, 12, 14, 5), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 12, 11, 5, 14, 12), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(2, 14, 12, 14, 15, 14), Block.box(2, 14, 4, 4, 15, 12), Block.box(12, 14, 4, 14, 15, 12), Block.box(2, 14, 2, 14, 15, 4), Block.box(2, 0, 2, 14, 1, 14), Block.box(2, 0, 14, 4, 15, 15), Block.box(2, 0, 1, 4, 15, 2), Block.box(12, 0, 14, 14, 15, 15), Block.box(12, 0, 1, 14, 15, 2), Block.box(1, 0, 1, 2, 15, 15), Block.box(14, 0, 1, 15, 15, 15), Block.box(4, 4, 2, 12, 12, 3), Block.box(4, 4, 13, 12, 12, 14), Block.box(0, 8, 10, 1, 10, 13), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 1, 1, 1, 15), Block.box(4, 12, 14, 12, 15, 15), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } static final class LampPowererShapes { - static final VoxelShape SHAPE_N = Stream.of(Block.box(0, 0, 0, 1, 1, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(15, 0, 0, 16, 1, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(3, 3, 15, 13, 13, 16), Block.box(1, 14, 1, 15, 15, 15), Block.box(1, 1, 1, 15, 2, 15), Block.box(14, 2, 1, 15, 14, 15), Block.box(1, 2, 1, 2, 14, 15), Block.box(2, 2, 14, 14, 14, 15), Block.box(2, 2, 1, 14, 14, 2), Block.box(0, 7, 7, 1, 9, 10), Block.box(15, 7, 6, 16, 9, 9)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_E = Stream.of(Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 3, 3, 1, 13, 13), Block.box(1, 14, 1, 15, 15, 15), Block.box(1, 1, 1, 15, 2, 15), Block.box(1, 2, 14, 15, 14, 15), Block.box(1, 2, 1, 15, 14, 2), Block.box(1, 2, 2, 2, 14, 14), Block.box(14, 2, 2, 15, 14, 14), Block.box(6, 7, 0, 9, 9, 1), Block.box(7, 7, 15, 10, 9, 16)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_S = Stream.of(Block.box(15, 0, 0, 16, 1, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 0, 0, 15, 1, 1), Block.box(1, 0, 15, 15, 1, 16), Block.box(0, 0, 0, 1, 1, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(3, 3, 0, 13, 13, 1), Block.box(1, 14, 1, 15, 15, 15), Block.box(1, 1, 1, 15, 2, 15), Block.box(1, 2, 1, 2, 14, 15), Block.box(14, 2, 1, 15, 14, 15), Block.box(2, 2, 1, 14, 14, 2), Block.box(2, 2, 14, 14, 14, 15), Block.box(15, 7, 6, 16, 9, 9), Block.box(0, 7, 7, 1, 9, 10)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_W = Stream.of(Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 3, 3, 16, 13, 13), Block.box(1, 14, 1, 15, 15, 15), Block.box(1, 1, 1, 15, 2, 15), Block.box(1, 2, 1, 15, 14, 2), Block.box(1, 2, 14, 15, 14, 15), Block.box(14, 2, 2, 15, 14, 14), Block.box(1, 2, 2, 2, 14, 14), Block.box(7, 7, 15, 10, 9, 16), Block.box(6, 7, 0, 9, 9, 1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_N = Stream.of(Block.box(0, 0, 0, 1, 1, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(15, 0, 0, 16, 1, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(3, 3, 15, 13, 13, 16), Block.box(1, 14, 1, 15, 15, 15), Block.box(1, 1, 1, 15, 2, 15), Block.box(14, 2, 1, 15, 14, 15), Block.box(1, 2, 1, 2, 14, 15), Block.box(2, 2, 14, 14, 14, 15), Block.box(2, 2, 1, 14, 14, 2), Block.box(0, 7, 7, 1, 9, 10), Block.box(15, 7, 6, 16, 9, 9)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_E = Stream.of(Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 3, 3, 1, 13, 13), Block.box(1, 14, 1, 15, 15, 15), Block.box(1, 1, 1, 15, 2, 15), Block.box(1, 2, 14, 15, 14, 15), Block.box(1, 2, 1, 15, 14, 2), Block.box(1, 2, 2, 2, 14, 14), Block.box(14, 2, 2, 15, 14, 14), Block.box(6, 7, 0, 9, 9, 1), Block.box(7, 7, 15, 10, 9, 16)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_S = Stream.of(Block.box(15, 0, 0, 16, 1, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 0, 0, 15, 1, 1), Block.box(1, 0, 15, 15, 1, 16), Block.box(0, 0, 0, 1, 1, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(3, 3, 0, 13, 13, 1), Block.box(1, 14, 1, 15, 15, 15), Block.box(1, 1, 1, 15, 2, 15), Block.box(1, 2, 1, 2, 14, 15), Block.box(14, 2, 1, 15, 14, 15), Block.box(2, 2, 1, 14, 14, 2), Block.box(2, 2, 14, 14, 14, 15), Block.box(15, 7, 6, 16, 9, 9), Block.box(0, 7, 7, 1, 9, 10)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_W = Stream.of(Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 3, 3, 16, 13, 13), Block.box(1, 14, 1, 15, 15, 15), Block.box(1, 1, 1, 15, 2, 15), Block.box(1, 2, 1, 15, 14, 2), Block.box(1, 2, 14, 15, 14, 15), Block.box(14, 2, 2, 15, 14, 14), Block.box(1, 2, 2, 2, 14, 14), Block.box(7, 7, 15, 10, 9, 16), Block.box(6, 7, 0, 9, 9, 1)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } static final class OilGeneratorShapes { - static final VoxelShape SHAPE_N = Stream.of(Block.box(4, 3, 1.5, 12, 4, 2), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(12, 3, 1, 13, 4, 2), Block.box(3, 3, 1, 4, 4, 2), Block.box(3, 7, 1, 4, 8, 2), Block.box(12, 7, 1, 13, 8, 2), Block.box(4, 10, 0.5, 6, 11, 1), Block.box(4, 13, 0.5, 6, 14, 1), Block.box(3, 11, 0.5, 4, 13, 1), Block.box(6, 11, 0.5, 7, 13, 1), Block.box(4, 11, 0, 6, 13, 1), Block.box(5, 5, 1.5, 6, 6, 2), Block.box(6, 4, 1.5, 7, 5, 2), Block.box(10, 5, 1.5, 11, 6, 2), Block.box(9, 6, 1.5, 10, 7, 2), Block.box(4, 7, 1.5, 12, 8, 2), Block.box(3, 4, 1.5, 4, 7, 2), Block.box(12, 4, 1.5, 13, 7, 2), Block.box(2, 0, 2, 14, 1, 14), Block.box(5, 14, 6, 11, 15, 7), Block.box(5, 14, 8, 11, 15, 9), Block.box(5, 14, 10, 11, 15, 14), Block.box(5, 14, 2, 11, 15, 5), Block.box(11, 14, 2, 14, 15, 14), Block.box(2, 14, 2, 5, 15, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 14, 15, 15, 15), Block.box(3, 8, 1, 13, 15, 2), Block.box(3, 0, 1, 13, 3, 2), Block.box(1, 0, 1, 3, 15, 2), Block.box(13, 0, 1, 15, 15, 2), Block.box(5, 13, 5, 11, 14, 10), Block.box(2, 3, 2, 14, 8, 3), Block.box(0, 0, 15, 1, 1, 16), Block.box(15, 0, 15, 16, 1, 16), Block.box(15, 0, 0, 16, 1, 1), Block.box(0, 0, 0, 1, 1, 1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_E = Stream.of(Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(14, 3, 12, 15, 4, 13), Block.box(14, 3, 3, 15, 4, 4), Block.box(14, 7, 3, 15, 8, 4), Block.box(14, 7, 12, 15, 8, 13), Block.box(15, 10, 4, 15.5, 11, 6), Block.box(15, 13, 4, 15.5, 14, 6), Block.box(15, 11, 3, 15.5, 13, 4), Block.box(15, 11, 6, 15.5, 13, 7), Block.box(15, 11, 4, 16, 13, 6), Block.box(14, 5, 5, 14.5, 6, 6), Block.box(14, 4, 6, 14.5, 5, 7), Block.box(14, 5, 10, 14.5, 6, 11), Block.box(14, 6, 9, 14.5, 7, 10), Block.box(14, 3, 4, 14.5, 4, 12), Block.box(14, 7, 4, 14.5, 8, 12), Block.box(14, 4, 3, 14.5, 7, 4), Block.box(14, 4, 12, 14.5, 7, 13), Block.box(2, 0, 2, 14, 1, 14), Block.box(9, 14, 5, 10, 15, 11), Block.box(7, 14, 5, 8, 15, 11), Block.box(2, 14, 5, 6, 15, 11), Block.box(11, 14, 5, 14, 15, 11), Block.box(2, 14, 11, 14, 15, 14), Block.box(2, 14, 2, 14, 15, 5), Block.box(2, 0, 1, 14, 15, 2), Block.box(2, 0, 14, 14, 15, 15), Block.box(1, 0, 1, 2, 15, 15), Block.box(14, 8, 3, 15, 15, 13), Block.box(14, 0, 3, 15, 3, 13), Block.box(14, 0, 1, 15, 15, 3), Block.box(14, 0, 13, 15, 15, 15), Block.box(6, 13, 5, 11, 14, 11), Block.box(13, 3, 2, 14, 8, 14), Block.box(0, 0, 0, 1, 1, 1), Block.box(0, 0, 15, 1, 1, 16), Block.box(15, 0, 15, 16, 1, 16), Block.box(15, 0, 0, 16, 1, 1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_S = Stream.of(Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(3, 3, 14, 4, 4, 15), Block.box(12, 3, 14, 13, 4, 15), Block.box(12, 7, 14, 13, 8, 15), Block.box(3, 7, 14, 4, 8, 15), Block.box(10, 10, 15, 12, 11, 15.5), Block.box(10, 13, 15, 12, 14, 15.5), Block.box(12, 11, 15, 13, 13, 15.5), Block.box(9, 11, 15, 10, 13, 15.5), Block.box(10, 11, 15, 12, 13, 16), Block.box(10, 5, 14, 11, 6, 14.5), Block.box(9, 4, 14, 10, 5, 14.5), Block.box(5, 5, 14, 6, 6, 14.5), Block.box(6, 6, 14, 7, 7, 14.5), Block.box(4, 3, 14, 12, 4, 14.5), Block.box(4, 7, 14, 12, 8, 14.5), Block.box(12, 4, 14, 13, 7, 14.5), Block.box(3, 4, 14, 4, 7, 14.5), Block.box(2, 0, 2, 14, 1, 14), Block.box(5, 14, 9, 11, 15, 10), Block.box(5, 14, 7, 11, 15, 8), Block.box(5, 14, 2, 11, 15, 6), Block.box(5, 14, 11, 11, 15, 14), Block.box(2, 14, 2, 5, 15, 14), Block.box(11, 14, 2, 14, 15, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(1, 0, 1, 15, 15, 2), Block.box(3, 8, 14, 13, 15, 15), Block.box(3, 0, 14, 13, 3, 15), Block.box(13, 0, 14, 15, 15, 15), Block.box(1, 0, 14, 3, 15, 15), Block.box(5, 13, 6, 11, 14, 11), Block.box(2, 3, 13, 14, 8, 14), Block.box(15, 0, 0, 16, 1, 1), Block.box(0, 0, 0, 1, 1, 1), Block.box(0, 0, 15, 1, 1, 16), Block.box(15, 0, 15, 16, 1, 16)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_W = Stream.of(Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(1, 3, 3, 2, 4, 4), Block.box(1, 3, 12, 2, 4, 13), Block.box(1, 7, 12, 2, 8, 13), Block.box(1, 7, 3, 2, 8, 4), Block.box(0.5, 10, 10, 1, 11, 12), Block.box(0.5, 13, 10, 1, 14, 12), Block.box(0.5, 11, 12, 1, 13, 13), Block.box(0.5, 11, 9, 1, 13, 10), Block.box(0, 11, 10, 1, 13, 12), Block.box(1.5, 5, 10, 2, 6, 11), Block.box(1.5, 4, 9, 2, 5, 10), Block.box(1.5, 5, 5, 2, 6, 6), Block.box(1.5, 6, 6, 2, 7, 7), Block.box(1.5, 3, 4, 2, 4, 12), Block.box(1.5, 7, 4, 2, 8, 12), Block.box(1.5, 4, 12, 2, 7, 13), Block.box(1.5, 4, 3, 2, 7, 4), Block.box(2, 0, 2, 14, 1, 14), Block.box(6, 14, 5, 7, 15, 11), Block.box(8, 14, 5, 9, 15, 11), Block.box(10, 14, 5, 14, 15, 11), Block.box(2, 14, 5, 5, 15, 11), Block.box(2, 14, 2, 14, 15, 5), Block.box(2, 14, 11, 14, 15, 14), Block.box(2, 0, 14, 14, 15, 15), Block.box(2, 0, 1, 14, 15, 2), Block.box(14, 0, 1, 15, 15, 15), Block.box(1, 8, 3, 2, 15, 13), Block.box(1, 0, 3, 2, 3, 13), Block.box(1, 0, 13, 2, 15, 15), Block.box(1, 0, 1, 2, 15, 3), Block.box(5, 13, 5, 10, 14, 11), Block.box(2, 3, 2, 3, 8, 14), Block.box(15, 0, 15, 16, 1, 16), Block.box(15, 0, 0, 16, 1, 1), Block.box(0, 0, 0, 1, 1, 1), Block.box(0, 0, 15, 1, 1, 16)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_N = Stream.of(Block.box(4, 3, 1.5, 12, 4, 2), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(12, 3, 1, 13, 4, 2), Block.box(3, 3, 1, 4, 4, 2), Block.box(3, 7, 1, 4, 8, 2), Block.box(12, 7, 1, 13, 8, 2), Block.box(4, 10, 0.5, 6, 11, 1), Block.box(4, 13, 0.5, 6, 14, 1), Block.box(3, 11, 0.5, 4, 13, 1), Block.box(6, 11, 0.5, 7, 13, 1), Block.box(4, 11, 0, 6, 13, 1), Block.box(5, 5, 1.5, 6, 6, 2), Block.box(6, 4, 1.5, 7, 5, 2), Block.box(10, 5, 1.5, 11, 6, 2), Block.box(9, 6, 1.5, 10, 7, 2), Block.box(4, 7, 1.5, 12, 8, 2), Block.box(3, 4, 1.5, 4, 7, 2), Block.box(12, 4, 1.5, 13, 7, 2), Block.box(2, 0, 2, 14, 1, 14), Block.box(5, 14, 6, 11, 15, 7), Block.box(5, 14, 8, 11, 15, 9), Block.box(5, 14, 10, 11, 15, 14), Block.box(5, 14, 2, 11, 15, 5), Block.box(11, 14, 2, 14, 15, 14), Block.box(2, 14, 2, 5, 15, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 14, 15, 15, 15), Block.box(3, 8, 1, 13, 15, 2), Block.box(3, 0, 1, 13, 3, 2), Block.box(1, 0, 1, 3, 15, 2), Block.box(13, 0, 1, 15, 15, 2), Block.box(5, 13, 5, 11, 14, 10), Block.box(2, 3, 2, 14, 8, 3), Block.box(0, 0, 15, 1, 1, 16), Block.box(15, 0, 15, 16, 1, 16), Block.box(15, 0, 0, 16, 1, 1), Block.box(0, 0, 0, 1, 1, 1)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_E = Stream.of(Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(14, 3, 12, 15, 4, 13), Block.box(14, 3, 3, 15, 4, 4), Block.box(14, 7, 3, 15, 8, 4), Block.box(14, 7, 12, 15, 8, 13), Block.box(15, 10, 4, 15.5, 11, 6), Block.box(15, 13, 4, 15.5, 14, 6), Block.box(15, 11, 3, 15.5, 13, 4), Block.box(15, 11, 6, 15.5, 13, 7), Block.box(15, 11, 4, 16, 13, 6), Block.box(14, 5, 5, 14.5, 6, 6), Block.box(14, 4, 6, 14.5, 5, 7), Block.box(14, 5, 10, 14.5, 6, 11), Block.box(14, 6, 9, 14.5, 7, 10), Block.box(14, 3, 4, 14.5, 4, 12), Block.box(14, 7, 4, 14.5, 8, 12), Block.box(14, 4, 3, 14.5, 7, 4), Block.box(14, 4, 12, 14.5, 7, 13), Block.box(2, 0, 2, 14, 1, 14), Block.box(9, 14, 5, 10, 15, 11), Block.box(7, 14, 5, 8, 15, 11), Block.box(2, 14, 5, 6, 15, 11), Block.box(11, 14, 5, 14, 15, 11), Block.box(2, 14, 11, 14, 15, 14), Block.box(2, 14, 2, 14, 15, 5), Block.box(2, 0, 1, 14, 15, 2), Block.box(2, 0, 14, 14, 15, 15), Block.box(1, 0, 1, 2, 15, 15), Block.box(14, 8, 3, 15, 15, 13), Block.box(14, 0, 3, 15, 3, 13), Block.box(14, 0, 1, 15, 15, 3), Block.box(14, 0, 13, 15, 15, 15), Block.box(6, 13, 5, 11, 14, 11), Block.box(13, 3, 2, 14, 8, 14), Block.box(0, 0, 0, 1, 1, 1), Block.box(0, 0, 15, 1, 1, 16), Block.box(15, 0, 15, 16, 1, 16), Block.box(15, 0, 0, 16, 1, 1)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_S = Stream.of(Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(3, 3, 14, 4, 4, 15), Block.box(12, 3, 14, 13, 4, 15), Block.box(12, 7, 14, 13, 8, 15), Block.box(3, 7, 14, 4, 8, 15), Block.box(10, 10, 15, 12, 11, 15.5), Block.box(10, 13, 15, 12, 14, 15.5), Block.box(12, 11, 15, 13, 13, 15.5), Block.box(9, 11, 15, 10, 13, 15.5), Block.box(10, 11, 15, 12, 13, 16), Block.box(10, 5, 14, 11, 6, 14.5), Block.box(9, 4, 14, 10, 5, 14.5), Block.box(5, 5, 14, 6, 6, 14.5), Block.box(6, 6, 14, 7, 7, 14.5), Block.box(4, 3, 14, 12, 4, 14.5), Block.box(4, 7, 14, 12, 8, 14.5), Block.box(12, 4, 14, 13, 7, 14.5), Block.box(3, 4, 14, 4, 7, 14.5), Block.box(2, 0, 2, 14, 1, 14), Block.box(5, 14, 9, 11, 15, 10), Block.box(5, 14, 7, 11, 15, 8), Block.box(5, 14, 2, 11, 15, 6), Block.box(5, 14, 11, 11, 15, 14), Block.box(2, 14, 2, 5, 15, 14), Block.box(11, 14, 2, 14, 15, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(1, 0, 1, 15, 15, 2), Block.box(3, 8, 14, 13, 15, 15), Block.box(3, 0, 14, 13, 3, 15), Block.box(13, 0, 14, 15, 15, 15), Block.box(1, 0, 14, 3, 15, 15), Block.box(5, 13, 6, 11, 14, 11), Block.box(2, 3, 13, 14, 8, 14), Block.box(15, 0, 0, 16, 1, 1), Block.box(0, 0, 0, 1, 1, 1), Block.box(0, 0, 15, 1, 1, 16), Block.box(15, 0, 15, 16, 1, 16)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_W = Stream.of(Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(1, 3, 3, 2, 4, 4), Block.box(1, 3, 12, 2, 4, 13), Block.box(1, 7, 12, 2, 8, 13), Block.box(1, 7, 3, 2, 8, 4), Block.box(0.5, 10, 10, 1, 11, 12), Block.box(0.5, 13, 10, 1, 14, 12), Block.box(0.5, 11, 12, 1, 13, 13), Block.box(0.5, 11, 9, 1, 13, 10), Block.box(0, 11, 10, 1, 13, 12), Block.box(1.5, 5, 10, 2, 6, 11), Block.box(1.5, 4, 9, 2, 5, 10), Block.box(1.5, 5, 5, 2, 6, 6), Block.box(1.5, 6, 6, 2, 7, 7), Block.box(1.5, 3, 4, 2, 4, 12), Block.box(1.5, 7, 4, 2, 8, 12), Block.box(1.5, 4, 12, 2, 7, 13), Block.box(1.5, 4, 3, 2, 7, 4), Block.box(2, 0, 2, 14, 1, 14), Block.box(6, 14, 5, 7, 15, 11), Block.box(8, 14, 5, 9, 15, 11), Block.box(10, 14, 5, 14, 15, 11), Block.box(2, 14, 5, 5, 15, 11), Block.box(2, 14, 2, 14, 15, 5), Block.box(2, 14, 11, 14, 15, 14), Block.box(2, 0, 14, 14, 15, 15), Block.box(2, 0, 1, 14, 15, 2), Block.box(14, 0, 1, 15, 15, 15), Block.box(1, 8, 3, 2, 15, 13), Block.box(1, 0, 3, 2, 3, 13), Block.box(1, 0, 13, 2, 15, 15), Block.box(1, 0, 1, 2, 15, 3), Block.box(5, 13, 5, 10, 14, 11), Block.box(2, 3, 2, 3, 8, 14), Block.box(15, 0, 15, 16, 1, 16), Block.box(15, 0, 0, 16, 1, 1), Block.box(0, 0, 0, 1, 1, 1), Block.box(0, 0, 15, 1, 1, 16)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } static final class MinerShapes { - static final VoxelShape SHAPE_N = Stream.of(Block.box(0, 1, 15, 1, 15, 16), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(15, 3, 3, 16, 13, 13), Block.box(0, 3, 3, 1, 13, 13), Block.box(4, 11, 4, 12, 12, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(3, 12, 5, 4, 14, 11), Block.box(12, 12, 5, 13, 14, 11), Block.box(5, 12, 3, 11, 14, 4), Block.box(5, 12, 12, 11, 14, 13), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 12, 4, 12, 14, 5), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 12, 11, 5, 14, 12), Block.box(4, 14, 11, 5, 15, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(2, 14, 2, 4, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(4, 14, 12, 12, 15, 14), Block.box(12, 14, 2, 14, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 1, 15, 15, 2), Block.box(1, 0, 14, 15, 15, 15)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_E = Stream.of(Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 0, 15, 16, 1, 16), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(3, 3, 15, 13, 13, 16), Block.box(3, 3, 0, 13, 13, 1), Block.box(4, 11, 4, 12, 12, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(5, 12, 3, 11, 14, 4), Block.box(5, 12, 12, 11, 14, 13), Block.box(12, 12, 5, 13, 14, 11), Block.box(3, 12, 5, 4, 14, 11), Block.box(4, 12, 11, 5, 14, 12), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 12, 4, 12, 14, 5), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(4, 14, 11, 5, 15, 12), Block.box(2, 14, 2, 14, 15, 4), Block.box(12, 14, 4, 14, 15, 12), Block.box(2, 14, 4, 4, 15, 12), Block.box(2, 14, 12, 14, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(2, 0, 1, 14, 15, 2), Block.box(2, 0, 14, 14, 15, 15), Block.box(14, 0, 1, 15, 15, 15), Block.box(1, 0, 1, 2, 15, 15)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_S = Stream.of(Block.box(15, 1, 0, 16, 15, 1), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(0, 3, 3, 1, 13, 13), Block.box(15, 3, 3, 16, 13, 13), Block.box(4, 11, 4, 12, 12, 12), Block.box(4, 14, 11, 5, 15, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(12, 12, 5, 13, 14, 11), Block.box(3, 12, 5, 4, 14, 11), Block.box(5, 12, 12, 11, 14, 13), Block.box(5, 12, 3, 11, 14, 4), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 12, 11, 5, 14, 12), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 12, 4, 12, 14, 5), Block.box(11, 14, 4, 12, 15, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(12, 14, 2, 14, 15, 14), Block.box(4, 14, 12, 12, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(2, 14, 2, 4, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(1, 0, 14, 15, 15, 15), Block.box(1, 0, 1, 15, 15, 2)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_W = Stream.of(Block.box(15, 1, 15, 16, 15, 16), Block.box(0, 0, 15, 16, 1, 16), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(3, 3, 0, 13, 13, 1), Block.box(3, 3, 15, 13, 13, 16), Block.box(4, 11, 4, 12, 12, 12), Block.box(4, 14, 4, 5, 15, 5), Block.box(4, 14, 11, 5, 15, 12), Block.box(5, 12, 12, 11, 14, 13), Block.box(5, 12, 3, 11, 14, 4), Block.box(3, 12, 5, 4, 14, 11), Block.box(12, 12, 5, 13, 14, 11), Block.box(11, 12, 4, 12, 14, 5), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 12, 11, 5, 14, 12), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(2, 14, 12, 14, 15, 14), Block.box(2, 14, 4, 4, 15, 12), Block.box(12, 14, 4, 14, 15, 12), Block.box(2, 14, 2, 14, 15, 4), Block.box(2, 0, 2, 14, 1, 14), Block.box(2, 0, 14, 14, 15, 15), Block.box(2, 0, 1, 14, 15, 2), Block.box(1, 0, 1, 2, 15, 15), Block.box(14, 0, 1, 15, 15, 15)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_N = Stream.of(Block.box(0, 1, 15, 1, 15, 16), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(15, 3, 3, 16, 13, 13), Block.box(0, 3, 3, 1, 13, 13), Block.box(4, 11, 4, 12, 12, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(3, 12, 5, 4, 14, 11), Block.box(12, 12, 5, 13, 14, 11), Block.box(5, 12, 3, 11, 14, 4), Block.box(5, 12, 12, 11, 14, 13), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 12, 4, 12, 14, 5), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 12, 11, 5, 14, 12), Block.box(4, 14, 11, 5, 15, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(2, 14, 2, 4, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(4, 14, 12, 12, 15, 14), Block.box(12, 14, 2, 14, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 1, 15, 15, 2), Block.box(1, 0, 14, 15, 15, 15)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_E = Stream.of(Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 0, 15, 16, 1, 16), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(3, 3, 15, 13, 13, 16), Block.box(3, 3, 0, 13, 13, 1), Block.box(4, 11, 4, 12, 12, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(5, 12, 3, 11, 14, 4), Block.box(5, 12, 12, 11, 14, 13), Block.box(12, 12, 5, 13, 14, 11), Block.box(3, 12, 5, 4, 14, 11), Block.box(4, 12, 11, 5, 14, 12), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 12, 4, 12, 14, 5), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(4, 14, 11, 5, 15, 12), Block.box(2, 14, 2, 14, 15, 4), Block.box(12, 14, 4, 14, 15, 12), Block.box(2, 14, 4, 4, 15, 12), Block.box(2, 14, 12, 14, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(2, 0, 1, 14, 15, 2), Block.box(2, 0, 14, 14, 15, 15), Block.box(14, 0, 1, 15, 15, 15), Block.box(1, 0, 1, 2, 15, 15)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_S = Stream.of(Block.box(15, 1, 0, 16, 15, 1), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(0, 3, 3, 1, 13, 13), Block.box(15, 3, 3, 16, 13, 13), Block.box(4, 11, 4, 12, 12, 12), Block.box(4, 14, 11, 5, 15, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(12, 12, 5, 13, 14, 11), Block.box(3, 12, 5, 4, 14, 11), Block.box(5, 12, 12, 11, 14, 13), Block.box(5, 12, 3, 11, 14, 4), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 12, 11, 5, 14, 12), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 12, 4, 12, 14, 5), Block.box(11, 14, 4, 12, 15, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(12, 14, 2, 14, 15, 14), Block.box(4, 14, 12, 12, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(2, 14, 2, 4, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(1, 0, 14, 15, 15, 15), Block.box(1, 0, 1, 15, 15, 2)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_W = Stream.of(Block.box(15, 1, 15, 16, 15, 16), Block.box(0, 0, 15, 16, 1, 16), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(3, 3, 0, 13, 13, 1), Block.box(3, 3, 15, 13, 13, 16), Block.box(4, 11, 4, 12, 12, 12), Block.box(4, 14, 4, 5, 15, 5), Block.box(4, 14, 11, 5, 15, 12), Block.box(5, 12, 12, 11, 14, 13), Block.box(5, 12, 3, 11, 14, 4), Block.box(3, 12, 5, 4, 14, 11), Block.box(12, 12, 5, 13, 14, 11), Block.box(11, 12, 4, 12, 14, 5), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 12, 11, 5, 14, 12), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(2, 14, 12, 14, 15, 14), Block.box(2, 14, 4, 4, 15, 12), Block.box(12, 14, 4, 14, 15, 12), Block.box(2, 14, 2, 14, 15, 4), Block.box(2, 0, 2, 14, 1, 14), Block.box(2, 0, 14, 14, 15, 15), Block.box(2, 0, 1, 14, 15, 2), Block.box(1, 0, 1, 2, 15, 15), Block.box(14, 0, 1, 15, 15, 15)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } static final class LeafGeneratorShapes { - static final VoxelShape SHAPE_N = Stream.of(Block.box(1, 0, 14, 15, 15, 15), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(5, 11, 0, 11, 12, 1), Block.box(0, 11, 5, 1, 12, 11), Block.box(15, 11, 5, 16, 12, 11), Block.box(5, 4, 0, 11, 5, 1), Block.box(0, 4, 5, 1, 5, 11), Block.box(15, 4, 5, 16, 5, 11), Block.box(4, 4, 0, 5, 12, 1), Block.box(0, 4, 4, 1, 12, 5), Block.box(15, 4, 4, 16, 12, 5), Block.box(11, 4, 0, 12, 12, 1), Block.box(0, 4, 11, 1, 12, 12), Block.box(15, 4, 11, 16, 12, 12), Block.box(4, 13, 4, 12, 14, 12), Block.box(4, 14, 11, 5, 15, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(12, 14, 2, 14, 15, 14), Block.box(4, 14, 12, 12, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(2, 14, 2, 4, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(1, 0, 1, 15, 15, 2), Block.box(1, 0, 2, 2, 5, 14), Block.box(2, 1, 2, 3, 14, 14), Block.box(1, 11, 2, 2, 15, 14), Block.box(1, 5, 2, 2, 11, 5), Block.box(1, 5, 11, 2, 11, 14), Block.box(13, 1, 2, 14, 14, 14), Block.box(14, 11, 2, 15, 15, 14), Block.box(14, 5, 11, 15, 11, 14), Block.box(14, 5, 2, 15, 11, 5), Block.box(14, 0, 2, 15, 5, 14)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_E = Stream.of(Block.box(1, 0, 1, 2, 15, 15), Block.box(0, 0, 15, 16, 1, 16), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 11, 5, 16, 12, 11), Block.box(5, 11, 0, 11, 12, 1), Block.box(5, 11, 15, 11, 12, 16), Block.box(15, 4, 5, 16, 5, 11), Block.box(5, 4, 0, 11, 5, 1), Block.box(5, 4, 15, 11, 5, 16), Block.box(15, 4, 4, 16, 12, 5), Block.box(11, 4, 0, 12, 12, 1), Block.box(11, 4, 15, 12, 12, 16), Block.box(15, 4, 11, 16, 12, 12), Block.box(4, 4, 0, 5, 12, 1), Block.box(4, 4, 15, 5, 12, 16), Block.box(4, 13, 4, 12, 14, 12), Block.box(4, 14, 4, 5, 15, 5), Block.box(4, 14, 11, 5, 15, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(2, 14, 12, 14, 15, 14), Block.box(2, 14, 4, 4, 15, 12), Block.box(12, 14, 4, 14, 15, 12), Block.box(2, 14, 2, 14, 15, 4), Block.box(2, 0, 2, 14, 1, 14), Block.box(14, 0, 1, 15, 15, 15), Block.box(2, 0, 1, 14, 5, 2), Block.box(2, 1, 2, 14, 14, 3), Block.box(2, 11, 1, 14, 15, 2), Block.box(11, 5, 1, 14, 11, 2), Block.box(2, 5, 1, 5, 11, 2), Block.box(2, 1, 13, 14, 14, 14), Block.box(2, 11, 14, 14, 15, 15), Block.box(2, 5, 14, 5, 11, 15), Block.box(11, 5, 14, 14, 11, 15), Block.box(2, 0, 14, 14, 5, 15)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_S = Stream.of(Block.box(1, 0, 1, 15, 15, 2), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(5, 11, 15, 11, 12, 16), Block.box(15, 11, 5, 16, 12, 11), Block.box(0, 11, 5, 1, 12, 11), Block.box(5, 4, 15, 11, 5, 16), Block.box(15, 4, 5, 16, 5, 11), Block.box(0, 4, 5, 1, 5, 11), Block.box(11, 4, 15, 12, 12, 16), Block.box(15, 4, 11, 16, 12, 12), Block.box(0, 4, 11, 1, 12, 12), Block.box(4, 4, 15, 5, 12, 16), Block.box(15, 4, 4, 16, 12, 5), Block.box(0, 4, 4, 1, 12, 5), Block.box(4, 13, 4, 12, 14, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(4, 14, 11, 5, 15, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(2, 14, 2, 4, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(4, 14, 12, 12, 15, 14), Block.box(12, 14, 2, 14, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(1, 0, 14, 15, 15, 15), Block.box(14, 0, 2, 15, 5, 14), Block.box(13, 1, 2, 14, 14, 14), Block.box(14, 11, 2, 15, 15, 14), Block.box(14, 5, 11, 15, 11, 14), Block.box(14, 5, 2, 15, 11, 5), Block.box(2, 1, 2, 3, 14, 14), Block.box(1, 11, 2, 2, 15, 14), Block.box(1, 5, 2, 2, 11, 5), Block.box(1, 5, 11, 2, 11, 14), Block.box(1, 0, 2, 2, 5, 14)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_W = Stream.of(Block.box(14, 0, 1, 15, 15, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 0, 15, 16, 1, 16), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 11, 5, 1, 12, 11), Block.box(5, 11, 15, 11, 12, 16), Block.box(5, 11, 0, 11, 12, 1), Block.box(0, 4, 5, 1, 5, 11), Block.box(5, 4, 15, 11, 5, 16), Block.box(5, 4, 0, 11, 5, 1), Block.box(0, 4, 11, 1, 12, 12), Block.box(4, 4, 15, 5, 12, 16), Block.box(4, 4, 0, 5, 12, 1), Block.box(0, 4, 4, 1, 12, 5), Block.box(11, 4, 15, 12, 12, 16), Block.box(11, 4, 0, 12, 12, 1), Block.box(4, 13, 4, 12, 14, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(4, 14, 11, 5, 15, 12), Block.box(2, 14, 2, 14, 15, 4), Block.box(12, 14, 4, 14, 15, 12), Block.box(2, 14, 4, 4, 15, 12), Block.box(2, 14, 12, 14, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(1, 0, 1, 2, 15, 15), Block.box(2, 0, 14, 14, 5, 15), Block.box(2, 1, 13, 14, 14, 14), Block.box(2, 11, 14, 14, 15, 15), Block.box(2, 5, 14, 5, 11, 15), Block.box(11, 5, 14, 14, 11, 15), Block.box(2, 1, 2, 14, 14, 3), Block.box(2, 11, 1, 14, 15, 2), Block.box(11, 5, 1, 14, 11, 2), Block.box(2, 5, 1, 5, 11, 2), Block.box(2, 0, 1, 14, 5, 2)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_N = Stream.of(Block.box(1, 0, 14, 15, 15, 15), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(5, 11, 0, 11, 12, 1), Block.box(0, 11, 5, 1, 12, 11), Block.box(15, 11, 5, 16, 12, 11), Block.box(5, 4, 0, 11, 5, 1), Block.box(0, 4, 5, 1, 5, 11), Block.box(15, 4, 5, 16, 5, 11), Block.box(4, 4, 0, 5, 12, 1), Block.box(0, 4, 4, 1, 12, 5), Block.box(15, 4, 4, 16, 12, 5), Block.box(11, 4, 0, 12, 12, 1), Block.box(0, 4, 11, 1, 12, 12), Block.box(15, 4, 11, 16, 12, 12), Block.box(4, 13, 4, 12, 14, 12), Block.box(4, 14, 11, 5, 15, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(12, 14, 2, 14, 15, 14), Block.box(4, 14, 12, 12, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(2, 14, 2, 4, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(1, 0, 1, 15, 15, 2), Block.box(1, 0, 2, 2, 5, 14), Block.box(2, 1, 2, 3, 14, 14), Block.box(1, 11, 2, 2, 15, 14), Block.box(1, 5, 2, 2, 11, 5), Block.box(1, 5, 11, 2, 11, 14), Block.box(13, 1, 2, 14, 14, 14), Block.box(14, 11, 2, 15, 15, 14), Block.box(14, 5, 11, 15, 11, 14), Block.box(14, 5, 2, 15, 11, 5), Block.box(14, 0, 2, 15, 5, 14)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_E = Stream.of(Block.box(1, 0, 1, 2, 15, 15), Block.box(0, 0, 15, 16, 1, 16), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 11, 5, 16, 12, 11), Block.box(5, 11, 0, 11, 12, 1), Block.box(5, 11, 15, 11, 12, 16), Block.box(15, 4, 5, 16, 5, 11), Block.box(5, 4, 0, 11, 5, 1), Block.box(5, 4, 15, 11, 5, 16), Block.box(15, 4, 4, 16, 12, 5), Block.box(11, 4, 0, 12, 12, 1), Block.box(11, 4, 15, 12, 12, 16), Block.box(15, 4, 11, 16, 12, 12), Block.box(4, 4, 0, 5, 12, 1), Block.box(4, 4, 15, 5, 12, 16), Block.box(4, 13, 4, 12, 14, 12), Block.box(4, 14, 4, 5, 15, 5), Block.box(4, 14, 11, 5, 15, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(2, 14, 12, 14, 15, 14), Block.box(2, 14, 4, 4, 15, 12), Block.box(12, 14, 4, 14, 15, 12), Block.box(2, 14, 2, 14, 15, 4), Block.box(2, 0, 2, 14, 1, 14), Block.box(14, 0, 1, 15, 15, 15), Block.box(2, 0, 1, 14, 5, 2), Block.box(2, 1, 2, 14, 14, 3), Block.box(2, 11, 1, 14, 15, 2), Block.box(11, 5, 1, 14, 11, 2), Block.box(2, 5, 1, 5, 11, 2), Block.box(2, 1, 13, 14, 14, 14), Block.box(2, 11, 14, 14, 15, 15), Block.box(2, 5, 14, 5, 11, 15), Block.box(11, 5, 14, 14, 11, 15), Block.box(2, 0, 14, 14, 5, 15)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_S = Stream.of(Block.box(1, 0, 1, 15, 15, 2), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(5, 11, 15, 11, 12, 16), Block.box(15, 11, 5, 16, 12, 11), Block.box(0, 11, 5, 1, 12, 11), Block.box(5, 4, 15, 11, 5, 16), Block.box(15, 4, 5, 16, 5, 11), Block.box(0, 4, 5, 1, 5, 11), Block.box(11, 4, 15, 12, 12, 16), Block.box(15, 4, 11, 16, 12, 12), Block.box(0, 4, 11, 1, 12, 12), Block.box(4, 4, 15, 5, 12, 16), Block.box(15, 4, 4, 16, 12, 5), Block.box(0, 4, 4, 1, 12, 5), Block.box(4, 13, 4, 12, 14, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(4, 14, 11, 5, 15, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(2, 14, 2, 4, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(4, 14, 12, 12, 15, 14), Block.box(12, 14, 2, 14, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(1, 0, 14, 15, 15, 15), Block.box(14, 0, 2, 15, 5, 14), Block.box(13, 1, 2, 14, 14, 14), Block.box(14, 11, 2, 15, 15, 14), Block.box(14, 5, 11, 15, 11, 14), Block.box(14, 5, 2, 15, 11, 5), Block.box(2, 1, 2, 3, 14, 14), Block.box(1, 11, 2, 2, 15, 14), Block.box(1, 5, 2, 2, 11, 5), Block.box(1, 5, 11, 2, 11, 14), Block.box(1, 0, 2, 2, 5, 14)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_W = Stream.of(Block.box(14, 0, 1, 15, 15, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 0, 15, 16, 1, 16), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 11, 5, 1, 12, 11), Block.box(5, 11, 15, 11, 12, 16), Block.box(5, 11, 0, 11, 12, 1), Block.box(0, 4, 5, 1, 5, 11), Block.box(5, 4, 15, 11, 5, 16), Block.box(5, 4, 0, 11, 5, 1), Block.box(0, 4, 11, 1, 12, 12), Block.box(4, 4, 15, 5, 12, 16), Block.box(4, 4, 0, 5, 12, 1), Block.box(0, 4, 4, 1, 12, 5), Block.box(11, 4, 15, 12, 12, 16), Block.box(11, 4, 0, 12, 12, 1), Block.box(4, 13, 4, 12, 14, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(4, 14, 11, 5, 15, 12), Block.box(2, 14, 2, 14, 15, 4), Block.box(12, 14, 4, 14, 15, 12), Block.box(2, 14, 4, 4, 15, 12), Block.box(2, 14, 12, 14, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(1, 0, 1, 2, 15, 15), Block.box(2, 0, 14, 14, 5, 15), Block.box(2, 1, 13, 14, 14, 14), Block.box(2, 11, 14, 14, 15, 15), Block.box(2, 5, 14, 5, 11, 15), Block.box(11, 5, 14, 14, 11, 15), Block.box(2, 1, 2, 14, 14, 3), Block.box(2, 11, 1, 14, 15, 2), Block.box(11, 5, 1, 14, 11, 2), Block.box(2, 5, 1, 5, 11, 2), Block.box(2, 0, 1, 14, 5, 2)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } static final class LavaFactoryShapes { - static final VoxelShape SHAPE_N = Stream.of(Block.box(0, 0, 0, 1, 1, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(15, 0, 0, 16, 1, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(12, 15, 5, 13, 16, 11), Block.box(3, 15, 5, 4, 16, 11), Block.box(11, 14, 11, 12, 16, 12), Block.box(11, 14, 4, 12, 16, 5), Block.box(4, 14, 11, 5, 16, 12), Block.box(4, 14, 4, 5, 16, 5), Block.box(4, 13, 4, 12, 14, 12), Block.box(4, 14, 12, 12, 15, 15), Block.box(4, 14, 1, 12, 15, 4), Block.box(1, 14, 1, 4, 15, 15), Block.box(12, 14, 1, 15, 15, 15), Block.box(1, 1, 1, 15, 2, 15), Block.box(14, 2, 1, 15, 14, 15), Block.box(1, 2, 1, 2, 14, 15), Block.box(2, 2, 14, 14, 14, 15), Block.box(2, 2, 1, 14, 14, 2), Block.box(5, 15, 3, 11, 16, 4), Block.box(5, 15, 12, 11, 16, 13)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_E = Stream.of(Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(5, 15, 12, 11, 16, 13), Block.box(5, 15, 3, 11, 16, 4), Block.box(4, 14, 11, 5, 16, 12), Block.box(11, 14, 11, 12, 16, 12), Block.box(4, 14, 4, 5, 16, 5), Block.box(11, 14, 4, 12, 16, 5), Block.box(4, 13, 4, 12, 14, 12), Block.box(1, 14, 4, 4, 15, 12), Block.box(12, 14, 4, 15, 15, 12), Block.box(1, 14, 1, 15, 15, 4), Block.box(1, 14, 12, 15, 15, 15), Block.box(1, 1, 1, 15, 2, 15), Block.box(1, 2, 14, 15, 14, 15), Block.box(1, 2, 1, 15, 14, 2), Block.box(1, 2, 2, 2, 14, 14), Block.box(14, 2, 2, 15, 14, 14), Block.box(12, 15, 5, 13, 16, 11), Block.box(3, 15, 5, 4, 16, 11)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_S = Stream.of(Block.box(15, 0, 0, 16, 1, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 0, 0, 15, 1, 1), Block.box(1, 0, 15, 15, 1, 16), Block.box(0, 0, 0, 1, 1, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(3, 15, 5, 4, 16, 11), Block.box(12, 15, 5, 13, 16, 11), Block.box(4, 14, 4, 5, 16, 5), Block.box(4, 14, 11, 5, 16, 12), Block.box(11, 14, 4, 12, 16, 5), Block.box(11, 14, 11, 12, 16, 12), Block.box(4, 13, 4, 12, 14, 12), Block.box(4, 14, 1, 12, 15, 4), Block.box(4, 14, 12, 12, 15, 15), Block.box(12, 14, 1, 15, 15, 15), Block.box(1, 14, 1, 4, 15, 15), Block.box(1, 1, 1, 15, 2, 15), Block.box(1, 2, 1, 2, 14, 15), Block.box(14, 2, 1, 15, 14, 15), Block.box(2, 2, 1, 14, 14, 2), Block.box(2, 2, 14, 14, 14, 15), Block.box(5, 15, 12, 11, 16, 13), Block.box(5, 15, 3, 11, 16, 4)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_W = Stream.of(Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(5, 15, 3, 11, 16, 4), Block.box(5, 15, 12, 11, 16, 13), Block.box(11, 14, 4, 12, 16, 5), Block.box(4, 14, 4, 5, 16, 5), Block.box(11, 14, 11, 12, 16, 12), Block.box(4, 14, 11, 5, 16, 12), Block.box(4, 13, 4, 12, 14, 12), Block.box(12, 14, 4, 15, 15, 12), Block.box(1, 14, 4, 4, 15, 12), Block.box(1, 14, 12, 15, 15, 15), Block.box(1, 14, 1, 15, 15, 4), Block.box(1, 1, 1, 15, 2, 15), Block.box(1, 2, 1, 15, 14, 2), Block.box(1, 2, 14, 15, 14, 15), Block.box(14, 2, 2, 15, 14, 14), Block.box(1, 2, 2, 2, 14, 14), Block.box(3, 15, 5, 4, 16, 11), Block.box(12, 15, 5, 13, 16, 11)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_N = Stream.of(Block.box(0, 0, 0, 1, 1, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(15, 0, 0, 16, 1, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(12, 15, 5, 13, 16, 11), Block.box(3, 15, 5, 4, 16, 11), Block.box(11, 14, 11, 12, 16, 12), Block.box(11, 14, 4, 12, 16, 5), Block.box(4, 14, 11, 5, 16, 12), Block.box(4, 14, 4, 5, 16, 5), Block.box(4, 13, 4, 12, 14, 12), Block.box(4, 14, 12, 12, 15, 15), Block.box(4, 14, 1, 12, 15, 4), Block.box(1, 14, 1, 4, 15, 15), Block.box(12, 14, 1, 15, 15, 15), Block.box(1, 1, 1, 15, 2, 15), Block.box(14, 2, 1, 15, 14, 15), Block.box(1, 2, 1, 2, 14, 15), Block.box(2, 2, 14, 14, 14, 15), Block.box(2, 2, 1, 14, 14, 2), Block.box(5, 15, 3, 11, 16, 4), Block.box(5, 15, 12, 11, 16, 13)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_E = Stream.of(Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(5, 15, 12, 11, 16, 13), Block.box(5, 15, 3, 11, 16, 4), Block.box(4, 14, 11, 5, 16, 12), Block.box(11, 14, 11, 12, 16, 12), Block.box(4, 14, 4, 5, 16, 5), Block.box(11, 14, 4, 12, 16, 5), Block.box(4, 13, 4, 12, 14, 12), Block.box(1, 14, 4, 4, 15, 12), Block.box(12, 14, 4, 15, 15, 12), Block.box(1, 14, 1, 15, 15, 4), Block.box(1, 14, 12, 15, 15, 15), Block.box(1, 1, 1, 15, 2, 15), Block.box(1, 2, 14, 15, 14, 15), Block.box(1, 2, 1, 15, 14, 2), Block.box(1, 2, 2, 2, 14, 14), Block.box(14, 2, 2, 15, 14, 14), Block.box(12, 15, 5, 13, 16, 11), Block.box(3, 15, 5, 4, 16, 11)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_S = Stream.of(Block.box(15, 0, 0, 16, 1, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 0, 0, 15, 1, 1), Block.box(1, 0, 15, 15, 1, 16), Block.box(0, 0, 0, 1, 1, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(3, 15, 5, 4, 16, 11), Block.box(12, 15, 5, 13, 16, 11), Block.box(4, 14, 4, 5, 16, 5), Block.box(4, 14, 11, 5, 16, 12), Block.box(11, 14, 4, 12, 16, 5), Block.box(11, 14, 11, 12, 16, 12), Block.box(4, 13, 4, 12, 14, 12), Block.box(4, 14, 1, 12, 15, 4), Block.box(4, 14, 12, 12, 15, 15), Block.box(12, 14, 1, 15, 15, 15), Block.box(1, 14, 1, 4, 15, 15), Block.box(1, 1, 1, 15, 2, 15), Block.box(1, 2, 1, 2, 14, 15), Block.box(14, 2, 1, 15, 14, 15), Block.box(2, 2, 1, 14, 14, 2), Block.box(2, 2, 14, 14, 14, 15), Block.box(5, 15, 12, 11, 16, 13), Block.box(5, 15, 3, 11, 16, 4)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_W = Stream.of(Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(5, 15, 3, 11, 16, 4), Block.box(5, 15, 12, 11, 16, 13), Block.box(11, 14, 4, 12, 16, 5), Block.box(4, 14, 4, 5, 16, 5), Block.box(11, 14, 11, 12, 16, 12), Block.box(4, 14, 11, 5, 16, 12), Block.box(4, 13, 4, 12, 14, 12), Block.box(12, 14, 4, 15, 15, 12), Block.box(1, 14, 4, 4, 15, 12), Block.box(1, 14, 12, 15, 15, 15), Block.box(1, 14, 1, 15, 15, 4), Block.box(1, 1, 1, 15, 2, 15), Block.box(1, 2, 1, 15, 14, 2), Block.box(1, 2, 14, 15, 14, 15), Block.box(14, 2, 2, 15, 14, 14), Block.box(1, 2, 2, 2, 14, 14), Block.box(3, 15, 5, 4, 16, 11), Block.box(12, 15, 5, 13, 16, 11)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } public static final VoxelShape FEEDER_SHAPE = ShapeBuilder.get() @@ -136,12 +137,12 @@ public class Shapes { .standardReduceBuild().get(); static final class LaserRelayShapes { - static final VoxelShape SHAPE_U = Stream.of(Block.box(1, 0, 1, 15, 1, 15), Block.box(3, 1, 3, 13, 5, 13), Block.box(7, 4, 7, 9, 10, 9)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_D = Stream.of(Block.box(1, 15, 1, 15, 16, 15), Block.box(3, 11, 3, 13, 15, 13), Block.box(7, 6, 7, 9, 12, 9)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_N = Stream.of(Block.box(1, 1, 15, 15, 15, 16), Block.box(3, 3, 11, 13, 13, 15), Block.box(7, 7, 6, 9, 9, 12)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_E = Stream.of(Block.box(0, 1, 1, 1, 15, 15), Block.box(1, 3, 3, 5, 13, 13), Block.box(4, 7, 7, 10, 9, 9)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_S = Stream.of(Block.box(1, 1, 0, 15, 15, 1), Block.box(3, 3, 1, 13, 13, 5), Block.box(7, 7, 4, 9, 9, 10)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_W = Stream.of(Block.box(15, 1, 1, 16, 15, 15), Block.box(11, 3, 3, 15, 13, 13), Block.box(6, 7, 7, 12, 9, 9)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_U = Stream.of(Block.box(1, 0, 1, 15, 1, 15), Block.box(3, 1, 3, 13, 5, 13), Block.box(7, 4, 7, 9, 10, 9)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_D = Stream.of(Block.box(1, 15, 1, 15, 16, 15), Block.box(3, 11, 3, 13, 15, 13), Block.box(7, 6, 7, 9, 12, 9)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_N = Stream.of(Block.box(1, 1, 15, 15, 15, 16), Block.box(3, 3, 11, 13, 13, 15), Block.box(7, 7, 6, 9, 9, 12)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_E = Stream.of(Block.box(0, 1, 1, 1, 15, 15), Block.box(1, 3, 3, 5, 13, 13), Block.box(4, 7, 7, 10, 9, 9)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_S = Stream.of(Block.box(1, 1, 0, 15, 15, 1), Block.box(3, 3, 1, 13, 13, 5), Block.box(7, 7, 4, 9, 9, 10)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); + static final VoxelShape SHAPE_W = Stream.of(Block.box(15, 1, 1, 16, 15, 15), Block.box(11, 3, 3, 15, 13, 13), Block.box(6, 7, 7, 12, 9, 9)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } public static class ShapeBuilder { @@ -157,7 +158,7 @@ public class Shapes { } public Optional standardReduceBuild() { - return this.shapes.build().reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)); + return this.shapes.build().reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)); } public static ShapeBuilder get() { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/AACrops.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/AACrops.java index 9f1b5ce12..a4f70df7f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/AACrops.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/AACrops.java @@ -1,12 +1,12 @@ package de.ellpeck.actuallyadditions.mod.blocks.base; -import net.minecraft.block.CropsBlock; -import net.minecraft.item.Item; -import net.minecraft.util.IItemProvider; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.ItemLike; +import net.minecraft.world.level.block.CropBlock; import java.util.function.Supplier; -public class AACrops extends CropsBlock { +public class AACrops extends CropBlock { Supplier itemSupplier; public AACrops(Properties p_i48421_1_, Supplier seedSupplier) { super(p_i48421_1_); @@ -14,7 +14,7 @@ public class AACrops extends CropsBlock { } @Override - protected IItemProvider getBaseSeedId() { + protected ItemLike getBaseSeedId() { return this.itemSupplier.get(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java index 372573806..a90287dfb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java @@ -11,10 +11,8 @@ package de.ellpeck.actuallyadditions.mod.blocks.base; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import net.minecraft.block.Block; -import net.minecraft.item.Item; - -import net.minecraft.block.AbstractBlock.Properties; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; public class BlockBase extends Block { public BlockBase(Properties properties) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java index 709f9dcba..ded3dfaab 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java @@ -10,10 +10,8 @@ package de.ellpeck.actuallyadditions.mod.blocks.base; -import net.minecraft.block.BushBlock; -import net.minecraft.block.SoundType; - -import net.minecraft.block.AbstractBlock.Properties; +import net.minecraft.world.level.block.BushBlock; +import net.minecraft.world.level.block.SoundType; public class BlockBushBase extends BushBlock { public BlockBushBase(Properties properties) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java index c7c939b55..9b1ae9f20 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java @@ -12,59 +12,57 @@ package de.ellpeck.actuallyadditions.mod.blocks.base; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.config.CommonConfig; -import de.ellpeck.actuallyadditions.mod.config.ConfigValues; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityInventoryBase; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.Block; -import net.minecraft.block.BlockRenderType; -import net.minecraft.block.BlockState; -import net.minecraft.block.ContainerBlock; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.inventory.container.INamedContainerProvider; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.IWorldReader; -import net.minecraft.world.World; -import net.minecraft.world.server.ServerWorld; +import net.minecraft.ChatFormatting; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +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.EntityBlock; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.fluids.FluidUtil; import net.minecraftforge.fluids.capability.templates.FluidTank; -import net.minecraftforge.fml.network.NetworkHooks; +import net.minecraftforge.network.NetworkHooks; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.Random; -public abstract class BlockContainerBase extends Block { +public abstract class BlockContainerBase extends Block implements EntityBlock { public BlockContainerBase(Properties properties) { super(properties); } - public ActionResultType openGui(World world, PlayerEntity player, BlockPos pos, Class expectedInstance) { + public InteractionResult openGui(Level world, Player player, BlockPos pos, Class expectedInstance) { if (!world.isClientSide) { - TileEntity tile = world.getBlockEntity(pos); + BlockEntity tile = world.getBlockEntity(pos); if (expectedInstance.isInstance(tile)) { - NetworkHooks.openGui((ServerPlayerEntity) player, (INamedContainerProvider) tile, pos); + NetworkHooks.openGui((ServerPlayer) player, (MenuProvider) tile, pos); } - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; } - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; } - private void dropInventory(World world, BlockPos position) { + private void dropInventory(Level world, BlockPos position) { if (!world.isClientSide) { - TileEntity aTile = world.getBlockEntity(position); + BlockEntity aTile = world.getBlockEntity(position); if (aTile instanceof TileEntityInventoryBase) { TileEntityInventoryBase tile = (TileEntityInventoryBase) aTile; if (tile.inv.getSlots() > 0) { @@ -76,7 +74,7 @@ public abstract class BlockContainerBase extends Block { } } - private void dropSlotFromInventory(int i, TileEntityInventoryBase tile, World world, BlockPos pos) { + private void dropSlotFromInventory(int i, TileEntityInventoryBase tile, Level world, BlockPos pos) { ItemStack stack = tile.inv.getStackInSlot(i); if (stack.isEmpty()) { return; @@ -91,10 +89,10 @@ public abstract class BlockContainerBase extends Block { world.addFreshEntity(entityItem); } - public boolean tryToggleRedstone(World world, BlockPos pos, PlayerEntity player) { + public boolean tryToggleRedstone(Level world, BlockPos pos, Player player) { ItemStack stack = player.getMainHandItem(); if (stack.getItem() == CommonConfig.Other.redstoneConfigureItem) { - TileEntity tile = world.getBlockEntity(pos); + BlockEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityBase) { TileEntityBase base = (TileEntityBase) tile; if (!world.isClientSide && base.isRedstoneToggle()) { @@ -109,9 +107,9 @@ public abstract class BlockContainerBase extends Block { } @Override - public void tick(@Nonnull BlockState state, ServerWorld world, @Nonnull BlockPos pos, @Nonnull Random rand) { + public void tick(@Nonnull BlockState state, ServerLevel world, @Nonnull BlockPos pos, @Nonnull Random rand) { if (!world.isClientSide) { - TileEntity tile = world.getBlockEntity(pos); + BlockEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityBase) { TileEntityBase base = (TileEntityBase) tile; if (base.respondsToPulses()) { @@ -121,10 +119,10 @@ public abstract class BlockContainerBase extends Block { } } - public void neighborsChangedCustom(World world, BlockPos pos) { + public void neighborsChangedCustom(Level world, BlockPos pos) { this.updateRedstoneState(world, pos); - TileEntity tile = world.getBlockEntity(pos); + BlockEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityBase) { TileEntityBase base = (TileEntityBase) tile; if (base.shouldSaveDataOnChangeOrWorldStart()) { @@ -134,21 +132,21 @@ public abstract class BlockContainerBase extends Block { } @Override //TODO do we need this? - public void neighborChanged(@Nonnull BlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull Block blockIn, @Nonnull BlockPos fromPos, boolean isMoving) { + public void neighborChanged(@Nonnull BlockState state, @Nonnull Level worldIn, @Nonnull BlockPos pos, @Nonnull Block blockIn, @Nonnull BlockPos fromPos, boolean isMoving) { this.neighborsChangedCustom(worldIn, pos); } @Override - public void onNeighborChange(BlockState state, IWorldReader world, BlockPos pos, BlockPos neighbor) { + public void onNeighborChange(BlockState state, LevelReader world, BlockPos pos, BlockPos neighbor) { super.onNeighborChange(state, world, pos, neighbor); - if (world instanceof World) { //TODO what? - this.neighborsChangedCustom((World) world, pos); + if (world instanceof Level) { //TODO what? + this.neighborsChangedCustom((Level) world, pos); } } - public void updateRedstoneState(World world, BlockPos pos) { + public void updateRedstoneState(Level world, BlockPos pos) { if (!world.isClientSide) { - TileEntity tile = world.getBlockEntity(pos); + BlockEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityBase) { TileEntityBase base = (TileEntityBase) tile; boolean powered = world.getBestNeighborSignal(pos) > 0; @@ -168,36 +166,36 @@ public abstract class BlockContainerBase extends Block { } } - protected boolean tryUseItemOnTank(PlayerEntity player, Hand hand, FluidTank tank) { + protected boolean tryUseItemOnTank(Player player, InteractionHand hand, FluidTank tank) { ItemStack heldItem = player.getItemInHand(hand); return StackUtil.isValid(heldItem) && FluidUtil.interactWithFluidHandler(player, hand, tank); } @Override - public void onPlace(@Nonnull BlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull BlockState oldState, boolean isMoving) { + public void onPlace(@Nonnull BlockState state, @Nonnull Level worldIn, @Nonnull BlockPos pos, @Nonnull BlockState oldState, boolean isMoving) { this.updateRedstoneState(worldIn, pos); } @Override - public void setPlacedBy(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { + public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { if (stack.hasTag()) { - TileEntity tile = world.getBlockEntity(pos); + BlockEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityBase) { TileEntityBase base = (TileEntityBase) tile; - CompoundNBT compound = stack.getOrCreateTag().getCompound("Data"); + CompoundTag compound = stack.getOrCreateTag().getCompound("Data"); base.readSyncableNBT(compound, TileEntityBase.NBTType.SAVE_BLOCK); } } } @Override - public void playerWillDestroy(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState state, PlayerEntity player) { + public void playerWillDestroy(@Nonnull Level world, @Nonnull BlockPos pos, @Nonnull BlockState state, Player player) { super.playerWillDestroy(world, pos, state, player); if (!player.isCreative()) { - TileEntity tile = world.getBlockEntity(pos); + BlockEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityBase && ((TileEntityBase) tile).stopFromDropping) { - player.displayClientMessage(new TranslationTextComponent("info." + ActuallyAdditions.MODID + ".machineBroke").withStyle(TextFormatting.RED), false); + player.displayClientMessage(new TranslatableComponent("info." + ActuallyAdditions.MODID + ".machineBroke").withStyle(ChatFormatting.RED), false); } } } @@ -208,8 +206,8 @@ public abstract class BlockContainerBase extends Block { } @Override - public int getAnalogOutputSignal(BlockState state, World world, BlockPos pos) { - TileEntity tile = world.getBlockEntity(pos); + public int getAnalogOutputSignal(BlockState state, Level world, BlockPos pos) { + BlockEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityBase) { return ((TileEntityBase) tile).getComparatorStrength(); } @@ -266,12 +264,12 @@ public abstract class BlockContainerBase extends Block { @Override - public BlockRenderType getRenderShape(BlockState pState) { - return BlockRenderType.MODEL; + public RenderShape getRenderShape(BlockState pState) { + return RenderShape.MODEL; } @Override - public void onRemove(BlockState state, World world, BlockPos pos, BlockState newState, boolean isMoving) { + public void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean isMoving) { if (state.getBlock() != newState.getBlock()) { if (this.shouldDropInventory(world, pos)) { this.dropInventory(world, pos); @@ -280,7 +278,7 @@ public abstract class BlockContainerBase extends Block { super.onRemove(state, world, pos, newState, isMoving); } - public boolean shouldDropInventory(World world, BlockPos pos) { + public boolean shouldDropInventory(Level world, BlockPos pos) { return true; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockFluidFlowing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockFluidFlowing.java index 898492fdb..962dbaae3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockFluidFlowing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockFluidFlowing.java @@ -10,9 +10,6 @@ package de.ellpeck.actuallyadditions.mod.blocks.base; -import net.minecraft.block.material.Material; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; /* public class BlockFluidFlowing extends BlockFluidClassic implements ItemBlockBase.ICustomRarity { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java index eb212d6c2..1558750ab 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java @@ -11,29 +11,29 @@ package de.ellpeck.actuallyadditions.mod.blocks.base; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.CropsBlock; -import net.minecraft.block.SoundType; -import net.minecraft.block.material.Material; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.IItemProvider; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; -import net.minecraft.world.server.ServerWorld; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.ItemLike; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.CropBlock; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.Material; +import net.minecraft.world.phys.BlockHitResult; import net.minecraftforge.common.PlantType; import net.minecraftforge.items.ItemHandlerHelper; import java.util.List; import java.util.function.Supplier; -public class BlockPlant extends CropsBlock { +public class BlockPlant extends CropBlock { public Supplier seedItem; // Stolen from potato for now @@ -52,7 +52,7 @@ public class BlockPlant extends CropsBlock { } @Override - public PlantType getPlantType(IBlockReader world, BlockPos pos) { + public PlantType getPlantType(BlockGetter world, BlockPos pos) { return PlantType.CROP; } // @@ -65,13 +65,13 @@ public class BlockPlant extends CropsBlock { @Override - public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { if (this.getAge(state) < 7) { - return ActionResultType.PASS; + return InteractionResult.PASS; } if (!world.isClientSide) { - List drops = Block.getDrops(state, (ServerWorld) world, pos, null); + List drops = Block.getDrops(state, (ServerLevel) world, pos, null); boolean deductedSeedSize = false; for (ItemStack drop : drops) { if (StackUtil.isValid(drop)) { @@ -92,7 +92,7 @@ public class BlockPlant extends CropsBlock { } @Override - protected IItemProvider getBaseSeedId() { + protected ItemLike getBaseSeedId() { return this.seedItem.get(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/DirectionalBlock.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/DirectionalBlock.java index 7c814125b..24220cf7a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/DirectionalBlock.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/DirectionalBlock.java @@ -1,14 +1,12 @@ package de.ellpeck.actuallyadditions.mod.blocks.base; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.item.BlockItemUseContext; -import net.minecraft.state.DirectionProperty; -import net.minecraft.state.StateContainer; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.util.Direction; - -import net.minecraft.block.AbstractBlock.Properties; +import net.minecraft.core.Direction; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.DirectionProperty; /** * Wrapper for Directional block states extending from our base blocks. It's not super nice but it'll do. @@ -21,12 +19,12 @@ public abstract class DirectionalBlock extends BlockBase { } @Override - public BlockState getStateForPlacement(BlockItemUseContext context) { + public BlockState getStateForPlacement(BlockPlaceContext context) { return this.defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite()); } @Override - protected void createBlockStateDefinition(StateContainer.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FACING); } @@ -40,12 +38,12 @@ public abstract class DirectionalBlock extends BlockBase { } @Override - public BlockState getStateForPlacement(BlockItemUseContext context) { + public BlockState getStateForPlacement(BlockPlaceContext context) { return this.defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite()); } @Override - protected void createBlockStateDefinition(StateContainer.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FACING); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/FullyDirectionalBlock.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/FullyDirectionalBlock.java index fee383377..8f1bde8f7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/FullyDirectionalBlock.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/FullyDirectionalBlock.java @@ -1,12 +1,12 @@ package de.ellpeck.actuallyadditions.mod.blocks.base; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.item.BlockItemUseContext; -import net.minecraft.state.DirectionProperty; -import net.minecraft.state.StateContainer; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.util.Direction; +import net.minecraft.core.Direction; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.DirectionProperty; /** * Wrapper for Fully Direction block states extending from our base blocks. It's not super nice but it'll do. @@ -20,7 +20,7 @@ public abstract class FullyDirectionalBlock extends BlockBase { } @Override - public BlockState getStateForPlacement(BlockItemUseContext context) { + public BlockState getStateForPlacement(BlockPlaceContext context) { return this.defaultBlockState().setValue(FACING, context.getNearestLookingDirection().getOpposite()); } @@ -30,7 +30,7 @@ public abstract class FullyDirectionalBlock extends BlockBase { } @Override - protected void createBlockStateDefinition(StateContainer.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FACING); } @@ -44,12 +44,12 @@ public abstract class FullyDirectionalBlock extends BlockBase { } @Override - public BlockState getStateForPlacement(BlockItemUseContext context) { + public BlockState getStateForPlacement(BlockPlaceContext context) { return this.defaultBlockState().setValue(FACING, context.getNearestLookingDirection().getOpposite()); } @Override - protected void createBlockStateDefinition(StateContainer.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FACING); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/ItemBlockBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/ItemBlockBase.java index 197a2961e..7cc6f2cba 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/ItemBlockBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/ItemBlockBase.java @@ -10,9 +10,9 @@ package de.ellpeck.actuallyadditions.mod.blocks.base; -import net.minecraft.block.Block; -import net.minecraft.item.BlockItem; -import net.minecraft.item.Item; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; public class ItemBlockBase extends BlockItem { public ItemBlockBase(Block block, Item.Properties properties) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheColoredLampColors.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheColoredLampColors.java index ac61cba61..acd2bfb21 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheColoredLampColors.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheColoredLampColors.java @@ -10,10 +10,10 @@ package de.ellpeck.actuallyadditions.mod.blocks.metalists; -import net.minecraft.util.IStringSerializable; +import net.minecraft.util.StringRepresentable; @Deprecated -public enum TheColoredLampColors implements IStringSerializable { +public enum TheColoredLampColors implements StringRepresentable { WHITE("White", "white"), ORANGE("Orange", "orange"), diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheMiscBlocks.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheMiscBlocks.java index e659d669c..76ba1b99b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheMiscBlocks.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheMiscBlocks.java @@ -10,11 +10,11 @@ package de.ellpeck.actuallyadditions.mod.blocks.metalists; -import net.minecraft.item.Rarity; -import net.minecraft.util.IStringSerializable; +import net.minecraft.util.StringRepresentable; +import net.minecraft.world.item.Rarity; @Deprecated -public enum TheMiscBlocks implements IStringSerializable { +public enum TheMiscBlocks implements StringRepresentable { QUARTZ_PILLAR("black_quartz_pillar", Rarity.RARE), QUARTZ_CHISELED("black_quartz_chiseled", Rarity.RARE), diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/package-info.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/package-info.java index 6ed11c4ff..b9ba0f7b3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/package-info.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/package-info.java @@ -2,5 +2,6 @@ @MethodsReturnNonnullByDefault package de.ellpeck.actuallyadditions.mod.blocks; -import mcp.MethodsReturnNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; + import javax.annotation.ParametersAreNonnullByDefault; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/ReconstructorRenderer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/ReconstructorRenderer.java index f4a6eac79..e7addb4de 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/ReconstructorRenderer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/ReconstructorRenderer.java @@ -10,35 +10,27 @@ package de.ellpeck.actuallyadditions.mod.blocks.render; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.math.Vector3f; import de.ellpeck.actuallyadditions.api.lens.ILensItem; -import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.BlockState; -import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.tileentity.TileEntityRenderer; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.util.Direction; -import net.minecraft.util.NonNullList; -import net.minecraft.util.math.vector.Quaternion; -import net.minecraft.util.math.vector.Vector3f; +import net.minecraft.client.renderer.LevelRenderer; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; +import net.minecraft.core.Direction; +import net.minecraft.world.item.ItemStack; import javax.annotation.Nonnull; -public class ReconstructorRenderer extends TileEntityRenderer { +public class ReconstructorRenderer implements BlockEntityRenderer { - public ReconstructorRenderer(TileEntityRendererDispatcher rendererDispatcherIn) { - super(rendererDispatcherIn); + public ReconstructorRenderer(BlockEntityRendererProvider.Context context) { } @Override - public void render(TileEntityAtomicReconstructor tile, float partialTicks, @Nonnull MatrixStack matrices, @Nonnull IRenderTypeBuffer buffer, int combinedLight, int combinedOverlay) { + public void render(TileEntityAtomicReconstructor tile, float partialTicks, @Nonnull PoseStack matrices, @Nonnull MultiBufferSource buffer, int combinedLight, int combinedOverlay) { ItemStack stack = tile.inv.getStackInSlot(0); //default color 0x1b6dff int color = tile.getBeamColor(); @@ -73,7 +65,7 @@ public class ReconstructorRenderer extends TileEntityRenderer { - public RenderBatteryBox(TileEntityRendererDispatcher rendererDispatcherIn) { - super(rendererDispatcherIn); +public class RenderBatteryBox implements BlockEntityRenderer { + public RenderBatteryBox(BlockEntityRendererProvider.Context context) { } @Override - public void render(TileEntityBatteryBox tile, float partialTicks, MatrixStack matrices, IRenderTypeBuffer buffer, int combinedLight, int combinedOverlay) { + public void render(TileEntityBatteryBox tile, float partialTicks, PoseStack matrices, MultiBufferSource buffer, int combinedLight, int combinedOverlay) { ItemStack stack = tile.inv.getStackInSlot(0); if (stack.isEmpty() || !(stack.getItem() instanceof ItemBattery)) { return; @@ -53,7 +51,7 @@ public class RenderBatteryBox extends TileEntityRenderer { matrices.translate(0F, 0F, -60F); stack.getCapability(CapabilityEnergy.ENERGY).ifPresent(cap -> { - FontRenderer font = Minecraft.getInstance().font; + Font font = Minecraft.getInstance().font; String energyTotal = Lang.cleanEnergyValues(cap, false); String energyName = I18n.get("misc.actuallyadditions.power_name_long"); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderDisplayStand.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderDisplayStand.java index 293d11825..0f9f2e83d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderDisplayStand.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderDisplayStand.java @@ -10,29 +10,26 @@ package de.ellpeck.actuallyadditions.mod.blocks.render; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.math.Vector3f; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.tile.TileEntityDisplayStand; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.tileentity.TileEntityRenderer; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; -import net.minecraft.item.BlockItem; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Util; -import net.minecraft.util.math.vector.Quaternion; -import net.minecraft.util.math.vector.Vector3f; +import net.minecraft.Util; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.ItemStack; import javax.annotation.Nonnull; -public class RenderDisplayStand extends TileEntityRenderer { - public RenderDisplayStand(TileEntityRendererDispatcher rendererDispatcherIn) { - super(rendererDispatcherIn); +public class RenderDisplayStand implements BlockEntityRenderer { + public RenderDisplayStand(BlockEntityRendererProvider.Context context) { } @Override - public void render(TileEntityDisplayStand tile, float partialTicks, @Nonnull MatrixStack matrices, @Nonnull IRenderTypeBuffer buffer, int combinedLightIn, int combinedOverlayIn) { + public void render(TileEntityDisplayStand tile, float partialTicks, @Nonnull PoseStack matrices, @Nonnull MultiBufferSource buffer, int combinedLightIn, int combinedOverlayIn) { ItemStack stack = tile.inv.getStackInSlot(0); if (stack.isEmpty()) { return; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderEmpowerer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderEmpowerer.java index 9a5fa5888..2aa0e9f74 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderEmpowerer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderEmpowerer.java @@ -10,32 +10,29 @@ package de.ellpeck.actuallyadditions.mod.blocks.render; -import com.mojang.blaze3d.matrix.MatrixStack; -import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.math.Vector3f; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe; import de.ellpeck.actuallyadditions.mod.tile.TileEntityEmpowerer; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.tileentity.TileEntityRenderer; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; -import net.minecraft.item.BlockItem; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Direction; -import net.minecraft.util.Util; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.vector.Quaternion; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.util.math.vector.Vector3f; +import net.minecraft.Util; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.phys.Vec3; -public class RenderEmpowerer extends TileEntityRenderer { - public RenderEmpowerer(TileEntityRendererDispatcher rendererDispatcherIn) { - super(rendererDispatcherIn); +public class RenderEmpowerer implements BlockEntityRenderer { + public RenderEmpowerer(BlockEntityRendererProvider.Context context) { } @Override - public void render(TileEntityEmpowerer tile, float partialTicks, MatrixStack matrices, IRenderTypeBuffer buffer, int combinedLight, int combinedOverlay) { + public void render(TileEntityEmpowerer tile, float partialTicks, PoseStack matrices, MultiBufferSource buffer, int combinedLight, int combinedOverlay) { ItemStack stack = tile.inv.getStackInSlot(0); if (StackUtil.isValid(stack)) { // TODO: [port][refactor] migrate this logic into a single method, most renders use it @@ -79,7 +76,7 @@ public class RenderEmpowerer extends TileEntityRenderer { Direction facing = Direction.from2DDataValue(i); BlockPos offset = new BlockPos(0,0,0).relative(facing, 3); - AssetUtil.renderLaser(matrices, buffer, new Vector3d(0.0d, 0.0d, 0.0d), new Vector3d(offset.getX(), offset.getY() + 0.45, offset.getZ()), 80, recipe.getParticleColors(), 1.0f ,0.1F); + AssetUtil.renderLaser(matrices, buffer, new Vec3(0.0d, 0.0d, 0.0d), new Vec3(offset.getX(), offset.getY() + 0.45, offset.getZ()), 80, recipe.getParticleColors(), 1.0f ,0.1F); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderLaserRelay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderLaserRelay.java index c4932ffd7..821de6619 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderLaserRelay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderLaserRelay.java @@ -10,7 +10,8 @@ package de.ellpeck.actuallyadditions.mod.blocks.render; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.math.Vector3f; import de.ellpeck.actuallyadditions.api.laser.IConnectionPair; import de.ellpeck.actuallyadditions.api.laser.LaserType; import de.ellpeck.actuallyadditions.mod.config.CommonConfig; @@ -21,40 +22,38 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import io.netty.util.internal.ConcurrentSet; -import net.minecraft.block.BlockState; +import net.minecraft.Util; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.tileentity.TileEntityRenderer; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; -import net.minecraft.util.Rotation; -import net.minecraft.util.Util; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.util.math.vector.Vector3f; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.phys.Vec3; -public class RenderLaserRelay extends TileEntityRenderer { +public class RenderLaserRelay implements BlockEntityRenderer { private static final int COLOR = 16711680; private static final int COLOR_ITEM = 31760; private static final int COLOR_FLUIDS = 25030; private static final int COLOR_INFRARED = 13743087; - public RenderLaserRelay(TileEntityRendererDispatcher rendererDispatcherIn) { - super(rendererDispatcherIn); + public RenderLaserRelay(BlockEntityRendererProvider.Context context) { } @Override - public void render(TileEntityLaserRelay tile, float partialTicks, MatrixStack matrices, IRenderTypeBuffer buffer, int combinedLight, int combinedOverlay) { + public void render(TileEntityLaserRelay tile, float partialTicks, PoseStack matrices, MultiBufferSource buffer, int combinedLight, int combinedOverlay) { TileEntityLaserRelay relay = tile; BlockState state = tile.getBlockState(); boolean hasInvis = false; - PlayerEntity player = Minecraft.getInstance().player; + Player player = Minecraft.getInstance().player; boolean hasGoggles = ItemEngineerGoggles.isWearing(player); ItemStack upgrade = relay.inv.getStackInSlot(0); @@ -89,7 +88,7 @@ public class RenderLaserRelay extends TileEntityRenderer { BlockPos first = tile.getBlockPos(); BlockPos second = pair.getPositions()[1]; - TileEntity secondTile = tile.getLevel().getBlockEntity(second); + BlockEntity secondTile = tile.getLevel().getBlockEntity(second); if (secondTile instanceof TileEntityLaserRelay) { ItemStack secondUpgrade = ((TileEntityLaserRelay) secondTile).inv.getStackInSlot(0); boolean otherInvis = StackUtil.isValid(secondUpgrade) && secondUpgrade.getItem() == ActuallyItems.LASER_UPGRADE_INVISIBILITY.get(); @@ -107,8 +106,8 @@ public class RenderLaserRelay extends TileEntityRenderer { matrices.pushPose(); AssetUtil.renderLaser(matrices, buffer, - new Vector3d(offsetStart.getX(), offsetStart.getY(), offsetStart.getZ()), - new Vector3d(offsetEnd.getX(), offsetEnd.getY(), offsetEnd.getZ()), + new Vec3(offsetStart.getX(), offsetStart.getY(), offsetStart.getZ()), + new Vec3(offsetEnd.getX(), offsetEnd.getY(), offsetEnd.getZ()), 120, color, hasInvis && otherInvis ? 0.1F diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderTypes.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderTypes.java index 38eabe2b3..f9f316d6d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderTypes.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderTypes.java @@ -1,15 +1,12 @@ package de.ellpeck.actuallyadditions.mod.blocks.render; -import com.mojang.blaze3d.platform.GlStateManager; -import com.mojang.blaze3d.systems.RenderSystem; -import net.minecraft.client.renderer.RenderState; +import com.mojang.blaze3d.vertex.DefaultVertexFormat; +import com.mojang.blaze3d.vertex.VertexFormat; +import net.minecraft.client.renderer.RenderStateShard; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.renderer.vertex.VertexFormat; -import org.lwjgl.opengl.GL11; public class RenderTypes extends RenderType { - public RenderTypes(String NameIn, VertexFormat FormatIn, int GLMode, int BufferSize, boolean useDelegate, boolean needsSorting, Runnable setupTask, Runnable ClearTask) { + public RenderTypes(String NameIn, VertexFormat FormatIn, VertexFormat.Mode GLMode, int BufferSize, boolean useDelegate, boolean needsSorting, Runnable setupTask, Runnable ClearTask) { super(NameIn, FormatIn, GLMode, BufferSize, useDelegate, needsSorting, setupTask, ClearTask); } @@ -20,14 +17,14 @@ public class RenderTypes extends RenderType { .setTextureState(NO_TEXTURE) .setOutputState(RenderType.OUTLINE_TARGET) .createCompositeState(true));*/ - public static final RenderType LASER = create("actuallyadditions:laser", DefaultVertexFormats.POSITION_COLOR_LIGHTMAP, - GL11.GL_QUADS, 256, false, true, - RenderType.State.builder() + public static final RenderType LASER = create("actuallyadditions:laser", DefaultVertexFormat.POSITION_COLOR_LIGHTMAP, + VertexFormat.Mode.QUADS, 256, false, true, + RenderType.CompositeState.builder() .setTransparencyState(ADDITIVE_TRANSPARENCY) .setTextureState(NO_TEXTURE) .setOutputState(RenderType.TRANSLUCENT_TARGET) - .setLightmapState(RenderState.LIGHTMAP) - .setAlphaState(RenderState.DEFAULT_ALPHA) - .setCullState(RenderState.NO_CULL) + .setLightmapState(RenderStateShard.LIGHTMAP) +// .setAlphaState(RenderStateShard.DEFAULT_ALPHA) + .setCullState(RenderStateShard.NO_CULL) .createCompositeState(true)); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/config/CommonConfig.java b/src/main/java/de/ellpeck/actuallyadditions/mod/config/CommonConfig.java index 311cadef8..2eb80f2d0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/config/CommonConfig.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/config/CommonConfig.java @@ -1,7 +1,7 @@ package de.ellpeck.actuallyadditions.mod.config; -import net.minecraft.item.Item; -import net.minecraft.item.Items; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; import net.minecraftforge.common.ForgeConfigSpec; import java.util.ArrayList; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigValues.java b/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigValues.java index ce0fb9ded..d4c30ca2b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigValues.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigValues.java @@ -10,7 +10,7 @@ package de.ellpeck.actuallyadditions.mod.config; -import net.minecraft.item.Item; +import net.minecraft.world.item.Item; public final class ConfigValues { // diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/config/conditions/BoolConfigCondition.java b/src/main/java/de/ellpeck/actuallyadditions/mod/config/conditions/BoolConfigCondition.java index 63f0a09d2..a44b84a74 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/config/conditions/BoolConfigCondition.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/config/conditions/BoolConfigCondition.java @@ -3,7 +3,7 @@ package de.ellpeck.actuallyadditions.mod.config.conditions; import com.google.gson.JsonObject; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.config.CommonConfig; -import net.minecraft.util.ResourceLocation; +import net.minecraft.resources.ResourceLocation; import net.minecraftforge.common.crafting.conditions.ICondition; import net.minecraftforge.common.crafting.conditions.IConditionSerializer; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ActuallyRecipes.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ActuallyRecipes.java index f09044bb1..bc1d8fb67 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ActuallyRecipes.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ActuallyRecipes.java @@ -1,42 +1,42 @@ package de.ellpeck.actuallyadditions.mod.crafting; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import net.minecraft.item.crafting.IRecipeSerializer; -import net.minecraft.item.crafting.IRecipeType; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.RecipeType; import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; public class ActuallyRecipes { - public static final DeferredRegister> SERIALIZERS = DeferredRegister.create(ForgeRegistries.RECIPE_SERIALIZERS, ActuallyAdditions.MODID); + public static final DeferredRegister> SERIALIZERS = DeferredRegister.create(ForgeRegistries.RECIPE_SERIALIZERS, ActuallyAdditions.MODID); public static void init(IEventBus bus) { SERIALIZERS.register(bus); } - public static final RegistryObject> KEEP_DATA_SHAPED_RECIPE = SERIALIZERS.register(RecipeKeepDataShaped.NAME, RecipeKeepDataShaped.Serializer::new); - public static final RegistryObject> LASER_RECIPE = SERIALIZERS.register(LaserRecipe.NAME, LaserRecipe.Serializer::new); - public static final RegistryObject> EMPOWERING_RECIPE = SERIALIZERS.register(EmpowererRecipe.NAME, EmpowererRecipe.Serializer::new); - public static final RegistryObject> CRUSHING_RECIPE = SERIALIZERS.register(CrushingRecipe.NAME, CrushingRecipe.Serializer::new); - public static final RegistryObject> SOLID_FUEL_RECIPE = SERIALIZERS.register(SolidFuelRecipe.NAME, SolidFuelRecipe.Serializer::new); - public static final RegistryObject> LIQUID_FUEL_RECIPE = SERIALIZERS.register(LiquidFuelRecipe.NAME, LiquidFuelRecipe.Serializer::new); - public static final RegistryObject> PRESSING_RECIPE = SERIALIZERS.register(PressingRecipe.NAME, PressingRecipe.Serializer::new); - public static final RegistryObject> FERMENTING_RECIPE = SERIALIZERS.register(FermentingRecipe.NAME, FermentingRecipe.Serializer::new); - public static final RegistryObject> COLOR_CHANGE_RECIPE = SERIALIZERS.register(ColorChangeRecipe.NAME, ColorChangeRecipe.Serializer::new); - public static final RegistryObject> MINING_LENS_RECIPE = SERIALIZERS.register(MiningLensRecipe.NAME, MiningLensRecipe.Serializer::new); + public static final RegistryObject> KEEP_DATA_SHAPED_RECIPE = SERIALIZERS.register(RecipeKeepDataShaped.NAME, RecipeKeepDataShaped.Serializer::new); + public static final RegistryObject> LASER_RECIPE = SERIALIZERS.register(LaserRecipe.NAME, LaserRecipe.Serializer::new); + public static final RegistryObject> EMPOWERING_RECIPE = SERIALIZERS.register(EmpowererRecipe.NAME, EmpowererRecipe.Serializer::new); + public static final RegistryObject> CRUSHING_RECIPE = SERIALIZERS.register(CrushingRecipe.NAME, CrushingRecipe.Serializer::new); + public static final RegistryObject> SOLID_FUEL_RECIPE = SERIALIZERS.register(SolidFuelRecipe.NAME, SolidFuelRecipe.Serializer::new); + public static final RegistryObject> LIQUID_FUEL_RECIPE = SERIALIZERS.register(LiquidFuelRecipe.NAME, LiquidFuelRecipe.Serializer::new); + public static final RegistryObject> PRESSING_RECIPE = SERIALIZERS.register(PressingRecipe.NAME, PressingRecipe.Serializer::new); + public static final RegistryObject> FERMENTING_RECIPE = SERIALIZERS.register(FermentingRecipe.NAME, FermentingRecipe.Serializer::new); + public static final RegistryObject> COLOR_CHANGE_RECIPE = SERIALIZERS.register(ColorChangeRecipe.NAME, ColorChangeRecipe.Serializer::new); + public static final RegistryObject> MINING_LENS_RECIPE = SERIALIZERS.register(MiningLensRecipe.NAME, MiningLensRecipe.Serializer::new); public static class Types { - public static final IRecipeType LASER = IRecipeType.register(ActuallyAdditions.MODID + ":laser"); - public static final IRecipeType EMPOWERING = IRecipeType.register(ActuallyAdditions.MODID + ":empower"); - public static final IRecipeType CRUSHING = IRecipeType.register(ActuallyAdditions.MODID + ":crushing"); - public static final IRecipeType SOLID_FUEL = IRecipeType.register(ActuallyAdditions.MODID + ":solid_fuel"); - public static final IRecipeType LIQUID_FUEL = IRecipeType.register(ActuallyAdditions.MODID + ":liquid_fuel"); - public static final IRecipeType PRESSING = IRecipeType.register(ActuallyAdditions.MODID + ":pressing"); - public static final IRecipeType FERMENTING = IRecipeType.register(ActuallyAdditions.MODID + ":fermenting"); - public static final IRecipeType COLOR_CHANGE = IRecipeType.register(ActuallyAdditions.MODID + ":color_change"); - public static final IRecipeType MINING_LENS = IRecipeType.register(ActuallyAdditions.MODID + ":mining_lens"); + public static final RecipeType LASER = RecipeType.register(ActuallyAdditions.MODID + ":laser"); + public static final RecipeType EMPOWERING = RecipeType.register(ActuallyAdditions.MODID + ":empower"); + public static final RecipeType CRUSHING = RecipeType.register(ActuallyAdditions.MODID + ":crushing"); + public static final RecipeType SOLID_FUEL = RecipeType.register(ActuallyAdditions.MODID + ":solid_fuel"); + public static final RecipeType LIQUID_FUEL = RecipeType.register(ActuallyAdditions.MODID + ":liquid_fuel"); + public static final RecipeType PRESSING = RecipeType.register(ActuallyAdditions.MODID + ":pressing"); + public static final RecipeType FERMENTING = RecipeType.register(ActuallyAdditions.MODID + ":fermenting"); + public static final RecipeType COLOR_CHANGE = RecipeType.register(ActuallyAdditions.MODID + ":color_change"); + public static final RecipeType MINING_LENS = RecipeType.register(ActuallyAdditions.MODID + ":mining_lens"); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ColorChangeRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ColorChangeRecipe.java index f5a7e768f..c16fe8d18 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ColorChangeRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ColorChangeRecipe.java @@ -2,25 +2,25 @@ package de.ellpeck.actuallyadditions.mod.crafting; import com.google.gson.JsonObject; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; -import net.minecraft.data.IFinishedRecipe; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.IRecipeSerializer; -import net.minecraft.item.crafting.IRecipeType; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.IItemProvider; -import net.minecraft.util.JSONUtils; -import net.minecraft.util.ResourceLocation; -import net.minecraft.world.World; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.GsonHelper; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +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.ItemLike; +import net.minecraft.world.level.Level; import net.minecraftforge.registries.ForgeRegistryEntry; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.Optional; -public class ColorChangeRecipe implements IRecipe { +public class ColorChangeRecipe implements Recipe { public static final String NAME = "color_change"; private final Ingredient input; @@ -34,7 +34,7 @@ public class ColorChangeRecipe implements IRecipe { } @Override - public boolean matches(@Nonnull IInventory pInv, @Nonnull World pLevel) { + public boolean matches(@Nonnull Container pInv, @Nonnull Level pLevel) { return input.test(pInv.getItem(0)); } @@ -49,7 +49,7 @@ public class ColorChangeRecipe implements IRecipe { @Nonnull @Override - public ItemStack assemble(@Nonnull IInventory pInv) { + public ItemStack assemble(@Nonnull Container pInv) { return output.copy(); } @@ -76,46 +76,46 @@ public class ColorChangeRecipe implements IRecipe { @Nonnull @Override - public IRecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return ActuallyRecipes.COLOR_CHANGE_RECIPE.get(); } @Override - public IRecipeType getType() { + public RecipeType getType() { return ActuallyRecipes.Types.COLOR_CHANGE; } - public static class Serializer extends ForgeRegistryEntry> implements IRecipeSerializer { + public static class Serializer extends ForgeRegistryEntry> implements RecipeSerializer { @Override public ColorChangeRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) { - Ingredient ingredient = Ingredient.fromJson(JSONUtils.getAsJsonObject(pJson, "ingredient")); - JsonObject resultObject = JSONUtils.getAsJsonObject(pJson, "result"); - ItemStack result = new ItemStack(JSONUtils.getAsItem(resultObject, "item")); + Ingredient ingredient = Ingredient.fromJson(GsonHelper.getAsJsonObject(pJson, "ingredient")); + JsonObject resultObject = GsonHelper.getAsJsonObject(pJson, "result"); + ItemStack result = new ItemStack(GsonHelper.getAsItem(resultObject, "item")); return new ColorChangeRecipe(pRecipeId, result, ingredient); } @Nullable @Override - public ColorChangeRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull PacketBuffer pBuffer) { + public ColorChangeRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull FriendlyByteBuf pBuffer) { Ingredient ingredient = Ingredient.fromNetwork(pBuffer); ItemStack result = pBuffer.readItem(); return new ColorChangeRecipe(pRecipeId, result, ingredient); } @Override - public void toNetwork(@Nonnull PacketBuffer pBuffer, ColorChangeRecipe pRecipe) { + public void toNetwork(@Nonnull FriendlyByteBuf pBuffer, ColorChangeRecipe pRecipe) { pRecipe.input.toNetwork(pBuffer); pBuffer.writeItem(pRecipe.output); } } - public static class FinishedRecipe implements IFinishedRecipe { + public static class Result implements FinishedRecipe { private final ResourceLocation id; private final Ingredient itemIngredient; - private final IItemProvider output; + private final ItemLike output; - public FinishedRecipe(ResourceLocation id, Ingredient itemIngredient, IItemProvider output) { + public Result(ResourceLocation id, Ingredient itemIngredient, ItemLike output) { this.id = id; this.itemIngredient = itemIngredient; this.output = output; @@ -137,7 +137,7 @@ public class ColorChangeRecipe implements IRecipe { } @Override - public IRecipeSerializer getType() { + public RecipeSerializer getType() { return ActuallyRecipes.COLOR_CHANGE_RECIPE.get(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/CrushingRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/CrushingRecipe.java index 9162a3013..3b49c1fe2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/CrushingRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/CrushingRecipe.java @@ -3,24 +3,24 @@ package de.ellpeck.actuallyadditions.mod.crafting; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import net.minecraft.data.IFinishedRecipe; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.IRecipeSerializer; -import net.minecraft.item.crafting.IRecipeType; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.IItemProvider; -import net.minecraft.util.JSONUtils; -import net.minecraft.util.ResourceLocation; -import net.minecraft.world.World; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.GsonHelper; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +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.ItemLike; +import net.minecraft.world.level.Level; import net.minecraftforge.registries.ForgeRegistryEntry; import javax.annotation.Nonnull; import javax.annotation.Nullable; -public class CrushingRecipe implements IRecipe { +public class CrushingRecipe implements Recipe { public static String NAME = "crushing"; private final ResourceLocation id; protected Ingredient input; @@ -48,7 +48,7 @@ public class CrushingRecipe implements IRecipe { } @Override - public boolean matches(IInventory pInv, World pLevel) { + public boolean matches(Container pInv, Level pLevel) { return input.test(pInv.getItem(0)); } @@ -63,7 +63,7 @@ public class CrushingRecipe implements IRecipe { @Override @Nonnull - public ItemStack assemble(@Nonnull IInventory pInv) { + public ItemStack assemble(@Nonnull Container pInv) { return ItemStack.EMPTY; } @@ -86,13 +86,13 @@ public class CrushingRecipe implements IRecipe { @Override @Nonnull - public IRecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return ActuallyRecipes.CRUSHING_RECIPE.get(); } @Override @Nonnull - public IRecipeType getType() { + public RecipeType getType() { return ActuallyRecipes.Types.CRUSHING; } @@ -115,36 +115,36 @@ public class CrushingRecipe implements IRecipe { return this.input; } - public static class Serializer extends ForgeRegistryEntry> implements IRecipeSerializer { + public static class Serializer extends ForgeRegistryEntry> implements RecipeSerializer { @Override @Nonnull public CrushingRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) { - Ingredient ingredient = Ingredient.fromJson(JSONUtils.getAsJsonObject(pJson, "ingredient")); + Ingredient ingredient = Ingredient.fromJson(GsonHelper.getAsJsonObject(pJson, "ingredient")); - JsonArray resultList = JSONUtils.getAsJsonArray(pJson, "result"); + JsonArray resultList = GsonHelper.getAsJsonArray(pJson, "result"); if (resultList.size() < 1) throw new IllegalStateException(pRecipeId.toString() + ": Recipe must contain at least 1 result item"); JsonObject result1 = resultList.get(0).getAsJsonObject(); - int count1 = JSONUtils.getAsInt(result1, "count", 0); - ItemStack output1 = new ItemStack(JSONUtils.getAsItem(result1, "item"), count1); - float chance1 = JSONUtils.getAsFloat(result1, "chance"); + int count1 = GsonHelper.getAsInt(result1, "count", 0); + ItemStack output1 = new ItemStack(GsonHelper.getAsItem(result1, "item"), count1); + float chance1 = GsonHelper.getAsFloat(result1, "chance"); ItemStack output2 = ItemStack.EMPTY; float chance2 = 1.0f; if (resultList.size() > 1) { JsonObject result2 = resultList.get(1).getAsJsonObject(); - int count2 = JSONUtils.getAsInt(result2, "count", 0); - output2 = new ItemStack(JSONUtils.getAsItem(result2, "item"), count2); - chance2 = JSONUtils.getAsFloat(result2, "chance"); + int count2 = GsonHelper.getAsInt(result2, "count", 0); + output2 = new ItemStack(GsonHelper.getAsItem(result2, "item"), count2); + chance2 = GsonHelper.getAsFloat(result2, "chance"); } return new CrushingRecipe(pRecipeId, ingredient, output1, chance1, output2, chance2); } @Override - public CrushingRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull PacketBuffer pBuffer) { + public CrushingRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull FriendlyByteBuf pBuffer) { Ingredient ingredient = Ingredient.fromNetwork(pBuffer); ItemStack output1 = pBuffer.readItem(); ItemStack output2 = pBuffer.readItem(); @@ -155,7 +155,7 @@ public class CrushingRecipe implements IRecipe { } @Override - public void toNetwork(@Nonnull PacketBuffer pBuffer, CrushingRecipe pRecipe) { + public void toNetwork(@Nonnull FriendlyByteBuf pBuffer, CrushingRecipe pRecipe) { pRecipe.input.toNetwork(pBuffer); pBuffer.writeItem(pRecipe.outputOne); pBuffer.writeItem(pRecipe.outputTwo); @@ -164,17 +164,17 @@ public class CrushingRecipe implements IRecipe { } } - public static class FinishedRecipe implements IFinishedRecipe { + public static class Result implements FinishedRecipe { private final ResourceLocation id; protected Ingredient input; - protected IItemProvider outputOne; + protected ItemLike outputOne; protected int countOne; protected float outputChance1; - protected IItemProvider outputTwo; + protected ItemLike outputTwo; protected int countTwo; protected float outputChance2; - public FinishedRecipe(ResourceLocation id, Ingredient input, IItemProvider outputOne, int countOne, float outputChance1, IItemProvider outputTwo, int countTwo, float outputChance2) { + public Result(ResourceLocation id, Ingredient input, ItemLike outputOne, int countOne, float outputChance1, ItemLike outputTwo, int countTwo, float outputChance2) { this.id = id; this.countOne = countOne; this.countTwo = countTwo; @@ -214,7 +214,7 @@ public class CrushingRecipe implements IRecipe { @Override @Nonnull - public IRecipeSerializer getType() { + public RecipeSerializer getType() { return ActuallyRecipes.CRUSHING_RECIPE.get(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/EmpowererRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/EmpowererRecipe.java index e78cd58c5..34c05f983 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/EmpowererRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/EmpowererRecipe.java @@ -2,18 +2,18 @@ package de.ellpeck.actuallyadditions.mod.crafting; import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import net.minecraft.data.IFinishedRecipe; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.IRecipeSerializer; -import net.minecraft.item.crafting.IRecipeType; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.IItemProvider; -import net.minecraft.util.JSONUtils; -import net.minecraft.util.ResourceLocation; -import net.minecraft.world.World; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.GsonHelper; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +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.ItemLike; +import net.minecraft.world.level.Level; import net.minecraftforge.registries.ForgeRegistryEntry; import javax.annotation.Nonnull; @@ -21,7 +21,7 @@ import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; -public class EmpowererRecipe implements IRecipe { +public class EmpowererRecipe implements Recipe { public static String NAME = "empowering"; private final ResourceLocation id; protected final Ingredient input; @@ -75,7 +75,7 @@ public class EmpowererRecipe implements IRecipe { } @Override - public boolean matches(@Nonnull IInventory pInv, @Nonnull World pLevel) { + public boolean matches(@Nonnull Container pInv, @Nonnull Level pLevel) { return false; } @@ -86,7 +86,7 @@ public class EmpowererRecipe implements IRecipe { @Override @Nonnull - public ItemStack assemble(@Nonnull IInventory pInv) { + public ItemStack assemble(@Nonnull Container pInv) { return output.copy(); } @@ -109,13 +109,13 @@ public class EmpowererRecipe implements IRecipe { @Override @Nonnull - public IRecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return ActuallyRecipes.EMPOWERING_RECIPE.get(); } @Override @Nonnull - public IRecipeType getType() { + public RecipeType getType() { return ActuallyRecipes.Types.EMPOWERING; } @@ -155,13 +155,13 @@ public class EmpowererRecipe implements IRecipe { return this.particleColor; } - public static class Serializer extends ForgeRegistryEntry> implements IRecipeSerializer { + public static class Serializer extends ForgeRegistryEntry> implements RecipeSerializer { @Override @Nonnull public EmpowererRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) { - Ingredient base = Ingredient.fromJson(JSONUtils.getAsJsonObject(pJson, "base")); + Ingredient base = Ingredient.fromJson(GsonHelper.getAsJsonObject(pJson, "base")); - JsonArray modifiers = JSONUtils.getAsJsonArray(pJson, "modifiers"); + JsonArray modifiers = GsonHelper.getAsJsonArray(pJson, "modifiers"); if (modifiers.size() != 4) throw new IllegalStateException(pRecipeId.toString() + ": Must have exactly 4 modifiers, has: " + modifiers.size()); @@ -169,18 +169,18 @@ public class EmpowererRecipe implements IRecipe { Ingredient mod2 = Ingredient.fromJson(modifiers.get(1)); Ingredient mod3 = Ingredient.fromJson(modifiers.get(2)); Ingredient mod4 = Ingredient.fromJson(modifiers.get(3)); - int energy = JSONUtils.getAsInt(pJson, "energy"); - int color = JSONUtils.getAsInt(pJson, "color"); - int time = JSONUtils.getAsInt(pJson, "time"); - JsonObject resultObject = JSONUtils.getAsJsonObject(pJson, "result"); - ItemStack result = new ItemStack(JSONUtils.getAsItem(resultObject, "item")); + int energy = GsonHelper.getAsInt(pJson, "energy"); + int color = GsonHelper.getAsInt(pJson, "color"); + int time = GsonHelper.getAsInt(pJson, "time"); + JsonObject resultObject = GsonHelper.getAsJsonObject(pJson, "result"); + ItemStack result = new ItemStack(GsonHelper.getAsItem(resultObject, "item")); return new EmpowererRecipe(pRecipeId, result, base, mod1, mod2, mod3, mod4, energy, color, time); } @Nullable @Override - public EmpowererRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, PacketBuffer pBuffer) { + public EmpowererRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, FriendlyByteBuf pBuffer) { ItemStack result = pBuffer.readItem(); Ingredient input = Ingredient.fromNetwork(pBuffer); Ingredient mod1 = Ingredient.fromNetwork(pBuffer); @@ -195,7 +195,7 @@ public class EmpowererRecipe implements IRecipe { } @Override - public void toNetwork(PacketBuffer pBuffer, EmpowererRecipe pRecipe) { + public void toNetwork(FriendlyByteBuf pBuffer, EmpowererRecipe pRecipe) { pBuffer.writeItem(pRecipe.output); pRecipe.input.toNetwork(pBuffer); pRecipe.modifier1.toNetwork(pBuffer); @@ -208,7 +208,7 @@ public class EmpowererRecipe implements IRecipe { } } - public static class FinishedRecipe implements IFinishedRecipe { + public static class Result implements FinishedRecipe { private final ResourceLocation id; private final Ingredient base; private final Ingredient mod1; @@ -218,9 +218,9 @@ public class EmpowererRecipe implements IRecipe { private final int energy; private final int color; private final int time; - private final IItemProvider output; + private final ItemLike output; - public FinishedRecipe(ResourceLocation id, IItemProvider output, Ingredient input, Ingredient modifier1, Ingredient modifier2, Ingredient modifier3, Ingredient modifier4, int energyPerStand, int particleColor, int time) { + public Result(ResourceLocation id, ItemLike output, Ingredient input, Ingredient modifier1, Ingredient modifier2, Ingredient modifier3, Ingredient modifier4, int energyPerStand, int particleColor, int time) { this.id = id; this.base = input; this.output = output; @@ -263,7 +263,7 @@ public class EmpowererRecipe implements IRecipe { @Override @Nonnull - public IRecipeSerializer getType() { + public RecipeSerializer getType() { return ActuallyRecipes.EMPOWERING_RECIPE.get(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/FermentingRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/FermentingRecipe.java index cba7f5222..2c5d6632e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/FermentingRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/FermentingRecipe.java @@ -3,17 +3,17 @@ package de.ellpeck.actuallyadditions.mod.crafting; import com.google.gson.JsonObject; import com.google.gson.JsonParseException; import de.ellpeck.actuallyadditions.mod.inventory.gui.FluidDisplay; -import net.minecraft.data.IFinishedRecipe; -import net.minecraft.fluid.Fluid; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.IRecipeSerializer; -import net.minecraft.item.crafting.IRecipeType; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.JSONUtils; -import net.minecraft.util.ResourceLocation; -import net.minecraft.world.World; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.GsonHelper; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +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 net.minecraft.world.level.material.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ForgeRegistryEntry; @@ -22,7 +22,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.Optional; -public class FermentingRecipe implements IRecipe { +public class FermentingRecipe implements Recipe { public static final String NAME = "fermenting"; private final ResourceLocation ID; private final FluidStack input; @@ -76,7 +76,7 @@ public class FermentingRecipe implements IRecipe { } @Override - public boolean matches(IInventory pInv, World pLevel) { + public boolean matches(Container pInv, Level pLevel) { return false; } @@ -87,7 +87,7 @@ public class FermentingRecipe implements IRecipe { @Nonnull @Override - public ItemStack assemble(IInventory pInv) { + public ItemStack assemble(Container pInv) { return ItemStack.EMPTY; } @@ -110,45 +110,45 @@ public class FermentingRecipe implements IRecipe { @Nonnull @Override - public IRecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return ActuallyRecipes.FERMENTING_RECIPE.get(); } @Nonnull @Override - public IRecipeType getType() { + public RecipeType getType() { return ActuallyRecipes.Types.FERMENTING; } - public static class Serializer extends ForgeRegistryEntry> implements IRecipeSerializer { + public static class Serializer extends ForgeRegistryEntry> implements RecipeSerializer { @Nonnull @Override public FermentingRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) { JsonObject ingredient = pJson.getAsJsonObject("ingredient"); - ResourceLocation fluidRes = new ResourceLocation(JSONUtils.getAsString(ingredient, "fluid")); + ResourceLocation fluidRes = new ResourceLocation(GsonHelper.getAsString(ingredient, "fluid")); Fluid fluid = ForgeRegistries.FLUIDS.getValue(fluidRes); if (fluid == null) throw new JsonParseException("Unknown fluid '" + fluidRes + "'"); - int inputAmount = JSONUtils.getAsInt(ingredient, "amount", 80); + int inputAmount = GsonHelper.getAsInt(ingredient, "amount", 80); FluidStack input = new FluidStack(fluid, inputAmount); JsonObject result = pJson.getAsJsonObject("result"); - ResourceLocation fluidOutputRes = new ResourceLocation(JSONUtils.getAsString(result, "fluid")); - int outputAmount = JSONUtils.getAsInt(result, "amount"); + ResourceLocation fluidOutputRes = new ResourceLocation(GsonHelper.getAsString(result, "fluid")); + int outputAmount = GsonHelper.getAsInt(result, "amount"); Fluid fluidOutput = ForgeRegistries.FLUIDS.getValue(fluidOutputRes); if(fluidOutput == null) throw new JsonParseException("Unknown fluid '" + fluidRes + "'"); FluidStack output = new FluidStack(fluidOutput, outputAmount); - int time = JSONUtils.getAsInt(pJson, "time", 100); + int time = GsonHelper.getAsInt(pJson, "time", 100); return new FermentingRecipe(pRecipeId, input, output, time); } @Nullable @Override - public FermentingRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull PacketBuffer pBuffer) { + public FermentingRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull FriendlyByteBuf pBuffer) { ResourceLocation inputRes = new ResourceLocation(pBuffer.readUtf()); int inputAmount = pBuffer.readInt(); Fluid inputFluid = ForgeRegistries.FLUIDS.getValue(inputRes); @@ -169,7 +169,7 @@ public class FermentingRecipe implements IRecipe { } @Override - public void toNetwork(@Nonnull PacketBuffer pBuffer, @Nonnull FermentingRecipe pRecipe) { + public void toNetwork(@Nonnull FriendlyByteBuf pBuffer, @Nonnull FermentingRecipe pRecipe) { pBuffer.writeUtf(pRecipe.input.getFluid().getRegistryName().toString()); pBuffer.writeInt(pRecipe.input.getAmount()); pBuffer.writeUtf(pRecipe.output.getFluid().getRegistryName().toString()); @@ -177,13 +177,13 @@ public class FermentingRecipe implements IRecipe { pBuffer.writeInt(pRecipe.time); } } - public static class FinishedRecipe implements IFinishedRecipe { + public static class Result implements FinishedRecipe { private final ResourceLocation ID; private final FluidStack input; private final FluidStack output; private final int time; - public FinishedRecipe(ResourceLocation ID, FluidStack input, FluidStack output, int timeIn) { + public Result(ResourceLocation ID, FluidStack input, FluidStack output, int timeIn) { this.ID = ID; this.input = input; this.output = output; @@ -211,7 +211,7 @@ public class FermentingRecipe implements IRecipe { } @Override - public IRecipeSerializer getType() { + public RecipeSerializer getType() { return ActuallyRecipes.FERMENTING_RECIPE.get(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/InitCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/InitCrafting.java index f080dd966..2b42b51e2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/InitCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/InitCrafting.java @@ -12,9 +12,11 @@ package de.ellpeck.actuallyadditions.mod.crafting; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntListValues; -import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; -import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.*; +import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.CactusFarmerBehavior; +import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.DefaultFarmerBehavior; +import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.MelonPumpkinFarmerBehavior; +import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.NetherWartFarmerBehavior; +import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.ReedFarmerBehavior; // TODO: [port] MOVE TO DATA_GENERATOR @Deprecated diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/LaserRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/LaserRecipe.java index b4a03e6ea..c665d2f20 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/LaserRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/LaserRecipe.java @@ -2,18 +2,18 @@ package de.ellpeck.actuallyadditions.mod.crafting; import com.google.gson.JsonObject; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; -import net.minecraft.data.IFinishedRecipe; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.IRecipeSerializer; -import net.minecraft.item.crafting.IRecipeType; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.IItemProvider; -import net.minecraft.util.JSONUtils; -import net.minecraft.util.ResourceLocation; -import net.minecraft.world.World; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.GsonHelper; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +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.ItemLike; +import net.minecraft.world.level.Level; import net.minecraftforge.registries.ForgeRegistryEntry; import javax.annotation.Nonnull; @@ -21,7 +21,7 @@ import javax.annotation.Nullable; import java.util.Optional; -public class LaserRecipe implements IRecipe { +public class LaserRecipe implements Recipe { public static String NAME = "laser"; private ItemStack result; private Ingredient itemIngredient; @@ -53,7 +53,7 @@ public class LaserRecipe implements IRecipe { //nah @Override - public boolean matches(IInventory pInv, World pLevel) { + public boolean matches(Container pInv, Level pLevel) { return false; } @@ -63,7 +63,7 @@ public class LaserRecipe implements IRecipe { } @Override - public ItemStack assemble(IInventory pInv) { + public ItemStack assemble(Container pInv) { return result.copy(); } @@ -83,12 +83,12 @@ public class LaserRecipe implements IRecipe { } @Override - public IRecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return ActuallyRecipes.LASER_RECIPE.get(); } @Override - public IRecipeType getType() { + public RecipeType getType() { return ActuallyRecipes.Types.LASER; } @@ -100,20 +100,20 @@ public class LaserRecipe implements IRecipe { return getRecipeForStack(stack).isPresent(); } - public static class Serializer extends ForgeRegistryEntry> implements IRecipeSerializer { + public static class Serializer extends ForgeRegistryEntry> implements RecipeSerializer { @Override public LaserRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) { - Ingredient ingredient = Ingredient.fromJson(JSONUtils.getAsJsonObject(pJson, "ingredient")); - int energy = JSONUtils.getAsInt(pJson, "energy"); - JsonObject resultObject = JSONUtils.getAsJsonObject(pJson, "result"); - ItemStack result = new ItemStack(JSONUtils.getAsItem(resultObject, "item")); + Ingredient ingredient = Ingredient.fromJson(GsonHelper.getAsJsonObject(pJson, "ingredient")); + int energy = GsonHelper.getAsInt(pJson, "energy"); + JsonObject resultObject = GsonHelper.getAsJsonObject(pJson, "result"); + ItemStack result = new ItemStack(GsonHelper.getAsItem(resultObject, "item")); return new LaserRecipe(pRecipeId, result, ingredient, energy); } @Nullable @Override - public LaserRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull PacketBuffer pBuffer) { + public LaserRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull FriendlyByteBuf pBuffer) { Ingredient ingredient = Ingredient.fromNetwork(pBuffer); int energy = pBuffer.readInt(); ItemStack result = pBuffer.readItem(); @@ -121,20 +121,20 @@ public class LaserRecipe implements IRecipe { } @Override - public void toNetwork(@Nonnull PacketBuffer pBuffer, LaserRecipe pRecipe) { + public void toNetwork(@Nonnull FriendlyByteBuf pBuffer, LaserRecipe pRecipe) { pRecipe.itemIngredient.toNetwork(pBuffer); pBuffer.writeInt(pRecipe.energy); pBuffer.writeItem(pRecipe.result); } } - public static class FinishedRecipe implements IFinishedRecipe { + public static class Result implements FinishedRecipe { private ResourceLocation id; private Ingredient itemIngredient; private int energy; - private IItemProvider output; + private ItemLike output; - public FinishedRecipe(ResourceLocation id, Ingredient itemIngredient, int energy, IItemProvider output) { + public Result(ResourceLocation id, Ingredient itemIngredient, int energy, ItemLike output) { this.id = id; this.itemIngredient = itemIngredient; this.energy = energy; @@ -158,7 +158,7 @@ public class LaserRecipe implements IRecipe { } @Override - public IRecipeSerializer getType() { + public RecipeSerializer getType() { return ActuallyRecipes.LASER_RECIPE.get(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/LiquidFuelRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/LiquidFuelRecipe.java index 5270d5ea3..bbaeb5bfa 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/LiquidFuelRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/LiquidFuelRecipe.java @@ -2,18 +2,17 @@ package de.ellpeck.actuallyadditions.mod.crafting; import com.google.gson.JsonObject; import com.google.gson.JsonParseException; -import net.minecraft.data.IFinishedRecipe; -import net.minecraft.fluid.Fluid; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.IRecipeSerializer; -import net.minecraft.item.crafting.IRecipeType; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.JSONUtils; -import net.minecraft.util.ResourceLocation; -import net.minecraft.world.World; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.GsonHelper; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +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 net.minecraft.world.level.material.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ForgeRegistryEntry; @@ -21,7 +20,7 @@ import net.minecraftforge.registries.ForgeRegistryEntry; import javax.annotation.Nonnull; import javax.annotation.Nullable; -public class LiquidFuelRecipe implements IRecipe { +public class LiquidFuelRecipe implements Recipe { public static String NAME = "liquid_fuel"; private FluidStack fuel; private int burnTime; @@ -51,7 +50,7 @@ public class LiquidFuelRecipe implements IRecipe { } @Override - public boolean matches(@Nonnull IInventory pInv,@Nonnull World pLevel) { + public boolean matches(@Nonnull Container pInv,@Nonnull Level pLevel) { return false; } @@ -74,7 +73,7 @@ public class LiquidFuelRecipe implements IRecipe { @Nonnull @Override - public ItemStack assemble(@Nonnull IInventory pInv) { + public ItemStack assemble(@Nonnull Container pInv) { return ItemStack.EMPTY; } @@ -97,27 +96,27 @@ public class LiquidFuelRecipe implements IRecipe { @Nonnull @Override - public IRecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return ActuallyRecipes.LIQUID_FUEL_RECIPE.get(); } @Nonnull @Override - public IRecipeType getType() { + public RecipeType getType() { return ActuallyRecipes.Types.LIQUID_FUEL; } - public static class Serializer extends ForgeRegistryEntry> implements IRecipeSerializer { + public static class Serializer extends ForgeRegistryEntry> implements RecipeSerializer { @Nonnull @Override public LiquidFuelRecipe fromJson(@Nonnull ResourceLocation pId, JsonObject pJson) { JsonObject ingredient = pJson.getAsJsonObject("ingredient"); - ResourceLocation fluidRes = new ResourceLocation(JSONUtils.getAsString(ingredient, "fluid")); + ResourceLocation fluidRes = new ResourceLocation(GsonHelper.getAsString(ingredient, "fluid")); Fluid fluid = ForgeRegistries.FLUIDS.getValue(fluidRes); if (fluid == null) throw new JsonParseException("Unknown fluid '" + fluidRes + "'"); - int inputAmount = JSONUtils.getAsInt(ingredient, "amount", 50); + int inputAmount = GsonHelper.getAsInt(ingredient, "amount", 50); FluidStack input = new FluidStack(fluid, inputAmount); JsonObject result = pJson.getAsJsonObject("result"); @@ -127,7 +126,7 @@ public class LiquidFuelRecipe implements IRecipe { } @Override - public LiquidFuelRecipe fromNetwork(@Nonnull ResourceLocation pId, @Nonnull PacketBuffer pBuffer) { + public LiquidFuelRecipe fromNetwork(@Nonnull ResourceLocation pId, @Nonnull FriendlyByteBuf pBuffer) { ResourceLocation inputRes = new ResourceLocation(pBuffer.readUtf()); int inputAmount = pBuffer.readInt(); Fluid inputFluid = ForgeRegistries.FLUIDS.getValue(inputRes); @@ -141,7 +140,7 @@ public class LiquidFuelRecipe implements IRecipe { } @Override - public void toNetwork(@Nonnull PacketBuffer pBuffer, LiquidFuelRecipe pRecipe) { + public void toNetwork(@Nonnull FriendlyByteBuf pBuffer, LiquidFuelRecipe pRecipe) { pBuffer.writeUtf(pRecipe.fuel.getFluid().getRegistryName().toString()); pBuffer.writeInt(pRecipe.fuel.getAmount()); pBuffer.writeInt(pRecipe.totalEnergy); @@ -149,13 +148,13 @@ public class LiquidFuelRecipe implements IRecipe { } } - public static class FinishedRecipe implements IFinishedRecipe { + public static class Result implements FinishedRecipe { private FluidStack fuel; private int burnTime; private int totalEnergy; private ResourceLocation id; - public FinishedRecipe(ResourceLocation id, FluidStack fuel, int totalEnergy, int burnTime) { + public Result(ResourceLocation id, FluidStack fuel, int totalEnergy, int burnTime) { this.fuel = fuel; this.burnTime = burnTime; this.totalEnergy = totalEnergy; @@ -184,7 +183,7 @@ public class LiquidFuelRecipe implements IRecipe { @Nonnull @Override - public IRecipeSerializer getType() { + public RecipeSerializer getType() { return ActuallyRecipes.LIQUID_FUEL_RECIPE.get(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/MiningLensRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/MiningLensRecipe.java index cfff269de..b8f846f78 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/MiningLensRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/MiningLensRecipe.java @@ -1,42 +1,45 @@ package de.ellpeck.actuallyadditions.mod.crafting; import com.google.gson.JsonObject; -import net.minecraft.data.IFinishedRecipe; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.IRecipeSerializer; -import net.minecraft.item.crafting.IRecipeType; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.IItemProvider; -import net.minecraft.util.JSONUtils; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.WeightedRandom; -import net.minecraft.world.World; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.GsonHelper; +import net.minecraft.util.random.Weight; +import net.minecraft.util.random.WeightedEntry; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +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.ItemLike; +import net.minecraft.world.level.Level; import net.minecraftforge.registries.ForgeRegistryEntry; import javax.annotation.Nonnull; import javax.annotation.Nullable; -public class MiningLensRecipe extends WeightedRandom.Item implements IRecipe { +public class MiningLensRecipe implements Recipe, WeightedEntry { public static final String NAME = "mining_lens"; private final ResourceLocation id; + private final int weight; private final Ingredient input; //private final int weight; private final ItemStack output; public MiningLensRecipe(ResourceLocation id, Ingredient input, int weight, ItemStack output) { - super(weight); + super(); + this.weight = weight; this.input = input; //this.weight = weight; this.output = output; this.id = id; } - public int getWeight() { - return weight; + public Weight getWeight() { + return Weight.of(weight); } public Ingredient getInput() { @@ -48,7 +51,7 @@ public class MiningLensRecipe extends WeightedRandom.Item implements IRecipe getSerializer() { + public RecipeSerializer getSerializer() { return ActuallyRecipes.MINING_LENS_RECIPE.get(); } @Override - public IRecipeType getType() { + public RecipeType getType() { return ActuallyRecipes.Types.MINING_LENS; } - public static class Serializer extends ForgeRegistryEntry> implements IRecipeSerializer { + public static class Serializer extends ForgeRegistryEntry> implements RecipeSerializer { @Override public MiningLensRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) { - Ingredient ingredient = Ingredient.fromJson(JSONUtils.getAsJsonObject(pJson, "ingredient")); - int weight = JSONUtils.getAsInt(pJson, "weight"); - JsonObject resultObject = JSONUtils.getAsJsonObject(pJson, "result"); - ItemStack result = new ItemStack(JSONUtils.getAsItem(resultObject, "item")); + Ingredient ingredient = Ingredient.fromJson(GsonHelper.getAsJsonObject(pJson, "ingredient")); + int weight = GsonHelper.getAsInt(pJson, "weight"); + JsonObject resultObject = GsonHelper.getAsJsonObject(pJson, "result"); + ItemStack result = new ItemStack(GsonHelper.getAsItem(resultObject, "item")); return new MiningLensRecipe(pRecipeId, ingredient, weight, result); } @Nullable @Override - public MiningLensRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull PacketBuffer pBuffer) { + public MiningLensRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull FriendlyByteBuf pBuffer) { Ingredient ingredient = Ingredient.fromNetwork(pBuffer); int weight = pBuffer.readInt(); ItemStack result = pBuffer.readItem(); @@ -109,20 +112,20 @@ public class MiningLensRecipe extends WeightedRandom.Item implements IRecipe getType() { + public RecipeSerializer getType() { return ActuallyRecipes.MINING_LENS_RECIPE.get(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/PressingRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/PressingRecipe.java index 8e4916684..b162f7056 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/PressingRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/PressingRecipe.java @@ -2,18 +2,18 @@ package de.ellpeck.actuallyadditions.mod.crafting; import com.google.gson.JsonObject; import com.google.gson.JsonParseException; -import net.minecraft.data.IFinishedRecipe; -import net.minecraft.fluid.Fluid; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.IRecipeSerializer; -import net.minecraft.item.crafting.IRecipeType; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.JSONUtils; -import net.minecraft.util.ResourceLocation; -import net.minecraft.world.World; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.GsonHelper; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +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 net.minecraft.world.level.material.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ForgeRegistryEntry; @@ -21,7 +21,7 @@ import net.minecraftforge.registries.ForgeRegistryEntry; import javax.annotation.Nonnull; import javax.annotation.Nullable; -public class PressingRecipe implements IRecipe { +public class PressingRecipe implements Recipe { public static final String NAME = "pressing"; private final ResourceLocation ID; private final Ingredient input; @@ -34,7 +34,7 @@ public class PressingRecipe implements IRecipe { } @Override - public boolean matches(@Nonnull IInventory pInv, @Nullable World pLevel) { + public boolean matches(@Nonnull Container pInv, @Nullable Level pLevel) { return input.test(pInv.getItem(0)); } @@ -44,7 +44,7 @@ public class PressingRecipe implements IRecipe { } @Override - public ItemStack assemble(IInventory pInv) { + public ItemStack assemble(Container pInv) { return ItemStack.EMPTY; } @@ -68,23 +68,23 @@ public class PressingRecipe implements IRecipe { } @Override - public IRecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return ActuallyRecipes.PRESSING_RECIPE.get(); } @Override - public IRecipeType getType() { + public RecipeType getType() { return ActuallyRecipes.Types.PRESSING; } - public static class Serializer extends ForgeRegistryEntry> implements IRecipeSerializer { + public static class Serializer extends ForgeRegistryEntry> implements RecipeSerializer { @Nonnull @Override public PressingRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) { - Ingredient ingredient = Ingredient.fromJson(JSONUtils.getAsJsonObject(pJson, "ingredient")); + Ingredient ingredient = Ingredient.fromJson(GsonHelper.getAsJsonObject(pJson, "ingredient")); JsonObject result = pJson.getAsJsonObject("result"); - ResourceLocation fluidRes = new ResourceLocation(JSONUtils.getAsString(result, "fluid")); - int fluidAmount = JSONUtils.getAsInt(result, "amount"); + ResourceLocation fluidRes = new ResourceLocation(GsonHelper.getAsString(result, "fluid")); + int fluidAmount = GsonHelper.getAsInt(result, "amount"); Fluid fluid = ForgeRegistries.FLUIDS.getValue(fluidRes); if(fluid == null) throw new JsonParseException("Unknown fluid '" + fluidRes + "'"); @@ -95,7 +95,7 @@ public class PressingRecipe implements IRecipe { @Nullable @Override - public PressingRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull PacketBuffer pBuffer) { + public PressingRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull FriendlyByteBuf pBuffer) { Ingredient ingredient = Ingredient.fromNetwork(pBuffer); ResourceLocation fluidRes = new ResourceLocation(pBuffer.readUtf()); int fluidAmount = pBuffer.readInt(); @@ -108,18 +108,18 @@ public class PressingRecipe implements IRecipe { } @Override - public void toNetwork(@Nonnull PacketBuffer pBuffer, @Nonnull PressingRecipe pRecipe) { + public void toNetwork(@Nonnull FriendlyByteBuf pBuffer, @Nonnull PressingRecipe pRecipe) { pRecipe.input.toNetwork(pBuffer); pBuffer.writeUtf(pRecipe.output.getFluid().getRegistryName().toString()); pBuffer.writeInt(pRecipe.output.getAmount()); } } - public static class FinishedRecipe implements IFinishedRecipe { + public static class Result implements FinishedRecipe { private final ResourceLocation ID; private final Ingredient input; private final FluidStack output; - public FinishedRecipe(ResourceLocation ID, Ingredient input, FluidStack output) { + public Result(ResourceLocation ID, Ingredient input, FluidStack output) { this.ID = ID; this.input = input; this.output = output; @@ -140,7 +140,7 @@ public class PressingRecipe implements IRecipe { } @Override - public IRecipeSerializer getType() { + public RecipeSerializer getType() { return ActuallyRecipes.PRESSING_RECIPE.get(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShaped.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShaped.java index 7cab1cc79..e9c86bcbe 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShaped.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShaped.java @@ -1,14 +1,14 @@ package de.ellpeck.actuallyadditions.mod.crafting; import com.google.gson.JsonObject; -import net.minecraft.inventory.CraftingInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipeSerializer; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.item.crafting.ShapedRecipe; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.NonNullList; -import net.minecraft.util.ResourceLocation; +import net.minecraft.core.NonNullList; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.inventory.CraftingContainer; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.ShapedRecipe; import net.minecraftforge.registries.ForgeRegistryEntry; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -27,7 +27,7 @@ public class RecipeKeepDataShaped extends ShapedRecipe { } @Override - public ItemStack assemble(CraftingInventory inv) { + public ItemStack assemble(CraftingContainer inv) { final ItemStack craftingResult = super.assemble(inv); TargetNBTIngredient donorIngredient = null; ItemStack datasource = ItemStack.EMPTY; @@ -56,21 +56,21 @@ public class RecipeKeepDataShaped extends ShapedRecipe { @Override - public IRecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return ActuallyRecipes.KEEP_DATA_SHAPED_RECIPE.get(); } - public static class Serializer extends ForgeRegistryEntry> implements IRecipeSerializer { + public static class Serializer extends ForgeRegistryEntry> implements RecipeSerializer { @Nullable @Override - public RecipeKeepDataShaped fromNetwork(ResourceLocation recipeId, PacketBuffer buffer) { - return new RecipeKeepDataShaped(IRecipeSerializer.SHAPED_RECIPE.fromNetwork(recipeId, buffer)); + public RecipeKeepDataShaped fromNetwork(ResourceLocation recipeId, FriendlyByteBuf buffer) { + return new RecipeKeepDataShaped(RecipeSerializer.SHAPED_RECIPE.fromNetwork(recipeId, buffer)); } @Override public RecipeKeepDataShaped fromJson(ResourceLocation recipeId, JsonObject json) { try { - return new RecipeKeepDataShaped(IRecipeSerializer.SHAPED_RECIPE.fromJson(recipeId, json)); + return new RecipeKeepDataShaped(RecipeSerializer.SHAPED_RECIPE.fromJson(recipeId, json)); } catch (Exception exception) { LOGGER.info("Error reading "+ NAME +" Recipe from packet: ", exception); @@ -79,9 +79,9 @@ public class RecipeKeepDataShaped extends ShapedRecipe { } @Override - public void toNetwork(PacketBuffer buffer, RecipeKeepDataShaped recipe) { + public void toNetwork(FriendlyByteBuf buffer, RecipeKeepDataShaped recipe) { try { - IRecipeSerializer.SHAPED_RECIPE.toNetwork(buffer, recipe); + RecipeSerializer.SHAPED_RECIPE.toNetwork(buffer, recipe); } catch (Exception exception) { LOGGER.info("Error writing "+ NAME +" Recipe to packet: ", exception); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/SingleItem.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/SingleItem.java index 8e2f88232..14430dec4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/SingleItem.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/SingleItem.java @@ -1,10 +1,10 @@ package de.ellpeck.actuallyadditions.mod.crafting; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; +import net.minecraft.world.Container; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; -public class SingleItem implements IInventory { +public class SingleItem implements Container { private final ItemStack itemStack; public SingleItem(ItemStack itemStack) { @@ -52,7 +52,7 @@ public class SingleItem implements IInventory { } @Override - public boolean stillValid(PlayerEntity pPlayer) { + public boolean stillValid(Player pPlayer) { return false; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/SolidFuelRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/SolidFuelRecipe.java index ab02fdd78..849ddacb2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/SolidFuelRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/SolidFuelRecipe.java @@ -1,20 +1,20 @@ package de.ellpeck.actuallyadditions.mod.crafting; import com.google.gson.JsonObject; -import net.minecraft.data.IFinishedRecipe; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.IRecipeSerializer; -import net.minecraft.item.crafting.IRecipeType; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.ResourceLocation; -import net.minecraft.world.World; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +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 net.minecraftforge.registries.ForgeRegistryEntry; import javax.annotation.Nullable; -public class SolidFuelRecipe implements IRecipe { +public class SolidFuelRecipe implements Recipe { public static String NAME = "solid_fuel"; private Ingredient itemIngredient; private int burnTime; @@ -37,7 +37,7 @@ public class SolidFuelRecipe implements IRecipe { } @Override - public boolean matches(SingleItem pInv, World pLevel) { + public boolean matches(SingleItem pInv, Level pLevel) { return itemIngredient.test(pInv.getItem()); } @@ -71,16 +71,16 @@ public class SolidFuelRecipe implements IRecipe { } @Override - public IRecipeSerializer getSerializer() { + public RecipeSerializer getSerializer() { return ActuallyRecipes.SOLID_FUEL_RECIPE.get(); } @Override - public IRecipeType getType() { + public RecipeType getType() { return ActuallyRecipes.Types.SOLID_FUEL; } - public static class Serializer extends ForgeRegistryEntry> implements IRecipeSerializer { + public static class Serializer extends ForgeRegistryEntry> implements RecipeSerializer { @Override public SolidFuelRecipe fromJson(ResourceLocation pId, JsonObject pJson) { Ingredient itemIngredient = Ingredient.fromJson(pJson.get("item")); @@ -90,7 +90,7 @@ public class SolidFuelRecipe implements IRecipe { } @Override - public SolidFuelRecipe fromNetwork(ResourceLocation pId, PacketBuffer pBuffer) { + public SolidFuelRecipe fromNetwork(ResourceLocation pId, FriendlyByteBuf pBuffer) { Ingredient itemIngredient = Ingredient.fromNetwork(pBuffer); int totalEnergy = pBuffer.readInt(); int burnTime = pBuffer.readInt(); @@ -98,20 +98,20 @@ public class SolidFuelRecipe implements IRecipe { } @Override - public void toNetwork(PacketBuffer pBuffer, SolidFuelRecipe pRecipe) { + public void toNetwork(FriendlyByteBuf pBuffer, SolidFuelRecipe pRecipe) { pRecipe.itemIngredient.toNetwork(pBuffer); pBuffer.writeInt(pRecipe.totalEnergy); pBuffer.writeInt(pRecipe.burnTime); } } - public static class FinishedRecipe implements IFinishedRecipe { + public static class Result implements FinishedRecipe { private Ingredient itemIngredient; private int burnTime; private int totalEnergy; private ResourceLocation id; - public FinishedRecipe(ResourceLocation id, Ingredient itemIngredient, int totalEnergy, int burnTime) { + public Result(ResourceLocation id, Ingredient itemIngredient, int totalEnergy, int burnTime) { this.itemIngredient = itemIngredient; this.burnTime = burnTime; this.totalEnergy = totalEnergy; @@ -131,7 +131,7 @@ public class SolidFuelRecipe implements IRecipe { } @Override - public IRecipeSerializer getType() { + public RecipeSerializer getType() { return ActuallyRecipes.SOLID_FUEL_RECIPE.get(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/TargetNBTIngredient.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/TargetNBTIngredient.java index ff1965418..4c3cd32db 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/TargetNBTIngredient.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/TargetNBTIngredient.java @@ -3,19 +3,19 @@ package de.ellpeck.actuallyadditions.mod.crafting; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.network.PacketBuffer; -import net.minecraft.tags.ITag; -import net.minecraft.util.IItemProvider; -import net.minecraft.util.ResourceLocation; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.level.ItemLike; import net.minecraftforge.common.crafting.IIngredientSerializer; import javax.annotation.Nonnull; import java.util.stream.Stream; public class TargetNBTIngredient extends Ingredient { - public TargetNBTIngredient(Stream itemLists) { + public TargetNBTIngredient(Stream itemLists) { super(itemLists); } @@ -25,15 +25,15 @@ public class TargetNBTIngredient extends Ingredient { return SERIALIZER; } - public static TargetNBTIngredient of(IItemProvider itemProvider) { - return new TargetNBTIngredient(Stream.of(new SingleItemList(new ItemStack(itemProvider)))); + public static TargetNBTIngredient of(ItemLike itemProvider) { + return new TargetNBTIngredient(Stream.of(new ItemValue(new ItemStack(itemProvider)))); } public static TargetNBTIngredient of(ItemStack itemStack) { - return new TargetNBTIngredient(Stream.of(new SingleItemList(itemStack))); + return new TargetNBTIngredient(Stream.of(new ItemValue(itemStack))); } @Nonnull - public static TargetNBTIngredient of(@Nonnull ITag tag) { - return new TargetNBTIngredient(Stream.of(new TagList(tag))); + public static TargetNBTIngredient of(@Nonnull TagKey tag) { + return new TargetNBTIngredient(Stream.of(new TagValue(tag))); } @@ -53,8 +53,8 @@ public class TargetNBTIngredient extends Ingredient { @Override @Nonnull - public TargetNBTIngredient parse(PacketBuffer buffer) { - return new TargetNBTIngredient(Stream.generate(() -> new SingleItemList(buffer.readItem())).limit(buffer.readVarInt())); + public TargetNBTIngredient parse(FriendlyByteBuf buffer) { + return new TargetNBTIngredient(Stream.generate(() -> new ItemValue(buffer.readItem())).limit(buffer.readVarInt())); } @Override @@ -64,7 +64,7 @@ public class TargetNBTIngredient extends Ingredient { } @Override - public void write(PacketBuffer buffer, TargetNBTIngredient ingredient) { + public void write(FriendlyByteBuf buffer, TargetNBTIngredient ingredient) { ItemStack[] items = ingredient.getItems(); buffer.writeVarInt(items.length); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/WrappedRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/WrappedRecipe.java index e9b01f66b..b1d126cda 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/WrappedRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/WrappedRecipe.java @@ -1,27 +1,27 @@ package de.ellpeck.actuallyadditions.mod.crafting; import com.google.gson.JsonObject; -import net.minecraft.data.IFinishedRecipe; -import net.minecraft.item.crafting.IRecipeSerializer; -import net.minecraft.util.ResourceLocation; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.crafting.RecipeSerializer; import javax.annotation.Nullable; import java.util.function.Consumer; -public class WrappedRecipe implements IFinishedRecipe { - IFinishedRecipe inner; - IRecipeSerializer serializerOverride; +public class WrappedRecipe implements FinishedRecipe { + FinishedRecipe inner; + RecipeSerializer serializerOverride; - public WrappedRecipe(IFinishedRecipe innerIn) { + public WrappedRecipe(FinishedRecipe innerIn) { inner = innerIn; } - public WrappedRecipe(IFinishedRecipe innerIn, IRecipeSerializer serializerOverrideIn) { + public WrappedRecipe(FinishedRecipe innerIn, RecipeSerializer serializerOverrideIn) { inner = innerIn; serializerOverride = serializerOverrideIn; } - public static Consumer Inject(Consumer consumer, IRecipeSerializer serializer) { + public static Consumer Inject(Consumer consumer, RecipeSerializer serializer) { return iFinishedRecipe -> consumer.accept(new WrappedRecipe(iFinishedRecipe, serializer)); } @@ -48,7 +48,7 @@ public class WrappedRecipe implements IFinishedRecipe { } @Override - public IRecipeSerializer getType () { + public RecipeSerializer getType () { return serializerOverride != null? serializerOverride:inner.getType(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/data/PlayerData.java b/src/main/java/de/ellpeck/actuallyadditions/mod/data/PlayerData.java index 91550cead..c52d434c2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/data/PlayerData.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/data/PlayerData.java @@ -11,11 +11,11 @@ package de.ellpeck.actuallyadditions.mod.data; import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.nbt.ListNBT; -import net.minecraft.nbt.StringNBT; -import net.minecraft.world.server.ServerWorld; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.StringTag; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.player.Player; import java.util.ArrayList; import java.util.List; @@ -24,8 +24,8 @@ import java.util.concurrent.ConcurrentHashMap; public final class PlayerData { - public static PlayerSave getDataFromPlayer(PlayerEntity player) { - WorldData worldData = WorldData.get((ServerWorld) player.getCommandSenderWorld()); + public static PlayerSave getDataFromPlayer(Player player) { + WorldData worldData = WorldData.get((ServerLevel) player.getCommandSenderWorld()); ConcurrentHashMap data = worldData.playerSaveData; UUID id = player.getUUID(); @@ -63,17 +63,17 @@ public final class PlayerData { this.id = id; } - public void readFromNBT(CompoundNBT compound, boolean savingToFile) { + public void readFromNBT(CompoundTag compound, boolean savingToFile) { this.bookGottenAlready = compound.getBoolean("BookGotten"); this.didBookTutorial = compound.getBoolean("DidTutorial"); this.hasBatWings = compound.getBoolean("HasBatWings"); this.batWingsFlyTime = compound.getInt("BatWingsFlyTime"); - ListNBT bookmarks = compound.getList("Bookmarks", 8); + ListTag bookmarks = compound.getList("Bookmarks", 8); this.loadBookmarks(bookmarks); - ListNBT trials = compound.getList("Trials", 8); + ListTag trials = compound.getList("Trials", 8); this.loadTrials(trials); if (!savingToFile) { @@ -81,7 +81,7 @@ public final class PlayerData { } } - public void writeToNBT(CompoundNBT compound, boolean savingToFile) { + public void writeToNBT(CompoundTag compound, boolean savingToFile) { compound.putBoolean("BookGotten", this.bookGottenAlready); compound.putBoolean("DidTutorial", this.didBookTutorial); @@ -96,17 +96,17 @@ public final class PlayerData { } } - public ListNBT saveBookmarks() { - ListNBT bookmarks = new ListNBT(); + public ListTag saveBookmarks() { + ListTag bookmarks = new ListTag(); for (IBookletPage bookmark : this.bookmarks) { - bookmarks.add(StringNBT.valueOf(bookmark == null + bookmarks.add(StringTag.valueOf(bookmark == null ? "" : bookmark.getIdentifier())); } return bookmarks; } - public void loadBookmarks(ListNBT bookmarks) { + public void loadBookmarks(ListTag bookmarks) { for (int i = 0; i < bookmarks.size(); i++) { String strg = bookmarks.getString(i); if (!strg.isEmpty()) { @@ -118,15 +118,15 @@ public final class PlayerData { } } - public ListNBT saveTrials() { - ListNBT trials = new ListNBT(); + public ListTag saveTrials() { + ListTag trials = new ListTag(); for (String trial : this.completedTrials) { - trials.add(StringNBT.valueOf(trial)); + trials.add(StringTag.valueOf(trial)); } return trials; } - public void loadTrials(ListNBT trials) { + public void loadTrials(ListTag trials) { this.completedTrials.clear(); for (int i = 0; i < trials.size(); i++) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/data/WorldData.java b/src/main/java/de/ellpeck/actuallyadditions/mod/data/WorldData.java index e0c6ec943..f23e42f36 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/data/WorldData.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/data/WorldData.java @@ -15,17 +15,17 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave; import de.ellpeck.actuallyadditions.mod.misc.apiimpl.LaserRelayConnectionHandler; import io.netty.util.internal.ConcurrentSet; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.nbt.ListNBT; -import net.minecraft.world.World; -import net.minecraft.world.server.ServerWorld; -import net.minecraft.world.storage.WorldSavedData; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.saveddata.SavedData; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; // TODO: [port] validate this still works -public class WorldData extends WorldSavedData { +public class WorldData extends SavedData { public static final String DATA_TAG = ActuallyAdditions.MODID + "data"; public static final String SAVE_NAME = ActuallyAdditions.MODID + "_worldsave"; @@ -34,19 +34,11 @@ public class WorldData extends WorldSavedData { public final ConcurrentHashMap playerSaveData = new ConcurrentHashMap<>(); public WorldData() { - super(SAVE_NAME); + super(); } - public static WorldData get(World world) { - WorldData storage = ((ServerWorld) world).getDataStorage().get(WorldData::new, SAVE_NAME); - - if (storage == null) { - storage = new WorldData(); - storage.setDirty(); - ((ServerWorld) world).getDataStorage().set(storage); - } - - return storage; + public static WorldData get(Level level) { + return ((ServerLevel) level).getDataStorage().computeIfAbsent(WorldData::load, WorldData::new, SAVE_NAME); } //TODO what in the world is this? @@ -57,45 +49,46 @@ public class WorldData extends WorldSavedData { } } - @Override - public void load(CompoundNBT compound) { - this.laserRelayNetworks.clear(); - ListNBT networkList = compound.getList("Networks", 10); + public static WorldData load(CompoundTag compound) { + WorldData worldData = new WorldData(); + worldData.laserRelayNetworks.clear(); + ListTag networkList = compound.getList("Networks", 10); for (int i = 0; i < networkList.size(); i++) { Network network = LaserRelayConnectionHandler.readNetworkFromNBT(networkList.getCompound(i)); - this.laserRelayNetworks.add(network); + worldData.laserRelayNetworks.add(network); } - this.playerSaveData.clear(); - ListNBT playerList = compound.getList("PlayerData", 10); + worldData.playerSaveData.clear(); + ListTag playerList = compound.getList("PlayerData", 10); for (int i = 0; i < playerList.size(); i++) { - CompoundNBT player = playerList.getCompound(i); + CompoundTag player = playerList.getCompound(i); UUID id = player.getUUID("UUID"); - CompoundNBT data = player.getCompound("Data"); + CompoundTag data = player.getCompound("Data"); PlayerSave save = new PlayerSave(id); save.readFromNBT(data, true); - this.playerSaveData.put(id, save); + worldData.playerSaveData.put(id, save); } + return worldData; } @Override - public CompoundNBT save(CompoundNBT compound) { + public CompoundTag save(CompoundTag compound) { //Laser World Data - ListNBT networkList = new ListNBT(); + ListTag networkList = new ListTag(); for (Network network : this.laserRelayNetworks) { networkList.add(LaserRelayConnectionHandler.writeNetworkToNBT(network)); } compound.put("Networks", networkList); //Player Data - ListNBT playerList = new ListNBT(); + ListTag playerList = new ListTag(); for (PlayerSave save : this.playerSaveData.values()) { - CompoundNBT player = new CompoundNBT(); + CompoundTag player = new CompoundTag(); player.putUUID("UUID", save.id); - CompoundNBT data = new CompoundNBT(); + CompoundTag data = new CompoundTag(); save.writeToNBT(data, true); player.put("Data", data); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/entity/EntityWorm.java b/src/main/java/de/ellpeck/actuallyadditions/mod/entity/EntityWorm.java index f4b1f57c1..563178eb3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/entity/EntityWorm.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/entity/EntityWorm.java @@ -11,33 +11,39 @@ package de.ellpeck.actuallyadditions.mod.entity; import de.ellpeck.actuallyadditions.mod.config.CommonConfig; -import net.minecraft.block.*; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.network.IPacket; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraft.world.server.ServerWorld; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.protocol.Packet; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +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.BonemealableBlock; +import net.minecraft.world.level.block.BushBlock; +import net.minecraft.world.level.block.FarmBlock; +import net.minecraft.world.level.block.GrassBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.AABB; import net.minecraftforge.common.FarmlandWaterManager; import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.ticket.AABBTicket; -import net.minecraftforge.fml.network.NetworkHooks; +import net.minecraftforge.network.NetworkHooks; public class EntityWorm extends Entity { public int timer; private AABBTicket waterTicket; - public EntityWorm(EntityType type, World world) { + public EntityWorm(EntityType type, Level world) { super(type, world); - this.setBoundingBox(new AxisAlignedBB(0, 0, 0, 0, 0, 0)); + this.setBoundingBox(new AABB(0, 0, 0, 0, 0, 0)); } - public static boolean canWormify(World world, BlockPos pos, BlockState state) { + public static boolean canWormify(Level world, BlockPos pos, BlockState state) { Block block = state.getBlock(); - boolean rightBlock = block instanceof FarmlandBlock || block == Blocks.DIRT || block instanceof GrassBlock; + boolean rightBlock = block instanceof FarmBlock || block == Blocks.DIRT || block instanceof GrassBlock; if (rightBlock) { BlockPos posUp = pos.above(); BlockState stateUp = world.getBlockState(posUp); @@ -49,11 +55,11 @@ public class EntityWorm extends Entity { } @Override - public void remove() { + public void remove(RemovalReason reason) { if (waterTicket != null) waterTicket.invalidate(); - super.remove(); + super.remove(reason); } @Override @@ -74,7 +80,7 @@ public class EntityWorm extends Entity { if (waterTicket != null) waterTicket.invalidate(); - waterTicket = FarmlandWaterManager.addAABBTicket(level, new AxisAlignedBB(getX() - 2, getY() - 1.5, getZ() - 2, getX() + 2, getY(), getZ() + 2)); + waterTicket = FarmlandWaterManager.addAABBTicket(level, new AABB(getX() - 2, getY() - 1.5, getZ() - 2, getX() + 2, getY(), getZ() + 2)); } @Override @@ -96,7 +102,7 @@ public class EntityWorm extends Entity { boolean isMiddlePose = x == 0 && z == 0; if (canWormify(this.level, pos, state)) { - boolean isFarmland = block instanceof FarmlandBlock; + boolean isFarmland = block instanceof FarmBlock; /* if (!isFarmland || state.getValue(FarmlandBlock.MOISTURE) < 7) { if (isMiddlePose || this.level.random.nextFloat() >= 0.45F) { @@ -119,8 +125,8 @@ public class EntityWorm extends Entity { BlockState plantState = this.level.getBlockState(plant); Block plantBlock = plantState.getBlock(); - if ((plantBlock instanceof IGrowable || plantBlock instanceof IPlantable) && !(plantBlock instanceof GrassBlock)) { - plantBlock.randomTick(plantState, (ServerWorld) this.level, plant, this.level.random); + if ((plantBlock instanceof BonemealableBlock || plantBlock instanceof IPlantable) && !(plantBlock instanceof GrassBlock)) { + plantBlock.randomTick(plantState, (ServerLevel) this.level, plant, this.level.random); BlockState newState = this.level.getBlockState(plant); if (newState != plantState) { @@ -149,17 +155,17 @@ public class EntityWorm extends Entity { } @Override - protected void readAdditionalSaveData(CompoundNBT compound) { + protected void readAdditionalSaveData(CompoundTag compound) { this.timer = compound.getInt("Timer"); } @Override - protected void addAdditionalSaveData(CompoundNBT compound) { + protected void addAdditionalSaveData(CompoundTag compound) { compound.putInt("Timer", this.timer); } @Override - public IPacket getAddEntityPacket() { + public Packet getAddEntityPacket() { return NetworkHooks.getEntitySpawningPacket(this); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/entity/RenderWorm.java b/src/main/java/de/ellpeck/actuallyadditions/mod/entity/RenderWorm.java index 8b90ac996..1f82c8094 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/entity/RenderWorm.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/entity/RenderWorm.java @@ -10,21 +10,20 @@ package de.ellpeck.actuallyadditions.mod.entity; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.math.Vector3f; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; +import net.minecraft.Util; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.IRenderTypeBuffer; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.renderer.entity.EntityRenderer; -import net.minecraft.client.renderer.entity.EntityRendererManager; -import net.minecraft.client.renderer.model.ItemCameraTransforms; +import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.inventory.container.PlayerContainer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Util; -import net.minecraft.util.math.vector.Quaternion; -import net.minecraft.util.math.vector.Vector3f; -import net.minecraft.util.text.StringTextComponent; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.inventory.InventoryMenu; +import net.minecraft.world.item.ItemStack; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -35,16 +34,16 @@ public class RenderWorm extends EntityRenderer { private ItemStack stack; private ItemStack snailStack; - public RenderWorm(EntityRendererManager p_i46179_1_) { - super(p_i46179_1_); + public RenderWorm(EntityRendererProvider.Context context) { + super(context); stack = new ItemStack(ActuallyItems.WORM.get()); snailStack = new ItemStack(ActuallyItems.WORM.get()); - snailStack.setHoverName(new StringTextComponent("Snail Mail")); + snailStack.setHoverName(new TextComponent("Snail Mail")); } @Override - public void render(EntityWorm entity, float partialTicks, float p_225623_3_, MatrixStack matrix, IRenderTypeBuffer buffer, int light) { + public void render(EntityWorm entity, float partialTicks, float p_225623_3_, PoseStack matrix, MultiBufferSource buffer, int light) { boolean isSnail = entity.getCustomName().getString().equalsIgnoreCase("snail mail"); matrix.pushPose(); matrix.translate(0, 0.7F, 0); @@ -52,7 +51,7 @@ public class RenderWorm extends EntityRenderer { matrix.mulPose(Vector3f.YP.rotationDegrees(-(float) (boop % 360))); matrix.translate(0,0,0.4); Minecraft.getInstance().getItemRenderer().renderStatic( - isSnail? snailStack:stack, ItemCameraTransforms.TransformType.FIXED, light, OverlayTexture.NO_OVERLAY, matrix, buffer + isSnail? snailStack:stack, ItemTransforms.TransformType.FIXED, light, OverlayTexture.NO_OVERLAY, matrix, buffer, 0 ); matrix.popPose(); @@ -60,6 +59,6 @@ public class RenderWorm extends EntityRenderer { @Override public ResourceLocation getTextureLocation(EntityWorm pEntity) { - return PlayerContainer.BLOCK_ATLAS; + return InventoryMenu.BLOCK_ATLAS; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java index dd7ad04fc..ee95d9c38 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java @@ -10,7 +10,8 @@ package de.ellpeck.actuallyadditions.mod.event; -import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay; import de.ellpeck.actuallyadditions.mod.config.CommonConfig; @@ -19,18 +20,18 @@ import de.ellpeck.actuallyadditions.mod.inventory.gui.EnergyDisplay; import de.ellpeck.actuallyadditions.mod.tile.IEnergyDisplay; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.Block; +import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TextFormatting; +import net.minecraft.client.gui.Font; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +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.client.event.RenderGameOverlayEvent; @@ -41,8 +42,8 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; @OnlyIn(Dist.CLIENT) public class ClientEvents { - private static final ITextComponent ADVANCED_INFO_TEXT_PRE = new StringTextComponent(" -").withStyle(TextFormatting.DARK_GRAY); - private static final ITextComponent ADVANCED_INFO_HEADER_PRE = new StringTextComponent(" -").withStyle(TextFormatting.GRAY); + private static final Component ADVANCED_INFO_TEXT_PRE = new TextComponent(" -").withStyle(ChatFormatting.DARK_GRAY); + private static final Component ADVANCED_INFO_HEADER_PRE = new TextComponent(" -").withStyle(ChatFormatting.GRAY); private static EnergyDisplay energyDisplay; @@ -163,45 +164,46 @@ public class ClientEvents { public void onGameOverlay(RenderGameOverlayEvent.Post event) { Minecraft minecraft = Minecraft.getInstance(); if (event.getType() == RenderGameOverlayEvent.ElementType.ALL && minecraft.screen == null) { - PlayerEntity player = minecraft.player; + PoseStack matrices = event.getMatrixStack(); + Player player = minecraft.player; if (player == null) { return; } - RayTraceResult posHit = minecraft.hitResult; - FontRenderer font = minecraft.font; + HitResult posHit = minecraft.hitResult; + Font font = minecraft.font; ItemStack stack = player.getMainHandItem(); if (StackUtil.isValid(stack)) { if (stack.getItem() instanceof IHudDisplay) { - ((IHudDisplay) stack.getItem()).displayHud(event.getMatrixStack(), minecraft, player, stack, posHit, event.getWindow()); + ((IHudDisplay) stack.getItem()).displayHud(matrices, minecraft, player, stack, posHit, event.getWindow()); } } - if (posHit != null && posHit.getType() == RayTraceResult.Type.BLOCK) { - BlockRayTraceResult rayCast = (BlockRayTraceResult) posHit; + if (posHit != null && posHit.getType() == HitResult.Type.BLOCK) { + BlockHitResult rayCast = (BlockHitResult) posHit; Block blockHit = minecraft.level.getBlockState(rayCast.getBlockPos()).getBlock(); - TileEntity tileHit = minecraft.level.getBlockEntity(rayCast.getBlockPos()); + BlockEntity tileHit = minecraft.level.getBlockEntity(rayCast.getBlockPos()); if (blockHit instanceof IHudDisplay) { - ((IHudDisplay) blockHit).displayHud(event.getMatrixStack(), minecraft, player, stack, posHit, event.getWindow()); + ((IHudDisplay) blockHit).displayHud(matrices, minecraft, player, stack, posHit, event.getWindow()); } if (tileHit instanceof TileEntityBase) { TileEntityBase base = (TileEntityBase) tileHit; if (base.isRedstoneToggle()) { - String strg = String.format("%s: %s", I18n.get("info." + ActuallyAdditions.MODID + ".redstoneMode"), TextFormatting.DARK_RED + I18n.get("info." + ActuallyAdditions.MODID + ".redstoneMode." + (base.isPulseMode + String strg = String.format("%s: %s", I18n.get("info." + ActuallyAdditions.MODID + ".redstoneMode"), ChatFormatting.DARK_RED + I18n.get("info." + ActuallyAdditions.MODID + ".redstoneMode." + (base.isPulseMode ? "pulse" - : "deactivation")) + TextFormatting.RESET); - font.drawShadow(event.getMatrixStack(), strg, event.getWindow().getGuiScaledWidth() / 2f + 5, event.getWindow().getGuiScaledHeight() / 2f + 5, 0xFFFFFF); + : "deactivation")) + ChatFormatting.RESET); + font.drawShadow(matrices, strg, event.getWindow().getGuiScaledWidth() / 2f + 5, event.getWindow().getGuiScaledHeight() / 2f + 5, 0xFFFFFF); String expl; if (!stack.isEmpty() && stack.getItem() == CommonConfig.Other.redstoneConfigureItem) { - expl = TextFormatting.GREEN + I18n.get("info." + ActuallyAdditions.MODID + ".redstoneMode.validItem"); + expl = ChatFormatting.GREEN + I18n.get("info." + ActuallyAdditions.MODID + ".redstoneMode.validItem"); } else { - expl = TextFormatting.GRAY.toString() + TextFormatting.ITALIC + I18n.get("info." + ActuallyAdditions.MODID + ".redstoneMode.invalidItem", I18n.get(CommonConfig.Other.redstoneConfigureItem.asItem().getDescriptionId())); + expl = ChatFormatting.GRAY.toString() + ChatFormatting.ITALIC + I18n.get("info." + ActuallyAdditions.MODID + ".redstoneMode.invalidItem", I18n.get(CommonConfig.Other.redstoneConfigureItem.asItem().getDescriptionId())); } - font.drawShadow(event.getMatrixStack(), expl, event.getWindow().getGuiScaledWidth() / 2f + 5, event.getWindow().getGuiScaledHeight() / 2f + 15, 0xFFFFFF); + font.drawShadow(matrices, expl, event.getWindow().getGuiScaledWidth() / 2f + 5, event.getWindow().getGuiScaledHeight() / 2f + 15, 0xFFFFFF); } } @@ -213,10 +215,11 @@ public class ClientEvents { } energyDisplay.setData(2, event.getWindow().getGuiScaledHeight() - 96, display.getEnergyStorage(), true, true); - GlStateManager._pushMatrix(); - GlStateManager._color4f(1F, 1F, 1F, 1F); - energyDisplay.draw(event.getMatrixStack()); - GlStateManager._popMatrix(); + matrices.pushPose(); +// GlStateManager._color4f(1F, 1F, 1F, 1F); + RenderSystem.setShaderColor(1F, 1F, 1F, 1F); + energyDisplay.draw(matrices); + matrices.popPose(); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/CommonEvents.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/CommonEvents.java index 8a50d4ada..c629c5fdc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/CommonEvents.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/CommonEvents.java @@ -23,13 +23,13 @@ import de.ellpeck.actuallyadditions.mod.tile.FilterSettings; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.entity.monster.SpiderEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.item.ItemStack; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.monster.Spider; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.event.entity.living.LivingDropsEvent; import net.minecraftforge.event.entity.player.EntityItemPickupEvent; import net.minecraftforge.event.entity.player.PlayerEvent; @@ -57,15 +57,15 @@ public class CommonEvents { return; } - PlayerEntity player = event.getPlayer(); + Player player = event.getPlayer(); ItemEntity item = event.getItem(); if (item != null && item.isAlive()) { ItemStack stack = item.getItem(); if (StackUtil.isValid(stack)) { - for (int i = 0; i < player.inventory.getContainerSize(); i++) { - if (i != player.inventory.selected) { + for (int i = 0; i < player.getInventory().getContainerSize(); i++) { + if (i != player.getInventory().selected) { - ItemStack invStack = player.inventory.getItem(i); + ItemStack invStack = player.getInventory().getItem(i); if (StackUtil.isValid(invStack) && invStack.getItem() instanceof Sack && invStack.hasTag()) { if (invStack.getOrCreateTag().getBoolean("AutoInsert")) { boolean changed = false; @@ -141,9 +141,9 @@ public class CommonEvents { //TODO this isnt how this should be done im pretty sure... @SubscribeEvent public void onEntityDropEvent(LivingDropsEvent event) { - if (event.getEntityLiving().level != null && !event.getEntityLiving().level.isClientSide && event.getSource().getEntity() instanceof PlayerEntity) { + if (event.getEntityLiving().level != null && !event.getEntityLiving().level.isClientSide && event.getSource().getEntity() instanceof Player) { //Drop Cobwebs from Spiders - if (ConfigBoolValues.DO_SPIDER_DROPS.isEnabled() && event.getEntityLiving() instanceof SpiderEntity) { + if (ConfigBoolValues.DO_SPIDER_DROPS.isEnabled() && event.getEntityLiving() instanceof Spider) { if (event.getEntityLiving().level.random.nextInt(20) <= event.getLootingLevel() * 2) { event.getDrops().add(new ItemEntity(event.getEntityLiving().level, event.getEntityLiving().getX(), event.getEntityLiving().getY(), event.getEntityLiving().getZ(), new ItemStack(Blocks.COBWEB, event.getEntityLiving().level.random.nextInt(2 + event.getLootingLevel()) + 1))); } @@ -153,8 +153,8 @@ public class CommonEvents { @SubscribeEvent public void onLogInEvent(PlayerEvent.PlayerLoggedInEvent event) { - if (!event.getPlayer().level.isClientSide && event.getPlayer() instanceof ServerPlayerEntity) { - ServerPlayerEntity player = (ServerPlayerEntity) event.getPlayer(); + if (!event.getPlayer().level.isClientSide && event.getPlayer() instanceof ServerPlayer) { + ServerPlayer player = (ServerPlayer) event.getPlayer(); PacketHandlerHelper.syncPlayerData(player, true); ActuallyAdditions.LOGGER.info("Sending Player Data to player " + player.getName() + " with UUID " + player.getUUID() + "."); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/fluids/FluidAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/fluids/FluidAA.java index 93cb2ccc1..ccfb87174 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/fluids/FluidAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/fluids/FluidAA.java @@ -13,19 +13,19 @@ package de.ellpeck.actuallyadditions.mod.fluids; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; -import net.minecraft.block.AbstractBlock; -import net.minecraft.block.Block; -import net.minecraft.block.FlowingFluidBlock; -import net.minecraft.block.material.Material; -import net.minecraft.fluid.FlowingFluid; -import net.minecraft.fluid.Fluid; -import net.minecraft.item.BucketItem; -import net.minecraft.item.Item; -import net.minecraft.item.Items; -import net.minecraft.util.ResourceLocation; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.BucketItem; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.LiquidBlock; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.material.FlowingFluid; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.level.material.Material; import net.minecraftforge.fluids.FluidAttributes; import net.minecraftforge.fluids.ForgeFlowingFluid; -import net.minecraftforge.fml.RegistryObject; +import net.minecraftforge.registries.RegistryObject; import java.util.function.Supplier; @@ -33,7 +33,7 @@ public class FluidAA implements Supplier { private String name; private RegistryObject source; private RegistryObject flowing; - private RegistryObject fluidBlock; + private RegistryObject fluidBlock; private RegistryObject bucket; public String getName() { @@ -45,11 +45,11 @@ public class FluidAA implements Supplier { ForgeFlowingFluid.Properties props = makeProperties(textureName, () -> fluidBlock.get(), () -> source.get(), () -> flowing.get(), () -> bucket.get()); source = InitFluids.FLUIDS.register(name, () -> new ForgeFlowingFluid.Source(props)); flowing = InitFluids.FLUIDS.register(name + "_flowing", () -> new ForgeFlowingFluid.Flowing(props)); - fluidBlock = ActuallyBlocks.BLOCKS.register(name, () -> new FlowingFluidBlock(source, AbstractBlock.Properties.of(Material.WATER))); + fluidBlock = ActuallyBlocks.BLOCKS.register(name, () -> new LiquidBlock(source, BlockBehaviour.Properties.of(Material.WATER))); bucket = ActuallyItems.ITEMS.register(name + "_bucket", () -> new BucketItem(source, new Item.Properties().craftRemainder(Items.BUCKET).tab(ActuallyAdditions.GROUP).stacksTo(1))); } - public static ForgeFlowingFluid.Properties makeProperties(String texture, Supplier blockSupplier, Supplier stillSupplier, Supplier flowingSupplier, Supplier bucketSupplier) { + public static ForgeFlowingFluid.Properties makeProperties(String texture, Supplier blockSupplier, Supplier stillSupplier, Supplier flowingSupplier, Supplier bucketSupplier) { return new ForgeFlowingFluid.Properties(stillSupplier, flowingSupplier, FluidAttributes.builder(new ResourceLocation(ActuallyAdditions.MODID,texture + "_still"), new ResourceLocation(ActuallyAdditions.MODID, texture + "_flowing"))).bucket(bucketSupplier).block(blockSupplier); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/fluids/InitFluids.java b/src/main/java/de/ellpeck/actuallyadditions/mod/fluids/InitFluids.java index 032142b5b..ae52302ae 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/fluids/InitFluids.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/fluids/InitFluids.java @@ -11,8 +11,8 @@ package de.ellpeck.actuallyadditions.mod.fluids; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import net.minecraft.block.Block; -import net.minecraft.fluid.Fluid; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.material.Fluid; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ActuallyContainers.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ActuallyContainers.java index 474dcb5d7..2783aeee2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ActuallyContainers.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ActuallyContainers.java @@ -1,41 +1,41 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import net.minecraft.inventory.container.ContainerType; -import net.minecraftforge.common.extensions.IForgeContainerType; -import net.minecraftforge.fml.RegistryObject; +import net.minecraft.world.inventory.MenuType; +import net.minecraftforge.common.extensions.IForgeMenuType; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; public class ActuallyContainers { - public static final DeferredRegister> CONTAINERS = DeferredRegister.create(ForgeRegistries.CONTAINERS, ActuallyAdditions.MODID); + public static final DeferredRegister> CONTAINERS = DeferredRegister.create(ForgeRegistries.CONTAINERS, ActuallyAdditions.MODID); - public static final RegistryObject> BAG_CONTAINER = CONTAINERS.register("bag_container", () -> IForgeContainerType.create(SackContainer::fromNetwork)); - public static final RegistryObject> BIO_REACTOR_CONTAINER = CONTAINERS.register("bioreactor_container", () -> IForgeContainerType.create(ContainerBioReactor::fromNetwork)); - public static final RegistryObject> BREAKER_CONTAINER = CONTAINERS.register("breaker_container", () -> IForgeContainerType.create(ContainerBreaker::fromNetwork)); - public static final RegistryObject> CANOLA_PRESS_CONTAINER = CONTAINERS.register("canola_press_container", () -> IForgeContainerType.create(ContainerCanolaPress::fromNetwork)); - public static final RegistryObject> COAL_GENERATOR_CONTAINER = CONTAINERS.register("coal_generator_container", () -> IForgeContainerType.create(ContainerCoalGenerator::fromNetwork)); - public static final RegistryObject> COFFEE_MACHINE_CONTAINER = CONTAINERS.register("coffee_machine_container", () -> IForgeContainerType.create(ContainerCoffeeMachine::fromNetwork)); - public static final RegistryObject> DIRECTIONAL_BREAKER_CONTAINER = CONTAINERS.register("directional_breaker_container", () -> IForgeContainerType.create(ContainerDirectionalBreaker::fromNetwork)); - public static final RegistryObject> DRILL_CONTAINER = CONTAINERS.register("drill_container", () -> IForgeContainerType.create(ContainerDrill::fromNetwork)); - public static final RegistryObject> DROPPER_CONTAINER = CONTAINERS.register("dropper_container", () -> IForgeContainerType.create(ContainerDropper::fromNetwork)); - public static final RegistryObject> ENERVATOR_CONTAINER = CONTAINERS.register("enervator_container", () -> IForgeContainerType.create(ContainerEnervator::fromNetwork)); - public static final RegistryObject> ENERGIZER_CONTAINER = CONTAINERS.register("energizer_container", () -> IForgeContainerType.create(ContainerEnergizer::fromNetwork)); + public static final RegistryObject> BAG_CONTAINER = CONTAINERS.register("bag_container", () -> IForgeMenuType.create(SackContainer::fromNetwork)); + public static final RegistryObject> BIO_REACTOR_CONTAINER = CONTAINERS.register("bioreactor_container", () -> IForgeMenuType.create(ContainerBioReactor::fromNetwork)); + public static final RegistryObject> BREAKER_CONTAINER = CONTAINERS.register("breaker_container", () -> IForgeMenuType.create(ContainerBreaker::fromNetwork)); + public static final RegistryObject> CANOLA_PRESS_CONTAINER = CONTAINERS.register("canola_press_container", () -> IForgeMenuType.create(ContainerCanolaPress::fromNetwork)); + public static final RegistryObject> COAL_GENERATOR_CONTAINER = CONTAINERS.register("coal_generator_container", () -> IForgeMenuType.create(ContainerCoalGenerator::fromNetwork)); + public static final RegistryObject> COFFEE_MACHINE_CONTAINER = CONTAINERS.register("coffee_machine_container", () -> IForgeMenuType.create(ContainerCoffeeMachine::fromNetwork)); + public static final RegistryObject> DIRECTIONAL_BREAKER_CONTAINER = CONTAINERS.register("directional_breaker_container", () -> IForgeMenuType.create(ContainerDirectionalBreaker::fromNetwork)); + public static final RegistryObject> DRILL_CONTAINER = CONTAINERS.register("drill_container", () -> IForgeMenuType.create(ContainerDrill::fromNetwork)); + public static final RegistryObject> DROPPER_CONTAINER = CONTAINERS.register("dropper_container", () -> IForgeMenuType.create(ContainerDropper::fromNetwork)); + public static final RegistryObject> ENERVATOR_CONTAINER = CONTAINERS.register("enervator_container", () -> IForgeMenuType.create(ContainerEnervator::fromNetwork)); + public static final RegistryObject> ENERGIZER_CONTAINER = CONTAINERS.register("energizer_container", () -> IForgeMenuType.create(ContainerEnergizer::fromNetwork)); - public static final RegistryObject> FARMER_CONTAINER = CONTAINERS.register("farmer_container", () -> IForgeContainerType.create(ContainerFarmer::fromNetwork)); - public static final RegistryObject> FEEDER_CONTAINER = CONTAINERS.register("feeder_container", () -> IForgeContainerType.create(ContainerFeeder::fromNetwork)); - public static final RegistryObject> FERMENTING_BARREL_CONTAINER = CONTAINERS.register("fermenting_barrel_container", () -> IForgeContainerType.create(ContainerFermentingBarrel::fromNetwork)); - public static final RegistryObject> FILTER_CONTAINER = CONTAINERS.register("filter_container", () -> IForgeContainerType.create(ContainerFilter::fromNetwork)); - public static final RegistryObject> FIREWORK_BOX_CONTAINER = CONTAINERS.register("firework_box_container", () -> IForgeContainerType.create(ContainerFireworkBox::fromNetwork)); - public static final RegistryObject> FLUID_COLLECTOR_CONTAINER = CONTAINERS.register("fluid_collector_container", () -> IForgeContainerType.create(ContainerFluidCollector::fromNetwork)); - public static final RegistryObject> FURNACE_DOUBLE_CONTAINER = CONTAINERS.register("furnace_double_container", () -> IForgeContainerType.create(ContainerFurnaceDouble::fromNetwork)); - public static final RegistryObject> GRINDER_CONTAINER = CONTAINERS.register("grinder_container", () -> IForgeContainerType.create(CrusherContainer::fromNetwork)); - public static final RegistryObject> LASER_RELAY_ITEM_WHITELIST_CONTAINER = CONTAINERS.register("laser_relay_item_whitelist_container", () -> IForgeContainerType.create(ContainerLaserRelayItemWhitelist::fromNetwork)); - public static final RegistryObject> MINER_CONTAINER = CONTAINERS.register("miner_container", () -> IForgeContainerType.create(ContainerMiner::fromNetwork)); - public static final RegistryObject> OIL_GENERATOR_CONTAINER = CONTAINERS.register("oil_generator_container", () -> IForgeContainerType.create(ContainerOilGenerator::fromNetwork)); - public static final RegistryObject> PHANTOM_PLACER_CONTAINER = CONTAINERS.register("phantom_placer_container", () -> IForgeContainerType.create(ContainerPhantomPlacer::fromNetwork)); - public static final RegistryObject> RANGED_COLLECTOR_CONTAINER = CONTAINERS.register("ranged_collector_container", () -> IForgeContainerType.create(ContainerRangedCollector::fromNetwork)); - public static final RegistryObject> XPSOLIDIFIER_CONTAINER = CONTAINERS.register("xpsolidifier_container", () -> IForgeContainerType.create(ContainerXPSolidifier::fromNetwork)); + public static final RegistryObject> FARMER_CONTAINER = CONTAINERS.register("farmer_container", () -> IForgeMenuType.create(ContainerFarmer::fromNetwork)); + public static final RegistryObject> FEEDER_CONTAINER = CONTAINERS.register("feeder_container", () -> IForgeMenuType.create(ContainerFeeder::fromNetwork)); + public static final RegistryObject> FERMENTING_BARREL_CONTAINER = CONTAINERS.register("fermenting_barrel_container", () -> IForgeMenuType.create(ContainerFermentingBarrel::fromNetwork)); + public static final RegistryObject> FILTER_CONTAINER = CONTAINERS.register("filter_container", () -> IForgeMenuType.create(ContainerFilter::fromNetwork)); + public static final RegistryObject> FIREWORK_BOX_CONTAINER = CONTAINERS.register("firework_box_container", () -> IForgeMenuType.create(ContainerFireworkBox::fromNetwork)); + public static final RegistryObject> FLUID_COLLECTOR_CONTAINER = CONTAINERS.register("fluid_collector_container", () -> IForgeMenuType.create(ContainerFluidCollector::fromNetwork)); + public static final RegistryObject> FURNACE_DOUBLE_CONTAINER = CONTAINERS.register("furnace_double_container", () -> IForgeMenuType.create(ContainerFurnaceDouble::fromNetwork)); + public static final RegistryObject> GRINDER_CONTAINER = CONTAINERS.register("grinder_container", () -> IForgeMenuType.create(CrusherContainer::fromNetwork)); + public static final RegistryObject> LASER_RELAY_ITEM_WHITELIST_CONTAINER = CONTAINERS.register("laser_relay_item_whitelist_container", () -> IForgeMenuType.create(ContainerLaserRelayItemWhitelist::fromNetwork)); + public static final RegistryObject> MINER_CONTAINER = CONTAINERS.register("miner_container", () -> IForgeMenuType.create(ContainerMiner::fromNetwork)); + public static final RegistryObject> OIL_GENERATOR_CONTAINER = CONTAINERS.register("oil_generator_container", () -> IForgeMenuType.create(ContainerOilGenerator::fromNetwork)); + public static final RegistryObject> PHANTOM_PLACER_CONTAINER = CONTAINERS.register("phantom_placer_container", () -> IForgeMenuType.create(ContainerPhantomPlacer::fromNetwork)); + public static final RegistryObject> RANGED_COLLECTOR_CONTAINER = CONTAINERS.register("ranged_collector_container", () -> IForgeMenuType.create(ContainerRangedCollector::fromNetwork)); + public static final RegistryObject> XPSOLIDIFIER_CONTAINER = CONTAINERS.register("xpsolidifier_container", () -> IForgeMenuType.create(ContainerXPSolidifier::fromNetwork)); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBioReactor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBioReactor.java index bb9462128..95e00c9ee 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBioReactor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBioReactor.java @@ -13,23 +13,23 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBioReactor; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketBuffer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; import java.util.Objects; -public class ContainerBioReactor extends Container { +public class ContainerBioReactor extends AbstractContainerMenu { public final TileEntityBioReactor tile; - public static ContainerBioReactor fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { + public static ContainerBioReactor fromNetwork(int windowId, Inventory inv, FriendlyByteBuf data) { return new ContainerBioReactor(windowId, inv, (TileEntityBioReactor) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } - public ContainerBioReactor(int windowId, PlayerInventory inventory, TileEntityBioReactor tile) { + public ContainerBioReactor(int windowId, Inventory inventory, TileEntityBioReactor tile) { super(ActuallyContainers.BIO_REACTOR_CONTAINER.get(), windowId); this.tile = tile; @@ -51,7 +51,7 @@ public class ContainerBioReactor extends Container { } @Override - public ItemStack quickMoveStack(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { int inventoryStart = 8; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -101,7 +101,7 @@ public class ContainerBioReactor extends Container { } @Override - public boolean stillValid(PlayerEntity player) { + public boolean stillValid(Player player) { return this.tile.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBreaker.java index 653f4026a..9a4a5a4bf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBreaker.java @@ -13,24 +13,24 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBreaker; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketBuffer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; import java.util.Objects; -public class ContainerBreaker extends Container { +public class ContainerBreaker extends AbstractContainerMenu { public final TileEntityBreaker breaker; - public static ContainerBreaker fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { + public static ContainerBreaker fromNetwork(int windowId, Inventory inv, FriendlyByteBuf data) { return new ContainerBreaker(windowId, inv, (TileEntityBreaker) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } - public ContainerBreaker(int windowId, PlayerInventory inventory, TileEntityBreaker tile) { + public ContainerBreaker(int windowId, Inventory inventory, TileEntityBreaker tile) { super(ActuallyContainers.BREAKER_CONTAINER.get(), windowId); this.breaker = tile; @@ -52,7 +52,7 @@ public class ContainerBreaker extends Container { } @Override - public ItemStack quickMoveStack(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { int inventoryStart = 9; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -98,7 +98,7 @@ public class ContainerBreaker extends Container { } @Override - public boolean stillValid(PlayerEntity player) { + public boolean stillValid(Player player) { return this.breaker.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCanolaPress.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCanolaPress.java index 0b79171f5..7918eddf0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCanolaPress.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCanolaPress.java @@ -14,21 +14,21 @@ import de.ellpeck.actuallyadditions.mod.crafting.PressingRecipe; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketBuffer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; import java.util.Objects; import java.util.Optional; -public class ContainerCanolaPress extends Container { +public class ContainerCanolaPress extends AbstractContainerMenu { public final TileEntityCanolaPress press; - public ContainerCanolaPress(int windowId, PlayerInventory inventory, TileEntityCanolaPress tile) { + public ContainerCanolaPress(int windowId, Inventory inventory, TileEntityCanolaPress tile) { super(ActuallyContainers.CANOLA_PRESS_CONTAINER.get(), windowId); this.press = tile; @@ -44,12 +44,12 @@ public class ContainerCanolaPress extends Container { } } - public static ContainerCanolaPress fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { + public static ContainerCanolaPress fromNetwork(int windowId, Inventory inv, FriendlyByteBuf data) { return new ContainerCanolaPress(windowId, inv, (TileEntityCanolaPress) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } @Override - public ItemStack quickMoveStack(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { int inventoryStart = 1; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -100,7 +100,7 @@ public class ContainerCanolaPress extends Container { } @Override - public boolean stillValid(PlayerEntity player) { + public boolean stillValid(Player player) { return this.press.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoalGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoalGenerator.java index 9ae565843..d4e16d2e8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoalGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoalGenerator.java @@ -13,25 +13,25 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketBuffer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; import net.minecraftforge.common.ForgeHooks; import java.util.Objects; -public class ContainerCoalGenerator extends Container { +public class ContainerCoalGenerator extends AbstractContainerMenu { public final TileEntityCoalGenerator generator; - public static ContainerCoalGenerator fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { + public static ContainerCoalGenerator fromNetwork(int windowId, Inventory inv, FriendlyByteBuf data) { return new ContainerCoalGenerator(windowId, inv, (TileEntityCoalGenerator) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } - public ContainerCoalGenerator(int windowId, PlayerInventory inventory, TileEntityCoalGenerator tile) { + public ContainerCoalGenerator(int windowId, Inventory inventory, TileEntityCoalGenerator tile) { super(ActuallyContainers.COAL_GENERATOR_CONTAINER.get(), windowId); this.generator = tile; @@ -48,7 +48,7 @@ public class ContainerCoalGenerator extends Container { } @Override - public ItemStack quickMoveStack(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { int inventoryStart = 1; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -63,7 +63,7 @@ public class ContainerCoalGenerator extends Container { //Other Slots in Inventory excluded if (slot >= inventoryStart) { //Shift from Inventory - if (ForgeHooks.getBurnTime(newStack) > 0) { + if (ForgeHooks.getBurnTime(newStack, null) > 0) { if (!this.moveItemStackTo(newStack, 0, 1, false)) { return ItemStack.EMPTY; } @@ -98,7 +98,7 @@ public class ContainerCoalGenerator extends Container { } @Override - public boolean stillValid(PlayerEntity player) { + public boolean stillValid(Player player) { return this.generator.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoffeeMachine.java index e44eb92b0..ff500a5ef 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoffeeMachine.java @@ -17,24 +17,24 @@ import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import de.ellpeck.actuallyadditions.mod.items.ItemCoffee; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketBuffer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; import java.util.Objects; -public class ContainerCoffeeMachine extends Container { +public class ContainerCoffeeMachine extends AbstractContainerMenu { public final TileEntityCoffeeMachine machine; - public static ContainerCoffeeMachine fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { + public static ContainerCoffeeMachine fromNetwork(int windowId, Inventory inv, FriendlyByteBuf data) { return new ContainerCoffeeMachine(windowId, inv, (TileEntityCoffeeMachine) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } - public ContainerCoffeeMachine(int windowId, PlayerInventory inventory, TileEntityCoffeeMachine tile) { + public ContainerCoffeeMachine(int windowId, Inventory inventory, TileEntityCoffeeMachine tile) { super(ActuallyContainers.COFFEE_MACHINE_CONTAINER.get(), windowId); this.machine = tile; @@ -59,7 +59,7 @@ public class ContainerCoffeeMachine extends Container { } @Override - public ItemStack quickMoveStack(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { int inventoryStart = 11; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -89,7 +89,7 @@ public class ContainerCoffeeMachine extends Container { if (!this.moveItemStackTo(newStack, 3, 11, false)) { return ItemStack.EMPTY; } - } else if (ActuallyTags.Items.COFFEE_BEANS.contains(newStack.getItem())) { + } else if (newStack.is(ActuallyTags.Items.COFFEE_BEANS)) { if (!this.moveItemStackTo(newStack, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS + 1, false)) { return ItemStack.EMPTY; } @@ -124,7 +124,7 @@ public class ContainerCoffeeMachine extends Container { } @Override - public boolean stillValid(PlayerEntity player) { + public boolean stillValid(Player player) { return this.machine.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDirectionalBreaker.java index b020e3d1d..d44ce34f3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDirectionalBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDirectionalBreaker.java @@ -13,20 +13,20 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLongRangeBreaker; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketBuffer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; import java.util.Objects; -public class ContainerDirectionalBreaker extends Container { +public class ContainerDirectionalBreaker extends AbstractContainerMenu { public final TileEntityLongRangeBreaker breaker; - public ContainerDirectionalBreaker(int windowId, PlayerInventory inventory, TileEntityLongRangeBreaker tile) { + public ContainerDirectionalBreaker(int windowId, Inventory inventory, TileEntityLongRangeBreaker tile) { super(ActuallyContainers.DIRECTIONAL_BREAKER_CONTAINER.get(), windowId); this.breaker = tile; @@ -46,12 +46,12 @@ public class ContainerDirectionalBreaker extends Container { } } - public static ContainerDirectionalBreaker fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { + public static ContainerDirectionalBreaker fromNetwork(int windowId, Inventory inv, FriendlyByteBuf data) { return new ContainerDirectionalBreaker(windowId, inv, (TileEntityLongRangeBreaker) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } @Override - public ItemStack quickMoveStack(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { int inventoryStart = 9; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -97,7 +97,7 @@ public class ContainerDirectionalBreaker extends Container { } @Override - public boolean stillValid(PlayerEntity player) { + public boolean stillValid(Player player) { return this.breaker.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java index 6bc1a8e7f..875f8a9dc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java @@ -16,26 +16,26 @@ import de.ellpeck.actuallyadditions.mod.items.DrillItem; import de.ellpeck.actuallyadditions.mod.items.ItemDrillUpgrade; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.ClickType; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketBuffer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ClickType; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; -public class ContainerDrill extends Container { +public class ContainerDrill extends AbstractContainerMenu { public static final int SLOT_AMOUNT = 5; private final ItemStackHandlerAA drillInventory = new ItemStackHandlerAA(SLOT_AMOUNT); - private final PlayerInventory inventory; + private final Inventory inventory; - public static ContainerDrill fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { + public static ContainerDrill fromNetwork(int windowId, Inventory inv, FriendlyByteBuf data) { return new ContainerDrill(windowId, inv); } - public ContainerDrill(int windowId, PlayerInventory inventory) { + public ContainerDrill(int windowId, Inventory inventory) { super(ActuallyContainers.DRILL_CONTAINER.get(), windowId); this.inventory = inventory; @@ -68,7 +68,7 @@ public class ContainerDrill extends Container { } @Override - public ItemStack quickMoveStack(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { int inventoryStart = 5; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -118,16 +118,16 @@ public class ContainerDrill extends Container { } @Override - public ItemStack clicked(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) { + public void clicked(int slotId, int dragType, ClickType clickTypeIn, Player player) { if (clickTypeIn == ClickType.SWAP && dragType == this.inventory.selected) { - return ItemStack.EMPTY; + return; //TODO: Check if this is correct, used to return ItemStack.EMPTY } else { - return super.clicked(slotId, dragType, clickTypeIn, player); + super.clicked(slotId, dragType, clickTypeIn, player); } } @Override - public void removed(PlayerEntity player) { + public void removed(Player player) { ItemStack stack = this.inventory.getSelected(); if (StackUtil.isValid(stack) && stack.getItem() instanceof DrillItem) { DrillItem.writeSlotsToNBT(this.drillInventory, this.inventory.getSelected()); @@ -136,7 +136,7 @@ public class ContainerDrill extends Container { } @Override - public boolean stillValid(PlayerEntity player) { + public boolean stillValid(Player player) { return true; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDropper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDropper.java index 681db3f2a..93c56a98c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDropper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDropper.java @@ -14,25 +14,25 @@ import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketBuffer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; import java.util.Objects; -public class ContainerDropper extends Container { +public class ContainerDropper extends AbstractContainerMenu { public final TileEntityDropper dropper; - PlayerEntity player; + Player player; - public static ContainerDropper fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { + public static ContainerDropper fromNetwork(int windowId, Inventory inv, FriendlyByteBuf data) { return new ContainerDropper(windowId, inv, (TileEntityDropper) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } - public ContainerDropper(int windowId, PlayerInventory inventory, TileEntityDropper tile) { + public ContainerDropper(int windowId, Inventory inventory, TileEntityDropper tile) { super(ActuallyContainers.DROPPER_CONTAINER.get(), windowId); this.dropper = tile; this.player = inventory.player; @@ -54,7 +54,7 @@ public class ContainerDropper extends Container { } @Override - public ItemStack quickMoveStack(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { int inventoryStart = 9; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -100,12 +100,12 @@ public class ContainerDropper extends Container { } @Override - public boolean stillValid(PlayerEntity player) { + public boolean stillValid(Player player) { return this.dropper.canPlayerUse(player); } @Override - public void removed(PlayerEntity playerIn) { + public void removed(Player playerIn) { super.removed(playerIn); if (!this.player.isSpectator()) { this.dropper.getLevel().updateNeighborsAt(this.dropper.getBlockPos(), ActuallyBlocks.DROPPER.get()); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java index d3134706c..f69778042 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java @@ -14,29 +14,29 @@ import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditio import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput; import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.EquipmentSlotType; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ArmorItem; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketBuffer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ArmorItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraftforge.energy.CapabilityEnergy; import java.util.Objects; -public class ContainerEnergizer extends Container { +public class ContainerEnergizer extends AbstractContainerMenu { - public static final EquipmentSlotType[] VALID_EQUIPMENT_SLOTS = new EquipmentSlotType[]{EquipmentSlotType.HEAD, EquipmentSlotType.CHEST, EquipmentSlotType.LEGS, EquipmentSlotType.FEET}; + public static final EquipmentSlot[] VALID_EQUIPMENT_SLOTS = new EquipmentSlot[]{EquipmentSlot.HEAD, EquipmentSlot.CHEST, EquipmentSlot.LEGS, EquipmentSlot.FEET}; public final TileEntityEnergizer energizer; - public static ContainerEnergizer fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { + public static ContainerEnergizer fromNetwork(int windowId, Inventory inv, FriendlyByteBuf data) { return new ContainerEnergizer(windowId, inv, (TileEntityEnergizer) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } - public ContainerEnergizer(int windowId, PlayerInventory inventory, TileEntityEnergizer tile) { + public ContainerEnergizer(int windowId, Inventory inventory, TileEntityEnergizer tile) { super(ActuallyContainers.ENERGIZER_CONTAINER.get(), windowId); this.energizer = tile; @@ -58,7 +58,7 @@ public class ContainerEnergizer extends Container { } for (int k = 0; k < 4; ++k) { - EquipmentSlotType slot = VALID_EQUIPMENT_SLOTS[k]; + EquipmentSlot slot = VALID_EQUIPMENT_SLOTS[k]; this.addSlot(new Slot(inventory, 36 + 3 - k, 102, 19 + k * 18) { @Override public int getMaxStackSize() { @@ -71,7 +71,7 @@ public class ContainerEnergizer extends Container { } @Override - public boolean mayPickup(PlayerEntity player) { + public boolean mayPickup(Player player) { ItemStack itemstack = this.getItem(); return (itemstack.isEmpty() || player.isCreative() || !EnchantmentHelper.hasBindingCurse(itemstack)) && super.mayPickup(player); } @@ -88,7 +88,7 @@ public class ContainerEnergizer extends Container { } @Override - public ItemStack quickMoveStack(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { int inventoryStart = 2; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -145,7 +145,7 @@ public class ContainerEnergizer extends Container { } @Override - public boolean stillValid(PlayerEntity player) { + public boolean stillValid(Player player) { return this.energizer.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java index a4e6f56ca..c5ae10a29 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java @@ -14,27 +14,27 @@ import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditio import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput; import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.EquipmentSlotType; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ArmorItem; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketBuffer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ArmorItem; +import net.minecraft.world.item.ItemStack; import net.minecraftforge.energy.CapabilityEnergy; import java.util.Objects; -public class ContainerEnervator extends Container { +public class ContainerEnervator extends AbstractContainerMenu { public final TileEntityEnervator enervator; - public static ContainerEnervator fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { + public static ContainerEnervator fromNetwork(int windowId, Inventory inv, FriendlyByteBuf data) { return new ContainerEnervator(windowId, inv, (TileEntityEnervator) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } - public ContainerEnervator(int windowId, PlayerInventory inventory, TileEntityEnervator tile) { + public ContainerEnervator(int windowId, Inventory inventory, TileEntityEnervator tile) { super(ActuallyContainers.ENERVATOR_CONTAINER.get(), windowId); this.enervator = tile; @@ -51,7 +51,7 @@ public class ContainerEnervator extends Container { } for (int k = 0; k < 4; ++k) { - EquipmentSlotType slot = ContainerEnergizer.VALID_EQUIPMENT_SLOTS[k]; + EquipmentSlot slot = ContainerEnergizer.VALID_EQUIPMENT_SLOTS[k]; this.addSlot(new Slot(inventory, 36 + 3 - k, 102, 19 + k * 18) { @Override public int getMaxStackSize() { @@ -76,7 +76,7 @@ public class ContainerEnervator extends Container { } @Override - public ItemStack quickMoveStack(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { int inventoryStart = 2; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -133,7 +133,7 @@ public class ContainerEnervator extends Container { } @Override - public boolean stillValid(PlayerEntity player) { + public boolean stillValid(Player player) { return this.enervator.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFarmer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFarmer.java index 80983757b..3b9369bed 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFarmer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFarmer.java @@ -13,24 +13,24 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketBuffer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; import java.util.Objects; -public class ContainerFarmer extends Container { +public class ContainerFarmer extends AbstractContainerMenu { public final TileEntityFarmer farmer; - public static ContainerFarmer fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { + public static ContainerFarmer fromNetwork(int windowId, Inventory inv, FriendlyByteBuf data) { return new ContainerFarmer(windowId, inv, (TileEntityFarmer) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } - public ContainerFarmer(int windowId, PlayerInventory inventory, TileEntityFarmer tile) { + public ContainerFarmer(int windowId, Inventory inventory, TileEntityFarmer tile) { super(ActuallyContainers.FARMER_CONTAINER.get(), windowId); this.farmer = tile; @@ -56,7 +56,7 @@ public class ContainerFarmer extends Container { } @Override - public ItemStack quickMoveStack(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { int inventoryStart = 12; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -102,7 +102,7 @@ public class ContainerFarmer extends Container { } @Override - public boolean stillValid(PlayerEntity player) { + public boolean stillValid(Player player) { return this.farmer.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFeeder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFeeder.java index 15f13cb2d..71c5802d7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFeeder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFeeder.java @@ -13,24 +13,24 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketBuffer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; import java.util.Objects; -public class ContainerFeeder extends Container { +public class ContainerFeeder extends AbstractContainerMenu { public final TileEntityFeeder feeder; - public static ContainerFeeder fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { + public static ContainerFeeder fromNetwork(int windowId, Inventory inv, FriendlyByteBuf data) { return new ContainerFeeder(windowId, inv, (TileEntityFeeder) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } - public ContainerFeeder(int windowId, PlayerInventory inventory, TileEntityFeeder tile) { + public ContainerFeeder(int windowId, Inventory inventory, TileEntityFeeder tile) { super(ActuallyContainers.FEEDER_CONTAINER.get(), windowId); this.feeder = tile; this.addSlot(new SlotItemHandlerUnconditioned(this.feeder.inv, 0, 80, 45)); @@ -46,7 +46,7 @@ public class ContainerFeeder extends Container { } @Override - public ItemStack quickMoveStack(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { int inventoryStart = 1; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -92,7 +92,7 @@ public class ContainerFeeder extends Container { } @Override - public boolean stillValid(PlayerEntity player) { + public boolean stillValid(Player player) { return this.feeder.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFermentingBarrel.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFermentingBarrel.java index 9da6e4f93..054f99a8f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFermentingBarrel.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFermentingBarrel.java @@ -12,24 +12,24 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketBuffer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; import java.util.Objects; -public class ContainerFermentingBarrel extends Container { +public class ContainerFermentingBarrel extends AbstractContainerMenu { public final TileEntityFermentingBarrel barrel; - public static ContainerFermentingBarrel fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { + public static ContainerFermentingBarrel fromNetwork(int windowId, Inventory inv, FriendlyByteBuf data) { return new ContainerFermentingBarrel(windowId, inv, (TileEntityFermentingBarrel) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } - public ContainerFermentingBarrel(int windowId, PlayerInventory inventory, TileEntityFermentingBarrel tile) { + public ContainerFermentingBarrel(int windowId, Inventory inventory, TileEntityFermentingBarrel tile) { super(ActuallyContainers.FERMENTING_BARREL_CONTAINER.get(), windowId); this.barrel = tile; @@ -44,7 +44,7 @@ public class ContainerFermentingBarrel extends Container { } @Override - public ItemStack quickMoveStack(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { int inventoryStart = 0; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -86,7 +86,7 @@ public class ContainerFermentingBarrel extends Container { } @Override - public boolean stillValid(PlayerEntity player) { + public boolean stillValid(Player player) { return this.barrel.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFilter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFilter.java index 3bca3c380..ecc839e29 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFilter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFilter.java @@ -15,26 +15,26 @@ import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotImmovable; import de.ellpeck.actuallyadditions.mod.items.DrillItem; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.ClickType; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketBuffer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ClickType; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; -public class ContainerFilter extends Container { +public class ContainerFilter extends AbstractContainerMenu { public static final int SLOT_AMOUNT = 24; private final ItemStackHandlerAA filterInventory = new ItemStackHandlerAA(SLOT_AMOUNT); - private final PlayerInventory inventory; + private final Inventory inventory; - public static ContainerFilter fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { + public static ContainerFilter fromNetwork(int windowId, Inventory inv, FriendlyByteBuf data) { return new ContainerFilter(windowId, inv); } - public ContainerFilter(int windowId, PlayerInventory inventory) { + public ContainerFilter(int windowId, Inventory inventory) { super(ActuallyContainers.FILTER_CONTAINER.get(), windowId); this.inventory = inventory; @@ -64,7 +64,7 @@ public class ContainerFilter extends Container { } @Override - public ItemStack quickMoveStack(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { int inventoryStart = SLOT_AMOUNT; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -108,18 +108,18 @@ public class ContainerFilter extends Container { } @Override - public ItemStack clicked(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) { + public void clicked(int slotId, int dragType, ClickType clickTypeIn, Player player) { if (SlotFilter.checkFilter(this, slotId, player)) { - return ItemStack.EMPTY; + return; //TODO: Check if this is correct, used to return ItemStack.EMPTY } else if (clickTypeIn == ClickType.SWAP && dragType == this.inventory.selected) { - return ItemStack.EMPTY; + return; //TODO: Check if this is correct, used to return ItemStack.EMPTY } else { - return super.clicked(slotId, dragType, clickTypeIn, player); + super.clicked(slotId, dragType, clickTypeIn, player); } } @Override - public void removed(PlayerEntity player) { + public void removed(Player player) { ItemStack stack = this.inventory.getSelected(); if (SlotFilter.isFilter(stack)) { DrillItem.writeSlotsToNBT(this.filterInventory, this.inventory.getSelected()); @@ -128,7 +128,7 @@ public class ContainerFilter extends Container { } @Override - public boolean stillValid(PlayerEntity player) { + public boolean stillValid(Player player) { return true; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFireworkBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFireworkBox.java index 6786b3c39..f207ecb65 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFireworkBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFireworkBox.java @@ -10,29 +10,29 @@ package de.ellpeck.actuallyadditions.mod.inventory; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketBuffer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.ItemStack; -public class ContainerFireworkBox extends Container { +public class ContainerFireworkBox extends AbstractContainerMenu { - public static ContainerFireworkBox fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { + public static ContainerFireworkBox fromNetwork(int windowId, Inventory inv, FriendlyByteBuf data) { return new ContainerFireworkBox(windowId, inv); } - public ContainerFireworkBox(int windowId, PlayerInventory inventory) { + public ContainerFireworkBox(int windowId, Inventory inventory) { super(ActuallyContainers.FIREWORK_BOX_CONTAINER.get(), windowId); } @Override - public ItemStack quickMoveStack(PlayerEntity playerIn, int index) { + public ItemStack quickMoveStack(Player playerIn, int index) { return ItemStack.EMPTY; } @Override - public boolean stillValid(PlayerEntity playerIn) { + public boolean stillValid(Player playerIn) { return true; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFluidCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFluidCollector.java index 09901a8ab..c87f463a7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFluidCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFluidCollector.java @@ -12,24 +12,24 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketBuffer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; import java.util.Objects; -public class ContainerFluidCollector extends Container { +public class ContainerFluidCollector extends AbstractContainerMenu { public final TileEntityFluidCollector collector; - public static ContainerFluidCollector fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { + public static ContainerFluidCollector fromNetwork(int windowId, Inventory inv, FriendlyByteBuf data) { return new ContainerFluidCollector(windowId, inv, (TileEntityFluidCollector) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } - public ContainerFluidCollector(int windowId, PlayerInventory inventory, TileEntityFluidCollector tile) { + public ContainerFluidCollector(int windowId, Inventory inventory, TileEntityFluidCollector tile) { super(ActuallyContainers.FLUID_COLLECTOR_CONTAINER.get(), windowId); this.collector = tile; @@ -44,7 +44,7 @@ public class ContainerFluidCollector extends Container { } @Override - public ItemStack quickMoveStack(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { int inventoryStart = 0; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -93,7 +93,7 @@ public class ContainerFluidCollector extends Container { } @Override - public boolean stillValid(PlayerEntity player) { + public boolean stillValid(Player player) { return this.collector.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFurnaceDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFurnaceDouble.java index fccce9edd..51233a427 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFurnaceDouble.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFurnaceDouble.java @@ -15,23 +15,23 @@ import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditio import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput; import de.ellpeck.actuallyadditions.mod.tile.TileEntityPoweredFurnace; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.IRecipeType; -import net.minecraft.network.PacketBuffer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeType; import javax.annotation.Nonnull; import java.util.Objects; -public class ContainerFurnaceDouble extends Container { +public class ContainerFurnaceDouble extends AbstractContainerMenu { public final TileEntityPoweredFurnace furnace; - public ContainerFurnaceDouble(int windowId, PlayerInventory inventory, TileEntityPoweredFurnace tile) { + public ContainerFurnaceDouble(int windowId, Inventory inventory, TileEntityPoweredFurnace tile) { super(ActuallyContainers.FURNACE_DOUBLE_CONTAINER.get(), windowId); this.furnace = tile; @@ -50,13 +50,13 @@ public class ContainerFurnaceDouble extends Container { } } - public static ContainerFurnaceDouble fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { + public static ContainerFurnaceDouble fromNetwork(int windowId, Inventory inv, FriendlyByteBuf data) { return new ContainerFurnaceDouble(windowId, inv, (TileEntityPoweredFurnace) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } @Nonnull @Override - public ItemStack quickMoveStack(@Nonnull PlayerEntity player, int slot) { + public ItemStack quickMoveStack(@Nonnull Player player, int slot) { int inventoryStart = 4; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -78,7 +78,7 @@ public class ContainerFurnaceDouble extends Container { //Other Slots in Inventory excluded else if (slot >= inventoryStart) { // TODO: VALIDATE - IRecipe irecipe = this.furnace.getLevel().getRecipeManager().getRecipeFor(IRecipeType.SMELTING, new SingleItem(newStack), this.furnace.getLevel()).orElse(null); + Recipe irecipe = this.furnace.getLevel().getRecipeManager().getRecipeFor(RecipeType.SMELTING, new SingleItem(newStack), this.furnace.getLevel()).orElse(null); if (irecipe == null) { return ItemStack.EMPTY; } @@ -123,7 +123,7 @@ public class ContainerFurnaceDouble extends Container { } @Override - public boolean stillValid(@Nonnull PlayerEntity player) { + public boolean stillValid(@Nonnull Player player) { return this.furnace.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerLaserRelayItemWhitelist.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerLaserRelayItemWhitelist.java index 152670d59..31d262db2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerLaserRelayItemWhitelist.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerLaserRelayItemWhitelist.java @@ -13,21 +13,21 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemAdvanced; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.ClickType; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketBuffer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ClickType; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; import java.util.Objects; -public class ContainerLaserRelayItemWhitelist extends Container { +public class ContainerLaserRelayItemWhitelist extends AbstractContainerMenu { public final TileEntityLaserRelayItemAdvanced tile; - public ContainerLaserRelayItemWhitelist(int windowId, PlayerInventory inventory, TileEntityLaserRelayItemAdvanced tile) { + public ContainerLaserRelayItemWhitelist(int windowId, Inventory inventory, TileEntityLaserRelayItemAdvanced tile) { super(ActuallyContainers.LASER_RELAY_ITEM_WHITELIST_CONTAINER.get(), windowId); this.tile = tile; @@ -51,12 +51,12 @@ public class ContainerLaserRelayItemWhitelist extends Container { } } - public static ContainerLaserRelayItemWhitelist fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { + public static ContainerLaserRelayItemWhitelist fromNetwork(int windowId, Inventory inv, FriendlyByteBuf data) { return new ContainerLaserRelayItemWhitelist(windowId, inv, (TileEntityLaserRelayItemAdvanced) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } @Override - public ItemStack quickMoveStack(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { int inventoryStart = 24; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -98,16 +98,16 @@ public class ContainerLaserRelayItemWhitelist extends Container { } @Override - public ItemStack clicked(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) { + public void clicked(int slotId, int dragType, ClickType clickTypeIn, Player player) { if (SlotFilter.checkFilter(this, slotId, player)) { - return ItemStack.EMPTY; + return; //TODO: Check if this is correct, used to return ItemStack.EMPTY } else { - return super.clicked(slotId, dragType, clickTypeIn, player); + super.clicked(slotId, dragType, clickTypeIn, player); } } @Override - public boolean stillValid(PlayerEntity player) { + public boolean stillValid(Player player) { return this.tile.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerMiner.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerMiner.java index c06a058b6..f8525b13a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerMiner.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerMiner.java @@ -13,20 +13,20 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.tile.TileEntityVerticalDigger; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketBuffer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; import java.util.Objects; -public class ContainerMiner extends Container { +public class ContainerMiner extends AbstractContainerMenu { public final TileEntityVerticalDigger miner; - public ContainerMiner(int windowId, PlayerInventory inventory, TileEntityVerticalDigger tile) { + public ContainerMiner(int windowId, Inventory inventory, TileEntityVerticalDigger tile) { super(ActuallyContainers.MINER_CONTAINER.get(), windowId); this.miner = tile; @@ -46,12 +46,12 @@ public class ContainerMiner extends Container { } } - public static ContainerMiner fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { + public static ContainerMiner fromNetwork(int windowId, Inventory inv, FriendlyByteBuf data) { return new ContainerMiner(windowId, inv, (TileEntityVerticalDigger) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } @Override - public ItemStack quickMoveStack(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { int inventoryStart = 9; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -97,7 +97,7 @@ public class ContainerMiner extends Container { } @Override - public boolean stillValid(PlayerEntity player) { + public boolean stillValid(Player player) { return this.miner.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerOilGenerator.java index f3a89623d..c37916906 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerOilGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerOilGenerator.java @@ -12,24 +12,24 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketBuffer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; import java.util.Objects; -public class ContainerOilGenerator extends Container { +public class ContainerOilGenerator extends AbstractContainerMenu { public final TileEntityOilGenerator generator; - public static ContainerOilGenerator fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { + public static ContainerOilGenerator fromNetwork(int windowId, Inventory inv, FriendlyByteBuf data) { return new ContainerOilGenerator(windowId, inv, (TileEntityOilGenerator) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } - public ContainerOilGenerator(int windowId, PlayerInventory inventory, TileEntityOilGenerator tile) { + public ContainerOilGenerator(int windowId, Inventory inventory, TileEntityOilGenerator tile) { super(ActuallyContainers.OIL_GENERATOR_CONTAINER.get(), windowId); this.generator = tile; @@ -44,7 +44,7 @@ public class ContainerOilGenerator extends Container { } @Override - public ItemStack quickMoveStack(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { int inventoryStart = 0; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -86,7 +86,7 @@ public class ContainerOilGenerator extends Container { } @Override - public boolean stillValid(PlayerEntity player) { + public boolean stillValid(Player player) { return this.generator.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerPhantomPlacer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerPhantomPlacer.java index 2d1714f2d..bb453d78b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerPhantomPlacer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerPhantomPlacer.java @@ -13,24 +13,24 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomPlacer; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketBuffer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; import java.util.Objects; -public class ContainerPhantomPlacer extends Container { +public class ContainerPhantomPlacer extends AbstractContainerMenu { public final TileEntityPhantomPlacer placer; - public static ContainerPhantomPlacer fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { + public static ContainerPhantomPlacer fromNetwork(int windowId, Inventory inv, FriendlyByteBuf data) { return new ContainerPhantomPlacer(windowId, inv, (TileEntityPhantomPlacer) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } - public ContainerPhantomPlacer(int windowId, PlayerInventory inventory, TileEntityPhantomPlacer tile) { + public ContainerPhantomPlacer(int windowId, Inventory inventory, TileEntityPhantomPlacer tile) { super(ActuallyContainers.PHANTOM_PLACER_CONTAINER.get(), windowId); this.placer = tile; @@ -51,7 +51,7 @@ public class ContainerPhantomPlacer extends Container { } @Override - public ItemStack quickMoveStack(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { int inventoryStart = 9; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -97,7 +97,7 @@ public class ContainerPhantomPlacer extends Container { } @Override - public boolean stillValid(PlayerEntity player) { + public boolean stillValid(Player player) { return this.placer.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRangedCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRangedCollector.java index 19c933fb0..b6efdfb10 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRangedCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRangedCollector.java @@ -14,25 +14,25 @@ import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.ClickType; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketBuffer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ClickType; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; import java.util.Objects; -public class ContainerRangedCollector extends Container { +public class ContainerRangedCollector extends AbstractContainerMenu { public final TileEntityRangedCollector collector; - public static ContainerRangedCollector fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { + public static ContainerRangedCollector fromNetwork(int windowId, Inventory inv, FriendlyByteBuf data) { return new ContainerRangedCollector(windowId, inv, (TileEntityRangedCollector) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } - public ContainerRangedCollector(int windowId, PlayerInventory inventory, TileEntityRangedCollector tile) { + public ContainerRangedCollector(int windowId, Inventory inventory, TileEntityRangedCollector tile) { super(ActuallyContainers.RANGED_COLLECTOR_CONTAINER.get(), windowId); this.collector = tile; @@ -58,7 +58,7 @@ public class ContainerRangedCollector extends Container { } @Override - public ItemStack quickMoveStack(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { int inventoryStart = 18; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -104,16 +104,16 @@ public class ContainerRangedCollector extends Container { } @Override - public ItemStack clicked(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) { + public void clicked(int slotId, int dragType, ClickType clickTypeIn, Player player) { if (SlotFilter.checkFilter(this, slotId, player)) { - return ItemStack.EMPTY; + return; //TODO: Check if this is correct, used to return ItemStack.EMPTY } else { - return super.clicked(slotId, dragType, clickTypeIn, player); + super.clicked(slotId, dragType, clickTypeIn, player); } } @Override - public boolean stillValid(PlayerEntity player) { + public boolean stillValid(Player player) { return this.collector.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerXPSolidifier.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerXPSolidifier.java index 6e67171e0..911108e3f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerXPSolidifier.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerXPSolidifier.java @@ -15,24 +15,24 @@ import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput; import de.ellpeck.actuallyadditions.mod.items.ItemSolidifiedExperience; import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketBuffer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; import java.util.Objects; -public class ContainerXPSolidifier extends Container { +public class ContainerXPSolidifier extends AbstractContainerMenu { public final TileEntityXPSolidifier solidifier; - public static ContainerXPSolidifier fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { + public static ContainerXPSolidifier fromNetwork(int windowId, Inventory inv, FriendlyByteBuf data) { return new ContainerXPSolidifier(windowId, inv, (TileEntityXPSolidifier) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } - public ContainerXPSolidifier(int windowId, PlayerInventory inventory, TileEntityXPSolidifier tile) { + public ContainerXPSolidifier(int windowId, Inventory inventory, TileEntityXPSolidifier tile) { super(ActuallyContainers.XPSOLIDIFIER_CONTAINER.get(), windowId); this.solidifier = tile; @@ -50,7 +50,7 @@ public class ContainerXPSolidifier extends Container { } @Override - public ItemStack quickMoveStack(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { int inventoryStart = 2; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -96,7 +96,7 @@ public class ContainerXPSolidifier extends Container { } @Override - public boolean stillValid(PlayerEntity player) { + public boolean stillValid(Player player) { return this.solidifier.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/CrusherContainer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/CrusherContainer.java index 5572d7678..b70296245 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/CrusherContainer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/CrusherContainer.java @@ -13,20 +13,20 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCrusher; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketBuffer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; import java.util.Objects; -public class CrusherContainer extends Container { +public class CrusherContainer extends AbstractContainerMenu { public final TileEntityCrusher tileGrinder; public final boolean isDouble; - public CrusherContainer(int windowId, PlayerInventory inventory, TileEntityCrusher tile) { + public CrusherContainer(int windowId, Inventory inventory, TileEntityCrusher tile) { super(ActuallyContainers.GRINDER_CONTAINER.get(), windowId); this.tileGrinder = tile; this.isDouble = tile.isDouble; @@ -56,12 +56,12 @@ public class CrusherContainer extends Container { } } - public static CrusherContainer fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { + public static CrusherContainer fromNetwork(int windowId, Inventory inv, FriendlyByteBuf data) { return new CrusherContainer(windowId, inv, (TileEntityCrusher) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } @Override - public ItemStack quickMoveStack(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { /* int inventoryStart = this.isDouble ? 6 @@ -129,7 +129,7 @@ public class CrusherContainer extends Container { } @Override - public boolean stillValid(PlayerEntity player) { + public boolean stillValid(Player player) { return this.tileGrinder.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java index 41117f3d4..84f092935 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java @@ -15,8 +15,8 @@ package de.ellpeck.actuallyadditions.mod.inventory; //import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.world.World; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; @Deprecated enum GuiTypes { @@ -71,7 +71,7 @@ enum GuiTypes { public class GuiHandler { @Deprecated - public Object getServerGuiElement(int id, PlayerEntity player, World world, int x, int y, int z) { + public Object getServerGuiElement(int id, Player player, Level world, int x, int y, int z) { TileEntityBase tile = null; // if (GuiTypes.values()[id].checkTileEntity) { // tile = (TileEntityBase) world.getBlockEntity(new BlockPos(x, y, z)); @@ -155,7 +155,7 @@ public class GuiHandler { } @Deprecated - public Object getClientGuiElement(int id, PlayerEntity player, World world, int x, int y, int z) { + public Object getClientGuiElement(int id, Player player, Level world, int x, int y, int z) { // TileEntityBase tile = null; // if (GuiTypes.values()[id].checkTileEntity) { // tile = (TileEntityBase) world.getBlockEntity(new BlockPos(x, y, z)); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/SackContainer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/SackContainer.java index 1f5eaa810..111521b85 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/SackContainer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/SackContainer.java @@ -19,35 +19,35 @@ import de.ellpeck.actuallyadditions.mod.items.Sack; import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.tile.FilterSettings; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.ClickType; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.network.PacketBuffer; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ClickType; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import javax.annotation.Nonnull; import java.util.UUID; -public class SackContainer extends Container implements IButtonReactor { +public class SackContainer extends AbstractContainerMenu implements IButtonReactor { public final FilterSettings filter = new FilterSettings(4, false, false, false); private final ItemStackHandlerAA bagInventory; - private final PlayerInventory inventory; + private final Inventory inventory; public boolean autoInsert; private boolean oldAutoInsert; public static final int SIZE = 28; - public static SackContainer fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { + public static SackContainer fromNetwork(int windowId, Inventory inv, FriendlyByteBuf data) { return new SackContainer(windowId, inv, data.readUUID(), new ItemStackHandlerAA(28)); } - public SackContainer(int windowId, PlayerInventory playerInventory, UUID uuid, ItemStackHandlerAA handler) { + public SackContainer(int windowId, Inventory playerInventory, UUID uuid, ItemStackHandlerAA handler) { super(ActuallyContainers.BAG_CONTAINER.get(), windowId); this.inventory = playerInventory; @@ -72,7 +72,7 @@ public class SackContainer extends Container implements IButtonReactor { this.addSlot(new SlotItemHandlerUnconditioned(this.bagInventory, col + row * 7, 10 + col * 18, 10 + row * 18) { @Override public boolean mayPlace(ItemStack stack) { - return !stack.getItem().is(ActuallyTags.Items.HOLDS_ITEMS) && SackContainer.this.filter.check(stack); + return !stack.is(ActuallyTags.Items.HOLDS_ITEMS) && SackContainer.this.filter.check(stack); } }); } @@ -98,7 +98,7 @@ public class SackContainer extends Container implements IButtonReactor { if (!stack.isEmpty() && stack.getItem() instanceof Sack) { //DrillItem.loadSlotsFromNBT(this.bagInventory, playerInventory.getSelected()); if (stack.hasTag()) { - CompoundNBT compound = stack.getOrCreateTag(); + CompoundTag compound = stack.getOrCreateTag(); this.filter.readFromNBT(compound, "Filter"); this.autoInsert = compound.getBoolean("AutoInsert"); } @@ -150,7 +150,7 @@ public class SackContainer extends Container implements IButtonReactor { } @Override - public ItemStack quickMoveStack(@Nonnull PlayerEntity player, int slot) { + public ItemStack quickMoveStack(@Nonnull Player player, int slot) { int inventoryStart = this.bagInventory.getSlots() + 4; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -197,22 +197,22 @@ public class SackContainer extends Container implements IButtonReactor { } @Override - public ItemStack clicked(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) { + public void clicked(int slotId, int dragType, ClickType clickTypeIn, Player player) { if (SlotFilter.checkFilter(this, slotId, player)) { - return ItemStack.EMPTY; + return; //TODO: Check if this is correct, used to return ItemStack.EMPTY } else if (clickTypeIn == ClickType.SWAP && dragType == this.inventory.selected) { - return ItemStack.EMPTY; + return; //TODO: Check if this is correct, used to return ItemStack.EMPTY } else { - return super.clicked(slotId, dragType, clickTypeIn, player); + super.clicked(slotId, dragType, clickTypeIn, player); } } @Override - public void removed(PlayerEntity player) { + public void removed(Player player) { ItemStack stack = this.inventory.getSelected(); if (!stack.isEmpty() && stack.getItem() instanceof Sack) { //DrillItem.writeSlotsToNBT(this.bagInventory, this.inventory.getSelected()); - CompoundNBT compound = stack.getOrCreateTag(); + CompoundTag compound = stack.getOrCreateTag(); this.filter.writeToNBT(compound, "Filter"); compound.putBoolean("AutoInsert", this.autoInsert); } @@ -220,12 +220,12 @@ public class SackContainer extends Container implements IButtonReactor { } @Override - public boolean stillValid(PlayerEntity player) { + public boolean stillValid(Player player) { return true; } @Override - public void onButtonPressed(int buttonID, PlayerEntity player) { + public void onButtonPressed(int buttonID, Player player) { if (buttonID == 0) { this.autoInsert = !this.autoInsert; } else { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/AAScreen.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/AAScreen.java index 25fc98faf..aa74bff26 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/AAScreen.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/AAScreen.java @@ -10,30 +10,29 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; -import net.minecraft.client.gui.screen.inventory.ContainerScreen; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; import javax.annotation.Nonnull; -public abstract class AAScreen extends ContainerScreen { +public abstract class AAScreen extends AbstractContainerScreen { - public AAScreen(T container, PlayerInventory inventory, ITextComponent pTitle) { + public AAScreen(T container, Inventory inventory, Component pTitle) { super(container, inventory, pTitle); } @Override - public void render(@Nonnull MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { + public void render(@Nonnull PoseStack matrixStack, int mouseX, int mouseY, float partialTicks) { this.renderBackground(matrixStack); super.render(matrixStack, mouseX, mouseY, partialTicks); this.renderTooltip(matrixStack, mouseX, mouseY); } @Override - public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) { + public void renderLabels(@Nonnull PoseStack matrices, int x, int y) { font.draw(matrices, this.title, titleLabelX, titleLabelY, 0xFFFFFF); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/Buttons.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/Buttons.java index f5d161d39..581c3ff3b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/Buttons.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/Buttons.java @@ -1,14 +1,14 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.widget.button.Button; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; +import net.minecraft.client.gui.components.Button; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.resources.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -19,11 +19,11 @@ public class Buttons { public final ResourceLocation resLoc = AssetUtil.getGuiLocation("gui_inputter"); private final boolean smaller; - public SmallerButton(int x, int y, ITextComponent display, IPressable pressable) { + public SmallerButton(int x, int y, Component display, OnPress pressable) { this(x, y, display, false, pressable); } - public SmallerButton(int x, int y, ITextComponent display, boolean smaller, IPressable pressable) { + public SmallerButton(int x, int y, Component display, boolean smaller, OnPress pressable) { super(x, y, 16, smaller ? 12 : 16, display, pressable); @@ -31,10 +31,10 @@ public class Buttons { } @Override - public void render(MatrixStack matrixStack, int x, int y, float f) { + public void render(PoseStack matrixStack, int x, int y, float f) { if (this.visible) { - Minecraft.getInstance().getTextureManager().bind(this.resLoc); - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.setShaderTexture(0, this.resLoc); this.isHovered = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height; int k = this.getYImage(this.isHovered); GlStateManager._enableBlend(); @@ -66,14 +66,14 @@ public class Buttons { public final ResourceLocation resLoc = AssetUtil.getGuiLocation("gui_inputter"); public TinyButton(int id, int x, int y) { - super(x, y, 8, 8, new StringTextComponent(""), Button::onPress); + super(x, y, 8, 8, new TextComponent(""), Button::onPress); } @Override - public void render(MatrixStack matrixStack, int x, int y, float f) { + public void render(PoseStack matrixStack, int x, int y, float f) { if (this.visible) { - Minecraft.getInstance().getTextureManager().bind(this.resLoc); - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.setShaderTexture(0, this.resLoc); this.isHovered = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height; int k = this.getYImage(this.isHovered); GlStateManager._enableBlend(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/CrusherScreen.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/CrusherScreen.java index 24e83a490..805b04375 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/CrusherScreen.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/CrusherScreen.java @@ -10,19 +10,19 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.inventory.CrusherContainer; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCrusher; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import net.minecraft.client.gui.widget.button.Button; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.ChatFormatting; +import net.minecraft.client.gui.components.Button; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -39,7 +39,7 @@ public class CrusherScreen extends AAScreen { private Button buttonAutoSplit; - public CrusherScreen(CrusherContainer container, PlayerInventory inventory, ITextComponent title) { + public CrusherScreen(CrusherContainer container, Inventory inventory, Component title) { super(container, inventory, title); this.tileGrinder = container.tileGrinder; this.isDouble = container.isDouble; @@ -55,8 +55,8 @@ public class CrusherScreen extends AAScreen { : 42), this.topPos + 5, this.tileGrinder.storage); if (this.isDouble) { - this.buttonAutoSplit = new Buttons.SmallerButton( this.leftPos - 10, this.topPos, new StringTextComponent("S"), (button) -> actionPerformed(0)); - this.addButton(this.buttonAutoSplit); + this.buttonAutoSplit = new Buttons.SmallerButton( this.leftPos - 10, this.topPos, new TextComponent("S"), (button) -> actionPerformed(0)); + this.addRenderableWidget(this.buttonAutoSplit); } titleLabelX = (int) (imageWidth / 2.0f - font.width(title) / 2.0f); @@ -70,35 +70,35 @@ public class CrusherScreen extends AAScreen { } @Override - public void tick() { - super.tick(); + public void containerTick() { + super.containerTick(); if (this.isDouble) { - this.buttonAutoSplit.setMessage(new StringTextComponent("S").withStyle(this.tileGrinder.isAutoSplit - ? TextFormatting.DARK_GREEN - : TextFormatting.RED)); + this.buttonAutoSplit.setMessage(new TextComponent("S").withStyle(this.tileGrinder.isAutoSplit + ? ChatFormatting.DARK_GREEN + : ChatFormatting.RED)); } } @Override - public void render(@Nonnull MatrixStack matrixStack, int x, int y, float f) { + public void render(@Nonnull PoseStack matrixStack, int x, int y, float f) { super.render(matrixStack, x, y, f); this.energy.render(matrixStack, x, y); if (this.isDouble && this.buttonAutoSplit.isMouseOver(x,y)) { - drawString(matrixStack, font, new TranslationTextComponent("info.actuallyadditions.gui.autosplititems." + (tileGrinder.isAutoSplit?"on":"off")).withStyle(TextFormatting.BOLD), x , y, 0xffffff); + drawString(matrixStack, font, new TranslatableComponent("info.actuallyadditions.gui.autosplititems." + (tileGrinder.isAutoSplit?"on":"off")).withStyle(ChatFormatting.BOLD), x , y, 0xffffff); } } @Override - public void renderBg(MatrixStack matrices, float f, int x, int y) { - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + public void renderBg(PoseStack matrices, float f, int x, int y) { + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + RenderSystem.setShaderTexture(0, AssetUtil.GUI_INVENTORY_LOCATION); this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bind(this.isDouble + RenderSystem.setShaderTexture(0, this.isDouble ? RES_LOC_DOUBLE : RES_LOC); this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); @@ -121,7 +121,7 @@ public class CrusherScreen extends AAScreen { public static class CrusherDoubleScreen extends CrusherScreen { - public CrusherDoubleScreen(CrusherContainer crusherContainer, PlayerInventory inventory, ITextComponent tile) { + public CrusherDoubleScreen(CrusherContainer crusherContainer, Inventory inventory, Component tile) { super(crusherContainer, inventory, tile); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/EnergyDisplay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/EnergyDisplay.java index a0a16f08a..a70bb6289 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/EnergyDisplay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/EnergyDisplay.java @@ -10,25 +10,24 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.tile.CustomEnergyStorage; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.AbstractGui; -import net.minecraft.client.resources.I18n; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.client.gui.GuiComponent; +import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.TranslatableComponent; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.fml.client.gui.GuiUtils; import java.text.NumberFormat; import java.util.ArrayList; import java.util.List; @OnlyIn(Dist.CLIENT) -public class EnergyDisplay extends AbstractGui { +public class EnergyDisplay extends GuiComponent { private CustomEnergyStorage rfReference; private int x; @@ -52,9 +51,10 @@ public class EnergyDisplay extends AbstractGui { this.drawTextNextTo = drawTextNextTo; } - public void draw(MatrixStack matrices) { + public void draw(PoseStack matrices) { Minecraft mc = Minecraft.getInstance(); - mc.getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + RenderSystem.setShader(GameRenderer::getPositionTexShader); + RenderSystem.setShaderTexture(0, AssetUtil.GUI_INVENTORY_LOCATION); //bind? int barX = this.x; int barY = this.y; @@ -71,9 +71,9 @@ public class EnergyDisplay extends AbstractGui { int i = this.rfReference.getEnergyStored() * 83 / this.rfReference.getMaxEnergyStored(); float[] color = AssetUtil.getWheelColor(mc.level.getGameTime() % 256); - RenderSystem.color3f(color[0] / 255F, color[1] / 255F, color[2] / 255F); + RenderSystem.setShaderColor(color[0] / 255F, color[1] / 255F, color[2] / 255F, 1F); //color3f this.blit(matrices, barX + 1, barY + 84 - i, 36, 172, 16, i); - RenderSystem.color3f(1F, 1F, 1F); + RenderSystem.setShaderColor(1F, 1F, 1F, 1F); //color3f } if (this.drawTextNextTo) { @@ -81,13 +81,14 @@ public class EnergyDisplay extends AbstractGui { } } - public void render(MatrixStack matrices, int mouseX, int mouseY) { + public void render(PoseStack matrices, int mouseX, int mouseY) { if (this.isMouseOver(mouseX, mouseY)) { Minecraft mc = Minecraft.getInstance(); - List text = new ArrayList<>(); - text.add(new StringTextComponent(this.getOverlayText())); - GuiUtils.drawHoveringText(matrices, text, mouseX, mouseY, mc.getWindow().getWidth(), mc.getWindow().getHeight(), -1, mc.font); + List text = new ArrayList<>(); + text.add(new TextComponent(this.getOverlayText())); + if(mc.screen != null) + mc.screen.renderComponentTooltip(matrices, text, mouseX, mouseY, mc.font); //TODO: Check if this is correct, used to call GuiUtils.drawHoveringText } } @@ -101,7 +102,7 @@ public class EnergyDisplay extends AbstractGui { private String getOverlayText() { NumberFormat format = NumberFormat.getInstance(); - return new TranslationTextComponent("misc.actuallyadditions.power_long", + return new TranslatableComponent("misc.actuallyadditions.power_long", format.format(this.rfReference.getEnergyStored()), format.format(this.rfReference.getMaxEnergyStored())) .getString(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FilterSettingsGui.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FilterSettingsGui.java index 714e08ca6..761dce0e8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FilterSettingsGui.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FilterSettingsGui.java @@ -10,26 +10,26 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.tile.FilterSettings; +import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.AbstractGui; -import net.minecraft.client.gui.widget.Widget; -import net.minecraft.client.gui.widget.button.Button; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.client.gui.GuiComponent; +import net.minecraft.client.gui.components.AbstractWidget; +import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.components.Widget; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.TranslatableComponent; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.fml.client.gui.GuiUtils; import java.util.ArrayList; import java.util.List; @OnlyIn(Dist.CLIENT) -public class FilterSettingsGui extends AbstractGui { +public class FilterSettingsGui extends GuiComponent { private final FilterSettings theSettings; @@ -40,52 +40,53 @@ public class FilterSettingsGui extends AbstractGui { public FilterSettingsGui(FilterSettings settings, int x, int y, List buttonList) { this.theSettings = settings; - this.whitelistButton = new Buttons.SmallerButton( x, y, new StringTextComponent("WH"), true, Button::onPress); //TODO these need translation keys + this.whitelistButton = new Buttons.SmallerButton( x, y, new TextComponent("WH"), true, Button::onPress); //TODO these need translation keys buttonList.add(this.whitelistButton); y += 14; - this.nbtButton = new Buttons.SmallerButton( x, y, new StringTextComponent("NB"), true, Button::onPress);//TODO also button actions + this.nbtButton = new Buttons.SmallerButton( x, y, new TextComponent("NB"), true, Button::onPress);//TODO also button actions buttonList.add(this.nbtButton); y += 14; - this.modButton = new Buttons.SmallerButton( x, y, new StringTextComponent("MO"), true, Button::onPress); + this.modButton = new Buttons.SmallerButton( x, y, new TextComponent("MO"), true, Button::onPress); buttonList.add(this.modButton); this.tick(); } public void tick() { - this.whitelistButton.setMessage(new StringTextComponent("WH").withStyle(this.theSettings.isWhitelist - ? TextFormatting.DARK_GREEN - : TextFormatting.RED)); - this.whitelistButton.setMessage(new StringTextComponent("NB").withStyle(this.theSettings.respectNBT - ? TextFormatting.DARK_GREEN - : TextFormatting.RED)); - this.whitelistButton.setMessage(new StringTextComponent("MO").withStyle(this.theSettings.respectMod - ? TextFormatting.DARK_GREEN - : TextFormatting.RED)); + this.whitelistButton.setMessage(new TextComponent("WH").withStyle(this.theSettings.isWhitelist + ? ChatFormatting.DARK_GREEN + : ChatFormatting.RED)); + this.whitelistButton.setMessage(new TextComponent("NB").withStyle(this.theSettings.respectNBT + ? ChatFormatting.DARK_GREEN + : ChatFormatting.RED)); + this.whitelistButton.setMessage(new TextComponent("MO").withStyle(this.theSettings.respectMod + ? ChatFormatting.DARK_GREEN + : ChatFormatting.RED)); } - public void drawHover(MatrixStack stack, int mouseX, int mouseY) { + public void drawHover(PoseStack stack, int mouseX, int mouseY) { Minecraft mc = Minecraft.getInstance(); - List list = new ArrayList<>(); + List list = new ArrayList<>(); if (this.whitelistButton.isMouseOver(mouseX, mouseY)) { list.add((this.theSettings.isWhitelist - ? new TranslationTextComponent("info." + ActuallyAdditions.MODID + ".gui.whitelist") - : new TranslationTextComponent("info." + ActuallyAdditions.MODID + ".gui.blacklist")).withStyle(TextFormatting.BOLD)); - list.add(new TranslationTextComponent("info." + ActuallyAdditions.MODID + ".gui.whitelistInfo")); + ? new TranslatableComponent("info." + ActuallyAdditions.MODID + ".gui.whitelist") + : new TranslatableComponent("info." + ActuallyAdditions.MODID + ".gui.blacklist")).withStyle(ChatFormatting.BOLD)); + list.add(new TranslatableComponent("info." + ActuallyAdditions.MODID + ".gui.whitelistInfo")); } else if (this.nbtButton.isMouseOver(mouseX, mouseY)) { list.add((this.theSettings.respectNBT - ? new TranslationTextComponent("info." + ActuallyAdditions.MODID + ".gui.respectNBT") - : new TranslationTextComponent("info." + ActuallyAdditions.MODID + ".gui.ignoreNBT")).withStyle(TextFormatting.BOLD)); + ? new TranslatableComponent("info." + ActuallyAdditions.MODID + ".gui.respectNBT") + : new TranslatableComponent("info." + ActuallyAdditions.MODID + ".gui.ignoreNBT")).withStyle(ChatFormatting.BOLD)); } else if (this.modButton.isMouseOver(mouseX, mouseY)) { list.add((this.theSettings.respectMod - ? new TranslationTextComponent("info." + ActuallyAdditions.MODID + ".gui.respectMod") - : new TranslationTextComponent("info." + ActuallyAdditions.MODID + ".gui.ignoreMod")).withStyle(TextFormatting.BOLD)); - list.add(new TranslationTextComponent("info." + ActuallyAdditions.MODID + ".gui.respectModInfo")); + ? new TranslatableComponent("info." + ActuallyAdditions.MODID + ".gui.respectMod") + : new TranslatableComponent("info." + ActuallyAdditions.MODID + ".gui.ignoreMod")).withStyle(ChatFormatting.BOLD)); + list.add(new TranslatableComponent("info." + ActuallyAdditions.MODID + ".gui.respectModInfo")); } //TODO tooltips still jank - if (!list.isEmpty()) - GuiUtils.drawHoveringText(stack, list, mouseX, mouseY, mc.getWindow().getGuiScaledWidth(), mc.getWindow().getGuiScaledHeight(), 200, mc.font); + if (!list.isEmpty() && mc.screen != null) { + mc.screen.renderComponentTooltip(stack, list, mouseX, mouseY, mc.font); //TODO: Check if this is correct, used to call GuiUtils.drawHoveringText + } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FluidDisplay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FluidDisplay.java index b8a964d5a..1d97a35be 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FluidDisplay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FluidDisplay.java @@ -10,29 +10,28 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.AbstractGui; -import net.minecraft.fluid.Fluid; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.StringTextComponent; +import net.minecraft.client.gui.GuiComponent; +import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.material.Fluid; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.fluids.capability.IFluidHandler; -import net.minecraftforge.fluids.capability.templates.FluidTank; -import net.minecraftforge.fml.client.gui.GuiUtils; import javax.annotation.Nonnull; import java.text.NumberFormat; import java.util.Collections; @OnlyIn(Dist.CLIENT) -public class FluidDisplay extends AbstractGui { +public class FluidDisplay extends GuiComponent { private IFluidTank fluidReference; private Fluid oldFluid; @@ -74,9 +73,10 @@ public class FluidDisplay extends AbstractGui { this.drawTextNextTo = drawTextNextTo; } - public void draw(MatrixStack matrices) { + public void draw(PoseStack matrices) { Minecraft mc = Minecraft.getInstance(); - mc.getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + RenderSystem.setShader(GameRenderer::getPositionTexShader); + RenderSystem.setShaderTexture(0, AssetUtil.GUI_INVENTORY_LOCATION); //bind? int barX = this.x; int barY = this.y; @@ -101,33 +101,34 @@ public class FluidDisplay extends AbstractGui { } if (stack != null && fluid != null && this.resLoc != null) { - mc.getTextureManager().bind(this.resLoc); + RenderSystem.setShaderTexture(0, this.resLoc); - GlStateManager._pushMatrix(); +// GlStateManager._pushMatrix(); GlStateManager._enableBlend(); - GlStateManager._disableAlphaTest(); +// GlStateManager._disableAlphaTest(); GlStateManager._blendFuncSeparate(770, 771, 1, 0); int i = this.fluidReference.getFluid().getAmount() * 83 / this.fluidReference.getCapacity(); - this.blit(matrices, barX + 1, barY + 84 - i, 0, 0, 16, i, 16, 512); + blit(matrices, barX + 1, barY + 84 - i, 0, 0, 16, i, 16, 512); //drawModalRectWithCustomSizedTexture(barX + 1, barY + 84 - i, 36, 172, 16, i, 16, 512); GlStateManager._disableBlend(); - GlStateManager._enableAlphaTest(); - GlStateManager._popMatrix(); +// GlStateManager._enableAlphaTest(); +// GlStateManager._popMatrix(); } if (this.drawTextNextTo) { - mc.font.draw(matrices, new StringTextComponent(this.getOverlayText()), barX + 25, barY + 78, 0xFFFFFF); + mc.font.draw(matrices, new TextComponent(this.getOverlayText()), barX + 25, barY + 78, 0xFFFFFF); } } - public void render(MatrixStack matrices, int mouseX, int mouseY) { + public void render(PoseStack matrices, int mouseX, int mouseY) { if (mouseX >= this.x && mouseY >= this.y && mouseX < this.x + (this.outline ? 26 : 18) && mouseY < this.y + (this.outline ? 93 : 85)) { Minecraft mc = Minecraft.getInstance(); - GuiUtils.drawHoveringText(matrices, Collections.singletonList(new StringTextComponent(this.getOverlayText())), mouseX, mouseY, mc.getWindow().getWidth(), mc.getWindow().getHeight(), -1, mc.font); + if(mc.screen != null) + mc.screen.renderComponentTooltip(matrices, Collections.singletonList(new TextComponent(this.getOverlayText())), mouseX, mouseY, mc.font); //TODO: Check if this is correct, used to call GuiUtils.drawHoveringText } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBioReactor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBioReactor.java index 893a90270..e2ed33e8f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBioReactor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBioReactor.java @@ -10,15 +10,15 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.inventory.ContainerBioReactor; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBioReactor; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; import javax.annotation.Nonnull; @@ -28,7 +28,7 @@ public class GuiBioReactor extends AAScreen { private final TileEntityBioReactor tile; private EnergyDisplay energy; - public GuiBioReactor(ContainerBioReactor container, PlayerInventory inventory, ITextComponent title) { + public GuiBioReactor(ContainerBioReactor container, Inventory inventory, Component title) { super(container, inventory, title); this.tile = container.tile; this.imageWidth = 176; @@ -42,19 +42,19 @@ public class GuiBioReactor extends AAScreen { } @Override - public void render(@Nonnull MatrixStack matrices, int mouseX, int mouseY, float partialTicks) { + public void render(@Nonnull PoseStack matrices, int mouseX, int mouseY, float partialTicks) { super.render(matrices, mouseX, mouseY, partialTicks); //this.energy.render(mouseX, mouseY); } @Override - public void renderBg(MatrixStack matrices, float partialTicks, int x, int y) { - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + public void renderBg(PoseStack matrices, float partialTicks, int x, int y) { + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + RenderSystem.setShaderTexture(0, AssetUtil.GUI_INVENTORY_LOCATION); this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bind(RES_LOC); + RenderSystem.setShaderTexture(0, RES_LOC); this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); if (this.tile.burnTime > 0) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBreaker.java index ff4e59d9e..284e186f9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBreaker.java @@ -10,15 +10,14 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.inventory.ContainerBreaker; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBreaker; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -30,7 +29,7 @@ public class GuiBreaker extends AAScreen { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_breaker"); private final TileEntityBreaker breaker; - public GuiBreaker(ContainerBreaker container, PlayerInventory inventory, ITextComponent title) { + public GuiBreaker(ContainerBreaker container, Inventory inventory, Component title) { super(container, inventory, title); this.breaker = container.breaker; this.imageWidth = 176; @@ -38,18 +37,13 @@ public class GuiBreaker extends AAScreen { } @Override - public void init(Minecraft pMinecraft, int pWidth, int pHeight) { - super.init(pMinecraft, pWidth, pHeight); - } + protected void renderBg(@Nonnull PoseStack matrices, float partialTicks, int x, int y) { + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - @Override - protected void renderBg(@Nonnull MatrixStack matrices, float partialTicks, int x, int y) { - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - - this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + RenderSystem.setShaderTexture(0, AssetUtil.GUI_INVENTORY_LOCATION); this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bind(RES_LOC); + RenderSystem.setShaderTexture(0, RES_LOC); this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCanolaPress.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCanolaPress.java index df17d0fca..6fe4b6bbc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCanolaPress.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCanolaPress.java @@ -10,14 +10,14 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.inventory.ContainerCanolaPress; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -31,7 +31,7 @@ public class GuiCanolaPress extends AAScreen { private EnergyDisplay energy; private FluidDisplay fluid; - public GuiCanolaPress(ContainerCanolaPress container, PlayerInventory inventory, ITextComponent title) { + public GuiCanolaPress(ContainerCanolaPress container, Inventory inventory, Component title) { super(container, inventory, title); this.press = container.press; this.imageWidth = 176; @@ -46,7 +46,7 @@ public class GuiCanolaPress extends AAScreen { } @Override - public void render(@Nonnull MatrixStack matrices, int x, int y, float f) { + public void render(@Nonnull PoseStack matrices, int x, int y, float f) { super.render(matrices, x, y, f); this.energy.render(matrices, x, y); @@ -54,13 +54,13 @@ public class GuiCanolaPress extends AAScreen { } @Override - public void renderBg(MatrixStack matrices, float f, int x, int y) { - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + public void renderBg(PoseStack matrices, float f, int x, int y) { + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + RenderSystem.setShaderTexture(0, AssetUtil.GUI_INVENTORY_LOCATION); this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bind(RES_LOC); + RenderSystem.setShaderTexture(0, RES_LOC); this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); if (this.press.currentProcessTime > 0) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoalGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoalGenerator.java index 36b7e2434..da2ab42fe 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoalGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoalGenerator.java @@ -10,16 +10,14 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.inventory.ContainerCoalGenerator; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import net.minecraft.client.gui.screen.inventory.ContainerScreen; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -32,7 +30,7 @@ public class GuiCoalGenerator extends AAScreen { private final TileEntityCoalGenerator generator; private EnergyDisplay energy; - public GuiCoalGenerator(ContainerCoalGenerator container, PlayerInventory inventory, ITextComponent title) { + public GuiCoalGenerator(ContainerCoalGenerator container, Inventory inventory, Component title) { super(container, inventory, title); this.generator = container.generator; this.imageWidth = 176; @@ -46,7 +44,7 @@ public class GuiCoalGenerator extends AAScreen { } @Override - public void render(@Nonnull MatrixStack matrices, int x, int y, float f) { + public void render(@Nonnull PoseStack matrices, int x, int y, float f) { renderBackground(matrices); super.render(matrices, x, y, f); this.energy.render(matrices, x, y); @@ -54,13 +52,13 @@ public class GuiCoalGenerator extends AAScreen { } @Override - public void renderBg(MatrixStack matrices, float f, int x, int y) { - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + public void renderBg(PoseStack matrices, float f, int x, int y) { + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + RenderSystem.setShaderTexture(0, AssetUtil.GUI_INVENTORY_LOCATION); this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bind(RES_LOC); + RenderSystem.setShaderTexture(0, RES_LOC); this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); if (this.generator.currentBurnTime > 0) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoffeeMachine.java index 1496ea3cf..a95be4821 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoffeeMachine.java @@ -10,27 +10,23 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; -import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.inventory.ContainerCoffeeMachine; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine; -import de.ellpeck.actuallyadditions.mod.util.*; +import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.widget.button.Button; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TextComponent; -import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.client.gui.components.Button; +import net.minecraft.network.chat.BaseComponent; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.fml.client.gui.GuiUtils; import javax.annotation.Nonnull; -import java.util.Arrays; import java.util.Collections; @OnlyIn(Dist.CLIENT) @@ -42,7 +38,7 @@ public class GuiCoffeeMachine extends AAScreen { private EnergyDisplay energy; private FluidDisplay fluid; - public GuiCoffeeMachine(ContainerCoffeeMachine container, PlayerInventory inventory, ITextComponent title) { + public GuiCoffeeMachine(ContainerCoffeeMachine container, Inventory inventory, Component title) { super(container, inventory, title); this.machine = container.machine; this.imageWidth = 176; @@ -53,22 +49,21 @@ public class GuiCoffeeMachine extends AAScreen { public void init() { super.init(); - this.addButton(new Button(this.leftPos + 60, this.topPos + 11, 58, 20, new TranslationTextComponent("info.actuallyadditions.gui.ok"), - (b) -> PacketHandlerHelper.sendButtonPacket(this.machine, 0))); + this.addRenderableWidget(new Button(this.leftPos + 60, this.topPos + 11, 58, 20, new TranslatableComponent("info.actuallyadditions.gui.ok"), + (b) -> PacketHandlerHelper.sendButtonPacket(this.machine, 0))); this.energy = new EnergyDisplay(this.leftPos + 16, this.topPos + 5, this.machine.storage); this.fluid = new FluidDisplay(this.leftPos - 30, this.topPos + 1, this.machine.tank, true, false); } @Override - public void render(@Nonnull MatrixStack matrices, int x, int y, float f) { + public void render(@Nonnull PoseStack matrices, int x, int y, float f) { super.render(matrices, x, y, f); Minecraft mc = Minecraft.getInstance(); - TextComponent text = new TranslationTextComponent("info.actuallyadditions.gui.coffee_amount", this.machine.coffeeCacheAmount, TileEntityCoffeeMachine.COFFEE_CACHE_MAX_AMOUNT); + BaseComponent text = new TranslatableComponent("info.actuallyadditions.gui.coffee_amount", this.machine.coffeeCacheAmount, TileEntityCoffeeMachine.COFFEE_CACHE_MAX_AMOUNT); if (x >= this.leftPos + 40 && y >= this.topPos + 25 && x <= this.leftPos + 49 && y <= this.topPos + 56) { - GuiUtils.drawHoveringText(matrices, Collections.singletonList(text), x, y, mc.getWindow().getWidth(), mc.getWindow().getWidth(), -1, font); - + renderComponentTooltip(matrices, Collections.singletonList(text), x, y, font); } this.energy.render(matrices, x, y); @@ -76,13 +71,13 @@ public class GuiCoffeeMachine extends AAScreen { } @Override - public void renderBg(@Nonnull MatrixStack matrices, float f, int x, int y) { - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + public void renderBg(@Nonnull PoseStack matrices, float f, int x, int y) { + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + RenderSystem.setShaderTexture(0, AssetUtil.GUI_INVENTORY_LOCATION); this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bind(RES_LOC); + RenderSystem.setShaderTexture(0, RES_LOC); this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); if (this.machine.coffeeCacheAmount > 0) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDirectionalBreaker.java index 14d230c03..a51732337 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDirectionalBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDirectionalBreaker.java @@ -10,14 +10,14 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.inventory.ContainerDirectionalBreaker; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLongRangeBreaker; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -30,7 +30,7 @@ public class GuiDirectionalBreaker extends AAScreen private final TileEntityLongRangeBreaker breaker; private EnergyDisplay energy; - public GuiDirectionalBreaker(ContainerDirectionalBreaker container, PlayerInventory inventory, ITextComponent title) { + public GuiDirectionalBreaker(ContainerDirectionalBreaker container, Inventory inventory, Component title) { super(container, inventory, title); this.breaker = container.breaker; this.imageWidth = 176; @@ -44,19 +44,19 @@ public class GuiDirectionalBreaker extends AAScreen } @Override - public void render(@Nonnull MatrixStack matrices, int x, int y, float f) { + public void render(@Nonnull PoseStack matrices, int x, int y, float f) { super.render(matrices, x, y, f); this.energy.render(matrices, x, y); } @Override - public void renderBg(MatrixStack matrices, float f, int x, int y) { - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + public void renderBg(PoseStack matrices, float f, int x, int y) { + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + RenderSystem.setShaderTexture(0, AssetUtil.GUI_INVENTORY_LOCATION); this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bind(RES_LOC); + RenderSystem.setShaderTexture(0, RES_LOC); this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); this.energy.draw(matrices); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDrill.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDrill.java index 06ded003c..0e5eab215 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDrill.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDrill.java @@ -10,15 +10,15 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.inventory.ContainerDrill; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -30,25 +30,25 @@ public class GuiDrill extends AAScreen { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_drill"); - public GuiDrill(ContainerDrill container, PlayerInventory inventory, ITextComponent title) { + public GuiDrill(ContainerDrill container, Inventory inventory, Component title) { super(container, inventory, title); this.imageWidth = 176; this.imageHeight = 54 + 86; } @Override - public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) { + public void renderLabels(@Nonnull PoseStack matrices, int x, int y) { AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, I18n.get("container." + ActuallyAdditions.MODID + ".drill.name")); } @Override - public void renderBg(MatrixStack matrices, float f, int x, int y) { - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + public void renderBg(PoseStack matrices, float f, int x, int y) { + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + RenderSystem.setShaderTexture(0, AssetUtil.GUI_INVENTORY_LOCATION); this.blit(matrices, this.leftPos, this.topPos + 54, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bind(RES_LOC); + RenderSystem.setShaderTexture(0, RES_LOC); this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 54); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDropper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDropper.java index 6b9208c19..d714df7ed 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDropper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDropper.java @@ -10,19 +10,17 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.inventory.ContainerDropper; import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import javax.annotation.Nonnull; - @OnlyIn(Dist.CLIENT) public class GuiDropper extends AAScreen { @@ -30,7 +28,7 @@ public class GuiDropper extends AAScreen { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_breaker"); private final TileEntityDropper dropper; - public GuiDropper(ContainerDropper container, PlayerInventory inventory, ITextComponent title) { + public GuiDropper(ContainerDropper container, Inventory inventory, Component title) { super(container, inventory, title); this.dropper = container.dropper; this.imageWidth = 176; @@ -45,13 +43,13 @@ public class GuiDropper extends AAScreen { } @Override - public void renderBg(MatrixStack matrices, float f, int x, int y) { - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + public void renderBg(PoseStack matrices, float f, int x, int y) { + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + RenderSystem.setShaderTexture(0, AssetUtil.GUI_INVENTORY_LOCATION); this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bind(RES_LOC); + RenderSystem.setShaderTexture(0, RES_LOC); this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnergizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnergizer.java index 4f37034ab..8ec8b3eaf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnergizer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnergizer.java @@ -10,14 +10,14 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnergizer; import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -30,7 +30,7 @@ public class GuiEnergizer extends AAScreen { private final TileEntityEnergizer energizer; private EnergyDisplay energy; - public GuiEnergizer(ContainerEnergizer container, PlayerInventory inventory, ITextComponent title) { + public GuiEnergizer(ContainerEnergizer container, Inventory inventory, Component title) { super(container, inventory, title); this.energizer = container.energizer; this.imageWidth = 176; @@ -44,19 +44,19 @@ public class GuiEnergizer extends AAScreen { } @Override - public void render(@Nonnull MatrixStack matrices, int x, int y, float f) { + public void render(@Nonnull PoseStack matrices, int x, int y, float f) { super.render(matrices, x, y, f); this.energy.render(matrices, x, y); } @Override - public void renderBg(MatrixStack matrices, float f, int x, int y) { - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + public void renderBg(PoseStack matrices, float f, int x, int y) { + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + RenderSystem.setShaderTexture(0, AssetUtil.GUI_INVENTORY_LOCATION); this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bind(RES_LOC); + RenderSystem.setShaderTexture(0, RES_LOC); this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); this.energy.draw(matrices); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnervator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnervator.java index 02a354e9c..63f8060b8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnervator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnervator.java @@ -10,14 +10,14 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnervator; import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -31,7 +31,7 @@ public class GuiEnervator extends AAScreen { private final TileEntityEnervator enervator; private EnergyDisplay energy; - public GuiEnervator(ContainerEnervator container, PlayerInventory inventory, ITextComponent title) { + public GuiEnervator(ContainerEnervator container, Inventory inventory, Component title) { super(container, inventory, title); this.enervator = container.enervator; this.imageWidth = 176; @@ -45,19 +45,19 @@ public class GuiEnervator extends AAScreen { } @Override - public void render(@Nonnull MatrixStack matrices, int x, int y, float f) { + public void render(@Nonnull PoseStack matrices, int x, int y, float f) { super.render(matrices, x, y, f); this.energy.render(matrices, x, y); } @Override - public void renderBg(MatrixStack matrices, float f, int x, int y) { - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + public void renderBg(PoseStack matrices, float f, int x, int y) { + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + RenderSystem.setShaderTexture(0, AssetUtil.GUI_INVENTORY_LOCATION); this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bind(RES_LOC); + RenderSystem.setShaderTexture(0, RES_LOC); this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); this.energy.draw(matrices); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFarmer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFarmer.java index f14c2a883..729f2382c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFarmer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFarmer.java @@ -10,14 +10,14 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFarmer; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -32,7 +32,7 @@ public class GuiFarmer extends AAScreen { private EnergyDisplay energy; - public GuiFarmer(ContainerFarmer container, PlayerInventory inventory, ITextComponent title) { + public GuiFarmer(ContainerFarmer container, Inventory inventory, Component title) { super(container, inventory, title); this.farmer = container.farmer; this.imageWidth = 176; @@ -47,20 +47,20 @@ public class GuiFarmer extends AAScreen { } @Override - public void renderBg(MatrixStack matrices, float f, int x, int y) { - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + public void renderBg(PoseStack matrices, float f, int x, int y) { + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + RenderSystem.setShaderTexture(0, AssetUtil.GUI_INVENTORY_LOCATION); this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bind(RES_LOC); + RenderSystem.setShaderTexture(0, RES_LOC); this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); this.energy.draw(matrices); } @Override - public void render(@Nonnull MatrixStack matrices, int x, int y, float f) { + public void render(@Nonnull PoseStack matrices, int x, int y, float f) { super.render(matrices, x, y, f); this.energy.render(matrices, x, y); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFeeder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFeeder.java index 00b2b36cf..04672fcb7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFeeder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFeeder.java @@ -10,16 +10,16 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFeeder; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -31,7 +31,7 @@ public class GuiFeeder extends AAScreen { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_feeder"); public final TileEntityFeeder tileFeeder; - public GuiFeeder(ContainerFeeder container, PlayerInventory inventory, ITextComponent title) { + public GuiFeeder(ContainerFeeder container, Inventory inventory, Component title) { super(container, inventory, title); this.tileFeeder = container.feeder; this.imageWidth = 176; @@ -39,7 +39,7 @@ public class GuiFeeder extends AAScreen { } @Override - public void render(@Nonnull MatrixStack matrices, int x, int y, float f) { + public void render(@Nonnull PoseStack matrices, int x, int y, float f) { super.render(matrices, x, y, f); if (x >= this.leftPos + 69 && y >= this.topPos + 30 && x <= this.leftPos + 69 + 10 && y <= this.topPos + 30 + 10) { String[] array = new String[]{this.tileFeeder.currentAnimalAmount + " " + I18n.get("info." + ActuallyAdditions.MODID + ".gui.animals"), this.tileFeeder.currentAnimalAmount >= 2 && this.tileFeeder.currentAnimalAmount < TileEntityFeeder.THRESHOLD @@ -52,11 +52,12 @@ public class GuiFeeder extends AAScreen { } @Override - public void renderBg(MatrixStack matrices, float f, int x, int y) { - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + public void renderBg(PoseStack matrices, float f, int x, int y) { + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + + RenderSystem.setShaderTexture(0, AssetUtil.GUI_INVENTORY_LOCATION); this.blit(matrices, this.leftPos, this.topPos + 70, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bind(RES_LOC); + RenderSystem.setShaderTexture(0, RES_LOC); this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 70); if (this.tileFeeder.currentTimer > 0) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFermentingBarrel.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFermentingBarrel.java index 98f1a8efa..95337c7c7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFermentingBarrel.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFermentingBarrel.java @@ -10,14 +10,14 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFermentingBarrel; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -32,7 +32,7 @@ public class GuiFermentingBarrel extends AAScreen { private FluidDisplay input; private FluidDisplay output; - public GuiFermentingBarrel(ContainerFermentingBarrel container, PlayerInventory inventory, ITextComponent title) { + public GuiFermentingBarrel(ContainerFermentingBarrel container, Inventory inventory, Component title) { super(container, inventory, title); this.press = container.barrel; this.imageWidth = 176; @@ -40,7 +40,7 @@ public class GuiFermentingBarrel extends AAScreen { } @Override - public void render(@Nonnull MatrixStack matrices, int x, int y, float f) { + public void render(@Nonnull PoseStack matrices, int x, int y, float f) { super.render(matrices, x, y, f); this.input.render(matrices, x, y); this.output.render(matrices, x, y); @@ -54,13 +54,13 @@ public class GuiFermentingBarrel extends AAScreen { } @Override - public void renderBg(MatrixStack matrices, float f, int x, int y) { - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + public void renderBg(PoseStack matrices, float f, int x, int y) { + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + RenderSystem.setShaderTexture(0, AssetUtil.GUI_INVENTORY_LOCATION); this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bind(RES_LOC); + RenderSystem.setShaderTexture(0, RES_LOC); this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); if (this.press.currentProcessTime > 0) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFilter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFilter.java index 44635cc4b..f057a9b5b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFilter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFilter.java @@ -10,15 +10,15 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFilter; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -29,25 +29,25 @@ public class GuiFilter extends AAScreen { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_filter"); - public GuiFilter(ContainerFilter container, PlayerInventory inventory, ITextComponent title) { + public GuiFilter(ContainerFilter container, Inventory inventory, Component title) { super(container, inventory, title); this.imageWidth = 176; this.imageHeight = 90 + 86; } @Override - public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) { + public void renderLabels(@Nonnull PoseStack matrices, int x, int y) { AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, I18n.get("container." + ActuallyAdditions.MODID + ".filter.name")); } @Override - public void renderBg(MatrixStack matrices, float f, int x, int y) { - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + public void renderBg(PoseStack matrices, float f, int x, int y) { + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + RenderSystem.setShaderTexture(0, AssetUtil.GUI_INVENTORY_LOCATION); this.blit(matrices, this.leftPos, this.topPos + 90, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bind(RES_LOC); + RenderSystem.setShaderTexture(0, RES_LOC); this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 90); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFireworkBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFireworkBox.java index 24fad9374..d4b81ba57 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFireworkBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFireworkBox.java @@ -10,22 +10,22 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFireworkBox; -import net.minecraft.client.gui.screen.inventory.ContainerScreen; -import net.minecraft.client.gui.widget.AbstractSlider; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.client.gui.components.AbstractSliderButton; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.player.Inventory; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; // TODO: FIX ME @OnlyIn(Dist.CLIENT) -public class GuiFireworkBox extends ContainerScreen { +public class GuiFireworkBox extends AbstractContainerScreen { // private final TileEntityFireworkBox tile; - public GuiFireworkBox(ContainerFireworkBox screenContainer, PlayerInventory inv, ITextComponent titleIn) { + public GuiFireworkBox(ContainerFireworkBox screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); // this.tile = tile.; this.imageWidth = 300; @@ -53,7 +53,7 @@ public class GuiFireworkBox extends ContainerScreen { } @Override - protected void renderBg(MatrixStack matrixStack, float partialTicks, int x, int y) { + protected void renderBg(PoseStack matrixStack, float partialTicks, int x, int y) { } @@ -90,8 +90,8 @@ public class GuiFireworkBox extends ContainerScreen { // } // TODO: FIX - private static class CustomSlider extends AbstractSlider { - public CustomSlider(int x, int y, int width, int height, ITextComponent message, double defaultValue) { + private static class CustomSlider extends AbstractSliderButton { + public CustomSlider(int x, int y, int width, int height, Component message, double defaultValue) { super(x, y, width, height, message, defaultValue); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFluidCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFluidCollector.java index 179f5384a..ce92b6b5f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFluidCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFluidCollector.java @@ -10,14 +10,14 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFluidCollector; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -31,7 +31,7 @@ public class GuiFluidCollector extends AAScreen { private final TileEntityFluidCollector collector; private FluidDisplay fluid; - public GuiFluidCollector(ContainerFluidCollector container, PlayerInventory inventory, ITextComponent title) { + public GuiFluidCollector(ContainerFluidCollector container, Inventory inventory, Component title) { super(container, inventory, title); this.collector = container.collector; this.imageWidth = 176; @@ -39,7 +39,7 @@ public class GuiFluidCollector extends AAScreen { } @Override - public void render(@Nonnull MatrixStack matrices, int x, int y, float f) { + public void render(@Nonnull PoseStack matrices, int x, int y, float f) { super.render(matrices, x, y, f); this.fluid.render(matrices, x, y); @@ -52,13 +52,13 @@ public class GuiFluidCollector extends AAScreen { } @Override - public void renderBg(MatrixStack matrices, float f, int x, int y) { - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + public void renderBg(PoseStack matrices, float f, int x, int y) { + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + RenderSystem.setShaderTexture(0, AssetUtil.GUI_INVENTORY_LOCATION); this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bind(RES_LOC); + RenderSystem.setShaderTexture(0, RES_LOC); this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); this.fluid.draw(matrices); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFurnaceDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFurnaceDouble.java index d8f3740fd..3d0487075 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFurnaceDouble.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFurnaceDouble.java @@ -10,27 +10,24 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFurnaceDouble; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.tile.TileEntityPoweredFurnace; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import de.ellpeck.actuallyadditions.mod.util.StringUtil; -import net.minecraft.client.gui.widget.button.Button; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.ChatFormatting; +import net.minecraft.client.gui.components.Button; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.fml.client.gui.GuiUtils; import javax.annotation.Nonnull; -import javax.xml.soap.Text; import java.util.Collections; @OnlyIn(Dist.CLIENT) @@ -42,7 +39,7 @@ public class GuiFurnaceDouble extends AAScreen { private Button buttonAutoSplit; - public GuiFurnaceDouble(ContainerFurnaceDouble container, PlayerInventory inventory, ITextComponent title) { + public GuiFurnaceDouble(ContainerFurnaceDouble container, Inventory inventory, Component title) { super(container, inventory, title); this.tileFurnace = container.furnace; this.imageWidth = 176; @@ -50,14 +47,14 @@ public class GuiFurnaceDouble extends AAScreen { } @Override - public void render(@Nonnull MatrixStack matrices, int x, int y, float f) { + public void render(@Nonnull PoseStack matrices, int x, int y, float f) { super.render(matrices, x, y, f); this.energy.render(matrices, x, y); if (this.buttonAutoSplit.isMouseOver(x, y)) { - GuiUtils.drawHoveringText(matrices, Collections.singletonList(this.tileFurnace.isAutoSplit - ? new TranslationTextComponent("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.on").withStyle(TextFormatting.BOLD) - : new TranslationTextComponent("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.off").withStyle(TextFormatting.BOLD)), x, y, this.width, this.height, 64, font); + renderComponentTooltip(matrices, Collections.singletonList(this.tileFurnace.isAutoSplit + ? new TranslatableComponent("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.on").withStyle(ChatFormatting.BOLD) + : new TranslatableComponent("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.off").withStyle(ChatFormatting.BOLD)), x, y); } } @@ -65,26 +62,26 @@ public class GuiFurnaceDouble extends AAScreen { public void init() { super.init(); this.energy = new EnergyDisplay(this.leftPos + 27, this.topPos + 5, this.tileFurnace.storage); - this.buttonAutoSplit = new Buttons.SmallerButton(this.leftPos, this.topPos, new StringTextComponent("S"), (button) -> PacketHandlerHelper.sendButtonPacket(this.tileFurnace, 0)); - buttonAutoSplit.setFGColor(this.tileFurnace.isAutoSplit ? TextFormatting.DARK_GREEN.getColor() : TextFormatting.RED.getColor()); - this.addButton(this.buttonAutoSplit); + this.buttonAutoSplit = new Buttons.SmallerButton(this.leftPos, this.topPos, new TextComponent("S"), (button) -> PacketHandlerHelper.sendButtonPacket(this.tileFurnace, 0)); + buttonAutoSplit.setFGColor(this.tileFurnace.isAutoSplit ? ChatFormatting.DARK_GREEN.getColor() : ChatFormatting.RED.getColor()); + this.addRenderableWidget(this.buttonAutoSplit); } @Override - public void tick() { - super.tick(); - buttonAutoSplit.setFGColor(this.tileFurnace.isAutoSplit ? TextFormatting.DARK_GREEN.getColor() : TextFormatting.RED.getColor()); + public void containerTick() { + super.containerTick(); + buttonAutoSplit.setFGColor(this.tileFurnace.isAutoSplit ? ChatFormatting.DARK_GREEN.getColor() : ChatFormatting.RED.getColor()); } @Override - public void renderBg(@Nonnull MatrixStack matrices, float f, int x, int y) { - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + public void renderBg(@Nonnull PoseStack matrices, float f, int x, int y) { + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + RenderSystem.setShaderTexture(0, AssetUtil.GUI_INVENTORY_LOCATION); this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bind(RES_LOC); + RenderSystem.setShaderTexture(0, RES_LOC); this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); if (this.tileFurnace.firstSmeltTime > 0) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java index b4d955e25..ac0b42c07 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java @@ -10,17 +10,17 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.inventory.ContainerLaserRelayItemWhitelist; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemAdvanced; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import net.minecraft.client.gui.widget.button.Button; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.client.gui.components.Button; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -38,7 +38,7 @@ public class GuiLaserRelayItemWhitelist extends AAScreen { @@ -31,7 +28,7 @@ public class GuiMiner extends AAScreen { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_breaker"); private final TileEntityVerticalDigger miner; - public GuiMiner(ContainerMiner container, PlayerInventory inventory, ITextComponent title) { + public GuiMiner(ContainerMiner container, Inventory inventory, Component title) { super(container, inventory, title); this.miner = container.miner; this.imageWidth = 176; @@ -51,13 +48,13 @@ public class GuiMiner extends AAScreen { // this.addButton(buttonReset); } @Override - public void renderBg(MatrixStack matrices, float f, int x, int y) { - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + public void renderBg(PoseStack matrices, float f, int x, int y) { + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + RenderSystem.setShaderTexture(0, AssetUtil.GUI_INVENTORY_LOCATION); this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bind(RES_LOC); + RenderSystem.setShaderTexture(0, RES_LOC); this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); String mining = this.miner.onlyMineOres diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiOilGenerator.java index 5fc2dac25..9dd1bc680 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiOilGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiOilGenerator.java @@ -10,16 +10,15 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.inventory.ContainerOilGenerator; import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import de.ellpeck.actuallyadditions.mod.util.StringUtil; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -35,7 +34,7 @@ public class GuiOilGenerator extends AAScreen { private EnergyDisplay energy; private FluidDisplay fluid; - public GuiOilGenerator(ContainerOilGenerator container, PlayerInventory inventory, ITextComponent title) { + public GuiOilGenerator(ContainerOilGenerator container, Inventory inventory, Component title) { super(container, inventory, title); this.generator = container.generator; this.imageWidth = 176; @@ -50,20 +49,20 @@ public class GuiOilGenerator extends AAScreen { } @Override - public void render(@Nonnull MatrixStack matrices, int x, int y, float f) { + public void render(@Nonnull PoseStack matrices, int x, int y, float f) { super.render(matrices, x, y, f); this.energy.render(matrices, x, y); this.fluid.render(matrices, x, y); } @Override - public void renderBg(MatrixStack matrices, float f, int x, int y) { - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + public void renderBg(PoseStack matrices, float f, int x, int y) { + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + RenderSystem.setShaderTexture(0, AssetUtil.GUI_INVENTORY_LOCATION); this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bind(RES_LOC); + RenderSystem.setShaderTexture(0, RES_LOC); this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); if (this.generator.currentBurnTime > 0 && this.generator.maxBurnTime > 0) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiPhantomPlacer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiPhantomPlacer.java index fabac7710..05fa8b2cd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiPhantomPlacer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiPhantomPlacer.java @@ -10,14 +10,14 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.inventory.ContainerPhantomPlacer; import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomPlacer; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -29,7 +29,7 @@ public class GuiPhantomPlacer extends AAScreen { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_breaker"); private final TileEntityPhantomPlacer placer; - public GuiPhantomPlacer(ContainerPhantomPlacer container, PlayerInventory inventory, ITextComponent title) { + public GuiPhantomPlacer(ContainerPhantomPlacer container, Inventory inventory, Component title) { super(container, inventory, title); this.placer = container.placer; this.imageWidth = 176; @@ -46,8 +46,8 @@ public class GuiPhantomPlacer extends AAScreen { } @Override - public void tick() { - super.tick(); + protected void containerTick() { + super.containerTick(); // if (!this.placer.isBreaker) { // this.buttonList.get(0).displayString = this.getSide(); @@ -55,7 +55,7 @@ public class GuiPhantomPlacer extends AAScreen { } @Override - public void render(@Nonnull MatrixStack matrices, int mouseX, int mouseY, float partialTicks) { + public void render(@Nonnull PoseStack matrices, int mouseX, int mouseY, float partialTicks) { super.render(matrices, mouseX, mouseY, partialTicks); // if (!this.placer.isBreaker && this.buttonList.get(0).isMouseOver()) { @@ -79,13 +79,13 @@ public class GuiPhantomPlacer extends AAScreen { // return GuiInputter.SIDES[this.placer.side + 1]; // } @Override - public void renderBg(MatrixStack matrices, float f, int x, int y) { - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + public void renderBg(PoseStack matrices, float f, int x, int y) { + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + RenderSystem.setShaderTexture(0, AssetUtil.GUI_INVENTORY_LOCATION); this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bind(RES_LOC); + RenderSystem.setShaderTexture(0, RES_LOC); this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiRangedCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiRangedCollector.java index bd6b5d960..4880998f1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiRangedCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiRangedCollector.java @@ -10,14 +10,14 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.inventory.ContainerRangedCollector; import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -32,7 +32,7 @@ public class GuiRangedCollector extends AAScreen { private FilterSettingsGui filter; - public GuiRangedCollector(ContainerRangedCollector container, PlayerInventory inventory, ITextComponent title) { + public GuiRangedCollector(ContainerRangedCollector container, Inventory inventory, Component title) { super(container, inventory, title); this.collector = container.collector; this.imageWidth = 176; @@ -47,27 +47,27 @@ public class GuiRangedCollector extends AAScreen { } @Override - public void render(@Nonnull MatrixStack matrices, int x, int y, float f) { + public void render(@Nonnull PoseStack matrices, int x, int y, float f) { super.render(matrices, x, y, f); //this.filter.drawHover(matrices, x, y); } @Override - public void tick() { - super.tick(); + public void containerTick() { + super.containerTick(); this.filter.tick(); } @Override - public void renderBg(MatrixStack matrices, float f, int x, int y) { - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + public void renderBg(PoseStack matrices, float f, int x, int y) { + RenderSystem.setShaderColor(1F, 1F, 1F, 1F); - this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + RenderSystem.setShaderTexture(0, AssetUtil.GUI_INVENTORY_LOCATION); this.blit(matrices, this.leftPos, this.topPos + 86, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bind(RES_LOC); + RenderSystem.setShaderTexture(0, RES_LOC); this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 86); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiXPSolidifier.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiXPSolidifier.java index 834d908d0..58d5c3a72 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiXPSolidifier.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiXPSolidifier.java @@ -10,20 +10,17 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.inventory.ContainerXPSolidifier; import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import de.ellpeck.actuallyadditions.mod.util.StringUtil; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import javax.annotation.Nonnull; - @OnlyIn(Dist.CLIENT) public class GuiXPSolidifier extends AAScreen { @@ -31,7 +28,7 @@ public class GuiXPSolidifier extends AAScreen { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_xp_solidifier"); private final TileEntityXPSolidifier solidifier; - public GuiXPSolidifier(ContainerXPSolidifier container, PlayerInventory inventory, ITextComponent title) { + public GuiXPSolidifier(ContainerXPSolidifier container, Inventory inventory, Component title) { super(container, inventory, title); this.solidifier = container.solidifier; this.imageWidth = 176; @@ -73,13 +70,13 @@ public class GuiXPSolidifier extends AAScreen { } @Override - public void renderBg(MatrixStack matrices, float f, int x, int y) { - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + public void renderBg(PoseStack matrices, float f, int x, int y) { + RenderSystem.setShaderColor(1F, 1F, 1F, 1F); - this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + RenderSystem.setShaderTexture(0, AssetUtil.GUI_INVENTORY_LOCATION); this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bind(RES_LOC); + RenderSystem.setShaderTexture(0, RES_LOC); this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); drawCenteredString(matrices, this.font, Integer.toString(this.solidifier.amount), this.leftPos + 88, this.topPos + 30, 0xFFFFFF); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/SackGui.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/SackGui.java index 208a44f25..800440ea7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/SackGui.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/SackGui.java @@ -10,14 +10,14 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.mod.inventory.SackContainer; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import net.minecraft.client.gui.widget.button.Button; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.client.gui.components.Button; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; import javax.annotation.Nonnull; @@ -30,7 +30,7 @@ public class SackGui extends AAScreen { private FilterSettingsGui filter; private Button buttonAutoInsert; - public SackGui(SackContainer container, PlayerInventory inventory, ITextComponent title) { + public SackGui(SackContainer container, Inventory inventory, Component title) { super(container, inventory, title); this.imageWidth = 176; this.imageHeight = 90 + 86; @@ -42,7 +42,7 @@ public class SackGui extends AAScreen { public void init() { super.init(); - this.filter = new FilterSettingsGui(this.container.filter, this.leftPos + 138, this.topPos + 10, this.buttons); + this.filter = new FilterSettingsGui(this.container.filter, this.leftPos + 138, this.topPos + 10, this.renderables); // // this.buttonAutoInsert = new Button(0, this.leftPos - 21, this.topPos + 8, 20, 20, (this.container.autoInsert // ? TextFormatting.DARK_GREEN @@ -60,8 +60,8 @@ public class SackGui extends AAScreen { // } @Override - public void tick() { - super.tick(); + public void containerTick() { + super.containerTick(); this.filter.tick(); //this.buttonAutoInsert.displayString = (this.container.autoInsert @@ -77,7 +77,7 @@ public class SackGui extends AAScreen { }*/ @Override - public void render(@Nonnull MatrixStack stack, int mouseX, int mouseY, float partialTicks) { + public void render(@Nonnull PoseStack stack, int mouseX, int mouseY, float partialTicks) { super.render(stack, mouseX, mouseY, partialTicks); this.filter.drawHover(stack, mouseX, mouseY); @@ -93,13 +93,13 @@ public class SackGui extends AAScreen { } @Override - protected void renderBg(MatrixStack matrixStack, float partialTicks, int x, int y) { - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + protected void renderBg(PoseStack matrixStack, float partialTicks, int x, int y) { + RenderSystem.setShaderColor(1F, 1F, 1F, 1F); - this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + RenderSystem.setShaderTexture(0, AssetUtil.GUI_INVENTORY_LOCATION); this.blit(matrixStack, this.leftPos, this.topPos + 90, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bind(this.isVoid + RenderSystem.setShaderTexture(0, this.isVoid ? RES_LOC_VOID : RES_LOC); this.blit(matrixStack, this.leftPos, this.topPos, 0, 0, 176, 90); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/TexturedButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/TexturedButton.java index a972365b4..7d9159dee 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/TexturedButton.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/TexturedButton.java @@ -10,23 +10,20 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.widget.button.Button; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.StringTextComponent; +import net.minecraft.client.gui.components.Button; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.resources.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.fml.client.gui.GuiUtils; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; -import net.minecraft.client.gui.widget.button.Button.IPressable; - @OnlyIn(Dist.CLIENT) public class TexturedButton extends Button { @@ -35,12 +32,12 @@ public class TexturedButton extends Button { public int texturePosX; public int texturePosY; - public TexturedButton(ResourceLocation resLoc, int x, int y, int texturePosX, int texturePosY, int width, int height, IPressable pressable) { + public TexturedButton(ResourceLocation resLoc, int x, int y, int texturePosX, int texturePosY, int width, int height, OnPress pressable) { this(resLoc, x, y, texturePosX, texturePosY, width, height, new ArrayList<>(), pressable); } - public TexturedButton(ResourceLocation resLoc, int x, int y, int texturePosX, int texturePosY, int width, int height, List hoverTextList, IPressable pressable) { - super(x, y, width, height, StringTextComponent.EMPTY, pressable); + public TexturedButton(ResourceLocation resLoc, int x, int y, int texturePosX, int texturePosY, int width, int height, List hoverTextList, OnPress pressable) { + super(x, y, width, height, TextComponent.EMPTY, pressable); this.texturePosX = texturePosX; this.texturePosY = texturePosY; this.resLoc = resLoc; @@ -48,10 +45,10 @@ public class TexturedButton extends Button { } @Override - public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) { + public void render(PoseStack matrices, int mouseX, int mouseY, float partialTicks) { if (this.visible) { - Minecraft.getInstance().getTextureManager().bind(this.resLoc); - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.setShaderTexture(0, this.resLoc); this.isHovered = mouseX >= this.x && mouseY >= this.y && this.x < this.x + this.width && this.y < this.y + this.height; int k = this.isHovered ? 1 @@ -65,10 +62,11 @@ public class TexturedButton extends Button { } } - public void drawHover(MatrixStack matrices, int x, int y) { + public void drawHover(PoseStack matrices, int x, int y) { if (this.isMouseOver(x, y)) { Minecraft mc = Minecraft.getInstance(); - GuiUtils.drawHoveringText(matrices, this.textList.stream().map(StringTextComponent::new).collect(Collectors.toList()), x, y, mc.screen.width, mc.screen.height, -1, mc.font); + if(mc.screen != null) + mc.screen.renderComponentTooltip(matrices, this.textList.stream().map(TextComponent::new).collect(Collectors.toList()), x, y, mc.font); //TODO: Check if this is correct, used to call GuiUtils.drawHoveringText } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotDeletion.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotDeletion.java index d721fd1f9..e4f419272 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotDeletion.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotDeletion.java @@ -11,7 +11,7 @@ package de.ellpeck.actuallyadditions.mod.inventory.slot; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.ItemStack; public class SlotDeletion extends SlotItemHandlerUnconditioned { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotFilter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotFilter.java index 228eac0c7..cc00b25eb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotFilter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotFilter.java @@ -14,10 +14,10 @@ import de.ellpeck.actuallyadditions.mod.items.ItemFilter; import de.ellpeck.actuallyadditions.mod.tile.FilterSettings; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; public class SlotFilter extends SlotItemHandlerUnconditioned { @@ -29,7 +29,7 @@ public class SlotFilter extends SlotItemHandlerUnconditioned { this(inv.filterInventory, slot, x, y); } - public static boolean checkFilter(Container container, int slotId, PlayerEntity player) { + public static boolean checkFilter(AbstractContainerMenu container, int slotId, Player player) { if (slotId >= 0 && slotId < container.slots.size()) { Slot slot = container.getSlot(slotId); if (slot instanceof SlotFilter) { @@ -44,13 +44,13 @@ public class SlotFilter extends SlotItemHandlerUnconditioned { return StackUtil.isValid(stack) && stack.getItem() instanceof ItemFilter; } - private void slotClick(PlayerEntity player) { - ItemStack heldStack = player.inventory.getCarried(); + private void slotClick(Player player) { + ItemStack heldStack = player.getInventory().getSelected(); ItemStack stackInSlot = this.getItem(); if (StackUtil.isValid(stackInSlot) && !StackUtil.isValid(heldStack)) { if (isFilter(stackInSlot)) { - player.inventory.setCarried(stackInSlot); + player.getInventory().setPickedItem(stackInSlot); } this.set(ItemStack.EMPTY); @@ -78,7 +78,7 @@ public class SlotFilter extends SlotItemHandlerUnconditioned { } @Override - public boolean mayPickup(PlayerEntity player) { + public boolean mayPickup(Player player) { return false; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotImmovable.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotImmovable.java index 1031968ce..21248caf4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotImmovable.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotImmovable.java @@ -10,14 +10,14 @@ package de.ellpeck.actuallyadditions.mod.inventory.slot; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; +import net.minecraft.world.Container; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; public class SlotImmovable extends Slot { - public SlotImmovable(IInventory inventory, int id, int x, int y) { + public SlotImmovable(Container inventory, int id, int x, int y) { super(inventory, id, x, y); } @@ -37,7 +37,7 @@ public class SlotImmovable extends Slot { } @Override - public boolean mayPickup(PlayerEntity player) { + public boolean mayPickup(Player player) { return false; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotItemHandlerUnconditioned.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotItemHandlerUnconditioned.java index 1fc736267..8b8f67c53 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotItemHandlerUnconditioned.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotItemHandlerUnconditioned.java @@ -10,13 +10,13 @@ package de.ellpeck.actuallyadditions.mod.inventory.slot; -import javax.annotation.Nonnull; - import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; import net.minecraftforge.items.SlotItemHandler; +import javax.annotation.Nonnull; + public class SlotItemHandlerUnconditioned extends SlotItemHandler { private final ItemStackHandlerAA inv; @@ -64,7 +64,7 @@ public class SlotItemHandlerUnconditioned extends SlotItemHandler { } @Override - public boolean mayPickup(PlayerEntity playerIn) { + public boolean mayPickup(Player playerIn) { return !this.inv.extractItem(this.getSlotIndex(), 1, true, false).isEmpty(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotOutput.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotOutput.java index 7b05345f8..26e9ef037 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotOutput.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotOutput.java @@ -11,7 +11,7 @@ package de.ellpeck.actuallyadditions.mod.inventory.slot; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.ItemStack; public class SlotOutput extends SlotItemHandlerUnconditioned { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ActuallyItems.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ActuallyItems.java index f5acc849c..9ca4d8071 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ActuallyItems.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ActuallyItems.java @@ -17,13 +17,15 @@ import de.ellpeck.actuallyadditions.mod.blocks.AABlockItem; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.items.lens.ItemLens; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemTier; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Tiers; +import net.minecraft.world.item.crafting.RecipeType; import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; +import org.jetbrains.annotations.Nullable; import javax.annotation.Nonnull; import java.util.Set; @@ -44,13 +46,13 @@ public final class ActuallyItems { public static final RegistryObject RICE_DOUGH = ITEMS.register("rice_dough", ItemBase::new); public static final RegistryObject TINY_COAL = ITEMS.register("tiny_coal", () -> new ItemBase() { @Override - public int getBurnTime(ItemStack stack) { + public int getBurnTime(ItemStack itemStack, @Nullable RecipeType recipeType) { return 200; } }); public static final RegistryObject TINY_CHARCOAL = ITEMS.register("tiny_charcoal", () -> new ItemBase() { @Override - public int getBurnTime(ItemStack stack) { + public int getBurnTime(ItemStack itemStack, @Nullable RecipeType recipeType) { return 200; } }); @@ -169,12 +171,12 @@ public final class ActuallyItems { public static final RegistryObject FLAX_SEEDS = ITEMS.register("flax_seeds", () -> new AABlockItem.AASeedItem(ActuallyBlocks.FLAX.get(), ActuallyItems.defaultProps())); //() -> new ItemSeed("seedFlax", ActuallyBlocks.FLAX, Items.STRING, 0)); // TOOLS & ARMOR - public static final RegistryObject WOODEN_AIOT = ITEMS.register("wooden_aiot", () -> new AllInOneTool(ItemTier.WOOD)); - public static final RegistryObject STONE_AIOT = ITEMS.register("stone_aiot", () -> new AllInOneTool(ItemTier.STONE)); - public static final RegistryObject IRON_AIOT = ITEMS.register("iron_aiot", () -> new AllInOneTool(ItemTier.IRON)); - public static final RegistryObject GOLD_AIOT = ITEMS.register("gold_aiot", () -> new AllInOneTool(ItemTier.GOLD)); - public static final RegistryObject DIAMOND_AIOT = ITEMS.register("diamond_aiot", () -> new AllInOneTool(ItemTier.DIAMOND)); - public static final RegistryObject NETHERITE_AIOT = ITEMS.register("netherite_aiot", () -> new AllInOneTool(ItemTier.NETHERITE)); + public static final RegistryObject WOODEN_AIOT = ITEMS.register("wooden_aiot", () -> new AllInOneTool(Tiers.WOOD)); + public static final RegistryObject STONE_AIOT = ITEMS.register("stone_aiot", () -> new AllInOneTool(Tiers.STONE)); + public static final RegistryObject IRON_AIOT = ITEMS.register("iron_aiot", () -> new AllInOneTool(Tiers.IRON)); + public static final RegistryObject GOLD_AIOT = ITEMS.register("gold_aiot", () -> new AllInOneTool(Tiers.GOLD)); + public static final RegistryObject DIAMOND_AIOT = ITEMS.register("diamond_aiot", () -> new AllInOneTool(Tiers.DIAMOND)); + public static final RegistryObject NETHERITE_AIOT = ITEMS.register("netherite_aiot", () -> new AllInOneTool(Tiers.NETHERITE)); public static final Set> SIMPLE_ITEMS = ImmutableSet.of( // Crystals diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/AllInOneTool.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/AllInOneTool.java index 0102fcbb0..b9ee7439a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/AllInOneTool.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/AllInOneTool.java @@ -1,27 +1,28 @@ package de.ellpeck.actuallyadditions.mod.items; -import com.google.common.collect.ImmutableSet; +import de.ellpeck.actuallyadditions.api.ActuallyTags; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.items.base.IActuallyItem; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.item.*; -import net.minecraft.util.ActionResultType; -import net.minecraftforge.common.ToolType; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.item.DiggerItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.Tier; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraftforge.common.ToolAction; +import net.minecraftforge.common.ToolActions; -public class AllInOneTool extends ToolItem implements IActuallyItem { - private final IItemTier tier; +public class AllInOneTool extends DiggerItem implements IActuallyItem { + private final Tier tier; - public AllInOneTool(IItemTier tier) { + public AllInOneTool(Tier tier) { super( 4.0f, -2f, tier, - ImmutableSet.of(), + ActuallyTags.Blocks.MINEABLE_WITH_AIO, new Properties() - .addToolType(ToolType.AXE, tier.getLevel()) - .addToolType(ToolType.HOE, tier.getLevel()) - .addToolType(ToolType.SHOVEL, tier.getLevel()) - .addToolType(ToolType.PICKAXE, tier.getLevel()) .durability(tier.getUses() * 4) .tab(ActuallyAdditions.GROUP) ); @@ -30,10 +31,17 @@ public class AllInOneTool extends ToolItem implements IActuallyItem { } @Override - public ActionResultType useOn(ItemUseContext context) { + public boolean canPerformAction(ItemStack stack, ToolAction toolAction) { + if (toolAction == ToolActions.AXE_DIG || toolAction == ToolActions.HOE_DIG || toolAction == ToolActions.PICKAXE_DIG || toolAction == ToolActions.SHOVEL_DIG) + return true; + return super.canPerformAction(stack, toolAction); + } + + @Override + public InteractionResult useOn(UseOnContext context) { // How, no idea, possible, most likely :cry: if (context.getPlayer() == null) { - return ActionResultType.FAIL; + return InteractionResult.FAIL; } // Player not sneaking? Act as a Hoe to the block, else, Act as a shovel diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/CanolaSeed.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/CanolaSeed.java index eb849511f..0cbe19040 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/CanolaSeed.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/CanolaSeed.java @@ -2,13 +2,13 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.FlowingFluidBlock; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.fluid.Fluid; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.LiquidBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.Fluid; public class CanolaSeed extends ItemBase { public boolean empowered; @@ -29,8 +29,8 @@ public class CanolaSeed extends ItemBase { BlockState state = entity.level.getBlockState(pos); Block block = state.getBlock(); - if (block instanceof FlowingFluidBlock && state.getFluidState().isSource()) { - Fluid fluid = ((FlowingFluidBlock) block).getFluid(); + if (block instanceof LiquidBlock && state.getFluidState().isSource()) { + Fluid fluid = ((LiquidBlock) block).getFluid(); if (fluid != null && fluid == (empowered ? InitFluids.CRYSTALLIZED_OIL.get() : InitFluids.REFINED_CANOLA_OIL.get())) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/DrillItem.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/DrillItem.java index 766691b86..e6770fd4a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/DrillItem.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/DrillItem.java @@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.items; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; +import de.ellpeck.actuallyadditions.api.ActuallyTags; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.config.CommonConfig; import de.ellpeck.actuallyadditions.mod.inventory.ContainerDrill; @@ -21,41 +22,69 @@ import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.material.Material; -import net.minecraft.enchantment.Enchantments; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.attributes.Attribute; -import net.minecraft.entity.ai.attributes.AttributeModifier; -import net.minecraft.entity.ai.attributes.Attributes; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.EquipmentSlotType; -import net.minecraft.inventory.container.SimpleNamedContainerProvider; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemUseContext; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.*; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.BlockTags; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.SimpleMenuProvider; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.attributes.Attribute; +import net.minecraft.world.entity.ai.attributes.AttributeModifier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Tier; +import net.minecraft.world.item.Tiers; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.item.enchantment.Enchantments; +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.state.BlockState; +import net.minecraft.world.level.material.Material; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.HitResult; import net.minecraftforge.common.ForgeHooks; -import net.minecraftforge.common.ToolType; +import net.minecraftforge.common.ToolAction; +import net.minecraftforge.common.ToolActions; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nullable; - public class DrillItem extends ItemEnergy { public static final int HARVEST_LEVEL = 4; private static final int ENERGY_USE = 100; public DrillItem() { - super(ActuallyItems.defaultProps().defaultDurability(0).stacksTo(1).addToolType(ToolType.SHOVEL, HARVEST_LEVEL).addToolType(ToolType.PICKAXE, HARVEST_LEVEL), 250000, 1000); + super(ActuallyItems.defaultProps().defaultDurability(0).stacksTo(1), 250000, 1000); + } + + @Override + public boolean canPerformAction(ItemStack stack, ToolAction toolAction) { + if (toolAction == ToolActions.SHOVEL_DIG || toolAction == ToolActions.PICKAXE_DIG) + return true; + return super.canPerformAction(stack, toolAction); + } + + @Override + public boolean isCorrectToolForDrops(BlockState pBlock) { + Tier tier = Tiers.NETHERITE; //Use Nettherite as the tier as it has the same harvest level as the drill + if (net.minecraftforge.common.TierSortingRegistry.isTierSorted(tier)) { + return net.minecraftforge.common.TierSortingRegistry.isCorrectTierForDrops(tier, pBlock) && pBlock.is(ActuallyTags.Blocks.MINEABLE_WITH_DRILL); + } + if (HARVEST_LEVEL < 3 && pBlock.is(BlockTags.NEEDS_DIAMOND_TOOL)) { + return false; + } else if (HARVEST_LEVEL < 2 && pBlock.is(BlockTags.NEEDS_IRON_TOOL)) { + return false; + } else { + return HARVEST_LEVEL < 1 && pBlock.is(BlockTags.NEEDS_STONE_TOOL) ? false : pBlock.is(ActuallyTags.Blocks.MINEABLE_WITH_DRILL); + } } /** @@ -64,7 +93,7 @@ public class DrillItem extends ItemEnergy { * @param stack The Drill */ public static void loadSlotsFromNBT(IItemHandlerModifiable slots, ItemStack stack) { - CompoundNBT compound = stack.getOrCreateTag(); + CompoundTag compound = stack.getOrCreateTag(); TileEntityInventoryBase.loadSlots(slots, compound); } @@ -75,23 +104,23 @@ public class DrillItem extends ItemEnergy { * @param stack The Drill */ public static void writeSlotsToNBT(IItemHandler slots, ItemStack stack) { - CompoundNBT compound = stack.getOrCreateTag(); + CompoundTag compound = stack.getOrCreateTag(); TileEntityInventoryBase.saveSlots(slots, compound); stack.setTag(compound); } @Override - public ActionResultType useOn(ItemUseContext context) { - PlayerEntity player = context.getPlayer(); - Hand hand = context.getHand(); + public InteractionResult useOn(UseOnContext context) { + Player player = context.getPlayer(); + InteractionHand hand = context.getHand(); ItemStack stack = player.getItemInHand(hand); ItemStack upgrade = this.getHasUpgradeAsStack(stack, ItemDrillUpgrade.UpgradeType.PLACER); if (StackUtil.isValid(upgrade)) { int slot = ItemDrillUpgrade.getSlotToPlaceFrom(upgrade); if (slot >= 0 && slot < 9) { // TODO: validate... old = PlayerInventory.getHotbarSize(); new = 9 - ItemStack equip = player.inventory.getItem(slot); + ItemStack equip = player.getInventory().getItem(slot); if (StackUtil.isValid(equip) && equip != stack) { ItemStack toPlaceStack = equip.copy(); @@ -100,7 +129,7 @@ public class DrillItem extends ItemEnergy { //tryPlaceItemIntoWorld could throw an Exception try { //Places the Block into the World - if (toPlaceStack.useOn(context) != ActionResultType.FAIL) { + if (toPlaceStack.useOn(context) != InteractionResult.FAIL) { if (!player.isCreative()) { WorldUtil.setHandItemWithoutAnnoyingSound(player, hand, toPlaceStack.copy()); } @@ -111,10 +140,10 @@ public class DrillItem extends ItemEnergy { ActuallyAdditions.LOGGER.error("Player " + player.getName() + " who should place a Block using a Drill at " + player.getX() + ", " + player.getY() + ", " + player.getZ() + " in World " + context.getLevel().dimension() + " threw an Exception! Don't let that happen again!"); } - player.inventory.setItem(slot, player.getItemInHand(hand)); + player.getInventory().setItem(slot, player.getItemInHand(hand)); WorldUtil.setHandItemWithoutAnnoyingSound(player, hand, stack); - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; } } } @@ -130,7 +159,7 @@ public class DrillItem extends ItemEnergy { * @return The Upgrade, if it's installed */ public ItemStack getHasUpgradeAsStack(ItemStack stack, ItemDrillUpgrade.UpgradeType upgrade) { - CompoundNBT compound = stack.getOrCreateTag(); + CompoundTag compound = stack.getOrCreateTag(); ItemStackHandlerAA inv = new ItemStackHandlerAA(ContainerDrill.SLOT_AMOUNT); loadSlotsFromNBT(inv, stack); @@ -146,30 +175,30 @@ public class DrillItem extends ItemEnergy { } @Override - public ActionResult use(World world, PlayerEntity player, Hand hand) { - if (!world.isClientSide && player.isShiftKeyDown() && hand == Hand.MAIN_HAND) { - player.openMenu(new SimpleNamedContainerProvider((id, inv, p) -> new ContainerDrill(id, inv), new StringTextComponent(""))); + public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { + if (!world.isClientSide && player.isShiftKeyDown() && hand == InteractionHand.MAIN_HAND) { + player.openMenu(new SimpleMenuProvider((id, inv, p) -> new ContainerDrill(id, inv), new TextComponent(""))); // player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.DRILL.ordinal(), world, (int) player.posX, (int) player.posY, (int) player.posZ); } - return new ActionResult<>(ActionResultType.PASS, player.getItemInHand(hand)); + return new InteractionResultHolder<>(InteractionResult.PASS, player.getItemInHand(hand)); } @Override - public ActionResultType interactLivingEntity(ItemStack stack, PlayerEntity player, LivingEntity entityHit, Hand hand) { + public InteractionResult interactLivingEntity(ItemStack stack, Player player, LivingEntity entityHit, InteractionHand hand) { int use = this.getEnergyUsePerBlock(stack); - if (!(entityHit instanceof PlayerEntity) || !((PlayerEntity) entityHit).isCreative()) { + if (!(entityHit instanceof Player) || !((Player) entityHit).isCreative()) { if (this.getEnergyStored(stack) >= use) { this.extractEnergyInternal(stack, use, false); } } - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; } @Override - public Multimap getAttributeModifiers(EquipmentSlotType slot, ItemStack stack) { + public Multimap getAttributeModifiers(EquipmentSlot slot, ItemStack stack) { Multimap map = ArrayListMultimap.create(); - if (slot == EquipmentSlotType.MAINHAND) { + if (slot == EquipmentSlot.MAINHAND) { map.put(Attributes.ATTACK_DAMAGE, new AttributeModifier("Drill Modifier", this.getEnergyStored(stack) >= ENERGY_USE ? 8.0F : 0.1F, AttributeModifier.Operation.ADDITION)); @@ -182,15 +211,18 @@ public class DrillItem extends ItemEnergy { @Override public float getDestroySpeed(ItemStack stack, BlockState state) { + if(!state.is(ActuallyTags.Blocks.MINEABLE_WITH_DRILL)) + return 1.0F; + return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) - ? (this.hasExtraWhitelist(state.getBlock()) || state.getBlock().getHarvestTool(state) == null || state.getBlock().getHarvestTool(state) == ToolType.PICKAXE || state.getBlock().getHarvestTool(state) == ToolType.SHOVEL) + ? (this.hasExtraWhitelist(state.getBlock())) ? this.getEfficiencyFromUpgrade(stack) : 1.0F : 0.1F; } @Override - public boolean onBlockStartBreak(ItemStack stack, BlockPos pos, PlayerEntity player) { + public boolean onBlockStartBreak(ItemStack stack, BlockPos pos, Player player) { boolean toReturn = false; int use = this.getEnergyUsePerBlock(stack); if (this.getEnergyStored(stack) >= use) { @@ -206,9 +238,9 @@ public class DrillItem extends ItemEnergy { } //Block hit - RayTraceResult ray = WorldUtil.getNearestBlockWithDefaultReachDistance(player.level, player); - if (ray != null && ray.getType() == RayTraceResult.Type.BLOCK) { - BlockRayTraceResult trace = (BlockRayTraceResult) ray; + HitResult ray = WorldUtil.getNearestBlockWithDefaultReachDistance(player.level, player); + if (ray != null && ray.getType() == HitResult.Type.BLOCK) { + BlockHitResult trace = (BlockHitResult) ray; //Breaks the Blocks if (!player.isShiftKeyDown() && this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.THREE_BY_THREE)) { if (this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FIVE_BY_FIVE)) { @@ -229,7 +261,7 @@ public class DrillItem extends ItemEnergy { } @Override - public boolean canHarvestBlock(ItemStack stack, BlockState state) { + public boolean isCorrectToolForDrops(ItemStack stack, BlockState state) { Block block = state.getBlock(); return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) && (this.hasExtraWhitelist(block) || state.getMaterial().isReplaceable() || block == Blocks.SNOW_BLOCK || block == Blocks.SNOW || (block == Blocks.OBSIDIAN ? HARVEST_LEVEL >= 3 @@ -248,10 +280,10 @@ public class DrillItem extends ItemEnergy { : HARVEST_LEVEL >= 2)); } - @Override - public int getHarvestLevel(ItemStack stack, ToolType p_getHarvestLevel_2_, @Nullable PlayerEntity p_getHarvestLevel_3_, @Nullable BlockState p_getHarvestLevel_4_) { - return HARVEST_LEVEL; - } +// @Override +// public int getHarvestLevel(ItemStack stack, ToolType p_getHarvestLevel_2_, @Nullable Player p_getHarvestLevel_3_, @Nullable BlockState p_getHarvestLevel_4_) { +// return HARVEST_LEVEL; +// } /** * Gets the Energy that is used per Block broken @@ -365,7 +397,7 @@ public class DrillItem extends ItemEnergy { * @param world The World * @param player The Player who breaks the Blocks */ - public boolean breakBlocks(ItemStack stack, int radius, World world, BlockPos aPos, Direction side, PlayerEntity player) { + public boolean breakBlocks(ItemStack stack, int radius, Level world, BlockPos aPos, Direction side, Player player) { int xRange = radius; int yRange = radius; int zRange = 0; @@ -437,12 +469,13 @@ public class DrillItem extends ItemEnergy { * @param player The Player breaking the Blocks * @param use The Energy that should be extracted per Block */ - private boolean tryHarvestBlock(World world, BlockPos pos, boolean isExtra, ItemStack stack, PlayerEntity player, int use) { + private boolean tryHarvestBlock(Level world, BlockPos pos, boolean isExtra, ItemStack stack, Player player, int use) { BlockState state = world.getBlockState(pos); Block block = state.getBlock(); float hardness = state.getDestroySpeed(world, pos); - boolean canHarvest = (ForgeHooks.canHarvestBlock(state, player, world, pos) || this.canHarvestBlock(stack, state)) && (!isExtra || this.getDestroySpeed(stack, world.getBlockState(pos)) > 1.0F); - if (hardness >= 0.0F && (!isExtra || canHarvest && !block.hasTileEntity(world.getBlockState(pos)))) { + + boolean canHarvest = (ForgeHooks.isCorrectToolForDrops(state, player) || this.isCorrectToolForDrops(stack, state)) && (!isExtra || this.getDestroySpeed(stack, world.getBlockState(pos)) > 1.0F); + if (hardness >= 0.0F && (!isExtra || canHarvest && !state.hasBlockEntity())) { if (!player.isCreative()) { this.extractEnergyInternal(stack, use, false); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAxeAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAxeAA.java index 8fb3ba4fe..3c8abd813 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAxeAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAxeAA.java @@ -12,23 +12,22 @@ package de.ellpeck.actuallyadditions.mod.items; import com.google.common.collect.ImmutableSet; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import net.minecraft.item.IItemTier; -import net.minecraft.item.ToolItem; -import net.minecraftforge.common.ToolType; +import net.minecraft.world.item.DiggerItem; +import net.minecraft.world.item.Tier; -public class ItemAxeAA extends ToolItem { - private IItemTier tier; - public ItemAxeAA(IItemTier tier) { +public class ItemAxeAA extends DiggerItem { + private Tier tier; + public ItemAxeAA(Tier tier) { super( 4.0f, -2f, tier, - ImmutableSet.of(), + null, //Feed block tags here new Properties() - .addToolType(ToolType.AXE, tier.getLevel()) - .addToolType(ToolType.HOE, tier.getLevel()) - .addToolType(ToolType.SHOVEL, tier.getLevel()) - .addToolType(ToolType.PICKAXE, tier.getLevel()) +// .addToolType(ToolType.AXE, tier.getLevel()) +// .addToolType(ToolType.HOE, tier.getLevel()) +// .addToolType(ToolType.SHOVEL, tier.getLevel()) +// .addToolType(ToolType.PICKAXE, tier.getLevel()) .durability(tier.getUses() * 4) .tab(ActuallyAdditions.GROUP) ); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBattery.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBattery.java index 991885a40..6ff3c9541 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBattery.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBattery.java @@ -12,15 +12,15 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.World; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.util.LazyOptional; @@ -43,11 +43,11 @@ public class ItemBattery extends ItemEnergy { } @Override - public void inventoryTick(@Nonnull ItemStack stack, World world, @Nonnull Entity entity, int itemSlot, boolean isSelected) { - if (!world.isClientSide && entity instanceof PlayerEntity && ItemUtil.isEnabled(stack) && !isSelected) { - PlayerEntity player = (PlayerEntity) entity; - for (int i = 0; i < player.inventory.getContainerSize(); i++) { - ItemStack slot = player.inventory.getItem(i); + public void inventoryTick(@Nonnull ItemStack stack, Level world, @Nonnull Entity entity, int itemSlot, boolean isSelected) { + if (!world.isClientSide && entity instanceof Player && ItemUtil.isEnabled(stack) && !isSelected) { + Player player = (Player) entity; + for (int i = 0; i < player.getInventory().getContainerSize(); i++) { + ItemStack slot = player.getInventory().getItem(i); if (!slot.isEmpty() && slot.getCount() == 1) { LazyOptional energy = slot.getCapability(CapabilityEnergy.ENERGY); energy.ifPresent(cap -> { @@ -65,21 +65,21 @@ public class ItemBattery extends ItemEnergy { @Nonnull @Override - public ActionResult use(World worldIn, @Nonnull PlayerEntity player, @Nonnull Hand hand) { + public InteractionResultHolder use(Level worldIn, @Nonnull Player player, @Nonnull InteractionHand hand) { if (!worldIn.isClientSide && player.isShiftKeyDown()) { ItemUtil.changeEnabled(player, hand); - return ActionResult.success(player.getItemInHand(hand)); + return InteractionResultHolder.success(player.getItemInHand(hand)); } return super.use(worldIn, player, hand); } @OnlyIn(Dist.CLIENT) @Override - public void appendHoverText(ItemStack stack, @Nullable World playerIn, List list, ITooltipFlag advanced) { + public void appendHoverText(ItemStack stack, @Nullable Level playerIn, List list, TooltipFlag advanced) { super.appendHoverText(stack, playerIn, list, advanced); - list.add(new TranslationTextComponent("tooltip.actuallyadditions.battery." + (ItemUtil.isEnabled(stack) + list.add(new TranslatableComponent("tooltip.actuallyadditions.battery." + (ItemUtil.isEnabled(stack) ? "discharge" : "noDischarge"))); - list.add(new TranslationTextComponent("tooltip.actuallyadditions.battery.changeMode")); + list.add(new TranslatableComponent("tooltip.actuallyadditions.battery.changeMode")); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java index 60db40c14..f999e1063 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java @@ -10,30 +10,30 @@ package de.ellpeck.actuallyadditions.mod.items; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.platform.Window; +import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; +import net.minecraft.ChatFormatting; import net.minecraft.advancements.Advancement; -import net.minecraft.advancements.AdvancementManager; -import net.minecraft.advancements.PlayerAdvancements; -import net.minecraft.client.MainWindow; import net.minecraft.client.Minecraft; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemUseContext; -import net.minecraft.util.ActionResult; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.World; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.PlayerAdvancements; +import net.minecraft.server.ServerAdvancementManager; +import net.minecraft.server.level.ServerPlayer; +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.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.HitResult; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -50,7 +50,7 @@ public class ItemBooklet extends ItemBase implements IHudDisplay { } @Override - public ActionResultType useOn(ItemUseContext context) { + public InteractionResult useOn(UseOnContext context) { // if (context.getPlayer().isShiftKeyDown()) { // BlockState state = context.getLevel().getBlockState(context.getClickedPos()); // Block block = state.getBlock(); @@ -64,15 +64,15 @@ public class ItemBooklet extends ItemBase implements IHudDisplay { // return ActionResultType.SUCCESS; // } // } - return ActionResultType.FAIL; + return InteractionResult.FAIL; } @Override - public ActionResult use(World world, PlayerEntity player, Hand hand) { + public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { if (!world.isClientSide) { - ServerPlayerEntity serverPlayer = (ServerPlayerEntity) player; + ServerPlayer serverPlayer = (ServerPlayer) player; PlayerAdvancements advancements = serverPlayer.getAdvancements(); - AdvancementManager manager = player.getServer().getAdvancements(); + ServerAdvancementManager manager = player.getServer().getAdvancements(); Advancement advancement = manager.getAdvancement(new ResourceLocation(ActuallyAdditions.MODID, "root")); if (advancement != null && !advancements.getOrStartProgress(advancement).isDone()) { advancements.award(advancement, "right_click"); @@ -84,27 +84,27 @@ public class ItemBooklet extends ItemBase implements IHudDisplay { // //TheAchievements.OPEN_BOOKLET.get(player); // //TheAchievements.OPEN_BOOKLET_MILESTONE.get(player); // } - return ActionResult.success(player.getItemInHand(hand)); + return InteractionResultHolder.success(player.getItemInHand(hand)); } @OnlyIn(Dist.CLIENT) @Override - public void appendHoverText(ItemStack stack, @Nullable World playerIn, List tooltip, ITooltipFlag advanced) { - tooltip.add(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + "." + this.getDescription().getString() + ".desc")); + public void appendHoverText(ItemStack stack, @Nullable Level playerIn, List tooltip, TooltipFlag advanced) { + tooltip.add(new TranslatableComponent("tooltip." + ActuallyAdditions.MODID + "." + this.getDescription().getString() + ".desc")); // TODO: this is bad for (int i = 1; i <= 4; i++) { - tooltip.add(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + "." + this.getDescription().getString() + ".sub." + i).withStyle(i == 4 - ? TextFormatting.GOLD - : TextFormatting.RESET).withStyle(i == 4 - ? TextFormatting.ITALIC - : TextFormatting.RESET)); + tooltip.add(new TranslatableComponent("tooltip." + ActuallyAdditions.MODID + "." + this.getDescription().getString() + ".sub." + i).withStyle(i == 4 + ? ChatFormatting.GOLD + : ChatFormatting.RESET).withStyle(i == 4 + ? ChatFormatting.ITALIC + : ChatFormatting.RESET)); } } @Override @OnlyIn(Dist.CLIENT) - public void displayHud(MatrixStack matrices, Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult rayCast, MainWindow resolution) { + public void displayHud(PoseStack matrices, Minecraft minecraft, Player player, ItemStack stack, HitResult rayCast, Window resolution) { // if (rayCast != null && rayCast.getBlockPos() != null) { // BlockState state = minecraft.level.getBlockState(rayCast.getBlockPos()); // Block block = state.getBlock(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java index d928c7a88..4327b72ba 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java @@ -15,17 +15,17 @@ import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.items.base.ItemFoodBase; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; -import net.minecraft.client.resources.I18n; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.world.World; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.LivingEntity; +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.item.crafting.Ingredient; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fml.ModList; @@ -83,7 +83,7 @@ public class ItemCoffee extends ItemFoodBase { } //@Override - public ItemStack onItemUseFinish(ItemStack stack, World world, LivingEntity player) { + public ItemStack onItemUseFinish(ItemStack stack, Level world, LivingEntity player) { ItemStack theStack = stack.copy(); super.finishUsingItem(stack, world, player); applyPotionEffectsFromStack(stack, player); @@ -103,13 +103,13 @@ public class ItemCoffee extends ItemFoodBase { @Nullable @Override - public CompoundNBT getShareTag(ItemStack stack) { + public CompoundTag getShareTag(ItemStack stack) { return super.getShareTag(stack); } @OnlyIn(Dist.CLIENT) @Override - public void appendHoverText(ItemStack stack, @Nullable World playerIn, List tooltip, ITooltipFlag advanced) { + public void appendHoverText(ItemStack stack, @Nullable Level playerIn, List tooltip, TooltipFlag advanced) { //PotionEffect[] effects = ActuallyAdditionsAPI.methodHandler.getEffectsFromStack(stack); //if (effects != null) { // for (PotionEffect effect : effects) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrafterOnAStick.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrafterOnAStick.java index af73bd707..698e271b1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrafterOnAStick.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrafterOnAStick.java @@ -11,23 +11,23 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.inventory.container.SimpleNamedContainerProvider; -import net.minecraft.inventory.container.WorkbenchContainer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ActionResult; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.World; -import net.minecraftforge.fml.network.NetworkHooks; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.SimpleMenuProvider; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.CraftingMenu; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraftforge.network.NetworkHooks; import javax.annotation.Nonnull; public class ItemCrafterOnAStick extends ItemBase { - private static final ITextComponent CONTAINER_TITLE = new TranslationTextComponent("container.crafting"); + private static final Component CONTAINER_TITLE = new TranslatableComponent("container.crafting"); public ItemCrafterOnAStick() { super(ActuallyItems.defaultNonStacking()); @@ -35,10 +35,10 @@ public class ItemCrafterOnAStick extends ItemBase { @Nonnull @Override - public ActionResult use(World world, @Nonnull PlayerEntity player, @Nonnull Hand hand) { + public InteractionResultHolder use(Level world, @Nonnull Player player, @Nonnull InteractionHand hand) { if (!world.isClientSide) { - NetworkHooks.openGui((ServerPlayerEntity) player, new SimpleNamedContainerProvider((windowId, playerInventory, playerEntity) -> new WorkbenchContainer(windowId, playerInventory), CONTAINER_TITLE)); + NetworkHooks.openGui((ServerPlayer) player, new SimpleMenuProvider((windowId, playerInventory, playerEntity) -> new CraftingMenu(windowId, playerInventory), CONTAINER_TITLE)); } - return new ActionResult<>(ActionResultType.SUCCESS, player.getItemInHand(hand)); + return new InteractionResultHolder<>(InteractionResult.SUCCESS, player.getItemInHand(hand)); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java index 32deb7557..34871348b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java @@ -11,7 +11,7 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.ItemStack; public class ItemCrystal extends ItemBase { private final boolean isEmpowered; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrillUpgrade.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrillUpgrade.java index 3a54306b0..872ef13f4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrillUpgrade.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrillUpgrade.java @@ -11,13 +11,13 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.ActionResult; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.world.World; +import net.minecraft.nbt.CompoundTag; +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.ItemStack; +import net.minecraft.world.level.Level; public class ItemDrillUpgrade extends ItemBase { @@ -29,7 +29,7 @@ public class ItemDrillUpgrade extends ItemBase { } public static int getSlotToPlaceFrom(ItemStack stack) { - CompoundNBT compound = stack.getTag(); + CompoundTag compound = stack.getTag(); if (compound != null) { return compound.getInt("SlotToPlaceFrom") - 1; } @@ -37,17 +37,17 @@ public class ItemDrillUpgrade extends ItemBase { } @Override - public ActionResult use(World world, PlayerEntity player, Hand hand) { + public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { ItemStack stack = player.getItemInHand(hand); if (!world.isClientSide && this.type == UpgradeType.PLACER) { - this.setSlotToPlaceFrom(stack, player.inventory.selected); - return new ActionResult<>(ActionResultType.SUCCESS, stack); + this.setSlotToPlaceFrom(stack, player.getInventory().selected); + return new InteractionResultHolder<>(InteractionResult.SUCCESS, stack); } - return new ActionResult<>(ActionResultType.FAIL, stack); + return new InteractionResultHolder<>(InteractionResult.FAIL, stack); } public void setSlotToPlaceFrom(ItemStack stack, int slot) { - CompoundNBT compound = stack.getOrCreateTag(); + CompoundTag compound = stack.getOrCreateTag(); compound.putInt("SlotToPlaceFrom", slot + 1); stack.setTag(compound); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemEngineerGoggles.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemEngineerGoggles.java index da9c7121d..d80338dc7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemEngineerGoggles.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemEngineerGoggles.java @@ -13,15 +13,14 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.api.misc.IGoggles; import de.ellpeck.actuallyadditions.mod.items.base.ItemArmorAA; import de.ellpeck.actuallyadditions.mod.material.ArmorMaterials; -import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import io.netty.util.internal.ConcurrentSet; import net.minecraft.client.Minecraft; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.EquipmentSlotType; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.phys.AABB; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.MinecraftForge; @@ -39,27 +38,27 @@ public class ItemEngineerGoggles extends ItemArmorAA implements IGoggles { private final boolean displayMobs; public ItemEngineerGoggles(boolean displayMobs) { - super(ArmorMaterials.GOGGLES, EquipmentSlotType.HEAD, ActuallyItems.defaultProps().setNoRepair().durability(0)); + super(ArmorMaterials.GOGGLES, EquipmentSlot.HEAD, ActuallyItems.defaultProps().setNoRepair().durability(0)); this.displayMobs = displayMobs; DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> MinecraftForge.EVENT_BUS.register(this)); } - public static boolean isWearing(PlayerEntity player) { - ItemStack face = player.inventory.armor.get(3); + public static boolean isWearing(Player player) { + ItemStack face = player.getInventory().armor.get(3); return StackUtil.isValid(face) && face.getItem() instanceof IGoggles; } @OnlyIn(Dist.CLIENT) @SubscribeEvent public void onClientTick(TickEvent.ClientTickEvent event) { - PlayerEntity player = Minecraft.getInstance().player; + Player player = Minecraft.getInstance().player; if (player != null && isWearing(player)) { - ItemStack face = player.inventory.armor.get(3); + ItemStack face = player.getInventory().armor.get(3); if (((IGoggles) face.getItem()).displaySpectralMobs()) { double range = 8; - AxisAlignedBB aabb = new AxisAlignedBB(player.getX() - range, player.getY() - range, player.getZ() - range, player.getX() + range, player.getY() + range, player.getZ() + range); + AABB aabb = new AABB(player.getX() - range, player.getY() - range, player.getZ() - range, player.getX() + range, player.getY() + range, player.getZ() + range); List entities = player.level.getEntitiesOfClass(Entity.class, aabb); if (entities != null && !entities.isEmpty()) { this.cachedGlowingEntities.addAll(entities); @@ -68,11 +67,11 @@ public class ItemEngineerGoggles extends ItemArmorAA implements IGoggles { if (!this.cachedGlowingEntities.isEmpty()) { for (Entity entity : this.cachedGlowingEntities) { if (!entity.isAlive() || entity.distanceToSqr(player.getX(), player.getY(), player.getZ()) > range * range) { - entity.setGlowing(false); + entity.setGlowingTag(false); this.cachedGlowingEntities.remove(entity); } else { - entity.setGlowing(true); + entity.setGlowingTag(true); } } } @@ -84,7 +83,7 @@ public class ItemEngineerGoggles extends ItemArmorAA implements IGoggles { if (!this.cachedGlowingEntities.isEmpty()) { for (Entity entity : this.cachedGlowingEntities) { if (entity.isAlive()) { - entity.setGlowing(false); + entity.setGlowingTag(false); } } this.cachedGlowingEntities.clear(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFertilizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFertilizer.java index 83bf67843..6930e2802 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFertilizer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFertilizer.java @@ -12,11 +12,11 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.misc.DispenserHandlerFertilize; -import net.minecraft.block.DispenserBlock; -import net.minecraft.item.BoneMealItem; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemUseContext; -import net.minecraft.util.ActionResultType; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.item.BoneMealItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.level.block.DispenserBlock; public class ItemFertilizer extends ItemBase { @@ -27,13 +27,13 @@ public class ItemFertilizer extends ItemBase { } @Override - public ActionResultType useOn(ItemUseContext context) { + public InteractionResult useOn(UseOnContext context) { ItemStack stack = context.getPlayer().getItemInHand(context.getHand()); if (BoneMealItem.applyBonemeal(stack, context.getLevel(), context.getClickedPos(), context.getPlayer())) { if (!context.getLevel().isClientSide) { context.getLevel().levelEvent(2005, context.getClickedPos(), 0); } - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; } return super.useOn(context); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFillingWand.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFillingWand.java index ee795af67..f6f6eb2ed 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFillingWand.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFillingWand.java @@ -13,26 +13,26 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.SoundType; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemUseContext; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.nbt.NBTUtil; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.text.IFormattableTextComponent; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtUtils; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.HitResult; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -46,17 +46,17 @@ public class ItemFillingWand extends ItemEnergy { super(500000, 1000); } - private static boolean removeFittingItem(BlockState state, PlayerEntity player) { + private static boolean removeFittingItem(BlockState state, Player player) { Block block = state.getBlock(); ItemStack stack = new ItemStack(block, 1); if (StackUtil.isValid(stack)) { - for (int i = 0; i < player.inventory.getContainerSize(); i++) { - ItemStack slot = player.inventory.getItem(i); + for (int i = 0; i < player.getInventory().getContainerSize(); i++) { + ItemStack slot = player.getInventory().getItem(i); if (StackUtil.isValid(slot) && slot.sameItem(stack)) { slot.shrink(1); if (!StackUtil.isValid(slot)) { - player.inventory.setItem(i, ItemStack.EMPTY); + player.getInventory().setItem(i, ItemStack.EMPTY); } return true; @@ -68,21 +68,21 @@ public class ItemFillingWand extends ItemEnergy { } private static void saveData(BlockState state, ItemStack wand) { - wand.getOrCreateTag().put("state", NBTUtil.writeBlockState(state)); + wand.getOrCreateTag().put("state", NbtUtils.writeBlockState(state)); } private static Optional loadData(ItemStack stack) { if (stack.getOrCreateTag().contains("state")) { - return Optional.of(NBTUtil.readBlockState(stack.getOrCreateTag().getCompound("state"))); + return Optional.of(NbtUtils.readBlockState(stack.getOrCreateTag().getCompound("state"))); } return Optional.empty(); } @Override - public ActionResultType useOn(ItemUseContext context) { + public InteractionResult useOn(UseOnContext context) { if (context.getPlayer() == null) { - return ActionResultType.PASS; + return InteractionResult.PASS; } ItemStack stack = context.getPlayer().getItemInHand(context.getHand()); @@ -90,9 +90,9 @@ public class ItemFillingWand extends ItemEnergy { if (context.getPlayer().isCrouching()) { BlockState state = context.getLevel().getBlockState(context.getClickedPos()); saveData(state, stack); - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; } else if (loadData(stack).isPresent()) { - CompoundNBT compound = stack.getOrCreateTag(); + CompoundTag compound = stack.getOrCreateTag(); if (compound.getInt("CurrX") == 0 && compound.getInt("CurrY") == 0 && compound.getInt("CurrZ") == 0) { compound.putInt("FirstX", context.getClickedPos().getX()); @@ -100,7 +100,7 @@ public class ItemFillingWand extends ItemEnergy { compound.putInt("FirstZ", context.getClickedPos().getZ()); context.getPlayer().startUsingItem(context.getHand()); - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; } } } @@ -108,15 +108,15 @@ public class ItemFillingWand extends ItemEnergy { } @Override - public void releaseUsing(ItemStack stack, World world, LivingEntity entity, int timeLeft) { + public void releaseUsing(ItemStack stack, Level world, LivingEntity entity, int timeLeft) { if (!world.isClientSide) { boolean clear = true; - if (entity instanceof PlayerEntity) { - RayTraceResult result = WorldUtil.getNearestBlockWithDefaultReachDistance(world, (PlayerEntity) entity); - if (result instanceof BlockRayTraceResult) { - CompoundNBT compound = stack.getOrCreateTag(); + if (entity instanceof Player) { + HitResult result = WorldUtil.getNearestBlockWithDefaultReachDistance(world, (Player) entity); + if (result instanceof BlockHitResult) { + CompoundTag compound = stack.getOrCreateTag(); - BlockPos pos = ((BlockRayTraceResult) result).getBlockPos(); + BlockPos pos = ((BlockHitResult) result).getBlockPos(); compound.putInt("SecondX", pos.getX()); compound.putInt("SecondY", pos.getY()); compound.putInt("SecondZ", pos.getZ()); @@ -134,7 +134,7 @@ public class ItemFillingWand extends ItemEnergy { } @Override - public void inventoryTick(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected) { + public void inventoryTick(ItemStack stack, Level world, Entity entity, int itemSlot, boolean isSelected) { super.inventoryTick(stack, world, entity, itemSlot, isSelected); @@ -142,11 +142,11 @@ public class ItemFillingWand extends ItemEnergy { boolean shouldClear = false; if (isSelected) { - if (entity instanceof PlayerEntity && stack.hasTag()) { - PlayerEntity player = (PlayerEntity) entity; + if (entity instanceof Player && stack.hasTag()) { + Player player = (Player) entity; boolean creative = player.isCreative(); - CompoundNBT compound = stack.getOrCreateTag(); + CompoundTag compound = stack.getOrCreateTag(); BlockPos firstPos = new BlockPos(compound.getInt("FirstX"), compound.getInt("FirstY"), compound.getInt("FirstZ")); BlockPos secondPos = new BlockPos(compound.getInt("SecondX"), compound.getInt("SecondY"), compound.getInt("SecondZ")); @@ -173,7 +173,7 @@ public class ItemFillingWand extends ItemEnergy { world.setBlock(pos, replaceState, 2); SoundType sound = replaceState.getBlock().getSoundType(replaceState, world, pos, player); - world.playSound(null, pos, sound.getPlaceSound(), SoundCategory.BLOCKS, sound.getVolume() / 2F + .5F, sound.getPitch() * 0.8F); + world.playSound(null, pos, sound.getPlaceSound(), SoundSource.BLOCKS, sound.getVolume() / 2F + .5F, sound.getPitch() * 0.8F); if (!creative) { this.extractEnergyInternal(stack, energyUse, false); @@ -222,14 +222,14 @@ public class ItemFillingWand extends ItemEnergy { @OnlyIn(Dist.CLIENT) @Override - public void appendHoverText(ItemStack stack, @Nullable World worldIn, List tooltip, ITooltipFlag flagIn) { + public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List tooltip, TooltipFlag flagIn) { super.appendHoverText(stack, worldIn, tooltip, flagIn); - IFormattableTextComponent display = loadData(stack) + MutableComponent display = loadData(stack) .map(state -> state.getBlock().getName()) - .orElse(new TranslationTextComponent("tooltip.actuallyadditions.item_filling_wand.selected_block.none")); + .orElse(new TranslatableComponent("tooltip.actuallyadditions.item_filling_wand.selected_block.none")); - tooltip.add(new TranslationTextComponent("tooltip.actuallyadditions.item_filling_wand.selected_block", display.getString())); + tooltip.add(new TranslatableComponent("tooltip.actuallyadditions.item_filling_wand.selected_block", display.getString())); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFilter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFilter.java index 83c82d927..80f40ce8f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFilter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFilter.java @@ -14,19 +14,19 @@ import de.ellpeck.actuallyadditions.mod.inventory.ContainerFilter; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.inventory.container.SimpleNamedContainerProvider; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.world.World; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.SimpleMenuProvider; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.fml.network.NetworkHooks; +import net.minecraftforge.network.NetworkHooks; import javax.annotation.Nullable; import java.util.List; @@ -38,17 +38,17 @@ public class ItemFilter extends ItemBase { } @Override - public ActionResult use(World world, PlayerEntity player, Hand hand) { - if (!world.isClientSide && hand == Hand.MAIN_HAND) { - NetworkHooks.openGui((ServerPlayerEntity) player, new SimpleNamedContainerProvider((windowId, inv, playerEnt) -> new ContainerFilter(windowId, inv), StringTextComponent.EMPTY)); + public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { + if (!world.isClientSide && hand == InteractionHand.MAIN_HAND) { + NetworkHooks.openGui((ServerPlayer) player, new SimpleMenuProvider((windowId, inv, playerEnt) -> new ContainerFilter(windowId, inv), TextComponent.EMPTY)); // player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FILTER.ordinal(), world, (int) player.posX, (int) player.posY, (int) player.posZ); } - return ActionResult.pass(player.getItemInHand(hand)); + return InteractionResultHolder.pass(player.getItemInHand(hand)); } @OnlyIn(Dist.CLIENT) @Override - public void appendHoverText(ItemStack stack, @Nullable World worldIn, List tooltip, ITooltipFlag flagIn) { + public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List tooltip, TooltipFlag flagIn) { super.appendHoverText(stack, worldIn, tooltip, flagIn); ItemStackHandlerAA inv = new ItemStackHandlerAA(ContainerFilter.SLOT_AMOUNT); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGeneric.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGeneric.java index a09850bd2..0c181f518 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGeneric.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGeneric.java @@ -12,8 +12,6 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; -import net.minecraft.item.Item.Properties; - public class ItemGeneric extends ItemBase { public ItemGeneric(Properties props) { super(props.durability(0)); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java index 2154d9ed3..e898f5524 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java @@ -12,17 +12,17 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.GrassBlock; -import net.minecraft.block.IGrowable; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.World; -import net.minecraft.world.server.ServerWorld; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.Entity; +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.BonemealableBlock; +import net.minecraft.world.level.block.GrassBlock; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.IPlantable; import java.util.ArrayList; @@ -35,12 +35,12 @@ public class ItemGrowthRing extends ItemEnergy { } @Override - public void inventoryTick(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected) { - if (!(entity instanceof PlayerEntity) || world.isClientSide || entity.isShiftKeyDown()) { + public void inventoryTick(ItemStack stack, Level world, Entity entity, int itemSlot, boolean isSelected) { + if (!(entity instanceof Player) || world.isClientSide || entity.isShiftKeyDown()) { return; } - PlayerEntity player = (PlayerEntity) entity; + Player player = (Player) entity; ItemStack equipped = player.getMainHandItem(); int energyUse = 300; @@ -53,12 +53,12 @@ public class ItemGrowthRing extends ItemEnergy { for (int x = -range; x < range + 1; x++) { for (int z = -range; z < range + 1; z++) { for (int y = -range; y < range + 1; y++) { - int theX = MathHelper.floor(player.getX() + x); - int theY = MathHelper.floor(player.getY() + y); - int theZ = MathHelper.floor(player.getZ() + z); + int theX = Mth.floor(player.getX() + x); + int theY = Mth.floor(player.getY() + y); + int theZ = Mth.floor(player.getZ() + z); BlockPos posInQuestion = new BlockPos(theX, theY, theZ); Block theBlock = world.getBlockState(posInQuestion).getBlock(); - if ((theBlock instanceof IGrowable || theBlock instanceof IPlantable) && !(theBlock instanceof GrassBlock)) { + if ((theBlock instanceof BonemealableBlock || theBlock instanceof IPlantable) && !(theBlock instanceof GrassBlock)) { blocks.add(posInQuestion); } } @@ -72,7 +72,7 @@ public class ItemGrowthRing extends ItemEnergy { BlockPos pos = blocks.get(world.random.nextInt(blocks.size())); BlockState state = world.getBlockState(pos); - state.randomTick((ServerWorld) world, pos, world.random); + state.randomTick((ServerLevel) world, pos, world.random); //Show Particles if Metadata changed BlockState newState = world.getBlockState(pos); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java index 0f7b45293..e1048a25e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java @@ -14,18 +14,18 @@ import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemUseContext; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.World; +import net.minecraft.ChatFormatting; +import net.minecraft.core.BlockPos; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -38,23 +38,23 @@ public class ItemLaserWrench extends ItemBase { } @Override - public ActionResultType useOn(ItemUseContext context) { + public InteractionResult useOn(UseOnContext context) { BlockPos pos = context.getClickedPos(); - World world = context.getLevel(); - PlayerEntity player = context.getPlayer(); + Level world = context.getLevel(); + Player player = context.getPlayer(); ItemStack stack = player.getItemInHand(context.getHand()); - TileEntity tile = world.getBlockEntity(pos); + BlockEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityLaserRelay) { TileEntityLaserRelay relay = (TileEntityLaserRelay) tile; if (!world.isClientSide) { if (ItemPhantomConnector.getStoredPosition(stack) == null) { ItemPhantomConnector.storeConnection(stack, pos.getX(), pos.getY(), pos.getZ(), world); - player.displayClientMessage(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".laser.stored.desc"), true); + player.displayClientMessage(new TranslatableComponent("tooltip." + ActuallyAdditions.MODID + ".laser.stored.desc"), true); } else { BlockPos savedPos = ItemPhantomConnector.getStoredPosition(stack); if (savedPos != null) { - TileEntity savedTile = world.getBlockEntity(savedPos); + BlockEntity savedTile = world.getBlockEntity(savedPos); if (savedTile instanceof TileEntityLaserRelay) { int distanceSq = (int) savedPos.distSqr(pos); TileEntityLaserRelay savedRelay = (TileEntityLaserRelay) savedTile; @@ -67,20 +67,20 @@ public class ItemLaserWrench extends ItemBase { ((TileEntityLaserRelay) savedTile).sendUpdate(); relay.sendUpdate(); - player.displayClientMessage(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".laser.connected.desc"), true); + player.displayClientMessage(new TranslatableComponent("tooltip." + ActuallyAdditions.MODID + ".laser.connected.desc"), true); - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; } } - player.displayClientMessage(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".laser.cantConnect.desc"), false); + player.displayClientMessage(new TranslatableComponent("tooltip." + ActuallyAdditions.MODID + ".laser.cantConnect.desc"), false); ItemPhantomConnector.clearStorage(stack, "XCoordOfTileStored", "YCoordOfTileStored", "ZCoordOfTileStored", "WorldOfTileStored"); } } } - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; } - return ActionResultType.FAIL; + return InteractionResult.FAIL; } // // TODO: [port] ensure this is correct @@ -92,14 +92,14 @@ public class ItemLaserWrench extends ItemBase { @OnlyIn(Dist.CLIENT) @Override - public void appendHoverText(ItemStack stack, World playerIn, List list, ITooltipFlag advanced) { + public void appendHoverText(ItemStack stack, Level playerIn, List list, TooltipFlag advanced) { BlockPos coords = ItemPhantomConnector.getStoredPosition(stack); if (coords != null) { - list.add(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".boundTo.desc").append(":")); - list.add(new StringTextComponent("X: " + coords.getX())); - list.add(new StringTextComponent("Y: " + coords.getY())); - list.add(new StringTextComponent("Z: " + coords.getZ())); - list.add(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".clearStorage.desc").withStyle(TextFormatting.ITALIC)); + list.add(new TranslatableComponent("tooltip." + ActuallyAdditions.MODID + ".boundTo.desc").append(":")); + list.add(new TextComponent("X: " + coords.getX())); + list.add(new TextComponent("Y: " + coords.getY())); + list.add(new TextComponent("Z: " + coords.getZ())); + list.add(new TranslatableComponent("tooltip." + ActuallyAdditions.MODID + ".clearStorage.desc").withStyle(ChatFormatting.ITALIC)); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java index efa530814..519ee179c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java @@ -12,19 +12,23 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.api.misc.IDisplayStandItem; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; -import net.minecraft.block.*; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.UseAction; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.util.Mth; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.UseAnim; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.BushBlock; +import net.minecraft.world.level.block.LeavesBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.IForgeShearable; import javax.annotation.Nonnull; @@ -42,15 +46,15 @@ public class ItemLeafBlower extends ItemBase implements IDisplayStandItem { @Nonnull @Override - public ActionResult use(@Nonnull World world, PlayerEntity player, @Nonnull Hand hand) { + public InteractionResultHolder use(@Nonnull Level world, Player player, @Nonnull InteractionHand hand) { player.startUsingItem(hand); - return ActionResult.success(player.getItemInHand(hand)); + return InteractionResultHolder.success(player.getItemInHand(hand)); } @Nonnull @Override - public UseAction getUseAnimation(@Nonnull ItemStack stack) { - return UseAction.BOW; + public UseAnim getUseAnimation(@Nonnull ItemStack stack) { + return UseAnim.BOW; } @Override @@ -60,16 +64,16 @@ public class ItemLeafBlower extends ItemBase implements IDisplayStandItem { @Override public void onUsingTick(ItemStack stack, LivingEntity player, int count) { - this.doUpdate(player.level, MathHelper.floor(player.getX()), MathHelper.floor(player.getY()), MathHelper.floor(player.getZ()), count, stack); + this.doUpdate(player.level, Mth.floor(player.getX()), Mth.floor(player.getY()), Mth.floor(player.getZ()), count, stack); } - private boolean doUpdate(World world, int x, int y, int z, int time, ItemStack stack) { + private boolean doUpdate(Level world, int x, int y, int z, int time, ItemStack stack) { if (!world.isClientSide) { if (time <= this.getUseDuration(stack) && (this.isAdvanced || time % 3 == 0)) { //Breaks the Blocks boolean broke = this.breakStuff(world, x, y, z); //Plays a Minecart sounds (It really sounds like a Leaf Blower!) - world.playSound(null, x, y, z, SoundEvents.MINECART_RIDING, SoundCategory.PLAYERS, 0.2F, 0.001F); + world.playSound(null, x, y, z, SoundEvents.MINECART_RIDING, SoundSource.PLAYERS, 0.2F, 0.001F); return broke; } } @@ -84,7 +88,7 @@ public class ItemLeafBlower extends ItemBase implements IDisplayStandItem { * @param y The Y Position of the Player * @param z The Z Position of the Player */ - public boolean breakStuff(World world, int x, int y, int z) { + public boolean breakStuff(Level world, int x, int y, int z) { ArrayList breakPositions = new ArrayList<>(); int rangeSides = 5; @@ -127,12 +131,12 @@ public class ItemLeafBlower extends ItemBase implements IDisplayStandItem { } @Override - public boolean update(ItemStack stack, TileEntity tile, int elapsedTicks) { + public boolean update(ItemStack stack, BlockEntity tile, int elapsedTicks) { return this.doUpdate(tile.getLevel(), tile.getBlockPos().getX(), tile.getBlockPos().getY(), tile.getBlockPos().getZ(), elapsedTicks, stack); } @Override - public int getUsePerTick(ItemStack stack, TileEntity tile, int elapsedTicks) { + public int getUsePerTick(ItemStack stack, BlockEntity tile, int elapsedTicks) { return 60; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java index 4da45e4ee..ff87229e2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java @@ -12,14 +12,14 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; -import net.minecraft.entity.Entity; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.world.World; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.AABB; import javax.annotation.Nonnull; import java.util.List; @@ -36,16 +36,16 @@ public class ItemMagnetRing extends ItemEnergy { } @Override - public void inventoryTick(@Nonnull ItemStack stack, @Nonnull World world, @Nonnull Entity entity, int itemSlot, boolean isSelected) { - if (entity instanceof PlayerEntity && !world.isClientSide && !ItemUtil.isEnabled(stack)) { - PlayerEntity player = (PlayerEntity) entity; + public void inventoryTick(@Nonnull ItemStack stack, @Nonnull Level world, @Nonnull Entity entity, int itemSlot, boolean isSelected) { + if (entity instanceof Player && !world.isClientSide && !ItemUtil.isEnabled(stack)) { + Player player = (Player) entity; if (player.isCreative() || player.isSpectator()) { return; } if (!entity.isShiftKeyDown()) { //Get all the Items in the area int range = 5; - List items = world.getEntitiesOfClass(ItemEntity.class, new AxisAlignedBB(entity.getX() - range, entity.getY() - range, entity.getZ() - range, entity.getX() + range, entity.getY() + range, entity.getZ() + range)); + List items = world.getEntitiesOfClass(ItemEntity.class, new AABB(entity.getX() - range, entity.getY() - range, entity.getZ() - range, entity.getX() + range, entity.getY() + range, entity.getZ() + range)); if (!items.isEmpty()) { for (ItemEntity item : items) { if (item.getPersistentData().getBoolean("PreventRemoteMovement")) { @@ -74,10 +74,10 @@ public class ItemMagnetRing extends ItemEnergy { @Nonnull @Override - public ActionResult use(World worldIn, @Nonnull PlayerEntity player, @Nonnull Hand hand) { + public InteractionResultHolder use(Level worldIn, @Nonnull Player player, @Nonnull InteractionHand hand) { if (!worldIn.isClientSide && player.isShiftKeyDown()) { ItemUtil.changeEnabled(player, hand); - return ActionResult.success(player.getItemInHand(hand)); + return InteractionResultHolder.success(player.getItemInHand(hand)); } return super.use(worldIn, player, hand); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java index 7607025e6..4d4d09649 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java @@ -14,21 +14,21 @@ import de.ellpeck.actuallyadditions.api.tile.IPhantomTile; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemUseContext; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.RegistryKey; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.registry.Registry; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.World; +import net.minecraft.ChatFormatting; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Registry; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -41,17 +41,17 @@ public class ItemPhantomConnector extends ItemBase { super(ActuallyItems.defaultNonStacking()); } - public static RegistryKey getStoredWorld(ItemStack stack) { - CompoundNBT tag = stack.getOrCreateTag(); + public static ResourceKey getStoredWorld(ItemStack stack) { + CompoundTag tag = stack.getOrCreateTag(); if (!tag.contains("WorldOfTileStored")) { return null; } - return RegistryKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(tag.getString("WorldOfTileStored"))); + return ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(tag.getString("WorldOfTileStored"))); } public static BlockPos getStoredPosition(ItemStack stack) { - CompoundNBT tag = stack.getOrCreateTag(); + CompoundTag tag = stack.getOrCreateTag(); int x = tag.getInt("XCoordOfTileStored"); int y = tag.getInt("YCoordOfTileStored"); int z = tag.getInt("ZCoordOfTileStored"); @@ -63,14 +63,14 @@ public class ItemPhantomConnector extends ItemBase { } public static void clearStorage(ItemStack stack, String... keys) { - CompoundNBT compound = stack.getOrCreateTag(); + CompoundTag compound = stack.getOrCreateTag(); for (String key : keys) { compound.remove(key); } } - public static void storeConnection(ItemStack stack, int x, int y, int z, World world) { - CompoundNBT tag = stack.getOrCreateTag(); + public static void storeConnection(ItemStack stack, int x, int y, int z, Level world) { + CompoundTag tag = stack.getOrCreateTag(); tag.putInt("XCoordOfTileStored", x); tag.putInt("YCoordOfTileStored", y); @@ -79,12 +79,12 @@ public class ItemPhantomConnector extends ItemBase { } @Override - public ActionResultType useOn(ItemUseContext context) { + public InteractionResult useOn(UseOnContext context) { ItemStack stack = context.getPlayer().getItemInHand(context.getHand()); if (!context.getLevel().isClientSide) { //Passing Data to Phantoms BlockPos pos = context.getClickedPos(); - TileEntity tile = context.getLevel().getBlockEntity(pos); + BlockEntity tile = context.getLevel().getBlockEntity(pos); if (tile != null) { //Passing to Phantom if (tile instanceof IPhantomTile) { @@ -95,35 +95,35 @@ public class ItemPhantomConnector extends ItemBase { ((TileEntityBase) tile).sendUpdate(); } clearStorage(stack, "XCoordOfTileStored", "YCoordOfTileStored", "ZCoordOfTileStored", "WorldOfTileStored"); - context.getPlayer().displayClientMessage(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".phantom.connected.desc"), true); - return ActionResultType.SUCCESS; + context.getPlayer().displayClientMessage(new TranslatableComponent("tooltip." + ActuallyAdditions.MODID + ".phantom.connected.desc"), true); + return InteractionResult.SUCCESS; } - return ActionResultType.FAIL; + return InteractionResult.FAIL; } } //Storing Connections storeConnection(stack, pos.getX(), pos.getY(), pos.getZ(), context.getLevel()); - context.getPlayer().displayClientMessage(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".phantom.stored.desc"), true); + context.getPlayer().displayClientMessage(new TranslatableComponent("tooltip." + ActuallyAdditions.MODID + ".phantom.stored.desc"), true); } - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; } @Nullable @Override - public CompoundNBT getShareTag(ItemStack stack) { - return new CompoundNBT(); + public CompoundTag getShareTag(ItemStack stack) { + return new CompoundTag(); } @OnlyIn(Dist.CLIENT) @Override - public void appendHoverText(ItemStack stack, @Nullable World playerIn, List list, ITooltipFlag advanced) { + public void appendHoverText(ItemStack stack, @Nullable Level playerIn, List list, TooltipFlag advanced) { BlockPos coords = getStoredPosition(stack); if (coords != null) { - list.add(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".boundTo.desc").append(":")); - list.add(new StringTextComponent("X: " + coords.getX())); - list.add(new StringTextComponent("Y: " + coords.getY())); - list.add(new StringTextComponent("Z: " + coords.getZ())); - list.add(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".clearStorage.desc").withStyle(TextFormatting.ITALIC)); + list.add(new TranslatableComponent("tooltip." + ActuallyAdditions.MODID + ".boundTo.desc").append(":")); + list.add(new TextComponent("X: " + coords.getX())); + list.add(new TextComponent("Y: " + coords.getY())); + list.add(new TextComponent("Z: " + coords.getZ())); + list.add(new TranslatableComponent("tooltip." + ActuallyAdditions.MODID + ".clearStorage.desc").withStyle(ChatFormatting.ITALIC)); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPickaxeAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPickaxeAA.java index 853a93339..bebe68b32 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPickaxeAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPickaxeAA.java @@ -10,25 +10,23 @@ package de.ellpeck.actuallyadditions.mod.items; -import com.google.common.collect.ImmutableSet; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import net.minecraft.item.IItemTier; -import net.minecraft.item.ToolItem; -import net.minecraftforge.common.ToolType; +import net.minecraft.world.item.DiggerItem; +import net.minecraft.world.item.Tier; -public class ItemPickaxeAA extends ToolItem { - private final IItemTier tier; - public ItemPickaxeAA(IItemTier tier) { +public class ItemPickaxeAA extends DiggerItem { + private final Tier tier; + public ItemPickaxeAA(Tier tier) { super( 4.0f, -2f, tier, - ImmutableSet.of(), - new Properties() - .addToolType(ToolType.AXE, tier.getLevel()) - .addToolType(ToolType.HOE, tier.getLevel()) - .addToolType(ToolType.SHOVEL, tier.getLevel()) - .addToolType(ToolType.PICKAXE, tier.getLevel()) + null, //Feed block tags here + new Properties() +// .addToolType(ToolType.AXE, tier.getLevel()) +// .addToolType(ToolType.HOE, tier.getLevel()) +// .addToolType(ToolType.SHOVEL, tier.getLevel()) +// .addToolType(ToolType.PICKAXE, tier.getLevel()) .durability(tier.getUses() * 4) .tab(ActuallyAdditions.GROUP) ); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPlayerProbe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPlayerProbe.java index c33fb8855..ba12b77d7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPlayerProbe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPlayerProbe.java @@ -14,19 +14,19 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityPlayerInterface; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemUseContext; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.World; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -42,38 +42,38 @@ public class ItemPlayerProbe extends ItemBase { // TODO: [port] might be the wrong event @Override - public void inventoryTick(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected) { + public void inventoryTick(ItemStack stack, Level world, Entity entity, int itemSlot, boolean isSelected) { if (!world.isClientSide) { - CompoundNBT compound = stack.getOrCreateTag(); + CompoundTag compound = stack.getOrCreateTag(); if (compound.contains("UUIDMost")) { UUID id = compound.getUUID("UUID"); - PlayerEntity player = world.getPlayerByUUID(id); + Player player = world.getPlayerByUUID(id); if (player != null) { if (player.isShiftKeyDown()) { ItemPhantomConnector.clearStorage(stack, "UUIDLeast", "UUIDMost", "Name"); - ((PlayerEntity) entity).displayClientMessage(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".playerProbe.disconnect.1"), false); - player.displayClientMessage(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".playerProbe.notice"), false); + ((Player) entity).displayClientMessage(new TranslatableComponent("tooltip." + ActuallyAdditions.MODID + ".playerProbe.disconnect.1"), false); + player.displayClientMessage(new TranslatableComponent("tooltip." + ActuallyAdditions.MODID + ".playerProbe.notice"), false); //TheAchievements.GET_UNPROBED.get(player); } } else { ItemPhantomConnector.clearStorage(stack, "UUIDLeast", "UUIDMost", "Name"); - ((PlayerEntity) entity).displayClientMessage(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".playerProbe.disconnect.2"), false); + ((Player) entity).displayClientMessage(new TranslatableComponent("tooltip." + ActuallyAdditions.MODID + ".playerProbe.disconnect.2"), false); } } } } @Override - public ActionResultType useOn(ItemUseContext context) { - PlayerEntity player = context.getPlayer(); + public InteractionResult useOn(UseOnContext context) { + Player player = context.getPlayer(); if (player == null) { - return ActionResultType.FAIL; + return InteractionResult.FAIL; } ItemStack stack = player.getItemInHand(context.getHand()); - TileEntity tile = context.getLevel().getBlockEntity(context.getClickedPos()); + BlockEntity tile = context.getLevel().getBlockEntity(context.getClickedPos()); if (tile instanceof TileEntityPlayerInterface) { - CompoundNBT compound = stack.getOrCreateTag(); + CompoundTag compound = stack.getOrCreateTag(); if (compound.contains("UUIDMost")) { if (!context.getLevel().isClientSide) { TileEntityPlayerInterface face = (TileEntityPlayerInterface) tile; @@ -84,38 +84,38 @@ public class ItemPlayerProbe extends ItemBase { ItemPhantomConnector.clearStorage(stack, "UUIDLeast", "UUIDMost", "Name"); } - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; } } - return ActionResultType.FAIL; + return InteractionResult.FAIL; } @Override - public ActionResultType interactLivingEntity(ItemStack aStack, PlayerEntity player, LivingEntity entity, Hand hand) { + public InteractionResult interactLivingEntity(ItemStack aStack, Player player, LivingEntity entity, InteractionHand hand) { if (!player.level.isClientSide) { ItemStack stack = player.getMainHandItem(); if (StackUtil.isValid(stack) && stack.getItem() == this) { - if (entity instanceof PlayerEntity) { - PlayerEntity playerHit = (PlayerEntity) entity; + if (entity instanceof Player) { + Player playerHit = (Player) entity; if (!playerHit.isShiftKeyDown()) { - CompoundNBT compound = stack.getOrCreateTag(); + CompoundTag compound = stack.getOrCreateTag(); compound.putString("Name", playerHit.getName().getString()); compound.putUUID("UUID", playerHit.getUUID()); - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; } } } } - return ActionResultType.FAIL; + return InteractionResult.FAIL; } @OnlyIn(Dist.CLIENT) @Override - public void appendHoverText(ItemStack stack, @Nullable World playerIn, List tooltip, ITooltipFlag advanced) { + public void appendHoverText(ItemStack stack, @Nullable Level playerIn, List tooltip, TooltipFlag advanced) { if (stack.getOrCreateTag().contains("Name")) { String name = stack.getOrCreateTag().getString("Name"); - tooltip.add(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".playerProbe.probing").append(": " + name)); + tooltip.add(new TranslatableComponent("tooltip." + ActuallyAdditions.MODID + ".playerProbe.probing").append(": " + name)); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemResonantRice.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemResonantRice.java index 1aca91d91..8db14011d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemResonantRice.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemResonantRice.java @@ -11,12 +11,12 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.world.Explosion; -import net.minecraft.world.World; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Explosion; +import net.minecraft.world.level.Level; public class ItemResonantRice extends ItemBase { @@ -25,12 +25,12 @@ public class ItemResonantRice extends ItemBase { } @Override - public ActionResult use(World world, PlayerEntity player, Hand hand) { + public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { ItemStack stack = player.getItemInHand(hand); if (!world.isClientSide) { stack.shrink(1); - world.explode(null, player.getX(), player.getY(), player.getZ(), 0.5F, Explosion.Mode.DESTROY); + world.explode(null, player.getX(), player.getY(), player.getZ(), 0.5F, Explosion.BlockInteraction.DESTROY); } - return ActionResult.success(stack); + return InteractionResultHolder.success(stack); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemShovelAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemShovelAA.java index 0f94c048c..284741836 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemShovelAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemShovelAA.java @@ -12,12 +12,17 @@ package de.ellpeck.actuallyadditions.mod.items; import com.google.common.collect.Sets; import de.ellpeck.actuallyadditions.mod.items.base.ItemToolAA; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.item.*; -import net.minecraft.tags.ITag; -import net.minecraft.util.ActionResultType; +import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.Tier; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; import javax.annotation.Nonnull; import java.util.Collections; @@ -25,9 +30,9 @@ import java.util.Set; public class ItemShovelAA extends ItemToolAA { - private static final Set EFFECTIVE_ON = Sets.newHashSet(Blocks.CLAY, Blocks.DIRT, Blocks.FARMLAND, Blocks.GRASS, Blocks.GRAVEL, Blocks.MYCELIUM, Blocks.SAND, Blocks.SNOW, Blocks.SNOW_BLOCK, Blocks.SOUL_SAND, Blocks.GRASS_PATH); + private static final Set EFFECTIVE_ON = Sets.newHashSet(Blocks.CLAY, Blocks.DIRT, Blocks.FARMLAND, Blocks.GRASS, Blocks.GRAVEL, Blocks.MYCELIUM, Blocks.SAND, Blocks.SNOW, Blocks.SNOW_BLOCK, Blocks.SOUL_SAND, Blocks.DIRT_PATH); - public ItemShovelAA(float p_i48512_1_, float p_i48512_2_, IItemTier p_i48512_3_, Set p_i48512_4_, Properties p_i48512_5_, String name, ItemStack repairItem, ITag repairTag) { + public ItemShovelAA(float p_i48512_1_, float p_i48512_2_, Tier p_i48512_3_, TagKey p_i48512_4_, Properties p_i48512_5_, String name, ItemStack repairItem, TagKey repairTag) { super(p_i48512_1_, p_i48512_2_, p_i48512_3_, p_i48512_4_, p_i48512_5_, name, repairItem, repairTag); } @@ -44,7 +49,7 @@ public class ItemShovelAA extends ItemToolAA { @Nonnull @Override - public ActionResultType useOn(ItemUseContext useContext) { + public InteractionResult useOn(UseOnContext useContext) { return Items.IRON_SHOVEL.useOn(useContext); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemSolidifiedExperience.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemSolidifiedExperience.java index d54187459..54ab6d4b4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemSolidifiedExperience.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemSolidifiedExperience.java @@ -12,20 +12,14 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.config.CommonConfig; -import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; -import net.minecraft.entity.CreatureEntity; -import net.minecraft.entity.item.ExperienceOrbEntity; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.world.GameRules; -import net.minecraft.world.World; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.entity.ExperienceOrb; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; import net.minecraftforge.common.util.FakePlayer; -import net.minecraftforge.event.entity.living.LivingDropsEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; public class ItemSolidifiedExperience extends ItemBase { @@ -36,7 +30,7 @@ public class ItemSolidifiedExperience extends ItemBase { } @Override - public ActionResult use(World world, PlayerEntity player, Hand hand) { + public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { ItemStack stack = player.getItemInHand(hand); if (!world.isClientSide) { int amount; @@ -53,13 +47,13 @@ public class ItemSolidifiedExperience extends ItemBase { } if (CommonConfig.Other.SOLID_XP_ALWAYS_ORBS.get() || player instanceof FakePlayer) { - ExperienceOrbEntity orb = new ExperienceOrbEntity(world, player.getX() + 0.5, player.getY() + 0.5, player.getZ() + 0.5, amount); + ExperienceOrb orb = new ExperienceOrb(world, player.getX() + 0.5, player.getY() + 0.5, player.getZ() + 0.5, amount); orb.getPersistentData().putBoolean(ActuallyAdditions.MODID + "FromSolidified", true); world.addFreshEntity(orb); } else { player.giveExperiencePoints(amount); } } - return ActionResult.success(stack); + return InteractionResultHolder.success(stack); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleportStaff.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleportStaff.java index db93c4815..91e06d0c2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleportStaff.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleportStaff.java @@ -11,17 +11,17 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.util.math.vector.Vector3i; -import net.minecraft.world.World; +import net.minecraft.core.Vec3i; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.Vec3; public class ItemTeleportStaff extends ItemEnergy { @@ -30,28 +30,28 @@ public class ItemTeleportStaff extends ItemEnergy { } @Override - public ActionResult use(World world, PlayerEntity player, Hand hand) { + public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { ItemStack stack = player.getItemInHand(hand); if (!world.isClientSide) { - RayTraceResult rayTraceResult = player.pick(100,1F,false); - if (rayTraceResult.getType() == RayTraceResult.Type.BLOCK || player.xRot >= -5) { - Vector3d location = rayTraceResult.getLocation(); - Vector3d pos = Vector3d.atBottomCenterOf(new Vector3i(location.x, location.y, location.z)); + HitResult rayTraceResult = player.pick(100,1F,false); + if (rayTraceResult.getType() == HitResult.Type.BLOCK || player.getXRot() >= -5) { + Vec3 location = rayTraceResult.getLocation(); + Vec3 pos = Vec3.atBottomCenterOf(new Vec3i(location.x, location.y, location.z)); int baseUse = 200; - int use = baseUse + (int) (baseUse * player.blockPosition().distSqr(new Vector3i(pos.x, pos.y, pos.z))); + int use = baseUse + (int) (baseUse * player.blockPosition().distSqr(new Vec3i(pos.x, pos.y, pos.z))); if (this.getEnergyStored(stack) >= use) { - ((ServerPlayerEntity) player).connection.teleport(pos.x, pos.y + 1F, pos.z, player.yRot, player.xRot); + ((ServerPlayer) player).connection.teleport(pos.x, pos.y + 1F, pos.z, player.getYRot(), player.getXRot()); player.removeVehicle(); - world.playSound(null, player.getX(), player.getY(), player.getZ(), SoundEvents.ENDERMAN_TELEPORT, SoundCategory.PLAYERS, 1.0F, 1.0F); + world.playSound(null, player.getX(), player.getY(), player.getZ(), SoundEvents.ENDERMAN_TELEPORT, SoundSource.PLAYERS, 1.0F, 1.0F); if (!player.isCreative()) { this.extractEnergyInternal(stack, use, false); player.getCooldowns().addCooldown(this, 50); } - return ActionResult.success(stack); + return InteractionResultHolder.success(stack); } } } player.swing(hand); - return ActionResult.fail(stack); + return InteractionResultHolder.fail(stack); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterBowl.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterBowl.java index 483267f5c..93f82f98f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterBowl.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterBowl.java @@ -14,23 +14,27 @@ import de.ellpeck.actuallyadditions.mod.config.CommonConfig; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.material.Material; -import net.minecraft.entity.Entity; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.particles.ParticleTypes; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.util.*; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +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.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.material.Material; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.HitResult; import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; @@ -47,13 +51,13 @@ public class ItemWaterBowl extends ItemBase { if (event.getWorld() != null) { if (CommonConfig.Other.WATER_BOWL.get()) { if (StackUtil.isValid(event.getItemStack()) && event.getItemStack().getItem() == Items.BOWL) { - RayTraceResult rayTrace = WorldUtil.getNearestBlockWithDefaultReachDistance(event.getWorld(), event.getPlayer(), true, false, false); - if (rayTrace.getType() != RayTraceResult.Type.BLOCK) { + HitResult rayTrace = WorldUtil.getNearestBlockWithDefaultReachDistance(event.getWorld(), event.getPlayer(), true, false, false); + if (rayTrace.getType() != HitResult.Type.BLOCK) { return; } - BlockRayTraceResult trace = (BlockRayTraceResult) rayTrace; - ActionResult result = ForgeEventFactory.onBucketUse(event.getPlayer(), event.getWorld(), event.getItemStack(), trace); + BlockHitResult trace = (BlockHitResult) rayTrace; + InteractionResultHolder result = ForgeEventFactory.onBucketUse(event.getPlayer(), event.getWorld(), event.getItemStack(), trace); if (result == null) { if (event.getPlayer().mayUseItemAt(trace.getBlockPos().relative(trace.getDirection()), trace.getDirection(), event.getItemStack())) { BlockState state = event.getWorld().getBlockState(trace.getBlockPos()); @@ -70,7 +74,7 @@ public class ItemWaterBowl extends ItemBase { ItemStack bowl = new ItemStack(ActuallyItems.WATER_BOWL.get()); if (!StackUtil.isValid(reduced)) { event.getPlayer().setItemInHand(event.getHand(), bowl); - } else if (!event.getPlayer().inventory.add(bowl.copy())) { + } else if (!event.getPlayer().getInventory().add(bowl.copy())) { ItemEntity entityItem = new ItemEntity(event.getWorld(), event.getPlayer().getX(), event.getPlayer().getY(), event.getPlayer().getZ(), bowl.copy()); entityItem.setPickUpDelay(0); event.getWorld().addFreshEntity(entityItem); @@ -85,45 +89,45 @@ public class ItemWaterBowl extends ItemBase { } @Override - public ActionResult use(World world, PlayerEntity player, Hand hand) { + public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { ItemStack stack = player.getItemInHand(hand); - RayTraceResult trace = WorldUtil.getNearestBlockWithDefaultReachDistance(world, player); - ActionResult result = ForgeEventFactory.onBucketUse(player, world, stack, trace); + HitResult trace = WorldUtil.getNearestBlockWithDefaultReachDistance(world, player); + InteractionResultHolder result = ForgeEventFactory.onBucketUse(player, world, stack, trace); if (result != null) { return result; } if (trace == null) { - return ActionResult.pass(stack); - } else if (trace.getType() != RayTraceResult.Type.BLOCK) { - return ActionResult.pass(stack); + return InteractionResultHolder.pass(stack); + } else if (trace.getType() != HitResult.Type.BLOCK) { + return InteractionResultHolder.pass(stack); } else { - BlockRayTraceResult blockTrace = (BlockRayTraceResult) trace; + BlockHitResult blockTrace = (BlockHitResult) trace; BlockPos pos = blockTrace.getBlockPos(); if (!world.mayInteract(player, pos)) { - return ActionResult.fail(stack); + return InteractionResultHolder.fail(stack); } else { BlockPos pos1 = world.getBlockState(pos).getMaterial().isReplaceable() && blockTrace.getDirection() == Direction.UP ? pos : pos.relative(blockTrace.getDirection()); if (!player.mayUseItemAt(pos1, blockTrace.getDirection(), stack)) { - return ActionResult.fail(stack); + return InteractionResultHolder.fail(stack); } else if (this.tryPlaceContainedLiquid(player, world, pos1, false)) { return !player.isCreative() - ? ActionResult.success(new ItemStack(Items.BOWL)) - : ActionResult.success(stack); + ? InteractionResultHolder.success(new ItemStack(Items.BOWL)) + : InteractionResultHolder.success(stack); } else { - return ActionResult.fail(stack); + return InteractionResultHolder.fail(stack); } } } } @Override - public void inventoryTick(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected) { + public void inventoryTick(ItemStack stack, Level world, Entity entity, int itemSlot, boolean isSelected) { if (!world.isClientSide) { if (CommonConfig.Other.WATER_BOWL_LOSS.get()) { if (world.getGameTime() % 10 == 0 && world.random.nextFloat() >= 0.5F) { @@ -131,7 +135,7 @@ public class ItemWaterBowl extends ItemBase { int lastY = 0; if (stack.hasTag()) { - CompoundNBT compound = stack.getOrCreateTag(); + CompoundTag compound = stack.getOrCreateTag(); lastX = compound.getInt("lastX"); lastY = compound.getInt("lastY"); } @@ -139,8 +143,8 @@ public class ItemWaterBowl extends ItemBase { boolean change = false; if (lastX != 0 && lastX != (int) entity.getX() || lastY != 0 && lastY != (int) entity.getY()) { if (!entity.isShiftKeyDown()) { - if (entity instanceof PlayerEntity) { - PlayerEntity player = (PlayerEntity) entity; + if (entity instanceof Player) { + Player player = (Player) entity; if (this.tryPlaceContainedLiquid(player, world, player.blockPosition(), true)) { this.checkReplace(player, stack, new ItemStack(Items.BOWL), itemSlot); } @@ -150,7 +154,7 @@ public class ItemWaterBowl extends ItemBase { } if (change || lastX == 0 || lastY == 0) { - CompoundNBT compound = stack.getOrCreateTag(); + CompoundTag compound = stack.getOrCreateTag(); compound.putInt("lastX", (int) entity.getX()); compound.putInt("lastY", (int) entity.getY()); } @@ -159,11 +163,11 @@ public class ItemWaterBowl extends ItemBase { } } - private void checkReplace(PlayerEntity player, ItemStack old, ItemStack stack, int slot) { - if (player.inventory.getItem(slot) == old) { - player.inventory.setItem(slot, stack); - } else if (player.inventory.offhand.get(slot) == old) { - player.inventory.offhand.set(slot, stack); + private void checkReplace(Player player, ItemStack old, ItemStack stack, int slot) { + if (player.getInventory().getItem(slot) == old) { + player.getInventory().setItem(slot, stack); + } else if (player.getInventory().offhand.get(slot) == old) { + player.getInventory().offhand.set(slot, stack); } } @@ -172,7 +176,7 @@ public class ItemWaterBowl extends ItemBase { return !ItemStack.isSame(oldStack, newStack); } - public boolean tryPlaceContainedLiquid(PlayerEntity player, World world, BlockPos pos, boolean finite) { + public boolean tryPlaceContainedLiquid(Player player, Level world, BlockPos pos, boolean finite) { BlockState state = world.getBlockState(pos); Material material = state.getMaterial(); boolean nonSolid = !material.isSolid(); @@ -182,7 +186,7 @@ public class ItemWaterBowl extends ItemBase { return false; } else { if (world.dimensionType().ultraWarm()) { - world.playSound(player, pos, SoundEvents.FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F); + world.playSound(player, pos, SoundEvents.FIRE_EXTINGUISH, SoundSource.BLOCKS, 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F); for (int k = 0; k < 8; k++) { world.addParticle(ParticleTypes.LARGE_SMOKE, pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), 0.0D, 0.0D, 0.0D); @@ -192,7 +196,7 @@ public class ItemWaterBowl extends ItemBase { world.destroyBlock(pos, true); } - world.playSound(player, pos, SoundEvents.BUCKET_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F); + world.playSound(player, pos, SoundEvents.BUCKET_EMPTY, SoundSource.BLOCKS, 1.0F, 1.0F); BlockState placeState = Blocks.WATER.defaultBlockState(); world.setBlock(pos, placeState, 3); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterRemovalRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterRemovalRing.java index a344b4e91..d6fb60359 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterRemovalRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterRemovalRing.java @@ -12,14 +12,14 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.Entity; +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.Blocks; public class ItemWaterRemovalRing extends ItemEnergy { @@ -28,12 +28,12 @@ public class ItemWaterRemovalRing extends ItemEnergy { } @Override - public void inventoryTick(ItemStack stack, World world, Entity player, int itemSlot, boolean isSelected) { - if (!(player instanceof PlayerEntity) || player.level.isClientSide || player.isShiftKeyDown()) { + public void inventoryTick(ItemStack stack, Level world, Entity player, int itemSlot, boolean isSelected) { + if (!(player instanceof Player) || player.level.isClientSide || player.isShiftKeyDown()) { return; } - ItemStack equipped = ((PlayerEntity) player).getMainHandItem(); + ItemStack equipped = ((Player) player).getMainHandItem(); int energyUse = 150; if (StackUtil.isValid(equipped) && equipped == stack && this.getEnergyStored(stack) >= energyUse) { @@ -43,9 +43,9 @@ public class ItemWaterRemovalRing extends ItemEnergy { for (int x = -range; x < range + 1; x++) { for (int z = -range; z < range + 1; z++) { for (int y = -range; y < range + 1; y++) { - int theX = MathHelper.floor(player.getX() + x); - int theY = MathHelper.floor(player.getY() + y); - int theZ = MathHelper.floor(player.getZ() + z); + int theX = Mth.floor(player.getX() + x); + int theY = Mth.floor(player.getY() + y); + int theZ = Mth.floor(player.getZ() + z); //Remove Water BlockPos pos = new BlockPos(theX, theY, theZ); @@ -54,7 +54,7 @@ public class ItemWaterRemovalRing extends ItemEnergy { if ((block == Blocks.WATER) && this.getEnergyStored(stack) >= energyUse) { world.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); - if (!((PlayerEntity) player).isCreative()) { + if (!((Player) player).isCreative()) { this.extractEnergyInternal(stack, energyUse, false); } } @@ -63,7 +63,7 @@ public class ItemWaterRemovalRing extends ItemEnergy { else if ((block == Blocks.LAVA) && this.getEnergyStored(stack) >= energyUse * 2) { world.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); - if (!((PlayerEntity) player).isCreative()) { + if (!((Player) player).isCreative()) { this.extractEnergyInternal(stack, energyUse * 2, false); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWingsOfTheBats.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWingsOfTheBats.java index b9d92fa05..10d7d56ef 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWingsOfTheBats.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWingsOfTheBats.java @@ -15,16 +15,16 @@ import de.ellpeck.actuallyadditions.mod.data.PlayerData; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.BlockState; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.entity.passive.BatEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.SwordItem; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ambient.Bat; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.SwordItem; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.event.entity.living.LivingDropsEvent; import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; @@ -48,49 +48,49 @@ public class ItemWingsOfTheBats extends ItemBase { * * @return The Wings */ - public static ItemStack getWingItem(PlayerEntity player) { - for (int i = 0; i < player.inventory.getContainerSize(); i++) { - if (StackUtil.isValid(player.inventory.getItem(i)) && player.inventory.getItem(i).getItem() instanceof ItemWingsOfTheBats) { - return player.inventory.getItem(i); + public static ItemStack getWingItem(Player player) { + for (int i = 0; i < player.getInventory().getContainerSize(); i++) { + if (StackUtil.isValid(player.getInventory().getItem(i)) && player.getInventory().getItem(i).getItem() instanceof ItemWingsOfTheBats) { + return player.getInventory().getItem(i); } } return ItemStack.EMPTY; } @Override - public boolean showDurabilityBar(ItemStack stack) { + public boolean isBarVisible(ItemStack stack) { return true; } @Override - public double getDurabilityForDisplay(ItemStack stack) { + public int getBarWidth(ItemStack stack) { /* PlayerEntity player = ClientProxy.getCurrentPlayer(); if (player != null) { // PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player); double diff = MAX_FLY_TIME - 1;//data.batWingsFlyTime; // TODO: fix me return 1 - diff / MAX_FLY_TIME; }*/ //TODO - return super.getDurabilityForDisplay(stack); + return super.getBarWidth(stack); } @Override - public int getRGBDurabilityForDisplay(ItemStack stack) { + public int getBarColor(ItemStack stack) { /* PlayerEntity player = ClientProxy.getCurrentPlayer(); if (player != null) { // PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player); int curr = 1;//data.batWingsFlyTime; // TODO: fix me return MathHelper.hsvToRgb(Math.max(0.0F, 1 - (float) curr / MAX_FLY_TIME) / 3.0F, 1.0F, 1.0F); }*/ - return super.getRGBDurabilityForDisplay(stack); + return super.getBarColor(stack); } @SubscribeEvent public void onEntityDropEvent(LivingDropsEvent event) { Entity source = event.getSource().getEntity(); - if (event.getEntityLiving().level != null && !event.getEntityLiving().level.isClientSide && source instanceof PlayerEntity) { + if (event.getEntityLiving().level != null && !event.getEntityLiving().level.isClientSide && source instanceof Player) { //Drop Wings from Bats - if (ConfigBoolValues.DO_BAT_DROPS.isEnabled() && event.getEntityLiving() instanceof BatEntity) { + if (ConfigBoolValues.DO_BAT_DROPS.isEnabled() && event.getEntityLiving() instanceof Bat) { int looting = event.getLootingLevel(); Iterable equip = source.getHandSlots(); @@ -112,8 +112,8 @@ public class ItemWingsOfTheBats extends ItemBase { @SubscribeEvent public void livingUpdateEvent(LivingEvent.LivingUpdateEvent event) { - if (event.getEntityLiving() instanceof PlayerEntity) { - PlayerEntity player = (PlayerEntity) event.getEntityLiving(); + if (event.getEntityLiving() instanceof Player) { + Player player = (Player) event.getEntityLiving(); if (false &&!player.isCreative() && !player.isSpectator()) { //TODO disabled for now. PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player); @@ -134,9 +134,9 @@ public class ItemWingsOfTheBats extends ItemBase { } } else { if (wingsEquipped && data.batWingsFlyTime < MAX_FLY_TIME) { - player.abilities.mayfly = true; + player.getAbilities().mayfly = true; - if (player.abilities.flying) { + if (player.getAbilities().flying) { data.batWingsFlyTime++; if (player.level.getLevelData().getGameTime() % 10 == 0) { @@ -150,16 +150,16 @@ public class ItemWingsOfTheBats extends ItemBase { data.shouldDisableBatWings = true; shouldSend = true; - player.abilities.mayfly = false; - player.abilities.flying = false; - player.abilities.invulnerable = false; + player.getAbilities().mayfly = false; + player.getAbilities().flying = false; + player.getAbilities().invulnerable = false; } } if (tryDeduct && data.batWingsFlyTime > 0) { int deductTime = 0; - if (!player.abilities.flying) { + if (!player.getAbilities().flying) { deductTime = 2; } else { BlockPos pos = new BlockPos(player.getX(), player.getY() + player.getBbHeight(), player.getZ()); @@ -184,13 +184,13 @@ public class ItemWingsOfTheBats extends ItemBase { } } else { if (data.hasBatWings) { - player.abilities.mayfly = true; + player.getAbilities().mayfly = true; } else if (data.shouldDisableBatWings) { //so that other modded flying won't be disabled data.shouldDisableBatWings = false; - player.abilities.mayfly = false; - player.abilities.flying = false; - player.abilities.invulnerable = false; + player.getAbilities().mayfly = false; + player.getAbilities().flying = false; + player.getAbilities().invulnerable = false; } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/Sack.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/Sack.java index a9cfdc28b..ba268c8ee 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/Sack.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/Sack.java @@ -16,19 +16,19 @@ import de.ellpeck.actuallyadditions.mod.sack.SackData; import de.ellpeck.actuallyadditions.mod.sack.SackManager; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.inventory.container.SimpleNamedContainerProvider; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemUseContext; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResult; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.world.World; -import net.minecraftforge.fml.network.NetworkHooks; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.SimpleMenuProvider; +import net.minecraft.world.entity.player.Player; +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.minecraftforge.items.CapabilityItemHandler; +import net.minecraftforge.network.NetworkHooks; import java.util.UUID; @@ -41,10 +41,10 @@ public class Sack extends ItemBase { } @Override - public ActionResultType useOn(ItemUseContext context) { + public InteractionResult useOn(UseOnContext context) { ItemStack stack = context.getPlayer().getItemInHand(context.getHand()); if (!this.isVoid) { - TileEntity tile = context.getLevel().getBlockEntity(context.getClickedPos()); + BlockEntity tile = context.getLevel().getBlockEntity(context.getClickedPos()); if (tile != null) { if (!context.getLevel().isClientSide) { ItemStackHandlerAA inv = new ItemStackHandlerAA(28); @@ -78,28 +78,28 @@ public class Sack extends ItemBase { DrillItem.writeSlotsToNBT(inv, stack); } } - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; } } - return ActionResultType.PASS; + return InteractionResult.PASS; } @Override - public ActionResult use(World world, PlayerEntity player, Hand hand) { + public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { ItemStack sackStack = player.getItemInHand(hand); - if (!world.isClientSide && hand == Hand.MAIN_HAND && sackStack.getItem() instanceof Sack && player instanceof ServerPlayerEntity) { + if (!world.isClientSide && hand == InteractionHand.MAIN_HAND && sackStack.getItem() instanceof Sack && player instanceof ServerPlayer) { if (!isVoid) { SackData data = getData(sackStack); if (data == null) - return ActionResult.fail(sackStack); + return InteractionResultHolder.fail(sackStack); UUID uuid = data.getUuid(); data.updateAccessRecords(player.getName().getString(), System.currentTimeMillis()); - NetworkHooks.openGui((ServerPlayerEntity) player, new SimpleNamedContainerProvider((id, inv, entity) -> + NetworkHooks.openGui((ServerPlayer) player, new SimpleMenuProvider((id, inv, entity) -> new SackContainer(id, inv, uuid, data.getSpecialHandler()), sackStack.getHoverName()), (buffer -> buffer.writeUUID(uuid))); } @@ -108,14 +108,14 @@ public class Sack extends ItemBase { new SimpleNamedContainerProvider((windowId, playerInventory, playerEntity) -> new ContainerBag(windowId, playerInventory, playerEntity.getItemInHand(hand), this.isVoid), StringTextComponent.EMPTY));*/ } - return ActionResult.pass(player.getItemInHand(hand)); + return InteractionResultHolder.pass(player.getItemInHand(hand)); } public static SackData getData(ItemStack stack) { if (!(stack.getItem() instanceof Sack)) return null; UUID uuid; - CompoundNBT tag = stack.getOrCreateTag(); + CompoundTag tag = stack.getOrCreateTag(); if (!tag.contains("UUID")) { uuid = UUID.randomUUID(); tag.putUUID("UUID", uuid); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/Worm.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/Worm.java index 525990ba2..5047ecdc9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/Worm.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/Worm.java @@ -14,15 +14,15 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.config.CommonConfig; import de.ellpeck.actuallyadditions.mod.entity.EntityWorm; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemUseContext; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.item.ItemEntity; +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.Blocks; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.AABB; import net.minecraftforge.event.entity.player.UseHoeEvent; import net.minecraftforge.eventbus.api.Event; @@ -35,16 +35,16 @@ public class Worm extends ItemBase { } @Override - public ActionResultType useOn(ItemUseContext context) { + public InteractionResult useOn(UseOnContext context) { BlockPos pos = context.getClickedPos(); ItemStack stack = context.getPlayer().getItemInHand(context.getHand()); - World level = context.getLevel(); + Level level = context.getLevel(); BlockState state = level.getBlockState(pos); if (level.isClientSide || !EntityWorm.canWormify(level, context.getClickedPos(), state)) return super.useOn(context); - List worms = level.getEntitiesOfClass(EntityWorm.class, new AxisAlignedBB(pos.getX() - 1, pos.getY(), pos.getZ() - 1, pos.getX() + 2, pos.getY() + 1, pos.getZ() + 2)); + List worms = level.getEntitiesOfClass(EntityWorm.class, new AABB(pos.getX() - 1, pos.getY(), pos.getZ() - 1, pos.getX() + 2, pos.getY() + 1, pos.getZ() + 2)); if (!worms.isEmpty()) return super.useOn(context); @@ -55,11 +55,11 @@ public class Worm extends ItemBase { if (!context.getPlayer().isCreative()) stack.shrink(1); - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; } public static void onHoe(UseHoeEvent event) { - World level = event.getEntity().level; + Level level = event.getEntity().level; if (level.isClientSide || !CommonConfig.Other.WORMS.get() || event.getResult() == Event.Result.DENY) return; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ActuallyItem.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ActuallyItem.java index 8a27bcfe4..ff1ab2cd4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ActuallyItem.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ActuallyItem.java @@ -1,7 +1,7 @@ package de.ellpeck.actuallyadditions.mod.items.base; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import net.minecraft.item.Item; +import net.minecraft.world.item.Item; /** * I'm using a custom class here as I'm sure we'll need a unified way of declaring rules diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java index cc6533b1f..9714abed2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java @@ -12,20 +12,18 @@ package de.ellpeck.actuallyadditions.mod.items.base; import de.ellpeck.actuallyadditions.api.misc.IDisableableItem; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; -import net.minecraft.inventory.EquipmentSlotType; -import net.minecraft.item.ArmorItem; -import net.minecraft.item.IArmorMaterial; - -import net.minecraft.item.Item.Properties; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.ArmorItem; +import net.minecraft.world.item.ArmorMaterial; public class ItemArmorAA extends ArmorItem implements IDisableableItem { private final boolean disabled; - public ItemArmorAA(IArmorMaterial material, EquipmentSlotType type) { + public ItemArmorAA(ArmorMaterial material, EquipmentSlot type) { this(material, type, ActuallyItems.defaultProps()); } - public ItemArmorAA(IArmorMaterial material, EquipmentSlotType type, Properties properties) { + public ItemArmorAA(ArmorMaterial material, EquipmentSlot type, Properties properties) { super(material, type, properties); this.disabled = false; // this.disabled = ConfigurationHandler.config.getBoolean("Disable: " + StringUtil.badTranslate(this.name), "Tool Control", false, "This will disable the " + StringUtil.badTranslate(this.name) + ". It will not be registered."); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemBase.java index 3ef106511..8b674b41d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemBase.java @@ -11,9 +11,7 @@ package de.ellpeck.actuallyadditions.mod.items.base; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; -import net.minecraft.item.Item; - -import net.minecraft.item.Item.Properties; +import net.minecraft.world.item.Item; public class ItemBase extends Item { public ItemBase(Properties props) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java index 83f0261e2..b179150ee 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java @@ -12,15 +12,15 @@ package de.ellpeck.actuallyadditions.mod.items.base; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import de.ellpeck.actuallyadditions.mod.tile.CustomEnergyStorage; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.item.ItemGroup; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.Direction; -import net.minecraft.util.NonNullList; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.World; +import net.minecraft.core.Direction; +import net.minecraft.core.NonNullList; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.capabilities.Capability; @@ -34,7 +34,6 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.text.NumberFormat; import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; public abstract class ItemEnergy extends ItemBase { @@ -54,14 +53,14 @@ public abstract class ItemEnergy extends ItemBase { @OnlyIn(Dist.CLIENT) @Override - public void appendHoverText(ItemStack stack, @Nullable World worldIn, List tooltip, ITooltipFlag flagIn) { + public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List tooltip, TooltipFlag flagIn) { super.appendHoverText(stack, worldIn, tooltip, flagIn); int energy = 0; if (stack.hasTag() && stack.getTag().contains("Energy")) { energy = stack.getTag().getInt("Energy"); } NumberFormat format = NumberFormat.getInstance(); - tooltip.add(new TranslationTextComponent("misc.actuallyadditions.power_long", format.format(energy), format.format(this.maxPower))); + tooltip.add(new TranslatableComponent("misc.actuallyadditions.power_long", format.format(energy), format.format(this.maxPower))); } @Override @@ -70,7 +69,7 @@ public abstract class ItemEnergy extends ItemBase { } @Override - public void fillItemCategory(ItemGroup group, NonNullList items) { + public void fillItemCategory(CreativeModeTab group, NonNullList items) { super.fillItemCategory(group, items); if (!this.allowdedIn(group)) { return; @@ -82,23 +81,23 @@ public abstract class ItemEnergy extends ItemBase { } @Override - public boolean showDurabilityBar(ItemStack itemStack) { + public boolean isBarVisible(ItemStack itemStack) { return true; } @Override - public double getDurabilityForDisplay(ItemStack stack) { + public int getBarWidth(ItemStack stack) { if (stack.hasTag() && stack.getTag().contains("Energy")) { - return 1 - (stack.getTag().getDouble("Energy") / this.maxPower); + return (int)(1 - (stack.getTag().getDouble("Energy") / this.maxPower)); } return 1; } @Override - public int getRGBDurabilityForDisplay(ItemStack stack) { + public int getBarColor(ItemStack stack) { //float[] color = AssetUtil.getWheelColor(player.level.getGameTime() % 256); //return MathHelper.color(color[0] / 255F, color[1] / 255F, color[2] / 255F); - return super.getRGBDurabilityForDisplay(stack); + return super.getBarColor(stack); } public void setEnergy(ItemStack stack, int energy) { @@ -150,11 +149,11 @@ public abstract class ItemEnergy extends ItemBase { } @Override - public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { + public ICapabilityProvider initCapabilities(ItemStack stack, CompoundTag nbt) { return new EnergyCapabilityProvider(stack, this); } - private static class EnergyCapabilityProvider implements ICapabilitySerializable { + private static class EnergyCapabilityProvider implements ICapabilitySerializable { public final CustomEnergyStorage storage; private final LazyOptional energyCapability; @@ -177,15 +176,15 @@ public abstract class ItemEnergy extends ItemBase { } @Override - public CompoundNBT serializeNBT() { + public CompoundTag serializeNBT() { if (this.storage.isDirty()) stack.getOrCreateTag().putInt("Energy", this.storage.getEnergyStored()); this.storage.clearDirty(); - return new CompoundNBT(); + return new CompoundTag(); } @Override - public void deserializeNBT(CompoundNBT nbt) { + public void deserializeNBT(CompoundTag nbt) { if (stack.getOrCreateTag().contains("Energy")) this.storage.setEnergyStored(stack.getOrCreateTag().getInt("Energy")); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemFoodSeed.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemFoodSeed.java index 117d40b8a..5f8503b9c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemFoodSeed.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemFoodSeed.java @@ -11,12 +11,12 @@ package de.ellpeck.actuallyadditions.mod.items.base; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockReader; +import net.minecraft.core.BlockPos; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; public class ItemFoodSeed /*extends ItemSeedFood */{ //TODO what is this?! @@ -43,7 +43,7 @@ public class ItemFoodSeed /*extends ItemSeedFood */{ //TODO what is this?! } //@Override - public BlockState getPlant(IBlockReader world, BlockPos pos) { + public BlockState getPlant(BlockGetter world, BlockPos pos) { return this.plant.defaultBlockState(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemHoeAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemHoeAA.java index 59460ba1c..89d0d5770 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemHoeAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemHoeAA.java @@ -11,21 +11,20 @@ package de.ellpeck.actuallyadditions.mod.items.base; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import net.minecraft.item.HoeItem; -import net.minecraft.item.IItemTier; -import net.minecraftforge.common.ToolType; +import net.minecraft.world.item.HoeItem; +import net.minecraft.world.item.Tier; public class ItemHoeAA extends HoeItem { - private IItemTier tier; - public ItemHoeAA(IItemTier tier) { + private Tier tier; + public ItemHoeAA(Tier tier) { super(tier, 4, -2f, new Properties() - .addToolType(ToolType.AXE, tier.getLevel()) - .addToolType(ToolType.HOE, tier.getLevel()) - .addToolType(ToolType.SHOVEL, tier.getLevel()) - .addToolType(ToolType.PICKAXE, tier.getLevel()) +// .addToolType(ToolType.AXE, tier.getLevel()) +// .addToolType(ToolType.HOE, tier.getLevel()) +// .addToolType(ToolType.SHOVEL, tier.getLevel()) +// .addToolType(ToolType.PICKAXE, tier.getLevel()) .durability(tier.getUses() * 4) .tab(ActuallyAdditions.GROUP) ); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSeed.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSeed.java index 5242d4608..93d8fa5e6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSeed.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSeed.java @@ -11,11 +11,11 @@ package de.ellpeck.actuallyadditions.mod.items.base; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.item.Item; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockReader; +import net.minecraft.core.BlockPos; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; public class ItemSeed /* extends ItemSeeds*/ { @@ -33,7 +33,7 @@ public class ItemSeed /* extends ItemSeeds*/ { } //@Override - public BlockState getPlant(IBlockReader world, BlockPos pos) { + public BlockState getPlant(BlockGetter world, BlockPos pos) { return this.plant.defaultBlockState(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSwordAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSwordAA.java index 8fb8fe588..cdd1caee5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSwordAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSwordAA.java @@ -11,21 +11,20 @@ package de.ellpeck.actuallyadditions.mod.items.base; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import net.minecraft.item.IItemTier; -import net.minecraft.item.SwordItem; -import net.minecraftforge.common.ToolType; +import net.minecraft.world.item.SwordItem; +import net.minecraft.world.item.Tier; public class ItemSwordAA extends SwordItem { - private IItemTier tier; - public ItemSwordAA(IItemTier tier) { + private Tier tier; + public ItemSwordAA(Tier tier) { super(tier, (int) tier.getAttackDamageBonus(), tier.getSpeed(), new Properties() - .addToolType(ToolType.AXE, tier.getLevel()) - .addToolType(ToolType.HOE, tier.getLevel()) - .addToolType(ToolType.SHOVEL, tier.getLevel()) - .addToolType(ToolType.PICKAXE, tier.getLevel()) +// .addToolType(ToolType.AXE, tier.getLevel()) +// .addToolType(ToolType.HOE, tier.getLevel()) +// .addToolType(ToolType.SHOVEL, tier.getLevel()) +// .addToolType(ToolType.PICKAXE, tier.getLevel()) .durability(tier.getUses() * 4) .tab(ActuallyAdditions.GROUP) ); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemToolAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemToolAA.java index 55fe22001..2ea59d686 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemToolAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemToolAA.java @@ -13,23 +13,24 @@ package de.ellpeck.actuallyadditions.mod.items.base; import de.ellpeck.actuallyadditions.api.misc.IDisableableItem; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.Block; -import net.minecraft.item.IItemTier; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ToolItem; -import net.minecraft.tags.ITag; +import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.DiggerItem; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Tier; +import net.minecraft.world.level.block.Block; import java.util.Set; -public class ItemToolAA extends ToolItem implements IDisableableItem { +public class ItemToolAA extends DiggerItem implements IDisableableItem { private final String name; private final ItemStack repairItem; - private final ITag repairTag; + private final TagKey repairTag; private final boolean disabled; - public ItemToolAA(float p_i48512_1_, float p_i48512_2_, IItemTier p_i48512_3_, Set p_i48512_4_, Properties p_i48512_5_, String name, ItemStack repairItem, ITag repairTag) { + public ItemToolAA(float p_i48512_1_, float p_i48512_2_, Tier p_i48512_3_, TagKey p_i48512_4_, Properties p_i48512_5_, String name, ItemStack repairItem, TagKey repairTag) { super(p_i48512_1_, p_i48512_2_, p_i48512_3_, p_i48512_4_, p_i48512_5_); this.name = name; @@ -63,7 +64,7 @@ public class ItemToolAA extends ToolItem implements IDisableableItem { if (StackUtil.isValid(this.repairItem)) { return ItemUtil.areItemsEqual(this.repairItem, stack, false); } else if (this.repairTag != null) { - return repairTag.contains(stack.getItem()); + return stack.is(repairTag); } return false; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java index 9b0267e30..f93d77faf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java @@ -14,14 +14,14 @@ import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.lens.Lens; import de.ellpeck.actuallyadditions.mod.crafting.ColorChangeRecipe; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.item.BlockItem; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Direction; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.AABB; import java.util.List; import java.util.Random; @@ -62,12 +62,12 @@ public class LensColor extends Lens { } } - List items = tile.getWorldObject().getEntitiesOfClass(ItemEntity.class, new AxisAlignedBB(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX() + 1, hitBlock.getY() + 1, hitBlock.getZ() + 1)); + List items = tile.getWorldObject().getEntitiesOfClass(ItemEntity.class, new AABB(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX() + 1, hitBlock.getY() + 1, hitBlock.getZ() + 1)); for (ItemEntity item : items) { if (item.isAlive() && !item.getItem().isEmpty() && tile.getEnergy() >= ENERGY_USE) { ItemStack newStack = this.tryConvert(item.getItem()); if (StackUtil.isValid(newStack)) { - item.remove(); + item.discard(); ItemEntity newItem = new ItemEntity(tile.getWorldObject(), item.getX(), item.getY(), item.getZ(), newStack); tile.getWorldObject().addFreshEntity(newItem); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDeath.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDeath.java index af7e07a96..f38985e0c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDeath.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDeath.java @@ -13,10 +13,10 @@ package de.ellpeck.actuallyadditions.mod.items.lens; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.lens.Lens; import de.ellpeck.actuallyadditions.mod.misc.DamageSources; -import net.minecraft.block.BlockState; -import net.minecraft.entity.LivingEntity; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.AABB; import java.util.List; @@ -24,7 +24,7 @@ public class LensDeath extends Lens { @Override public boolean invoke(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) { - List entities = tile.getWorldObject().getEntitiesOfClass(LivingEntity.class, new AxisAlignedBB(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX() + 1, hitBlock.getY() + 1, hitBlock.getZ() + 1)); + List entities = tile.getWorldObject().getEntitiesOfClass(LivingEntity.class, new AABB(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX() + 1, hitBlock.getY() + 1, hitBlock.getZ() + 1)); for (LivingEntity entity : entities) { int use = this.getUsePerEntity(); if (tile.getEnergy() >= use) { @@ -34,7 +34,7 @@ public class LensDeath extends Lens { } } - return !hitState.getBlock().isAir(hitState, tile.getWorldObject(), hitBlock); + return !hitState.isAir(); } protected void onAttacked(LivingEntity entity, IAtomicReconstructor tile) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDetonation.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDetonation.java index 044db3344..336fa5596 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDetonation.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDetonation.java @@ -12,10 +12,10 @@ package de.ellpeck.actuallyadditions.mod.items.lens; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.lens.Lens; -import net.minecraft.block.BlockState; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.Explosion; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.Explosion; +import net.minecraft.world.level.block.state.BlockState; public class LensDetonation extends Lens { @@ -23,9 +23,9 @@ public class LensDetonation extends Lens { @Override public boolean invoke(BlockState state, BlockPos hitBlock, IAtomicReconstructor tile) { - if (hitBlock != null && !state.getBlock().isAir(state, tile.getWorldObject(), hitBlock)) { + if (hitBlock != null && !state.isAir()) { if (tile.getEnergy() >= ENERGY_USE) { - tile.getWorldObject().explode(null, hitBlock.getX() + 0.5, hitBlock.getY() + 0.5, hitBlock.getZ() + 0.5, 10F, true, Explosion.Mode.NONE); // TODO: [port][test] make sure this is the right explosion mode + tile.getWorldObject().explode(null, hitBlock.getX() + 0.5, hitBlock.getY() + 0.5, hitBlock.getZ() + 0.5, 10F, true, Explosion.BlockInteraction.NONE); // TODO: [port][test] make sure this is the right explosion mode tile.extractEnergy(ENERGY_USE); } return true; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisenchanting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisenchanting.java index b4d5ad260..a20cb421b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisenchanting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisenchanting.java @@ -14,18 +14,18 @@ import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.lens.Lens; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.BlockState; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentData; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.item.EnchantedBookItem; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.util.Direction; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.item.EnchantedBookItem; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.item.enchantment.EnchantmentHelper; +import net.minecraft.world.item.enchantment.EnchantmentInstance; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.AABB; import java.util.List; import java.util.Map; @@ -37,7 +37,7 @@ public class LensDisenchanting extends Lens { @Override public boolean invoke(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) { if (tile.getEnergy() >= ENERGY_USE) { - List items = tile.getWorldObject().getEntitiesOfClass(ItemEntity.class, new AxisAlignedBB(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX() + 1, hitBlock.getY() + 1, hitBlock.getZ() + 1)); + List items = tile.getWorldObject().getEntitiesOfClass(ItemEntity.class, new AABB(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX() + 1, hitBlock.getY() + 1, hitBlock.getZ() + 1)); if (items != null && !items.isEmpty()) { ItemEntity book = null; ItemEntity toDisenchant = null; @@ -84,12 +84,12 @@ public class LensDisenchanting extends Lens { } ItemUtil.removeEnchantment(newDisenchantStack, enchant); - EnchantedBookItem.addEnchantment(newBookStack, new EnchantmentData(enchant, level)); + EnchantedBookItem.addEnchantment(newBookStack, new EnchantmentInstance(enchant, level)); ItemEntity disenchanted = new ItemEntity(toDisenchant.getCommandSenderWorld(), toDisenchant.getX(), toDisenchant.getY(), toDisenchant.getZ(), newDisenchantStack); ItemEntity newBook = new ItemEntity(book.getCommandSenderWorld(), book.getX(), book.getY(), book.getZ(), newBookStack); - toDisenchant.remove(); - book.remove(); + toDisenchant.discard(); + book.discard(); tile.getWorldObject().addFreshEntity(newBook); tile.getWorldObject().addFreshEntity(disenchanted); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensKiller.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensKiller.java index f763a94ef..9e5178cd2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensKiller.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensKiller.java @@ -11,9 +11,9 @@ package de.ellpeck.actuallyadditions.mod.items.lens; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; -import net.minecraft.entity.LivingEntity; -import net.minecraft.util.DamageSource; -import net.minecraft.world.server.ServerWorld; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.LivingEntity; import net.minecraftforge.common.util.FakePlayerFactory; public class LensKiller extends LensDeath { @@ -21,7 +21,7 @@ public class LensKiller extends LensDeath { @Override protected void onAttacked(LivingEntity entity, IAtomicReconstructor tile) { if (!tile.getWorldObject().isClientSide) { - entity.hurt(DamageSource.playerAttack(FakePlayerFactory.getMinecraft((ServerWorld) tile.getWorldObject())), 20); + entity.hurt(DamageSource.playerAttack(FakePlayerFactory.getMinecraft((ServerLevel) tile.getWorldObject())), 20); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensMining.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensMining.java index d43fedef4..b235f1596 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensMining.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensMining.java @@ -13,24 +13,18 @@ package de.ellpeck.actuallyadditions.mod.items.lens; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.lens.Lens; -import de.ellpeck.actuallyadditions.api.recipe.WeightedOre; import de.ellpeck.actuallyadditions.mod.config.CommonConfig; -import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.crafting.MiningLensRecipe; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.NetherrackBlock; -import net.minecraft.item.BlockItem; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.WeightedRandom; -import net.minecraft.util.math.BlockPos; -import net.minecraftforge.common.Tags; +import net.minecraft.core.BlockPos; +import net.minecraft.util.random.WeightedRandom; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; import java.util.ArrayList; -import java.util.Collections; import java.util.List; -import java.util.stream.Collectors; +import java.util.Optional; public class LensMining extends Lens { @@ -104,11 +98,11 @@ public class LensMining extends Lens { if (!ores.isEmpty()) { int totalWeight = WeightedRandom.getTotalWeight(ores); - MiningLensRecipe ore = WeightedRandom.getRandomItem(tile.getWorldObject().random, ores); + Optional ore = WeightedRandom.getRandomItem(tile.getWorldObject().random, ores); - ItemStack stack = ore.getResultItem().copy(); + ItemStack stack = ore.map(recipe -> recipe.getResultItem().copy()).orElse(ItemStack.EMPTY); - if (stack.getItem() instanceof BlockItem) { + if (!stack.isEmpty() && stack.getItem() instanceof BlockItem) { Block toPlace = Block.byItem(stack.getItem()); BlockState state2Place = toPlace.defaultBlockState(); tile.getWorldObject().setBlock(hitPos, state2Place, 2); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/Crystals.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/Crystals.java index 5fe15bc8b..01d8f97d0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/Crystals.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/Crystals.java @@ -10,9 +10,9 @@ package de.ellpeck.actuallyadditions.mod.items.metalists; -import net.minecraft.util.IStringSerializable; +import net.minecraft.util.StringRepresentable; -public enum Crystals implements IStringSerializable { +public enum Crystals implements StringRepresentable { REDSTONE("red", 0xFF2F21, 0x9e2b27), LAPIS("blue", 0x5171FF, 0x253293), DIAMOND("light_blue", 0x35F1FF, 0x6387d2), diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/TheDusts.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/TheDusts.java index 77d43a763..78ecc7bc0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/TheDusts.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/TheDusts.java @@ -10,7 +10,7 @@ package de.ellpeck.actuallyadditions.mod.items.metalists; -import net.minecraft.item.Rarity; +import net.minecraft.world.item.Rarity; @Deprecated public enum TheDusts { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/TheFoods.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/TheFoods.java index 0ff958bcd..cc130cca3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/TheFoods.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/TheFoods.java @@ -11,9 +11,9 @@ package de.ellpeck.actuallyadditions.mod.items.metalists; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.item.Rarity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.Rarity; @Deprecated public enum TheFoods { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/TheJams.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/TheJams.java index efff4a1e3..350879b62 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/TheJams.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/TheJams.java @@ -10,7 +10,7 @@ package de.ellpeck.actuallyadditions.mod.items.metalists; -import net.minecraft.item.Rarity; +import net.minecraft.world.item.Rarity; @Deprecated public enum TheJams { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/ThePotionRings.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/ThePotionRings.java index 633763961..e44d51bf8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/ThePotionRings.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/ThePotionRings.java @@ -10,19 +10,19 @@ package de.ellpeck.actuallyadditions.mod.items.metalists; -import net.minecraft.block.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.item.Rarity; -import net.minecraft.potion.Effect; -import net.minecraft.potion.Effects; +import net.minecraft.world.effect.MobEffect; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.Rarity; +import net.minecraft.world.level.block.Blocks; @Deprecated public enum ThePotionRings { SPEED( 8171462, - Effects.MOVEMENT_SPEED, + MobEffects.MOVEMENT_SPEED, 0, 1, 10, @@ -32,7 +32,7 @@ public enum ThePotionRings { ), HASTE( 14270531, - Effects.DIG_SPEED, + MobEffects.DIG_SPEED, 0, 1, 10, @@ -42,7 +42,7 @@ public enum ThePotionRings { ), STRENGTH( 9643043, - Effects.DAMAGE_BOOST, + MobEffects.DAMAGE_BOOST, 0, 1, 10, @@ -52,7 +52,7 @@ public enum ThePotionRings { ), JUMP_BOOST( 7889559, - Effects.JUMP, + MobEffects.JUMP, 0, 1, 10, @@ -62,7 +62,7 @@ public enum ThePotionRings { ), REGEN( 13458603, - Effects.REGENERATION, + MobEffects.REGENERATION, 0, 1, 50, @@ -72,7 +72,7 @@ public enum ThePotionRings { ), RESISTANCE( 10044730, - Effects.DAMAGE_RESISTANCE, + MobEffects.DAMAGE_RESISTANCE, 0, 1, 10, @@ -82,7 +82,7 @@ public enum ThePotionRings { ), FIRE_RESISTANCE( 14981690, - Effects.FIRE_RESISTANCE, + MobEffects.FIRE_RESISTANCE, 0, 0, 10, @@ -92,7 +92,7 @@ public enum ThePotionRings { ), WATER_BREATHING( 3035801, - Effects.WATER_BREATHING, + MobEffects.WATER_BREATHING, 0, 0, 10, @@ -102,7 +102,7 @@ public enum ThePotionRings { ), INVISIBILITY( 8356754, - Effects.INVISIBILITY, + MobEffects.INVISIBILITY, 0, 0, 10, @@ -112,7 +112,7 @@ public enum ThePotionRings { ), NIGHT_VISION( 2039713, - Effects.NIGHT_VISION, + MobEffects.NIGHT_VISION, 0, 0, 300, @@ -124,14 +124,14 @@ public enum ThePotionRings { public final String name; public final int color; public final Rarity rarity; - public final Effect effect; + public final MobEffect effect; public final int normalAmplifier; public final int advancedAmplifier; public final int activeTime; public final boolean needsWaitBeforeActivating; public final ItemStack craftingItem; - ThePotionRings(int color, Effect effect, int normalAmplifier, int advancedAmplifier, int activeTime, boolean needsWaitBeforeActivating, Rarity rarity, ItemStack craftingItem) { + ThePotionRings(int color, MobEffect effect, int normalAmplifier, int advancedAmplifier, int activeTime, boolean needsWaitBeforeActivating, Rarity rarity, ItemStack craftingItem) { this.name = effect.getDisplayName().getString(); this.color = color; this.rarity = rarity; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/misc/YummyItem.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/misc/YummyItem.java index 2640d26b9..c85444e2a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/misc/YummyItem.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/misc/YummyItem.java @@ -3,9 +3,9 @@ package de.ellpeck.actuallyadditions.mod.items.misc; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import de.ellpeck.actuallyadditions.mod.items.base.ActuallyItem; -import net.minecraft.item.Food; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; +import net.minecraft.world.food.FoodProperties; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; public class YummyItem extends ActuallyItem { private final Foods food; @@ -17,45 +17,45 @@ public class YummyItem extends ActuallyItem { } public enum Foods { - CHEESE(new Food.Builder().nutrition(1).saturationMod(0.05F), 3), - PUMPKIN_STEW(new Food.Builder().nutrition(6).saturationMod(0.3F), 30, true, new ItemStack(Items.BOWL)), - CARROT_JUICE(new Food.Builder().nutrition(4).saturationMod(0.2F), 20, true, new ItemStack(Items.GLASS_BOTTLE)), - FISH_N_CHIPS(new Food.Builder().nutrition(14).saturationMod(0.65F), 40, new ItemStack(ActuallyItems.PAPER_CONE.get())), - FRENCH_FRIES(new Food.Builder().nutrition(10).saturationMod(0.6F), 32, new ItemStack(ActuallyItems.PAPER_CONE.get())), - FRENCH_FRY(new Food.Builder().nutrition(2).saturationMod(0.025F), 3), - SPAGHETTI(new Food.Builder().nutrition(7).saturationMod(0.4F), 38, new ItemStack(Items.BOWL)), - NOODLE(new Food.Builder().nutrition(1).saturationMod(0.01F), 3), - CHOCOLATE_CAKE(new Food.Builder().nutrition(16).saturationMod(0.8F), 45), - CHOCOLATE(new Food.Builder().nutrition(3).saturationMod(0.3F), 15), - TOAST(new Food.Builder().nutrition(3).saturationMod(0.08F), 25), - SUBMARINE_SANDWICH(new Food.Builder().nutrition(9).saturationMod(0.4F), 40), - BIG_COOKIE(new Food.Builder().nutrition(4).saturationMod(0.25F), 20), - HAMBURGER(new Food.Builder().nutrition(13).saturationMod(0.65F), 40), - PIZZA(new Food.Builder().nutrition(16).saturationMod(0.8F), 45), - BAGUETTE(new Food.Builder().nutrition(6).saturationMod(0.5F), 25), - RICE(new Food.Builder().nutrition(2).saturationMod(0.05F), 10), - RICE_BREAD(new Food.Builder().nutrition(6).saturationMod(0.5F), 25), - DOUGHNUT(new Food.Builder().nutrition(2).saturationMod(0.1F), 10), - CHOCOLATE_TOAST(new Food.Builder().nutrition(5).saturationMod(0.2F), 40), - BACON(new Food.Builder().nutrition(4).saturationMod(0.1F), 30); + CHEESE(new FoodProperties.Builder().nutrition(1).saturationMod(0.05F), 3), + PUMPKIN_STEW(new FoodProperties.Builder().nutrition(6).saturationMod(0.3F), 30, true, new ItemStack(Items.BOWL)), + CARROT_JUICE(new FoodProperties.Builder().nutrition(4).saturationMod(0.2F), 20, true, new ItemStack(Items.GLASS_BOTTLE)), + FISH_N_CHIPS(new FoodProperties.Builder().nutrition(14).saturationMod(0.65F), 40, new ItemStack(ActuallyItems.PAPER_CONE.get())), + FRENCH_FRIES(new FoodProperties.Builder().nutrition(10).saturationMod(0.6F), 32, new ItemStack(ActuallyItems.PAPER_CONE.get())), + FRENCH_FRY(new FoodProperties.Builder().nutrition(2).saturationMod(0.025F), 3), + SPAGHETTI(new FoodProperties.Builder().nutrition(7).saturationMod(0.4F), 38, new ItemStack(Items.BOWL)), + NOODLE(new FoodProperties.Builder().nutrition(1).saturationMod(0.01F), 3), + CHOCOLATE_CAKE(new FoodProperties.Builder().nutrition(16).saturationMod(0.8F), 45), + CHOCOLATE(new FoodProperties.Builder().nutrition(3).saturationMod(0.3F), 15), + TOAST(new FoodProperties.Builder().nutrition(3).saturationMod(0.08F), 25), + SUBMARINE_SANDWICH(new FoodProperties.Builder().nutrition(9).saturationMod(0.4F), 40), + BIG_COOKIE(new FoodProperties.Builder().nutrition(4).saturationMod(0.25F), 20), + HAMBURGER(new FoodProperties.Builder().nutrition(13).saturationMod(0.65F), 40), + PIZZA(new FoodProperties.Builder().nutrition(16).saturationMod(0.8F), 45), + BAGUETTE(new FoodProperties.Builder().nutrition(6).saturationMod(0.5F), 25), + RICE(new FoodProperties.Builder().nutrition(2).saturationMod(0.05F), 10), + RICE_BREAD(new FoodProperties.Builder().nutrition(6).saturationMod(0.5F), 25), + DOUGHNUT(new FoodProperties.Builder().nutrition(2).saturationMod(0.1F), 10), + CHOCOLATE_TOAST(new FoodProperties.Builder().nutrition(5).saturationMod(0.2F), 40), + BACON(new FoodProperties.Builder().nutrition(4).saturationMod(0.1F), 30); - Food food; + FoodProperties food; int useDuration; boolean isDrunken; ItemStack returnItem; - Foods(Food.Builder food, int useDuration, boolean isDrunken, ItemStack returnItem) { + Foods(FoodProperties.Builder food, int useDuration, boolean isDrunken, ItemStack returnItem) { this.food = food.build(); this.useDuration = useDuration; this.isDrunken = isDrunken; this.returnItem = returnItem; } - Foods(Food.Builder food, int useDuration) { + Foods(FoodProperties.Builder food, int useDuration) { this(food, useDuration, false, ItemStack.EMPTY); } - Foods(Food.Builder food, int useDuration, ItemStack returnItem) { + Foods(FoodProperties.Builder food, int useDuration, ItemStack returnItem) { this(food, useDuration, false, returnItem); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/EmpowererRecipeCategory.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/EmpowererRecipeCategory.java index beae11afb..c7a3f9d8d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/EmpowererRecipeCategory.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/EmpowererRecipeCategory.java @@ -1,97 +1,97 @@ -/* - * This file ("EmpowererRecipeCategory.java") is part of the Actually Additions mod for Minecraft. - * It is created and owned by Ellpeck and distributed - * under the Actually Additions License to be found at - * http://ellpeck.de/actaddlicense - * View the source code at https://github.com/Ellpeck/ActuallyAdditions - * - * © 2015-2017 Ellpeck - */ - -package de.ellpeck.actuallyadditions.mod.jei; - -import java.util.ArrayList; -import java.util.Arrays; - -import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe; -import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import mezz.jei.api.constants.VanillaTypes; -import mezz.jei.api.gui.IRecipeLayout; -import mezz.jei.api.gui.drawable.IDrawable; -import mezz.jei.api.gui.drawable.IDrawableStatic; -import mezz.jei.api.helpers.IGuiHelper; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.category.IRecipeCategory; -import net.minecraft.client.resources.I18n; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; - -public class EmpowererRecipeCategory implements IRecipeCategory { - - public static final ResourceLocation ID = new ResourceLocation(ActuallyAdditions.MODID, "empowerer_jei"); - - private final IDrawableStatic background; - - public EmpowererRecipeCategory(IGuiHelper helper) { - this.background = helper.drawableBuilder(AssetUtil.getGuiLocation("gui_nei_empowerer"), 0, 0, 135, 80).setTextureSize(256,256).build(); - } - - @Override - public ResourceLocation getUid() { - return ID; - } - - @Override - public Class getRecipeClass() { - return EmpowererRecipe.class; - } - - @Override - public String getTitle() { - return I18n.get("container.actuallyadditions.empowerer"); - } - - @Override - public IDrawable getBackground() { - return background; - } - - @Override - public IDrawable getIcon() { - return null; - } - - @Override - public void setIngredients(EmpowererRecipe empowererRecipe, IIngredients ingredients) { - ArrayList input = new ArrayList<>(); - input.addAll(Arrays.asList(empowererRecipe.getInput().getItems())); - input.addAll(Arrays.asList(empowererRecipe.getStandOne().getItems())); - input.addAll(Arrays.asList(empowererRecipe.getStandTwo().getItems())); - input.addAll(Arrays.asList(empowererRecipe.getStandThree().getItems())); - input.addAll(Arrays.asList(empowererRecipe.getStandFour().getItems())); - ingredients.setInputs(VanillaTypes.ITEM, input); - ingredients.setOutput(VanillaTypes.ITEM, empowererRecipe.getOutput()); - } - - @Override - public void setRecipe(IRecipeLayout recipeLayout, EmpowererRecipe recipe, IIngredients ingredients) { - recipeLayout.getItemStacks().init(0, true, 31, 31); - recipeLayout.getItemStacks().set(0, Arrays.asList(recipe.getInput().getItems())); - - recipeLayout.getItemStacks().init(1, true, 1, 31); - recipeLayout.getItemStacks().set(1, Arrays.asList(recipe.getStandOne().getItems())); - - recipeLayout.getItemStacks().init(2, true, 31, 1); - recipeLayout.getItemStacks().set(2, Arrays.asList(recipe.getStandTwo().getItems())); - - recipeLayout.getItemStacks().init(3, true, 61, 31); - recipeLayout.getItemStacks().set(3, Arrays.asList(recipe.getStandThree().getItems())); - - recipeLayout.getItemStacks().init(4, true, 31, 61); - recipeLayout.getItemStacks().set(4, Arrays.asList(recipe.getStandFour().getItems())); - - recipeLayout.getItemStacks().init(5, false, 112, 31); - recipeLayout.getItemStacks().set(5, recipe.getResultItem()); - } -} +///* +// * This file ("EmpowererRecipeCategory.java") is part of the Actually Additions mod for Minecraft. +// * It is created and owned by Ellpeck and distributed +// * under the Actually Additions License to be found at +// * http://ellpeck.de/actaddlicense +// * View the source code at https://github.com/Ellpeck/ActuallyAdditions +// * +// * © 2015-2017 Ellpeck +// */ +// +//package de.ellpeck.actuallyadditions.mod.jei; +// +//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; +//import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe; +//import de.ellpeck.actuallyadditions.mod.util.AssetUtil; +//import mezz.jei.api.constants.VanillaTypes; +//import mezz.jei.api.gui.IRecipeLayout; +//import mezz.jei.api.gui.drawable.IDrawable; +//import mezz.jei.api.gui.drawable.IDrawableStatic; +//import mezz.jei.api.helpers.IGuiHelper; +//import mezz.jei.api.ingredients.IIngredients; +//import mezz.jei.api.recipe.category.IRecipeCategory; +//import net.minecraft.client.resources.language.I18n; +//import net.minecraft.resources.ResourceLocation; +//import net.minecraft.world.item.ItemStack; +// +//import java.util.ArrayList; +//import java.util.Arrays; +// +//public class EmpowererRecipeCategory implements IRecipeCategory { +// +// public static final ResourceLocation ID = new ResourceLocation(ActuallyAdditions.MODID, "empowerer_jei"); +// +// private final IDrawableStatic background; +// +// public EmpowererRecipeCategory(IGuiHelper helper) { +// this.background = helper.drawableBuilder(AssetUtil.getGuiLocation("gui_nei_empowerer"), 0, 0, 135, 80).setTextureSize(256,256).build(); +// } +// +// @Override +// public ResourceLocation getUid() { +// return ID; +// } +// +// @Override +// public Class getRecipeClass() { +// return EmpowererRecipe.class; +// } +// +// @Override +// public String getTitle() { +// return I18n.get("container.actuallyadditions.empowerer"); +// } +// +// @Override +// public IDrawable getBackground() { +// return background; +// } +// +// @Override +// public IDrawable getIcon() { +// return null; +// } +// +// @Override +// public void setIngredients(EmpowererRecipe empowererRecipe, IIngredients ingredients) { +// ArrayList input = new ArrayList<>(); +// input.addAll(Arrays.asList(empowererRecipe.getInput().getItems())); +// input.addAll(Arrays.asList(empowererRecipe.getStandOne().getItems())); +// input.addAll(Arrays.asList(empowererRecipe.getStandTwo().getItems())); +// input.addAll(Arrays.asList(empowererRecipe.getStandThree().getItems())); +// input.addAll(Arrays.asList(empowererRecipe.getStandFour().getItems())); +// ingredients.setInputs(VanillaTypes.ITEM, input); +// ingredients.setOutput(VanillaTypes.ITEM, empowererRecipe.getOutput()); +// } +// +// @Override +// public void setRecipe(IRecipeLayout recipeLayout, EmpowererRecipe recipe, IIngredients ingredients) { +// recipeLayout.getItemStacks().init(0, true, 31, 31); +// recipeLayout.getItemStacks().set(0, Arrays.asList(recipe.getInput().getItems())); +// +// recipeLayout.getItemStacks().init(1, true, 1, 31); +// recipeLayout.getItemStacks().set(1, Arrays.asList(recipe.getStandOne().getItems())); +// +// recipeLayout.getItemStacks().init(2, true, 31, 1); +// recipeLayout.getItemStacks().set(2, Arrays.asList(recipe.getStandTwo().getItems())); +// +// recipeLayout.getItemStacks().init(3, true, 61, 31); +// recipeLayout.getItemStacks().set(3, Arrays.asList(recipe.getStandThree().getItems())); +// +// recipeLayout.getItemStacks().init(4, true, 31, 61); +// recipeLayout.getItemStacks().set(4, Arrays.asList(recipe.getStandFour().getItems())); +// +// recipeLayout.getItemStacks().init(5, false, 112, 31); +// recipeLayout.getItemStacks().set(5, recipe.getResultItem()); +// } +//} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/FermentingCategory.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/FermentingCategory.java index 8cebb0751..f334795ed 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/FermentingCategory.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/FermentingCategory.java @@ -1,84 +1,84 @@ -package de.ellpeck.actuallyadditions.mod.jei; - -import com.mojang.blaze3d.matrix.MatrixStack; -import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import de.ellpeck.actuallyadditions.mod.crafting.FermentingRecipe; -import de.ellpeck.actuallyadditions.mod.inventory.gui.FluidDisplay; -import mezz.jei.api.constants.VanillaTypes; -import mezz.jei.api.gui.IRecipeLayout; -import mezz.jei.api.gui.drawable.IDrawable; -import mezz.jei.api.gui.drawable.IDrawableStatic; -import mezz.jei.api.helpers.IGuiHelper; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.category.IRecipeCategory; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fluids.FluidAttributes; - -import javax.annotation.Nonnull; - -public class FermentingCategory implements IRecipeCategory { - public static final ResourceLocation ID = new ResourceLocation(ActuallyAdditions.MODID, "fermenting_jei"); - - private final IDrawableStatic background; - - public FermentingCategory(IGuiHelper guiHelper) { - background = guiHelper.drawableBuilder(new ResourceLocation(ActuallyAdditions.MODID, "textures/gui/gui_fermenting_barrel.png"), 41, 4, 94, 86).setTextureSize(256,256).build(); - } - - @Override - public ResourceLocation getUid() { - return ID; - } - - @Override - public Class getRecipeClass() { - return FermentingRecipe.class; - } - - @Override - public String getTitle() { - return "Fermenting Recipe"; - } - - @Override - public IDrawable getBackground() { - return background; - } - - @Override - public IDrawable getIcon() { - return null; - } - - @Override - public void setIngredients(@Nonnull FermentingRecipe fermentingRecipe, @Nonnull IIngredients ingredients) { - ingredients.setInput(VanillaTypes.FLUID, fermentingRecipe.getInput()); - ingredients.setOutput(VanillaTypes.FLUID, fermentingRecipe.getOutput()); - } - - @Override - public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull FermentingRecipe fermentingRecipe, @Nonnull IIngredients ingredients) { - int maxFluid = Math.max(FluidAttributes.BUCKET_VOLUME, Math.max(fermentingRecipe.getInput().getAmount(), fermentingRecipe.getOutput().getAmount())); - - fermentingRecipe.setInputDisplay(new FluidDisplay(19, 1, fermentingRecipe.getInput(), maxFluid, false)); - fermentingRecipe.setOutputDisplay(new FluidDisplay(19+38, 1, fermentingRecipe.getOutput(), maxFluid, false)); - } - - @Override - public void draw(FermentingRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) { - IRecipeCategory.super.draw(recipe, matrixStack, mouseX, mouseY); - - recipe.getInputDisplay().ifPresent(display -> { - display.draw(matrixStack); - display.render(matrixStack, (int) mouseX, (int) mouseY); - }); - - recipe.getOutputDisplay().ifPresent(display -> { - display.draw(matrixStack); - display.render(matrixStack, (int) mouseX, (int) mouseY); - }); - - - //TODO draw the progress indicator, scaled to the recipe duration. - } -} +//package de.ellpeck.actuallyadditions.mod.jei; +// +//import com.mojang.blaze3d.vertex.PoseStack; +//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; +//import de.ellpeck.actuallyadditions.mod.crafting.FermentingRecipe; +//import de.ellpeck.actuallyadditions.mod.inventory.gui.FluidDisplay; +//import mezz.jei.api.constants.VanillaTypes; +//import mezz.jei.api.gui.IRecipeLayout; +//import mezz.jei.api.gui.drawable.IDrawable; +//import mezz.jei.api.gui.drawable.IDrawableStatic; +//import mezz.jei.api.helpers.IGuiHelper; +//import mezz.jei.api.ingredients.IIngredients; +//import mezz.jei.api.recipe.category.IRecipeCategory; +//import net.minecraft.resources.ResourceLocation; +//import net.minecraftforge.fluids.FluidAttributes; +// +//import javax.annotation.Nonnull; +// +//public class FermentingCategory implements IRecipeCategory { +// public static final ResourceLocation ID = new ResourceLocation(ActuallyAdditions.MODID, "fermenting_jei"); +// +// private final IDrawableStatic background; +// +// public FermentingCategory(IGuiHelper guiHelper) { +// background = guiHelper.drawableBuilder(new ResourceLocation(ActuallyAdditions.MODID, "textures/gui/gui_fermenting_barrel.png"), 41, 4, 94, 86).setTextureSize(256,256).build(); +// } +// +// @Override +// public ResourceLocation getUid() { +// return ID; +// } +// +// @Override +// public Class getRecipeClass() { +// return FermentingRecipe.class; +// } +// +// @Override +// public String getTitle() { +// return "Fermenting Recipe"; +// } +// +// @Override +// public IDrawable getBackground() { +// return background; +// } +// +// @Override +// public IDrawable getIcon() { +// return null; +// } +// +// @Override +// public void setIngredients(@Nonnull FermentingRecipe fermentingRecipe, @Nonnull IIngredients ingredients) { +// ingredients.setInput(VanillaTypes.FLUID, fermentingRecipe.getInput()); +// ingredients.setOutput(VanillaTypes.FLUID, fermentingRecipe.getOutput()); +// } +// +// @Override +// public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull FermentingRecipe fermentingRecipe, @Nonnull IIngredients ingredients) { +// int maxFluid = Math.max(FluidAttributes.BUCKET_VOLUME, Math.max(fermentingRecipe.getInput().getAmount(), fermentingRecipe.getOutput().getAmount())); +// +// fermentingRecipe.setInputDisplay(new FluidDisplay(19, 1, fermentingRecipe.getInput(), maxFluid, false)); +// fermentingRecipe.setOutputDisplay(new FluidDisplay(19+38, 1, fermentingRecipe.getOutput(), maxFluid, false)); +// } +// +// @Override +// public void draw(FermentingRecipe recipe, PoseStack matrixStack, double mouseX, double mouseY) { +// IRecipeCategory.super.draw(recipe, matrixStack, mouseX, mouseY); +// +// recipe.getInputDisplay().ifPresent(display -> { +// display.draw(matrixStack); +// display.render(matrixStack, (int) mouseX, (int) mouseY); +// }); +// +// recipe.getOutputDisplay().ifPresent(display -> { +// display.draw(matrixStack); +// display.render(matrixStack, (int) mouseX, (int) mouseY); +// }); +// +// +// //TODO draw the progress indicator, scaled to the recipe duration. +// } +//} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/JEIActuallyAdditionsPlugin.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/JEIActuallyAdditionsPlugin.java index 98caf9a80..15da7d1cc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/JEIActuallyAdditionsPlugin.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/JEIActuallyAdditionsPlugin.java @@ -11,20 +11,18 @@ package de.ellpeck.actuallyadditions.mod.jei; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; -import de.ellpeck.actuallyadditions.mod.crafting.ActuallyRecipes; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import mezz.jei.api.IModPlugin; import mezz.jei.api.JeiPlugin; -import mezz.jei.api.constants.VanillaRecipeCategoryUid; +import mezz.jei.api.constants.RecipeTypes; import mezz.jei.api.helpers.IJeiHelpers; import mezz.jei.api.registration.IRecipeCatalystRegistration; import mezz.jei.api.registration.IRecipeCategoryRegistration; import mezz.jei.api.registration.IRecipeRegistration; import net.minecraft.client.Minecraft; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraft.world.World; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; @JeiPlugin public class JEIActuallyAdditionsPlugin implements IModPlugin { @@ -38,19 +36,19 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin { public void registerCategories(IRecipeCategoryRegistration registry) { IJeiHelpers helpers = registry.getJeiHelpers(); - registry.addRecipeCategories(new FermentingCategory(helpers.getGuiHelper())); - registry.addRecipeCategories(new LaserRecipeCategory(helpers.getGuiHelper())); - registry.addRecipeCategories(new EmpowererRecipeCategory(helpers.getGuiHelper())); +// registry.addRecipeCategories(new FermentingCategory(helpers.getGuiHelper())); //TODO: re-enable after refactor jei compat +// registry.addRecipeCategories(new LaserRecipeCategory(helpers.getGuiHelper())); //TODO: re-enable after refactor jei compat +// registry.addRecipeCategories(new EmpowererRecipeCategory(helpers.getGuiHelper())); //TODO: re-enable after refactor jei compat //registry.addRecipeCategories(new CoffeeMachineRecipeCategory(helpers.getGuiHelper()), new CompostRecipeCategory(helpers.getGuiHelper()), new CrusherRecipeCategory(helpers.getGuiHelper()), new ReconstructorRecipeCategory(helpers.getGuiHelper()), new EmpowererRecipeCategory(helpers.getGuiHelper()), new BookletRecipeCategory(helpers.getGuiHelper())); } @Override public void registerRecipeCatalysts(IRecipeCatalystRegistration registry) { - registry.addRecipeCatalyst(new ItemStack(ActuallyItems.CRAFTER_ON_A_STICK.get()), VanillaRecipeCategoryUid.CRAFTING); - registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.FERMENTING_BARREL.getItem()), FermentingCategory.ID); - registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.getItem()), LaserRecipeCategory.ID); - registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.EMPOWERER.getItem()), EmpowererRecipeCategory.ID); + registry.addRecipeCatalyst(new ItemStack(ActuallyItems.CRAFTER_ON_A_STICK.get()), RecipeTypes.CRAFTING); +// registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.FERMENTING_BARREL.getItem()), FermentingCategory.ID); //TODO: re-enable after refactor jei compat +// registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.getItem()), LaserRecipeCategory.ID); //TODO: re-enable after refactor jei compat +// registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.EMPOWERER.getItem()), EmpowererRecipeCategory.ID); //TODO: re-enable after refactor jei compat // registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.blockFurnaceDouble.get()), VanillaRecipeCategoryUid.SMELTING); // registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.blockGrinder.get()), CrusherRecipeCategory.NAME); @@ -64,11 +62,11 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin { @Override public void registerRecipes(IRecipeRegistration registry) { - World level = Minecraft.getInstance().level; + Level level = Minecraft.getInstance().level; - registry.addRecipes(level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.FERMENTING), FermentingCategory.ID); - registry.addRecipes(level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.LASER), LaserRecipeCategory.ID); - registry.addRecipes(level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.EMPOWERING), EmpowererRecipeCategory.ID); +// registry.addRecipes(level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.FERMENTING), FermentingCategory.ID); //TODO: re-enable after refactor jei compat +// registry.addRecipes(level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.LASER), LaserRecipeCategory.ID); //TODO: re-enable after refactor jei compat +// registry.addRecipes(level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.EMPOWERING), EmpowererRecipeCategory.ID); //TODO: re-enable after refactor jei compat //registry.addRecipes(ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA, BookletRecipeCategory.NAME); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/LaserRecipeCategory.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/LaserRecipeCategory.java index 2332b90e5..bd5a7e3fa 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/LaserRecipeCategory.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/LaserRecipeCategory.java @@ -1,83 +1,83 @@ -/* - * This file ("ReconstructorRecipeCategory.java") is part of the Actually Additions mod for Minecraft. - * It is created and owned by Ellpeck and distributed - * under the Actually Additions License to be found at - * http://ellpeck.de/actaddlicense - * View the source code at https://github.com/Ellpeck/ActuallyAdditions - * - * © 2015-2017 Ellpeck - */ - -package de.ellpeck.actuallyadditions.mod.jei; - -import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; -import de.ellpeck.actuallyadditions.mod.crafting.LaserRecipe; -import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import mezz.jei.api.constants.VanillaTypes; -import mezz.jei.api.gui.IRecipeLayout; -import mezz.jei.api.gui.drawable.IDrawable; -import mezz.jei.api.gui.drawable.IDrawableStatic; -import mezz.jei.api.helpers.IGuiHelper; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.category.IRecipeCategory; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.TranslationTextComponent; - -import javax.annotation.Nonnull; -import java.util.Arrays; - -public class LaserRecipeCategory implements IRecipeCategory { - - public static final ResourceLocation ID = new ResourceLocation(ActuallyAdditions.MODID, "laser_jei"); - private final IDrawableStatic background; - private final ItemStack RECONSTRUCTOR = new ItemStack(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.getItem()); - - public LaserRecipeCategory(IGuiHelper helper) { - this.background = helper.drawableBuilder(AssetUtil.getGuiLocation("gui_nei_atomic_reconstructor"), 0, 0, 96, 60).setTextureSize(256,256).build(); - } - - @Override - public ResourceLocation getUid() { - return ID; - } - - @Override - public Class getRecipeClass() { - return LaserRecipe.class; - } - - @Override - public String getTitle() { - return new TranslationTextComponent("container.actuallyadditions.reconstructor").getString(); - } - - @Override - public IDrawable getBackground() { - return this.background; - } - - @Override - public IDrawable getIcon() { - return null; - } - - @Override - public void setIngredients(LaserRecipe laserRecipe, IIngredients ingredients) { - ingredients.setInputs(VanillaTypes.ITEM, Arrays.asList(laserRecipe.getInput().getItems())); - ingredients.setOutput(VanillaTypes.ITEM, laserRecipe.getResultItem()); - } - - @Override - public void setRecipe(@Nonnull IRecipeLayout layout, @Nonnull LaserRecipe laserRecipe, @Nonnull IIngredients iIngredients) { - layout.getItemStacks().init(0, true, 4, 18); - layout.getItemStacks().set(0, iIngredients.getInputs(VanillaTypes.ITEM).get(0)); - - layout.getItemStacks().init(1, false, 34, 19); - layout.getItemStacks().set(1, RECONSTRUCTOR); - - layout.getItemStacks().init(2, false, 66, 18); - layout.getItemStacks().set(2, iIngredients.getOutputs(VanillaTypes.ITEM).get(0)); - } -} +///* +// * This file ("ReconstructorRecipeCategory.java") is part of the Actually Additions mod for Minecraft. +// * It is created and owned by Ellpeck and distributed +// * under the Actually Additions License to be found at +// * http://ellpeck.de/actaddlicense +// * View the source code at https://github.com/Ellpeck/ActuallyAdditions +// * +// * © 2015-2017 Ellpeck +// */ +// +//package de.ellpeck.actuallyadditions.mod.jei; +// +//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; +//import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; +//import de.ellpeck.actuallyadditions.mod.crafting.LaserRecipe; +//import de.ellpeck.actuallyadditions.mod.util.AssetUtil; +//import mezz.jei.api.constants.VanillaTypes; +//import mezz.jei.api.gui.IRecipeLayout; +//import mezz.jei.api.gui.drawable.IDrawable; +//import mezz.jei.api.gui.drawable.IDrawableStatic; +//import mezz.jei.api.helpers.IGuiHelper; +//import mezz.jei.api.ingredients.IIngredients; +//import mezz.jei.api.recipe.category.IRecipeCategory; +//import net.minecraft.network.chat.TranslatableComponent; +//import net.minecraft.resources.ResourceLocation; +//import net.minecraft.world.item.ItemStack; +// +//import javax.annotation.Nonnull; +//import java.util.Arrays; +// +//public class LaserRecipeCategory implements IRecipeCategory { +// +// public static final ResourceLocation ID = new ResourceLocation(ActuallyAdditions.MODID, "laser_jei"); +// private final IDrawableStatic background; +// private final ItemStack RECONSTRUCTOR = new ItemStack(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.getItem()); +// +// public LaserRecipeCategory(IGuiHelper helper) { +// this.background = helper.drawableBuilder(AssetUtil.getGuiLocation("gui_nei_atomic_reconstructor"), 0, 0, 96, 60).setTextureSize(256,256).build(); +// } +// +// @Override +// public ResourceLocation getUid() { +// return ID; +// } +// +// @Override +// public Class getRecipeClass() { +// return LaserRecipe.class; +// } +// +// @Override +// public String getTitle() { +// return new TranslatableComponent("container.actuallyadditions.reconstructor").getString(); +// } +// +// @Override +// public IDrawable getBackground() { +// return this.background; +// } +// +// @Override +// public IDrawable getIcon() { +// return null; +// } +// +// @Override +// public void setIngredients(LaserRecipe laserRecipe, IIngredients ingredients) { +// ingredients.setInputs(VanillaTypes.ITEM, Arrays.asList(laserRecipe.getInput().getItems())); +// ingredients.setOutput(VanillaTypes.ITEM, laserRecipe.getResultItem()); +// } +// +// @Override +// public void setRecipe(@Nonnull IRecipeLayout layout, @Nonnull LaserRecipe laserRecipe, @Nonnull IIngredients iIngredients) { +// layout.getItemStacks().init(0, true, 4, 18); +// layout.getItemStacks().set(0, iIngredients.getInputs(VanillaTypes.ITEM).get(0)); +// +// layout.getItemStacks().init(1, false, 34, 19); +// layout.getItemStacks().set(1, RECONSTRUCTOR); +// +// layout.getItemStacks().init(2, false, 66, 18); +// layout.getItemStacks().set(2, iIngredients.getOutputs(VanillaTypes.ITEM).get(0)); +// } +//} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/material/ArmorMaterials.java b/src/main/java/de/ellpeck/actuallyadditions/mod/material/ArmorMaterials.java index e2211df6d..eec7d1823 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/material/ArmorMaterials.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/material/ArmorMaterials.java @@ -2,23 +2,23 @@ package de.ellpeck.actuallyadditions.mod.material; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; -import net.minecraft.inventory.EquipmentSlotType; -import net.minecraft.item.IArmorMaterial; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.util.LazyValue; -import net.minecraft.util.SoundEvent; -import net.minecraft.util.SoundEvents; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.util.LazyLoadedValue; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.ArmorMaterial; +import net.minecraft.world.item.crafting.Ingredient; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import java.util.function.Supplier; /** - * Complete copy paste from {@link net.minecraft.item.ArmorMaterial} + * Complete copy paste from {@link net.minecraft.world.item.ArmorMaterial} *

* todo validate all values refect correctly */ -public enum ArmorMaterials implements IArmorMaterial { +public enum ArmorMaterials implements ArmorMaterial { // EMERALD("emerald_armor_material", 30, new int[] { 5, 8, 9, 4 }, 15, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 2, 0f, () -> Ingredient.fromItems(Items.EMERALD)), // OBSIDIAN("obsidian_armor_material", 28, new int[] { 1, 3, 4, 3 }, 10, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 1, 0f, () -> Ingredient.fromItems(Items.OBSIDIAN)), @@ -40,7 +40,7 @@ public enum ArmorMaterials implements IArmorMaterial { private final SoundEvent soundEvent; private final float toughness; private final float knockbackResistance; - private final LazyValue repairMaterial; + private final LazyLoadedValue repairMaterial; ArmorMaterials(String name, int maxDamageFactor, int[] damageReductionAmountArray, int enchantability, SoundEvent soundEvent, float toughness, float knockbackResistance, Supplier repairMaterial) { this.name = String.format("%s:%s", ActuallyAdditions.MODID, name); @@ -50,16 +50,16 @@ public enum ArmorMaterials implements IArmorMaterial { this.soundEvent = soundEvent; this.toughness = toughness; this.knockbackResistance = knockbackResistance; - this.repairMaterial = new LazyValue<>(repairMaterial); + this.repairMaterial = new LazyLoadedValue<>(repairMaterial); } @Override - public int getDurabilityForSlot(EquipmentSlotType slotIn) { + public int getDurabilityForSlot(EquipmentSlot slotIn) { return MAX_DAMAGE_ARRAY[slotIn.getIndex()] * this.maxDamageFactor; } @Override - public int getDefenseForSlot(EquipmentSlotType slotIn) { + public int getDefenseForSlot(EquipmentSlot slotIn) { return this.damageReductionAmountArray[slotIn.getIndex()]; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/material/ToolMaterials.java b/src/main/java/de/ellpeck/actuallyadditions/mod/material/ToolMaterials.java index 1d53fa4dd..b3ee70b63 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/material/ToolMaterials.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/material/ToolMaterials.java @@ -1,69 +1,26 @@ package de.ellpeck.actuallyadditions.mod.material; +import de.ellpeck.actuallyadditions.api.ActuallyTags; +import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; -import net.minecraft.item.IItemTier; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.util.LazyValue; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Tier; +import net.minecraft.world.item.Tiers; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraftforge.common.ForgeTier; +import net.minecraftforge.common.TierSortingRegistry; -import java.util.function.Supplier; +import java.util.List; /** - * Complete copy paste from {@link net.minecraft.item.ItemTier} - *

* todo: review to ensure all values act as intended */ -public enum ToolMaterials implements IItemTier { - BLACK_QUARTZ(2, 280, 6.5f, 2.0f, 10, () -> Ingredient.of(ActuallyItems.BLACK_QUARTZ.get())), - RESTONIA(2, 300, 7.0f, 2.25f, 12, () -> Ingredient.of(ActuallyItems.RESTONIA_CRYSTAL.get())), - PALIS(2, 300, 7.0f, 2.25f, 12, () -> Ingredient.of(ActuallyItems.PALIS_CRYSTAL.get())), - DIAMATINE(3, 1600, 9.0f, 4.0f, 14, () -> Ingredient.of(ActuallyItems.DIAMATINE_CRYSTAL.get())), - VOID(2, 280, 6.0f, 2.0f, 8, () -> Ingredient.of(ActuallyItems.VOID_CRYSTAL.get())), - EMERADIC(4, 2200, 9.5f, 5.55f, 18, () -> Ingredient.of(ActuallyItems.EMERADIC_CRYSTAL.get())), - ENORI(2, 280, 6.25f, 6.25f, 15, () -> Ingredient.of(ActuallyItems.ENORI_CRYSTAL.get())); - - private final int harvestLevel; - private final int maxUses; - private final float efficiency; - private final float attackDamage; - private final int enchantability; - private final LazyValue repairMaterial; - - ToolMaterials(int harvestLevelIn, int maxUsesIn, float efficiencyIn, float attackDamageIn, int enchantabilityIn, Supplier repairMaterialIn) { - this.harvestLevel = harvestLevelIn; - this.maxUses = maxUsesIn; - this.efficiency = efficiencyIn; - this.attackDamage = attackDamageIn; - this.enchantability = enchantabilityIn; - this.repairMaterial = new LazyValue<>(repairMaterialIn); - } - - @Override - public int getUses() { - return this.maxUses; - } - - @Override - public float getSpeed() { - return this.efficiency; - } - - @Override - public float getAttackDamageBonus() { - return this.attackDamage; - } - - @Override - public int getLevel() { - return this.harvestLevel; - } - - @Override - public int getEnchantmentValue() { - return this.enchantability; - } - - @Override - public Ingredient getRepairIngredient() { - return this.repairMaterial.get(); - } +public class ToolMaterials { + public static final Tier BLACK_QUARTZ = TierSortingRegistry.registerTier(new ForgeTier(2, 280, 6.5f, 2.0f, 10, ActuallyTags.Blocks.NEEDS_BLACK_QUARTZ_TOOL, () -> Ingredient.of(ActuallyItems.BLACK_QUARTZ.get())), new ResourceLocation(ActuallyAdditions.MODID, "black_quartz"), List.of(Tiers.IRON), List.of(Tiers.DIAMOND)); + public static final Tier RESTONIA = TierSortingRegistry.registerTier(new ForgeTier(2, 300, 7.0f, 2.25f, 12, ActuallyTags.Blocks.NEEDS_RESTONIA_TOOL, () -> Ingredient.of(ActuallyItems.RESTONIA_CRYSTAL.get())), new ResourceLocation(ActuallyAdditions.MODID, "restonia"), List.of(Tiers.IRON), List.of(Tiers.DIAMOND)); + public static final Tier PALIS = TierSortingRegistry.registerTier(new ForgeTier(2, 300, 7.0f, 2.25f, 12, ActuallyTags.Blocks.NEEDS_PALIS_TOOL, () -> Ingredient.of(ActuallyItems.PALIS_CRYSTAL.get())), new ResourceLocation(ActuallyAdditions.MODID, "palis"), List.of(Tiers.IRON), List.of(Tiers.DIAMOND)); + public static final Tier DIAMATINE = TierSortingRegistry.registerTier(new ForgeTier(3, 1600, 9.0f, 4.0f, 14, ActuallyTags.Blocks.NEEDS_DIAMATINE_TOOL, () -> Ingredient.of(ActuallyItems.DIAMATINE_CRYSTAL.get())), new ResourceLocation(ActuallyAdditions.MODID, "diamatine"), List.of(Tiers.DIAMOND), List.of(Tiers.NETHERITE)); + public static final Tier VOID = TierSortingRegistry.registerTier(new ForgeTier(2, 280, 6.0f, 2.0f, 8, ActuallyTags.Blocks.NEEDS_VOID_TOOL, () -> Ingredient.of(ActuallyItems.VOID_CRYSTAL.get())), new ResourceLocation(ActuallyAdditions.MODID, "void"), List.of(Tiers.IRON), List.of(Tiers.DIAMOND)); + public static final Tier EMERADIC = TierSortingRegistry.registerTier(new ForgeTier(4, 2200, 9.5f, 5.55f, 18, ActuallyTags.Blocks.NEEDS_EMERADIC_TOOL, () -> Ingredient.of(ActuallyItems.EMERADIC_CRYSTAL.get())), new ResourceLocation(ActuallyAdditions.MODID, "emeradic"), List.of(Tiers.NETHERITE), List.of()); + public static final Tier ENORI = TierSortingRegistry.registerTier(new ForgeTier(2, 280, 6.25f, 6.25f, 15, ActuallyTags.Blocks.NEEDS_ENORI_TOOL, () -> Ingredient.of(ActuallyItems.ENORI_CRYSTAL.get())), new ResourceLocation(ActuallyAdditions.MODID, "enori"), List.of(Tiers.IRON), List.of(Tiers.DIAMOND)); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/BannerHelper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/BannerHelper.java index 1b752d30d..54f1499cf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/BannerHelper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/BannerHelper.java @@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.mod.misc; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.ItemStack; public final class BannerHelper { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DamageSources.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DamageSources.java index e9a815d81..a59c1cc0a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DamageSources.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DamageSources.java @@ -11,10 +11,10 @@ package de.ellpeck.actuallyadditions.mod.misc; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import net.minecraft.entity.LivingEntity; -import net.minecraft.util.DamageSource; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.LivingEntity; public class DamageSources extends DamageSource { @@ -28,8 +28,8 @@ public class DamageSources extends DamageSource { } @Override - public ITextComponent getLocalizedDeathMessage(LivingEntity entity) { + public Component getLocalizedDeathMessage(LivingEntity entity) { String locTag = "death." + ActuallyAdditions.MODID + "." + this.msgId + "." + (entity.level.random.nextInt(this.messageCount) + 1); - return new TranslationTextComponent(locTag, entity.getName()); + return new TranslatableComponent(locTag, entity.getName()); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DispenserHandlerFertilize.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DispenserHandlerFertilize.java index 835865981..d727f9ae2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DispenserHandlerFertilize.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DispenserHandlerFertilize.java @@ -10,19 +10,19 @@ package de.ellpeck.actuallyadditions.mod.misc; -import net.minecraft.dispenser.DefaultDispenseItemBehavior; -import net.minecraft.dispenser.IBlockSource; -import net.minecraft.item.BoneMealItem; -import net.minecraft.item.ItemStack; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.core.BlockSource; +import net.minecraft.core.Direction; +import net.minecraft.core.dispenser.DefaultDispenseItemBehavior; +import net.minecraft.world.item.BoneMealItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; // TODO: [port][note] might not be needed anymore public class DispenserHandlerFertilize extends DefaultDispenseItemBehavior { @Override - public ItemStack execute(IBlockSource source, ItemStack stack) { + public ItemStack execute(BlockSource source, ItemStack stack) { Direction facing = source.getBlockState().getValue(BlockStateProperties.FACING); BlockPos pos = source.getPos().relative(facing); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/ConnectionPair.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/ConnectionPair.java index 139c3d42a..c872b4f9d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/ConnectionPair.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/ConnectionPair.java @@ -12,8 +12,8 @@ package de.ellpeck.actuallyadditions.mod.misc.apiimpl; import de.ellpeck.actuallyadditions.api.laser.IConnectionPair; import de.ellpeck.actuallyadditions.api.laser.LaserType; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; public class ConnectionPair implements IConnectionPair { @@ -33,7 +33,7 @@ public class ConnectionPair implements IConnectionPair { } @Override - public void readFromNBT(CompoundNBT compound) { + public void readFromNBT(CompoundTag compound) { if (compound != null) { for (int i = 0; i < this.positions.length; i++) { int anX = compound.getInt("x" + i); @@ -85,7 +85,7 @@ public class ConnectionPair implements IConnectionPair { } @Override - public void writeToNBT(CompoundNBT compound) { + public void writeToNBT(CompoundTag compound) { for (int i = 0; i < this.positions.length; i++) { BlockPos relay = this.positions[i]; compound.putInt("x" + i, relay.getX()); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/LaserRelayConnectionHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/LaserRelayConnectionHandler.java index 6be542211..693b7abcf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/LaserRelayConnectionHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/LaserRelayConnectionHandler.java @@ -17,28 +17,28 @@ import de.ellpeck.actuallyadditions.api.laser.Network; import de.ellpeck.actuallyadditions.mod.data.WorldData; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay; import io.netty.util.internal.ConcurrentSet; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.nbt.ListNBT; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; public final class LaserRelayConnectionHandler implements ILaserRelayConnectionHandler { - public static CompoundNBT writeNetworkToNBT(Network network) { - ListNBT list = new ListNBT(); + public static CompoundTag writeNetworkToNBT(Network network) { + ListTag list = new ListTag(); for (IConnectionPair pair : network.connections) { - CompoundNBT tag = new CompoundNBT(); + CompoundTag tag = new CompoundTag(); pair.writeToNBT(tag); list.add(tag); } - CompoundNBT compound = new CompoundNBT(); + CompoundTag compound = new CompoundTag(); compound.put("Network", list); return compound; } - public static Network readNetworkFromNBT(CompoundNBT tag) { - ListNBT list = tag.getList("Network", 10); + public static Network readNetworkFromNBT(CompoundTag tag) { + ListTag list = tag.getList("Network", 10); Network network = new Network(); for (int i = 0; i < list.size(); i++) { ConnectionPair pair = new ConnectionPair(); @@ -52,7 +52,7 @@ public final class LaserRelayConnectionHandler implements ILaserRelayConnectionH * Merges two laserRelayNetworks together * (Actually puts everything from the second network into the first one and removes the second one) */ - private static void mergeNetworks(Network firstNetwork, Network secondNetwork, World world) { + private static void mergeNetworks(Network firstNetwork, Network secondNetwork, Level world) { for (IConnectionPair secondPair : secondNetwork.connections) { firstNetwork.connections.add(secondPair); } @@ -68,7 +68,7 @@ public final class LaserRelayConnectionHandler implements ILaserRelayConnectionH * Gets all Connections for a Relay */ @Override - public ConcurrentSet getConnectionsFor(BlockPos relay, World world) { + public ConcurrentSet getConnectionsFor(BlockPos relay, Level world) { ConcurrentSet allPairs = new ConcurrentSet<>(); if(!world.isClientSide) { for (Network aNetwork : WorldData.get(world).laserRelayNetworks) { @@ -86,7 +86,7 @@ public final class LaserRelayConnectionHandler implements ILaserRelayConnectionH * Removes a Relay from its Network */ @Override - public void removeRelayFromNetwork(BlockPos relay, World world) { + public void removeRelayFromNetwork(BlockPos relay, Level world) { Network network = this.getNetworkFor(relay, world); if (network != null) { network.changeAmount++; @@ -108,7 +108,7 @@ public final class LaserRelayConnectionHandler implements ILaserRelayConnectionH * Gets a Network for a Relay */ @Override - public Network getNetworkFor(BlockPos relay, World world) { + public Network getNetworkFor(BlockPos relay, Level world) { if (world != null && !world.isClientSide) { for (Network aNetwork : WorldData.get(world).laserRelayNetworks) { for (IConnectionPair pair : aNetwork.connections) { @@ -122,7 +122,7 @@ public final class LaserRelayConnectionHandler implements ILaserRelayConnectionH } @Override - public boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, World world) { + public boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, Level world) { return this.addConnection(firstRelay, secondRelay, type, world, false); } @@ -131,12 +131,12 @@ public final class LaserRelayConnectionHandler implements ILaserRelayConnectionH * (Puts it into the correct network!) */ @Override - public boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, World world, boolean suppressConnectionRender) { + public boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, Level world, boolean suppressConnectionRender) { return this.addConnection(firstRelay, secondRelay, type, world, suppressConnectionRender, false); } @Override - public boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, World world, boolean suppressConnectionRender, boolean removeIfConnected) { + public boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, Level world, boolean suppressConnectionRender, boolean removeIfConnected) { if (world.isClientSide || firstRelay == null || secondRelay == null || firstRelay == secondRelay || firstRelay.equals(secondRelay)) { return false; } @@ -185,7 +185,7 @@ public final class LaserRelayConnectionHandler implements ILaserRelayConnectionH } @Override - public void removeConnection(World world, BlockPos firstRelay, BlockPos secondRelay) { + public void removeConnection(Level world, BlockPos firstRelay, BlockPos secondRelay) { if (world != null && !world.isClientSide && firstRelay != null && secondRelay != null) { Network network = this.getNetworkFor(firstRelay, world); @@ -206,7 +206,7 @@ public final class LaserRelayConnectionHandler implements ILaserRelayConnectionH } @Override - public LaserType getTypeFromLaser(TileEntity tile) { + public LaserType getTypeFromLaser(BlockEntity tile) { if (tile instanceof TileEntityLaserRelay) { return ((TileEntityLaserRelay) tile).type; } else { @@ -215,7 +215,7 @@ public final class LaserRelayConnectionHandler implements ILaserRelayConnectionH } @Override - public LaserType getTypeFromLaser(BlockPos pos, World world) { + public LaserType getTypeFromLaser(BlockPos pos, Level world) { return this.getTypeFromLaser(world.getBlockEntity(pos)); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/MethodHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/MethodHandler.java index 3e0cfb663..4cdf4070e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/MethodHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/MethodHandler.java @@ -18,19 +18,19 @@ import de.ellpeck.actuallyadditions.mod.blocks.BlockLaserRelay; import de.ellpeck.actuallyadditions.mod.crafting.LaserRecipe; import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.item.BlockItem; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.potion.Effect; -import net.minecraft.potion.EffectInstance; -import net.minecraft.util.Direction; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.vector.Vector3i; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.Vec3i; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.effect.MobEffect; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.AABB; import java.util.ArrayList; import java.util.List; @@ -42,10 +42,10 @@ public class MethodHandler implements IMethodHandler { public boolean addEffectToStack(ItemStack stack, CoffeeIngredient ingredient) { boolean worked = false; if (ingredient != null) { - EffectInstance[] effects = ingredient.getEffects(); + MobEffectInstance[] effects = ingredient.getEffects(); if (effects != null && effects.length > 0) { - for (EffectInstance effect : effects) { - EffectInstance effectHas = this.getSameEffectFromStack(stack, effect); + for (MobEffectInstance effect : effects) { + MobEffectInstance effectHas = this.getSameEffectFromStack(stack, effect); if (effectHas != null) { if (effectHas.getAmplifier() < ingredient.getMaxAmplifier() - 1) { this.addEffectProperties(stack, effect, false, true); @@ -62,10 +62,10 @@ public class MethodHandler implements IMethodHandler { } @Override - public EffectInstance getSameEffectFromStack(ItemStack stack, EffectInstance effect) { - EffectInstance[] effectsStack = this.getEffectsFromStack(stack); + public MobEffectInstance getSameEffectFromStack(ItemStack stack, MobEffectInstance effect) { + MobEffectInstance[] effectsStack = this.getEffectsFromStack(stack); if (effectsStack != null && effectsStack.length > 0) { - for (EffectInstance effectStack : effectsStack) { + for (MobEffectInstance effectStack : effectsStack) { if (effect.getEffect() == effectStack.getEffect()) { return effectStack; } @@ -75,12 +75,12 @@ public class MethodHandler implements IMethodHandler { } @Override - public void addEffectProperties(ItemStack stack, EffectInstance effect, boolean addDur, boolean addAmp) { - EffectInstance[] effects = this.getEffectsFromStack(stack); - stack.setTag(new CompoundNBT()); + public void addEffectProperties(ItemStack stack, MobEffectInstance effect, boolean addDur, boolean addAmp) { + MobEffectInstance[] effects = this.getEffectsFromStack(stack); + stack.setTag(new CompoundTag()); for (int i = 0; i < effects.length; i++) { if (effects[i].getEffect() == effect.getEffect()) { - effects[i] = new EffectInstance(effects[i].getEffect(), effects[i].getDuration() + (addDur + effects[i] = new MobEffectInstance(effects[i].getEffect(), effects[i].getDuration() + (addDur ? effect.getDuration() : 0), effects[i].getAmplifier() + (addAmp ? effect.getAmplifier() > 0 @@ -93,11 +93,11 @@ public class MethodHandler implements IMethodHandler { } @Override - public void addEffectToStack(ItemStack stack, EffectInstance effect) { - CompoundNBT tag = stack.getOrCreateTag(); + public void addEffectToStack(ItemStack stack, MobEffectInstance effect) { + CompoundTag tag = stack.getOrCreateTag(); int prevCounter = tag.getInt("Counter"); - CompoundNBT compound = new CompoundNBT(); + CompoundTag compound = new CompoundTag(); //compound.putInt("ID", Potion.getIdFromPotion(effect.getEffect())); //TODO ?! compound.putInt("Duration", effect.getDuration()); compound.putInt("Amplifier", effect.getAmplifier()); @@ -110,18 +110,18 @@ public class MethodHandler implements IMethodHandler { } @Override - public EffectInstance[] getEffectsFromStack(ItemStack stack) { - ArrayList effects = new ArrayList<>(); - CompoundNBT tag = stack.getOrCreateTag(); + public MobEffectInstance[] getEffectsFromStack(ItemStack stack) { + ArrayList effects = new ArrayList<>(); + CompoundTag tag = stack.getOrCreateTag(); int counter = tag.getInt("Counter"); while (counter > 0) { - CompoundNBT compound = (CompoundNBT) tag.get(counter + ""); - EffectInstance effect = new EffectInstance(Effect.byId(compound.getInt("ID")), compound.getInt("Duration"), compound.getByte("Amplifier")); + CompoundTag compound = (CompoundTag) tag.get(counter + ""); + MobEffectInstance effect = new MobEffectInstance(MobEffect.byId(compound.getInt("ID")), compound.getInt("Duration"), compound.getByte("Amplifier")); effects.add(effect); counter--; } return effects.size() > 0 - ? effects.toArray(new EffectInstance[effects.size()]) + ? effects.toArray(new MobEffectInstance[effects.size()]) : null; } @@ -182,8 +182,8 @@ public class MethodHandler implements IMethodHandler { } //Converting the Items - AxisAlignedBB aabb = new AxisAlignedBB(tile.getPosition().getX(), tile.getPosition().getY(), tile.getPosition().getZ(), hitBlock.getX() + 1, hitBlock.getY() + 1, hitBlock.getZ() + 1); - Vector3i dir = tile.getOrientation().getNormal(); + AABB aabb = new AABB(tile.getPosition().getX(), tile.getPosition().getY(), tile.getPosition().getZ(), hitBlock.getX() + 1, hitBlock.getY() + 1, hitBlock.getZ() + 1); + Vec3i dir = tile.getOrientation().getNormal(); aabb = aabb.inflate(0.02, 0.02, 0.02).expandTowards(dir.getX(), dir.getY(), dir.getZ()); List items = tile.getWorldObject().getEntitiesOfClass(ItemEntity.class, aabb); for (ItemEntity item : items) { @@ -195,7 +195,7 @@ public class MethodHandler implements IMethodHandler { if (itemsPossible > 0) { //recipe.transformHook(item.getItem(), null, item.blockPosition(), tile); //TODO empty method - item.remove(); + item.discard(); if (stack.getCount() - itemsPossible > 0) { ItemStack stackCopy = stack.copy(); @@ -218,7 +218,7 @@ public class MethodHandler implements IMethodHandler { } } } - return !hitState.getBlock().isAir(hitState, tile.getWorldObject(), hitBlock); + return !hitState.isAir(); } return false; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/CactusFarmerBehavior.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/CactusFarmerBehavior.java index 9fe45270e..988f475b2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/CactusFarmerBehavior.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/CactusFarmerBehavior.java @@ -13,26 +13,25 @@ package de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer; import de.ellpeck.actuallyadditions.api.farmer.FarmerResult; import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior; import de.ellpeck.actuallyadditions.api.internal.IFarmer; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.item.BlockItem; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.loot.LootContext; -import net.minecraft.loot.LootParameters; -import net.minecraft.util.NonNullList; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.world.World; -import net.minecraft.world.server.ServerWorld; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.Item; +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.Blocks; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.storage.loot.LootContext; +import net.minecraft.world.level.storage.loot.parameters.LootContextParams; +import net.minecraft.world.phys.Vec3; import java.util.List; public class CactusFarmerBehavior implements IFarmerBehavior { @Override - public FarmerResult tryPlantSeed(ItemStack seed, World world, BlockPos pos, IFarmer farmer) { + public FarmerResult tryPlantSeed(ItemStack seed, Level world, BlockPos pos, IFarmer farmer) { int use = 250; if (farmer.getEnergy() >= use) { Item item = seed.getItem(); @@ -55,7 +54,7 @@ public class CactusFarmerBehavior implements IFarmerBehavior { } @Override - public FarmerResult tryHarvestPlant(ServerWorld world, BlockPos pos, IFarmer farmer) { + public FarmerResult tryHarvestPlant(ServerLevel world, BlockPos pos, IFarmer farmer) { int use = 250; if (farmer.getEnergy() >= use) { BlockState state = world.getBlockState(pos); @@ -68,8 +67,8 @@ public class CactusFarmerBehavior implements IFarmerBehavior { BlockState upState = world.getBlockState(up); if (upState.getBlock() == Blocks.CACTUS) { List drops = state.getDrops(new LootContext.Builder(world) - .withParameter(LootParameters.ORIGIN, new Vector3d(pos.getX(), pos.getY(), pos.getZ())) - .withParameter(LootParameters.TOOL, ItemStack.EMPTY)); + .withParameter(LootContextParams.ORIGIN, new Vec3(pos.getX(), pos.getY(), pos.getZ())) + .withParameter(LootContextParams.TOOL, ItemStack.EMPTY)); if (!drops.isEmpty()) { if (farmer.canAddToOutput(drops)) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/DefaultFarmerBehavior.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/DefaultFarmerBehavior.java index d68db04e6..1a7c66720 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/DefaultFarmerBehavior.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/DefaultFarmerBehavior.java @@ -14,21 +14,33 @@ import de.ellpeck.actuallyadditions.api.farmer.FarmerResult; import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior; import de.ellpeck.actuallyadditions.api.internal.IFarmer; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.*; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.*; -import net.minecraft.loot.LootContext; -import net.minecraft.loot.LootParameters; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.util.*; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.world.World; -import net.minecraft.world.server.ServerWorld; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.tags.BlockTags; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +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.context.UseOnContext; +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.BonemealableBlock; +import net.minecraft.world.level.block.CropBlock; +import net.minecraft.world.level.block.StemBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.storage.loot.LootContext; +import net.minecraft.world.level.storage.loot.parameters.LootContextParams; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.IPlantable; -import net.minecraftforge.common.Tags; -import net.minecraftforge.common.ToolType; import net.minecraftforge.common.util.FakePlayerFactory; import java.util.ArrayList; @@ -36,14 +48,14 @@ import java.util.List; public class DefaultFarmerBehavior implements IFarmerBehavior { - public static boolean defaultPlant(World world, BlockPos pos, BlockState toPlant, IFarmer farmer, int use) { + public static boolean defaultPlant(Level world, BlockPos pos, BlockState toPlant, IFarmer farmer, int use) { if (toPlant != null) { BlockPos farmland = pos.below(); - Block farmlandBlock = world.getBlockState(farmland).getBlock(); - if (Tags.Blocks.DIRT.contains(farmlandBlock) || farmlandBlock == Blocks.GRASS) { + BlockState farmlandState = world.getBlockState(farmland); + if (farmlandState.is(BlockTags.DIRT) || farmlandState.is(Blocks.GRASS_BLOCK)) { world.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); useHoeAt(world, farmland); - world.playSound(null, farmland, SoundEvents.HOE_TILL, SoundCategory.BLOCKS, 1.0F, 1.0F); + world.playSound(null, farmland, SoundEvents.HOE_TILL, SoundSource.BLOCKS, 1.0F, 1.0F); farmer.extractEnergy(use); } @@ -55,7 +67,7 @@ public class DefaultFarmerBehavior implements IFarmerBehavior { return false; } - private static boolean tryPlant(BlockState toPlant, World world, BlockPos pos) { + private static boolean tryPlant(BlockState toPlant, Level world, BlockPos pos) { if (toPlant.canSurvive(world, pos)) { world.setBlockAndUpdate(pos, toPlant); return true; @@ -64,7 +76,7 @@ public class DefaultFarmerBehavior implements IFarmerBehavior { } @Override - public FarmerResult tryPlantSeed(ItemStack seed, World world, BlockPos pos, IFarmer farmer) { + public FarmerResult tryPlantSeed(ItemStack seed, Level world, BlockPos pos, IFarmer farmer) { int use = 350; if (farmer.getEnergy() >= use * 2) { if (defaultPlant(world, pos, this.getPlantablePlantFromStack(seed, world, pos), farmer, use)) { @@ -75,14 +87,14 @@ public class DefaultFarmerBehavior implements IFarmerBehavior { } @Override - public FarmerResult tryHarvestPlant(ServerWorld world, BlockPos pos, IFarmer farmer) { + public FarmerResult tryHarvestPlant(ServerLevel world, BlockPos pos, IFarmer farmer) { int use = 250; if (farmer.getEnergy() >= use) { BlockState state = world.getBlockState(pos); Block block = state.getBlock(); - if (block instanceof CropsBlock) { - if (((CropsBlock) block).isMaxAge(state)) { + if (block instanceof CropBlock) { + if (((CropBlock) block).isMaxAge(state)) { return this.doFarmerStuff(state, world, pos, farmer); } } @@ -95,12 +107,12 @@ public class DefaultFarmerBehavior implements IFarmerBehavior { return FarmerResult.FAIL; } - private FarmerResult doFarmerStuff(BlockState state, ServerWorld world, BlockPos pos, IFarmer farmer) { + private FarmerResult doFarmerStuff(BlockState state, ServerLevel world, BlockPos pos, IFarmer farmer) { List seeds = new ArrayList<>(); List other = new ArrayList<>(); List drops = state.getDrops(new LootContext.Builder(world) - .withParameter(LootParameters.ORIGIN, new Vector3d(pos.getX(), pos.getY(), pos.getZ())) - .withParameter(LootParameters.TOOL, ItemStack.EMPTY)); + .withParameter(LootContextParams.ORIGIN, new Vec3(pos.getX(), pos.getY(), pos.getZ())) + .withParameter(LootContextParams.TOOL, ItemStack.EMPTY)); if (drops.isEmpty()) return FarmerResult.FAIL; for (ItemStack stack : drops) { @@ -138,12 +150,12 @@ public class DefaultFarmerBehavior implements IFarmerBehavior { return 0; } - private BlockState getPlantablePlantFromStack(ItemStack stack, World world, BlockPos pos) { + private BlockState getPlantablePlantFromStack(ItemStack stack, Level world, BlockPos pos) { if (StackUtil.isValid(stack)) { IPlantable plantable = this.getPlantableFromStack(stack); if (plantable != null) { BlockState state = plantable.getPlant(world, pos); - if (state != null && state.getBlock() instanceof IGrowable) { + if (state != null && state.getBlock() instanceof BonemealableBlock) { return state; } } @@ -173,36 +185,36 @@ public class DefaultFarmerBehavior implements IFarmerBehavior { return hoe; } - public static ActionResultType useHoeAt(World world, BlockPos pos) { + public static InteractionResult useHoeAt(Level world, BlockPos pos) { - PlayerEntity player = FakePlayerFactory.getMinecraft((ServerWorld) world); //TODO we need our own fakeplayer for the mod. + Player player = FakePlayerFactory.getMinecraft((ServerLevel) world); //TODO we need our own fakeplayer for the mod. ItemStack itemstack = getHoeStack(); if (!player.mayUseItemAt(pos.relative(Direction.UP), Direction.UP, itemstack)) { - return ActionResultType.FAIL; + return InteractionResult.FAIL; } else { - ItemUseContext dummyContext = new ItemUseContext(world, player, Hand.MAIN_HAND, itemstack, new BlockRayTraceResult(new Vector3d(0.5, 0.5, 0.5), Direction.UP, pos, false)); + UseOnContext dummyContext = new UseOnContext(world, player, InteractionHand.MAIN_HAND, itemstack, new BlockHitResult(new Vec3(0.5, 0.5, 0.5), Direction.UP, pos, false)); int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(dummyContext); if (hook != 0) { return hook > 0 - ? ActionResultType.SUCCESS - : ActionResultType.FAIL; + ? InteractionResult.SUCCESS + : InteractionResult.FAIL; } if (world.isEmptyBlock(pos.above())) { - Block block = world.getBlockState(pos).getBlock(); - if (block == Blocks.GRASS || block == Blocks.GRASS_PATH) { + BlockState state = world.getBlockState(pos); + if (state.is(Blocks.GRASS_BLOCK) || state.is(Blocks.DIRT_PATH)) { world.setBlockAndUpdate(pos, Blocks.FARMLAND.defaultBlockState()); - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; } - if (Tags.Blocks.DIRT.contains(block)) { + if (state.is(BlockTags.DIRT)) { world.setBlockAndUpdate(pos, Blocks.FARMLAND.defaultBlockState()); - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; } } - return ActionResultType.PASS; + return InteractionResult.PASS; } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/MelonPumpkinFarmerBehavior.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/MelonPumpkinFarmerBehavior.java index a4aa50a97..70bf1ceef 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/MelonPumpkinFarmerBehavior.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/MelonPumpkinFarmerBehavior.java @@ -14,26 +14,25 @@ import de.ellpeck.actuallyadditions.api.farmer.FarmerResult; import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior; import de.ellpeck.actuallyadditions.api.internal.IFarmer; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.loot.LootContext; -import net.minecraft.loot.LootParameters; -import net.minecraft.util.NonNullList; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.world.World; -import net.minecraft.world.server.ServerWorld; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +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.state.BlockState; +import net.minecraft.world.level.storage.loot.LootContext; +import net.minecraft.world.level.storage.loot.parameters.LootContextParams; +import net.minecraft.world.phys.Vec3; import java.util.List; public class MelonPumpkinFarmerBehavior implements IFarmerBehavior { @Override - public FarmerResult tryPlantSeed(ItemStack seed, World world, BlockPos pos, IFarmer farmer) { + public FarmerResult tryPlantSeed(ItemStack seed, Level world, BlockPos pos, IFarmer farmer) { int use = 350; if (farmer.getEnergy() >= use * 2) { if (StackUtil.isValid(seed)) { @@ -57,15 +56,15 @@ public class MelonPumpkinFarmerBehavior implements IFarmerBehavior { } @Override - public FarmerResult tryHarvestPlant(ServerWorld world, BlockPos pos, IFarmer farmer) { + public FarmerResult tryHarvestPlant(ServerLevel world, BlockPos pos, IFarmer farmer) { int use = 500; if (farmer.getEnergy() >= use) { BlockState state = world.getBlockState(pos); Block block = state.getBlock(); if (block == Blocks.PUMPKIN || block == Blocks.MELON) { List drops = state.getDrops(new LootContext.Builder(world) - .withParameter(LootParameters.ORIGIN, new Vector3d(pos.getX(), pos.getY(), pos.getZ())) - .withParameter(LootParameters.TOOL, ItemStack.EMPTY)); + .withParameter(LootContextParams.ORIGIN, new Vec3(pos.getX(), pos.getY(), pos.getZ())) + .withParameter(LootContextParams.TOOL, ItemStack.EMPTY)); if (!drops.isEmpty()) { if (farmer.canAddToOutput(drops)) { world.levelEvent(2001, pos, Block.getId(state)); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/NetherWartFarmerBehavior.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/NetherWartFarmerBehavior.java index 839a6744e..01bc1b0f9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/NetherWartFarmerBehavior.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/NetherWartFarmerBehavior.java @@ -13,21 +13,20 @@ package de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer; import de.ellpeck.actuallyadditions.api.farmer.FarmerResult; import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior; import de.ellpeck.actuallyadditions.api.internal.IFarmer; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.NetherWartBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.loot.LootContext; -import net.minecraft.loot.LootParameters; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.util.Direction; -import net.minecraft.util.NonNullList; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.world.World; -import net.minecraft.world.server.ServerWorld; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +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.NetherWartBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.storage.loot.LootContext; +import net.minecraft.world.level.storage.loot.parameters.LootContextParams; +import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.IPlantable; import java.util.List; @@ -35,7 +34,7 @@ import java.util.List; public class NetherWartFarmerBehavior implements IFarmerBehavior { @Override - public FarmerResult tryPlantSeed(ItemStack seed, World world, BlockPos pos, IFarmer farmer) { + public FarmerResult tryPlantSeed(ItemStack seed, Level world, BlockPos pos, IFarmer farmer) { int use = 500; if (farmer.getEnergy() >= use) { if (seed.getItem() == Items.NETHER_WART) { @@ -51,15 +50,15 @@ public class NetherWartFarmerBehavior implements IFarmerBehavior { } @Override - public FarmerResult tryHarvestPlant(ServerWorld world, BlockPos pos, IFarmer farmer) { + public FarmerResult tryHarvestPlant(ServerLevel world, BlockPos pos, IFarmer farmer) { int use = 500; if (farmer.getEnergy() >= use) { BlockState state = world.getBlockState(pos); if (state.getBlock() instanceof NetherWartBlock) { if (state.getValue(BlockStateProperties.AGE_3) >= 3) { List drops = state.getDrops(new LootContext.Builder(world) - .withParameter(LootParameters.ORIGIN, new Vector3d(pos.getX(), pos.getY(), pos.getZ())) - .withParameter(LootParameters.TOOL, ItemStack.EMPTY)); + .withParameter(LootContextParams.ORIGIN, new Vec3(pos.getX(), pos.getY(), pos.getZ())) + .withParameter(LootContextParams.TOOL, ItemStack.EMPTY)); if (!drops.isEmpty()) { boolean toInput = farmer.canAddToSeeds(drops); if (toInput || farmer.canAddToOutput(drops)) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/ReedFarmerBehavior.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/ReedFarmerBehavior.java index b4b76110d..4f062c700 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/ReedFarmerBehavior.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/ReedFarmerBehavior.java @@ -13,26 +13,25 @@ package de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer; import de.ellpeck.actuallyadditions.api.farmer.FarmerResult; import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior; import de.ellpeck.actuallyadditions.api.internal.IFarmer; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.SugarCaneBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.loot.LootContext; -import net.minecraft.loot.LootParameters; -import net.minecraft.util.NonNullList; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.world.World; -import net.minecraft.world.server.ServerWorld; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +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.SugarCaneBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.storage.loot.LootContext; +import net.minecraft.world.level.storage.loot.parameters.LootContextParams; +import net.minecraft.world.phys.Vec3; import java.util.List; public class ReedFarmerBehavior implements IFarmerBehavior { @Override - public FarmerResult tryPlantSeed(ItemStack seed, World world, BlockPos pos, IFarmer farmer) { + public FarmerResult tryPlantSeed(ItemStack seed, Level world, BlockPos pos, IFarmer farmer) { int use = 250; if (farmer.getEnergy() >= use) { if (seed.getItem() == Items.SUGAR_CANE) { @@ -48,7 +47,7 @@ public class ReedFarmerBehavior implements IFarmerBehavior { } @Override - public FarmerResult tryHarvestPlant(ServerWorld world, BlockPos pos, IFarmer farmer) { + public FarmerResult tryHarvestPlant(ServerLevel world, BlockPos pos, IFarmer farmer) { int use = 250; if (farmer.getEnergy() >= use) { BlockState state = world.getBlockState(pos); @@ -61,8 +60,8 @@ public class ReedFarmerBehavior implements IFarmerBehavior { BlockState upState = world.getBlockState(up); if (upState.getBlock() instanceof SugarCaneBlock) { List drops = state.getDrops(new LootContext.Builder(world) - .withParameter(LootParameters.ORIGIN, new Vector3d(pos.getX(), pos.getY(), pos.getZ())) - .withParameter(LootParameters.TOOL, ItemStack.EMPTY)); + .withParameter(LootContextParams.ORIGIN, new Vec3(pos.getX(), pos.getY(), pos.getZ())) + .withParameter(LootContextParams.TOOL, ItemStack.EMPTY)); if (!drops.isEmpty()) { if (farmer.canAddToOutput(drops)) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java index 6f31fc790..6a4829b8b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java @@ -10,19 +10,18 @@ package de.ellpeck.actuallyadditions.mod.misc.special; -import com.mojang.blaze3d.matrix.MatrixStack; -import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.math.Vector3f; +import net.minecraft.Util; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.model.ItemCameraTransforms; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerModelPart; -import net.minecraft.item.BlockItem; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Util; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.util.math.vector.Vector3f; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.player.PlayerModelPart; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.phys.Vec3; public class RenderSpecial { @@ -32,15 +31,15 @@ public class RenderSpecial { this.theThingToRender = stack; } - public void render(MatrixStack matrixStack, IRenderTypeBuffer buffer, int combinedLight, PlayerEntity player, float partialTicks) { + public void render(PoseStack matrixStack, MultiBufferSource buffer, int combinedLight, Player player, float partialTick) { if (this.theThingToRender.isEmpty() || player.isInvisible() || !player.isModelPartShown(PlayerModelPart.CAPE) || player.isFallFlying()) { return; } matrixStack.pushPose(); - Vector3d currentPos = Minecraft.getInstance().player.getEyePosition(partialTicks); - Vector3d playerPos = player.getEyePosition(partialTicks); + Vec3 currentPos = Minecraft.getInstance().player.getEyePosition(partialTick); + Vec3 playerPos = player.getEyePosition(partialTick); matrixStack.translate(playerPos.x - currentPos.x, playerPos.y - currentPos.y, playerPos.z - currentPos.z); matrixStack.translate(0D, 2.575D - (player.isCrouching() ? 0.125D @@ -66,17 +65,17 @@ public class RenderSpecial { matrixStack.translate(0D, Math.sin(boop % (2 * Math.PI)) * 0.25, 0D); matrixStack.mulPose(Vector3f.YP.rotationDegrees((float) (boop * 40D % 360))); - GlStateManager._disableLighting(); +// GlStateManager._disableLighting(); matrixStack.pushPose(); if (!isBlock) { matrixStack.translate(0D, 0.5D, 0D); } matrixStack.mulPose(Vector3f.XN.rotationDegrees(180F)); - Minecraft.getInstance().getItemRenderer().renderStatic(theThingToRender, ItemCameraTransforms.TransformType.FIXED, combinedLight, OverlayTexture.NO_OVERLAY, matrixStack, buffer); + Minecraft.getInstance().getItemRenderer().renderStatic(theThingToRender, ItemTransforms.TransformType.FIXED, combinedLight, OverlayTexture.NO_OVERLAY, matrixStack, buffer, 0); matrixStack.popPose(); - GlStateManager._enableLighting(); +// GlStateManager._enableLighting(); matrixStack.popPose(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/SpecialRenderInit.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/SpecialRenderInit.java index 50bb7e46e..783b69979 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/SpecialRenderInit.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/SpecialRenderInit.java @@ -11,10 +11,10 @@ package de.ellpeck.actuallyadditions.mod.misc.special; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Block; import net.minecraftforge.client.event.RenderPlayerEvent; import net.minecraftforge.eventbus.api.EventPriority; import net.minecraftforge.eventbus.api.SubscribeEvent; @@ -94,7 +94,7 @@ public class SpecialRenderInit { if (SPECIAL_LIST.containsKey(lower)) { RenderSpecial render = SPECIAL_LIST.get(lower); if (render != null) { - render.render(event.getMatrixStack(), event.getBuffers(), event.getLight(), event.getPlayer(), event.getPartialRenderTick()); + render.render(event.getPoseStack(), event.getMultiBufferSource(), event.getPackedLight(), event.getPlayer(), event.getPartialTick()); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/IDataHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/IDataHandler.java index ccac7cf62..e6bf22348 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/IDataHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/IDataHandler.java @@ -10,11 +10,11 @@ package de.ellpeck.actuallyadditions.mod.network; -import net.minecraft.nbt.CompoundNBT; -import net.minecraftforge.fml.network.NetworkEvent; +import net.minecraft.nbt.CompoundTag; +import net.minecraftforge.network.NetworkEvent; public interface IDataHandler { - void handleData(CompoundNBT compound, NetworkEvent.Context context); + void handleData(CompoundTag compound, NetworkEvent.Context context); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketClientToServer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketClientToServer.java index 573131956..6684d2391 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketClientToServer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketClientToServer.java @@ -11,30 +11,29 @@ package de.ellpeck.actuallyadditions.mod.network; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import io.netty.buffer.ByteBuf; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.network.PacketBuffer; -import net.minecraftforge.fml.network.NetworkEvent; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class PacketClientToServer { - private CompoundNBT data; + private CompoundTag data; private IDataHandler handler; public PacketClientToServer() { } - public PacketClientToServer(CompoundNBT data, IDataHandler handler) { + public PacketClientToServer(CompoundTag data, IDataHandler handler) { this.data = data; this.handler = handler; } - public static PacketClientToServer fromBytes(PacketBuffer buffer) { + public static PacketClientToServer fromBytes(FriendlyByteBuf buffer) { try { - CompoundNBT data = buffer.readNbt(); + CompoundTag data = buffer.readNbt(); int handlerId = buffer.readInt(); if (handlerId >= 0 && handlerId < PacketHandler.DATA_HANDLERS.size()) { @@ -46,7 +45,7 @@ public class PacketClientToServer { return new PacketClientToServer(); } - public static void toBytes(PacketClientToServer message, PacketBuffer buffer) { + public static void toBytes(PacketClientToServer message, FriendlyByteBuf buffer) { buffer.writeNbt(message.data); buffer.writeInt(PacketHandler.DATA_HANDLERS.indexOf(message.handler)); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandler.java index 6ae8a06dd..d8708195d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandler.java @@ -20,26 +20,26 @@ import de.ellpeck.actuallyadditions.mod.particle.ParticleLaserItem; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import net.minecraft.client.Minecraft; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.inventory.container.Container; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.RegistryKey; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.registry.Registry; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Registry; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.util.FakePlayer; -import net.minecraftforge.fml.network.NetworkDirection; -import net.minecraftforge.fml.network.NetworkEvent; -import net.minecraftforge.fml.network.NetworkRegistry; -import net.minecraftforge.fml.network.PacketDistributor; -import net.minecraftforge.fml.network.simple.SimpleChannel; +import net.minecraftforge.network.NetworkDirection; +import net.minecraftforge.network.NetworkEvent; +import net.minecraftforge.network.NetworkRegistry; +import net.minecraftforge.network.PacketDistributor; +import net.minecraftforge.network.simple.SimpleChannel; import java.util.ArrayList; import java.util.List; @@ -50,17 +50,17 @@ public final class PacketHandler { public static final IDataHandler LASER_HANDLER = new IDataHandler() { @Override @OnlyIn(Dist.CLIENT) - public void handleData(CompoundNBT compound, NetworkEvent.Context context) { + public void handleData(CompoundTag compound, NetworkEvent.Context context) { AssetUtil.spawnLaserWithTimeClient(compound.getDouble("StartX"), compound.getDouble("StartY"), compound.getDouble("StartZ"), compound.getDouble("EndX"), compound.getDouble("EndY"), compound.getDouble("EndZ"), compound.getInt("Color"), compound.getInt("MaxAge"), compound.getDouble("RotationTime"), compound.getFloat("Size"), compound.getFloat("Alpha")); } }; public static final IDataHandler TILE_ENTITY_HANDLER = new IDataHandler() { @Override @OnlyIn(Dist.CLIENT) - public void handleData(CompoundNBT compound, NetworkEvent.Context context) { - World world = Minecraft.getInstance().level; + public void handleData(CompoundTag compound, NetworkEvent.Context context) { + Level world = Minecraft.getInstance().level; if (world != null) { - TileEntity tile = world.getBlockEntity(new BlockPos(compound.getInt("X"), compound.getInt("Y"), compound.getInt("Z"))); + BlockEntity tile = world.getBlockEntity(new BlockPos(compound.getInt("X"), compound.getInt("Y"), compound.getInt("Z"))); if (tile instanceof TileEntityBase) { ((TileEntityBase) tile).readSyncableNBT(compound.getCompound("Data"), TileEntityBase.NBTType.SYNC); } @@ -70,7 +70,7 @@ public final class PacketHandler { public static final IDataHandler LASER_PARTICLE_HANDLER = new IDataHandler() { @Override @OnlyIn(Dist.CLIENT) - public void handleData(CompoundNBT compound, NetworkEvent.Context context) { + public void handleData(CompoundTag compound, NetworkEvent.Context context) { Minecraft mc = Minecraft.getInstance(); ItemStack stack = ItemStack.of(compound); @@ -90,51 +90,51 @@ public final class PacketHandler { } }; public static final IDataHandler GUI_BUTTON_TO_TILE_HANDLER = (compound, context) -> { - World world = context.getSender().getServer().getLevel(RegistryKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(compound.getString("WorldID")))); - TileEntity tile = world.getBlockEntity(new BlockPos(compound.getInt("X"), compound.getInt("Y"), compound.getInt("Z"))); + Level world = context.getSender().getServer().getLevel(ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(compound.getString("WorldID")))); + BlockEntity tile = world.getBlockEntity(new BlockPos(compound.getInt("X"), compound.getInt("Y"), compound.getInt("Z"))); if (tile instanceof IButtonReactor) { IButtonReactor reactor = (IButtonReactor) tile; Entity entity = world.getEntity(compound.getInt("PlayerID")); - if (entity instanceof PlayerEntity) { - reactor.onButtonPressed(compound.getInt("ButtonID"), (PlayerEntity) entity); + if (entity instanceof Player) { + reactor.onButtonPressed(compound.getInt("ButtonID"), (Player) entity); } } }; public static final IDataHandler GUI_BUTTON_TO_CONTAINER_HANDLER = (compound, context) -> { - World world = context.getSender().getServer().getLevel(RegistryKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(compound.getString("WorldID")))); + Level world = context.getSender().getServer().getLevel(ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(compound.getString("WorldID")))); Entity entity = world.getEntity(compound.getInt("PlayerID")); - if (entity instanceof PlayerEntity) { - Container container = ((PlayerEntity) entity).containerMenu; + if (entity instanceof Player) { + AbstractContainerMenu container = ((Player) entity).containerMenu; if (container instanceof IButtonReactor) { - ((IButtonReactor) container).onButtonPressed(compound.getInt("ButtonID"), (PlayerEntity) entity); + ((IButtonReactor) container).onButtonPressed(compound.getInt("ButtonID"), (Player) entity); } } }; public static final IDataHandler GUI_NUMBER_TO_TILE_HANDLER = (compound, context) -> { - World world = context.getSender().getServer().getLevel(RegistryKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(compound.getString("WorldID")))); - TileEntity tile = world.getBlockEntity(new BlockPos(compound.getInt("X"), compound.getInt("Y"), compound.getInt("Z"))); + Level world = context.getSender().getServer().getLevel(ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(compound.getString("WorldID")))); + BlockEntity tile = world.getBlockEntity(new BlockPos(compound.getInt("X"), compound.getInt("Y"), compound.getInt("Z"))); if (tile instanceof INumberReactor) { INumberReactor reactor = (INumberReactor) tile; - reactor.onNumberReceived(compound.getDouble("Number"), compound.getInt("NumberID"), (PlayerEntity) world.getEntity(compound.getInt("PlayerID"))); + reactor.onNumberReceived(compound.getDouble("Number"), compound.getInt("NumberID"), (Player) world.getEntity(compound.getInt("PlayerID"))); } }; public static final IDataHandler GUI_STRING_TO_TILE_HANDLER = (compound, context) -> { - World world = context.getSender().getServer().getLevel(RegistryKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(compound.getString("WorldID")))); - TileEntity tile = world.getBlockEntity(new BlockPos(compound.getInt("X"), compound.getInt("Y"), compound.getInt("Z"))); + Level world = context.getSender().getServer().getLevel(ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(compound.getString("WorldID")))); + BlockEntity tile = world.getBlockEntity(new BlockPos(compound.getInt("X"), compound.getInt("Y"), compound.getInt("Z"))); if (tile instanceof IStringReactor) { IStringReactor reactor = (IStringReactor) tile; - reactor.onTextReceived(compound.getString("Text"), compound.getInt("TextID"), (PlayerEntity) world.getEntity(compound.getInt("PlayerID"))); + reactor.onTextReceived(compound.getString("Text"), compound.getInt("TextID"), (Player) world.getEntity(compound.getInt("PlayerID"))); } }; public static final IDataHandler SYNC_PLAYER_DATA = new IDataHandler() { @Override @OnlyIn(Dist.CLIENT) - public void handleData(CompoundNBT compound, NetworkEvent.Context context) { - CompoundNBT dataTag = compound.getCompound("Data"); - PlayerEntity player = context.getSender(); //ActuallyAdditions.PROXY.getCurrentPlayer(); + public void handleData(CompoundTag compound, NetworkEvent.Context context) { + CompoundTag dataTag = compound.getCompound("Data"); + Player player = context.getSender(); //ActuallyAdditions.PROXY.getCurrentPlayer(); if (player != null) { PlayerData.getDataFromPlayer(player).readFromNBT(dataTag, false); @@ -148,8 +148,8 @@ public final class PacketHandler { } }; public static final IDataHandler PLAYER_DATA_TO_SERVER = (compound, context) -> { - World world = context.getSender().getServer().getLevel(RegistryKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(compound.getString("World")))); - PlayerEntity player = world.getServer().getPlayerList().getPlayer(compound.getUUID("UUID")); + Level world = context.getSender().getServer().getLevel(ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(compound.getString("World")))); + Player player = world.getServer().getPlayerList().getPlayer(compound.getUUID("UUID")); if (player != null) { PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player); @@ -206,7 +206,7 @@ public final class PacketHandler { DATA_HANDLERS.add(PLAYER_DATA_TO_SERVER); } - public static void sendTo(Object msg, ServerPlayerEntity player) { + public static void sendTo(Object msg, ServerPlayer player) { if (!(player instanceof FakePlayer)) { THE_NETWORK.sendTo(msg, player.connection.getConnection(), NetworkDirection.PLAY_TO_CLIENT); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandlerHelper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandlerHelper.java index e1899ddb1..c5fae13ba 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandlerHelper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandlerHelper.java @@ -15,20 +15,20 @@ import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.mod.data.PlayerData; import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave; import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.fml.network.PacketDistributor; +import net.minecraftforge.network.PacketDistributor; public final class PacketHandlerHelper { @OnlyIn(Dist.CLIENT) - public static void sendButtonPacket(TileEntity tile, int buttonId) { - CompoundNBT compound = new CompoundNBT(); + public static void sendButtonPacket(BlockEntity tile, int buttonId) { + CompoundTag compound = new CompoundTag(); BlockPos pos = tile.getBlockPos(); compound.putInt("X", pos.getX()); compound.putInt("Y", pos.getY()); @@ -39,26 +39,26 @@ public final class PacketHandlerHelper { PacketHandler.THE_NETWORK.sendToServer(new PacketClientToServer(compound, PacketHandler.GUI_BUTTON_TO_TILE_HANDLER)); } - public static void syncPlayerData(PlayerEntity player, boolean log) { - CompoundNBT compound = new CompoundNBT(); + public static void syncPlayerData(Player player, boolean log) { + CompoundTag compound = new CompoundTag(); compound.putBoolean("Log", log); - CompoundNBT data = new CompoundNBT(); + CompoundTag data = new CompoundTag(); PlayerData.getDataFromPlayer(player).writeToNBT(data, false); compound.put("Data", data); - if (player instanceof ServerPlayerEntity) { - PacketHandler.THE_NETWORK.send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) player), new PacketServerToClient(compound, PacketHandler.SYNC_PLAYER_DATA)); + if (player instanceof ServerPlayer) { + PacketHandler.THE_NETWORK.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new PacketServerToClient(compound, PacketHandler.SYNC_PLAYER_DATA)); } } @OnlyIn(Dist.CLIENT) public static void sendPlayerDataToServer(boolean log, int type) { - CompoundNBT compound = new CompoundNBT(); + CompoundTag compound = new CompoundTag(); compound.putBoolean("Log", log); compound.putInt("Type", type); - PlayerEntity player = Minecraft.getInstance().player; + Player player = Minecraft.getInstance().player; if (player != null) { compound.putString("World", player.level.dimension().getRegistryName().toString()); compound.putUUID("UUID", player.getUUID()); @@ -89,8 +89,8 @@ public final class PacketHandlerHelper { } @OnlyIn(Dist.CLIENT) - public static void sendNumberPacket(TileEntity tile, double number, int id) { - CompoundNBT compound = new CompoundNBT(); + public static void sendNumberPacket(BlockEntity tile, double number, int id) { + CompoundTag compound = new CompoundTag(); compound.putInt("X", tile.getBlockPos().getX()); compound.putInt("Y", tile.getBlockPos().getY()); compound.putInt("Z", tile.getBlockPos().getZ()); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketServerToClient.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketServerToClient.java index a1a56162d..6fb5f0a86 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketServerToClient.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketServerToClient.java @@ -11,30 +11,30 @@ package de.ellpeck.actuallyadditions.mod.network; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.network.PacketBuffer; -import net.minecraftforge.fml.network.NetworkEvent; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class PacketServerToClient { - private CompoundNBT data; + private CompoundTag data; private IDataHandler handler; public PacketServerToClient() { } - public PacketServerToClient(CompoundNBT data, IDataHandler handler) { + public PacketServerToClient(CompoundTag data, IDataHandler handler) { this.data = data; this.handler = handler; } - public static PacketServerToClient fromBytes(final PacketBuffer buffer) { + public static PacketServerToClient fromBytes(final FriendlyByteBuf buffer) { try { - CompoundNBT data = buffer.readNbt(); + CompoundTag data = buffer.readNbt(); int handlerId = buffer.readInt(); if (handlerId >= 0 && handlerId < PacketHandler.DATA_HANDLERS.size()) { @@ -46,7 +46,7 @@ public class PacketServerToClient { return new PacketServerToClient(); } - public static void toBytes(final PacketServerToClient message, PacketBuffer buffer) { + public static void toBytes(final PacketServerToClient message, FriendlyByteBuf buffer) { buffer.writeNbt(message.data); buffer.writeInt(PacketHandler.DATA_HANDLERS.indexOf(message.handler)); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/IButtonReactor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/IButtonReactor.java index 8cd749605..4daff3c96 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/IButtonReactor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/IButtonReactor.java @@ -10,7 +10,7 @@ package de.ellpeck.actuallyadditions.mod.network.gui; -import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.world.entity.player.Player; public interface IButtonReactor { @@ -21,5 +21,5 @@ public interface IButtonReactor { * @param buttonID The button's ID * @param player The Player pressing it */ - void onButtonPressed(int buttonID, PlayerEntity player); + void onButtonPressed(int buttonID, Player player); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/INumberReactor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/INumberReactor.java index fe2d14d1f..ec8d5c181 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/INumberReactor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/INumberReactor.java @@ -10,7 +10,7 @@ package de.ellpeck.actuallyadditions.mod.network.gui; -import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.world.entity.player.Player; public interface INumberReactor { @@ -21,5 +21,5 @@ public interface INumberReactor { * @param id The ID (meaning the place in the GUI) of the number typed in * @param player The Player doing it */ - void onNumberReceived(double number, int id, PlayerEntity player); + void onNumberReceived(double number, int id, Player player); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/IStringReactor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/IStringReactor.java index 6300ec13d..4ab020eb2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/IStringReactor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/IStringReactor.java @@ -10,7 +10,7 @@ package de.ellpeck.actuallyadditions.mod.network.gui; -import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.world.entity.player.Player; public interface IStringReactor { @@ -21,5 +21,5 @@ public interface IStringReactor { * @param textID The ID (meaning the place in the GUI) of the text typed in * @param player The Player doing it */ - void onTextReceived(String text, int textID, PlayerEntity player); + void onTextReceived(String text, int textID, Player player); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/ore/InitOreDict.java b/src/main/java/de/ellpeck/actuallyadditions/mod/ore/InitOreDict.java index 6b4e15b85..1cb046fc8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/ore/InitOreDict.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/ore/InitOreDict.java @@ -11,10 +11,10 @@ package de.ellpeck.actuallyadditions.mod.ore; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.block.Block; // TODO: [port][change] migrate to TAGS @Deprecated diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ActuallyParticles.java b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ActuallyParticles.java index 4fd0d68ce..e0098657f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ActuallyParticles.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ActuallyParticles.java @@ -1,11 +1,11 @@ package de.ellpeck.actuallyadditions.mod.particle; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import net.minecraft.particles.ParticleType; +import net.minecraft.core.particles.ParticleType; import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; public class ActuallyParticles { private static final DeferredRegister> PARTICLE_TYPES = DeferredRegister.create(ForgeRegistries.PARTICLE_TYPES, ActuallyAdditions.MODID); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/BeamParticleData.java b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/BeamParticleData.java index f60d5ec5f..49651ab63 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/BeamParticleData.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/BeamParticleData.java @@ -4,13 +4,13 @@ import com.mojang.brigadier.StringReader; import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.network.PacketBuffer; -import net.minecraft.particles.IParticleData; -import net.minecraft.particles.ParticleType; +import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.core.particles.ParticleType; +import net.minecraft.network.FriendlyByteBuf; import java.util.Locale; -public class BeamParticleData extends ParticleType implements IParticleData { +public class BeamParticleData extends ParticleType implements ParticleOptions { private ParticleType type; public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( Codec.DOUBLE.fieldOf("endX").forGetter(d -> d.endX), @@ -32,7 +32,7 @@ public class BeamParticleData extends ParticleType implements protected final double rotationTime; protected final float size; @SuppressWarnings("deprecation") - static final IDeserializer DESERIALIZER = new IDeserializer() { + static final Deserializer DESERIALIZER = new Deserializer() { @Override public BeamParticleData fromCommand(ParticleType type, StringReader reader) throws CommandSyntaxException { @@ -60,7 +60,7 @@ public class BeamParticleData extends ParticleType implements } @Override - public BeamParticleData fromNetwork(ParticleType type, PacketBuffer buffer) { + public BeamParticleData fromNetwork(ParticleType type, FriendlyByteBuf buffer) { double endX = buffer.readDouble(); double endY = buffer.readDouble(); double endZ = buffer.readDouble(); @@ -109,7 +109,7 @@ public class BeamParticleData extends ParticleType implements } @Override - public void writeToNetwork(PacketBuffer buffer) { + public void writeToNetwork(FriendlyByteBuf buffer) { buffer.writeDouble(this.endX); buffer.writeDouble(this.endY); buffer.writeDouble(this.endZ); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/BeamParticleType.java b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/BeamParticleType.java index 8de37e7b5..050934fb6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/BeamParticleType.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/BeamParticleType.java @@ -1,7 +1,7 @@ package de.ellpeck.actuallyadditions.mod.particle; import com.mojang.serialization.Codec; -import net.minecraft.particles.ParticleType; +import net.minecraft.core.particles.ParticleType; public class BeamParticleType extends ParticleType { public BeamParticleType() { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/LaserItemParticleData.java b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/LaserItemParticleData.java index 30c94a181..f5b00a846 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/LaserItemParticleData.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/LaserItemParticleData.java @@ -4,17 +4,17 @@ import com.mojang.brigadier.StringReader; import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketBuffer; -import net.minecraft.particles.IParticleData; -import net.minecraft.particles.ParticleType; -import net.minecraft.util.ResourceLocation; +import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.core.particles.ParticleType; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.minecraftforge.registries.ForgeRegistries; import java.util.Locale; -public class LaserItemParticleData extends ParticleType implements IParticleData { +public class LaserItemParticleData extends ParticleType implements ParticleOptions { private ParticleType type; public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( ItemStack.CODEC.fieldOf("stack").forGetter(d -> d.stack), @@ -26,7 +26,7 @@ public class LaserItemParticleData extends ParticleType i protected final ItemStack stack; protected final double outputX, outputY, outputZ; @SuppressWarnings("deprecation") - static final IParticleData.IDeserializer DESERIALIZER = new IParticleData.IDeserializer() { + static final ParticleOptions.Deserializer DESERIALIZER = new ParticleOptions.Deserializer() { @Override public LaserItemParticleData fromCommand(ParticleType type, StringReader reader) throws CommandSyntaxException { @@ -45,7 +45,7 @@ public class LaserItemParticleData extends ParticleType i } @Override - public LaserItemParticleData fromNetwork(ParticleType type, PacketBuffer buffer) { + public LaserItemParticleData fromNetwork(ParticleType type, FriendlyByteBuf buffer) { ItemStack stack = buffer.readItem(); double outputX = buffer.readDouble(); double outputY = buffer.readDouble(); @@ -74,7 +74,7 @@ public class LaserItemParticleData extends ParticleType i } @Override - public void writeToNetwork(PacketBuffer buffer) { + public void writeToNetwork(FriendlyByteBuf buffer) { buffer.writeItemStack(this.stack, true); buffer.writeDouble(this.outputX); buffer.writeDouble(this.outputY); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/LaserItemParticleType.java b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/LaserItemParticleType.java index bc8a7f6ef..612ce9c9c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/LaserItemParticleType.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/LaserItemParticleType.java @@ -1,7 +1,7 @@ package de.ellpeck.actuallyadditions.mod.particle; import com.mojang.serialization.Codec; -import net.minecraft.particles.ParticleType; +import net.minecraft.core.particles.ParticleType; public class LaserItemParticleType extends ParticleType { public LaserItemParticleType() { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleBeam.java b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleBeam.java index f2f9af4af..765cde6bf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleBeam.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleBeam.java @@ -10,15 +10,15 @@ package de.ellpeck.actuallyadditions.mod.particle; -import com.mojang.blaze3d.vertex.IVertexBuilder; +import com.mojang.blaze3d.vertex.VertexConsumer; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import net.minecraft.client.particle.IAnimatedSprite; -import net.minecraft.client.particle.IParticleFactory; -import net.minecraft.client.particle.IParticleRenderType; +import net.minecraft.client.Camera; +import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.particle.Particle; -import net.minecraft.client.renderer.ActiveRenderInfo; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.particles.IParticleData; +import net.minecraft.client.particle.ParticleProvider; +import net.minecraft.client.particle.ParticleRenderType; +import net.minecraft.client.particle.SpriteSet; +import net.minecraft.core.particles.ParticleOptions; public class ParticleBeam extends Particle { @@ -30,7 +30,7 @@ public class ParticleBeam extends Particle { private final float size; private final float alpha; - public ParticleBeam(ClientWorld world, double startX, double startY, double startZ, double endX, double endY, double endZ, + public ParticleBeam(ClientLevel world, double startX, double startY, double startZ, double endX, double endY, double endZ, float[] color, float alpha, int maxAge, double rotationTime, float size) { super(world, startX, startY, startZ); this.endX = endX; @@ -44,30 +44,30 @@ public class ParticleBeam extends Particle { } @Override - public void render(IVertexBuilder buffer, ActiveRenderInfo renderInfo, float partialTicks) { + public void render(VertexConsumer buffer, Camera renderInfo, float partialTicks) { float ageRatio = (float) this.age / (float) this.lifetime; float currAlpha = this.alpha - ageRatio * this.alpha; AssetUtil.renderLaser(this.x + 0.5, this.y + 0.5, this.z + 0.5, this.endX + 0.5, this.endY + 0.5, this.endZ + 0.5, this.rotationTime, currAlpha, this.size, this.color); } @Override - public IParticleRenderType getRenderType() { - return IParticleRenderType.PARTICLE_SHEET_TRANSLUCENT; + public ParticleRenderType getRenderType() { + return ParticleRenderType.PARTICLE_SHEET_TRANSLUCENT; } - public static class Factory implements IParticleFactory { - public Factory(IAnimatedSprite sprite) { + public static class Factory implements ParticleProvider { + public Factory(SpriteSet sprite) { } @Override - public Particle createParticle(BeamParticleData data, ClientWorld worldIn, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { + public Particle createParticle(BeamParticleData data, ClientLevel worldIn, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { return new ParticleBeam(worldIn, x, y, z, data.endX, data.endY, data.endZ, data.color, data.alpha, data.maxAge, data.rotationTime, data.size); } - public static IParticleData createData(double endX, double endY, double endZ, float[] color, float alpha, + public static ParticleOptions createData(double endX, double endY, double endZ, float[] color, float alpha, int maxAge, double rotationTime, float size) { return new BeamParticleData(endX, endY, endZ, color, alpha, maxAge, rotationTime, size); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleLaserItem.java b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleLaserItem.java index e2fe83721..d0256a07a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleLaserItem.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleLaserItem.java @@ -10,29 +10,28 @@ package de.ellpeck.actuallyadditions.mod.particle; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.IVertexBuilder; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.math.Vector3f; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; +import net.minecraft.Util; +import net.minecraft.client.Camera; import net.minecraft.client.Minecraft; -import net.minecraft.client.particle.IAnimatedSprite; -import net.minecraft.client.particle.IParticleFactory; -import net.minecraft.client.particle.IParticleRenderType; +import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.particle.Particle; -import net.minecraft.client.renderer.ActiveRenderInfo; -import net.minecraft.client.renderer.IRenderTypeBuffer; +import net.minecraft.client.particle.ParticleProvider; +import net.minecraft.client.particle.ParticleRenderType; +import net.minecraft.client.particle.SpriteSet; import net.minecraft.client.renderer.LightTexture; -import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.item.ItemStack; -import net.minecraft.particles.IParticleData; -import net.minecraft.util.Util; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.util.math.vector.Vector3f; -import net.minecraft.world.LightType; +import net.minecraft.core.BlockPos; +import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.LightLayer; +import net.minecraft.world.phys.Vec3; public class ParticleLaserItem extends Particle { private final double otherX; @@ -41,11 +40,11 @@ public class ParticleLaserItem extends Particle { private final ItemStack stack; - private ParticleLaserItem(ClientWorld world, double posX, double posY, double posZ, ItemStack stack, double motionY) { + private ParticleLaserItem(ClientLevel world, double posX, double posY, double posZ, ItemStack stack, double motionY) { this(world, posX, posY, posZ, stack, motionY, 0, 0, 0); } - public ParticleLaserItem(ClientWorld world, double posX, double posY, double posZ, ItemStack stack, double motionY, double otherX, double otherY, double otherZ) { + public ParticleLaserItem(ClientLevel world, double posX, double posY, double posZ, ItemStack stack, double motionY, double otherX, double otherY, double otherZ) { super(world, posX + (world.random.nextDouble() - 0.5) / 8, posY, posZ + (world.random.nextDouble() - 0.5) / 8); this.stack = stack; this.otherX = otherX; @@ -71,14 +70,14 @@ public class ParticleLaserItem extends Particle { } @Override - public void render(IVertexBuilder buffer, ActiveRenderInfo renderInfo, float partialTicks) { + public void render(VertexConsumer vertexConsumer, Camera renderInfo, float partialTicks) { Minecraft mc = Minecraft.getInstance(); - IRenderTypeBuffer.Impl renderBuffer = mc.renderBuffers().bufferSource(); - Vector3d cam = renderInfo.getPosition(); + MultiBufferSource.BufferSource renderBuffer = mc.renderBuffers().bufferSource(); + Vec3 cam = renderInfo.getPosition(); - RenderSystem.pushMatrix(); - RenderHelper.turnBackOn(); - MatrixStack matrices = new MatrixStack(); +// RenderSystem.pushMatrix(); +// Lighting.turnBackOn(); + PoseStack matrices = new PoseStack(); matrices.pushPose(); matrices.translate(x - cam.x, y - cam.y, z - cam.z); @@ -87,7 +86,7 @@ public class ParticleLaserItem extends Particle { double boop = Util.getMillis() / 600D; matrices.mulPose(Vector3f.YP.rotationDegrees((float) (boop * 40D % 360))); - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); +// RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); TODO: See if this is needed RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); @@ -95,34 +94,34 @@ public class ParticleLaserItem extends Particle { float color = this.yd < 0 ? 1F - ageRatio : ageRatio; - RenderSystem.blendColor(color, color, color, color); +// RenderSystem.blendColor(color, color, color, color); TODO: See if this is needed - int blockLight = level.getBrightness(LightType.BLOCK, new BlockPos(x, y, z)); - int skyLight = level.getBrightness(LightType.SKY, new BlockPos(x, y, z)); + int blockLight = level.getBrightness(LightLayer.BLOCK, new BlockPos(x, y, z)); + int skyLight = level.getBrightness(LightLayer.SKY, new BlockPos(x, y, z)); AssetUtil.renderItemWithoutScrewingWithColors(this.stack, matrices, LightTexture.pack(blockLight, skyLight), OverlayTexture.NO_OVERLAY); - RenderHelper.turnOff(); +// Lighting.turnOff(); matrices.popPose(); - RenderSystem.popMatrix(); +// RenderSystem.popMatrix(); renderBuffer.endBatch(); } @Override - public IParticleRenderType getRenderType() { - return IParticleRenderType.PARTICLE_SHEET_TRANSLUCENT; + public ParticleRenderType getRenderType() { + return ParticleRenderType.PARTICLE_SHEET_TRANSLUCENT; } - public static class Factory implements IParticleFactory { - public Factory(IAnimatedSprite sprite) { + public static class Factory implements ParticleProvider { + public Factory(SpriteSet sprite) { } @Override - public Particle createParticle(LaserItemParticleData data, ClientWorld worldIn, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { + public Particle createParticle(LaserItemParticleData data, ClientLevel worldIn, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { return new ParticleLaserItem(worldIn, x, y, z, data.stack, ySpeed, data.outputX, data.outputY, data.outputZ); } - public static IParticleData createData(ItemStack stack, double outputX, double outputY, double outputZ) { + public static ParticleOptions createData(ItemStack stack, double outputX, double outputY, double outputZ) { return new LaserItemParticleData(stack, outputX, outputY, outputZ); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java b/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java index 21d95f875..f52c4c510 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java @@ -10,10 +10,8 @@ package de.ellpeck.actuallyadditions.mod.proxy; -import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.player.ClientPlayerEntity; -import net.minecraft.item.Item; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/CrusherRecipeRegistry.java b/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/CrusherRecipeRegistry.java index 41464c20d..29555417d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/CrusherRecipeRegistry.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/CrusherRecipeRegistry.java @@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.mod.recipe; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.ItemStack; public final class CrusherRecipeRegistry { // diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/sack/SackData.java b/src/main/java/de/ellpeck/actuallyadditions/mod/sack/SackData.java index d45cb9cd8..7638a8d27 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/sack/SackData.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/sack/SackData.java @@ -1,7 +1,7 @@ package de.ellpeck.actuallyadditions.mod.sack; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; -import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.CompoundTag; import net.minecraftforge.common.util.INBTSerializable; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.IItemHandler; @@ -54,7 +54,7 @@ public class SackData { optional = LazyOptional.of(() -> inventory); } - public SackData(UUID uuid, CompoundNBT incoming) { + public SackData(UUID uuid, CompoundTag incoming) { this.uuid = uuid; inventory = new ItemStackHandlerAA(SIZE){ @@ -78,7 +78,7 @@ public class SackData { return uuid; } - public static Optional fromNBT(CompoundNBT nbt) { + public static Optional fromNBT(CompoundTag nbt) { if (nbt.contains("UUID")) { UUID uuid = nbt.getUUID("UUID"); return Optional.of(new SackData(uuid, nbt)); @@ -86,8 +86,8 @@ public class SackData { return Optional.empty(); } - public CompoundNBT toNBT() { - CompoundNBT nbt = new CompoundNBT(); + public CompoundTag toNBT() { + CompoundTag nbt = new CompoundTag(); nbt.putUUID("UUID", uuid); @@ -98,7 +98,7 @@ public class SackData { return nbt; } - public static class Metadata implements INBTSerializable { + public static class Metadata implements INBTSerializable { private String firstAccessedPlayer = ""; private long firstAccessedTime = 0; @@ -129,8 +129,8 @@ public class SackData { } @Override - public CompoundNBT serializeNBT() { - CompoundNBT nbt = new CompoundNBT(); + public CompoundTag serializeNBT() { + CompoundTag nbt = new CompoundTag(); nbt.putString("firstPlayer", firstAccessedPlayer); nbt.putLong("firstTime", firstAccessedTime); @@ -141,7 +141,7 @@ public class SackData { } @Override - public void deserializeNBT(CompoundNBT nbt) { + public void deserializeNBT(CompoundTag nbt) { firstAccessedPlayer = nbt.getString("firstPlayer"); firstAccessedTime = nbt.getLong("firstTime"); lastAccessedPlayer = nbt.getString("lastPlayer"); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/sack/SackManager.java b/src/main/java/de/ellpeck/actuallyadditions/mod/sack/SackManager.java index 1749c2c33..453568033 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/sack/SackManager.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/sack/SackManager.java @@ -1,23 +1,22 @@ package de.ellpeck.actuallyadditions.mod.sack; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.nbt.ListNBT; -import net.minecraft.world.World; -import net.minecraft.world.storage.WorldSavedData; -import net.minecraftforge.common.util.Constants; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.saveddata.SavedData; import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.fml.common.thread.SidedThreadGroups; -import net.minecraftforge.fml.server.ServerLifecycleHooks; +import net.minecraftforge.fml.util.thread.SidedThreadGroups; import net.minecraftforge.items.IItemHandler; +import net.minecraftforge.server.ServerLifecycleHooks; import javax.annotation.Nonnull; import java.util.HashMap; import java.util.Optional; import java.util.UUID; -public class SackManager extends WorldSavedData { +public class SackManager extends SavedData { private static final String NAME = ActuallyAdditions.MODID + "_sack_data"; private static final SackManager blankClient = new SackManager(); @@ -25,12 +24,12 @@ public class SackManager extends WorldSavedData { private static final HashMap data = new HashMap<>(); public SackManager() { - super(NAME); + super(); } public static SackManager get() { if (Thread.currentThread().getThreadGroup() == SidedThreadGroups.SERVER) - return ServerLifecycleHooks.getCurrentServer().getLevel(World.OVERWORLD).getDataStorage().computeIfAbsent(SackManager::new, NAME); + return ServerLifecycleHooks.getCurrentServer().getLevel(Level.OVERWORLD).getDataStorage().computeIfAbsent(SackManager::load, SackManager::new, NAME); else return blankClient; } @@ -72,18 +71,18 @@ public class SackManager extends WorldSavedData { return LazyOptional.empty(); } - @Override - public void load(CompoundNBT nbt) { + public static SackManager load(CompoundTag nbt) { if (nbt.contains("Sacks")) { - ListNBT list = nbt.getList("Sacks", Constants.NBT.TAG_COMPOUND); - list.forEach((sackNBT) -> SackData.fromNBT((CompoundNBT) sackNBT).ifPresent((sack) -> data.put(sack.getUuid(), sack))); + ListTag list = nbt.getList("Sacks", CompoundTag.TAG_COMPOUND); + list.forEach((sackNBT) -> SackData.fromNBT((CompoundTag) sackNBT).ifPresent((sack) -> data.put(sack.getUuid(), sack))); } + return new SackManager(); } @Override @Nonnull - public CompoundNBT save(CompoundNBT compound) { - ListNBT sacks = new ListNBT(); + public CompoundTag save(CompoundTag compound) { + ListTag sacks = new ListTag(); data.forEach(((uuid, sackData) -> sacks.add(sackData.toNBT()))); compound.put("Sacks", sacks); return compound; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/CustomEnergyStorage.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/CustomEnergyStorage.java index e784b4836..89d17e08c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/CustomEnergyStorage.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/CustomEnergyStorage.java @@ -10,7 +10,7 @@ package de.ellpeck.actuallyadditions.mod.tile; -import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.CompoundTag; import net.minecraftforge.energy.EnergyStorage; public class CustomEnergyStorage extends EnergyStorage { @@ -60,12 +60,12 @@ public class CustomEnergyStorage extends EnergyStorage { dirty = false; } - public void readFromNBT(CompoundNBT compound) { + public void readFromNBT(CompoundTag compound) { if (compound.contains("Energy")) this.setEnergyStored(compound.getInt("Energy")); } - public void writeToNBT(CompoundNBT compound) { + public void writeToNBT(CompoundTag compound) { compound.putInt("Energy", this.getEnergyStored()); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/FilterSettings.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/FilterSettings.java index ccfbd43d9..3a81dfc6c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/FilterSettings.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/FilterSettings.java @@ -14,9 +14,9 @@ import de.ellpeck.actuallyadditions.mod.inventory.ContainerFilter; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter; import de.ellpeck.actuallyadditions.mod.items.DrillItem; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; public class FilterSettings { public final ItemStackHandlerAA filterInventory; @@ -83,8 +83,8 @@ public class FilterSettings { return false; } - public void writeToNBT(CompoundNBT tag, String name) { - CompoundNBT compound = new CompoundNBT(); + public void writeToNBT(CompoundTag tag, String name) { + CompoundTag compound = new CompoundTag(); compound.putBoolean("Whitelist", this.isWhitelist); compound.putBoolean("NBT", this.respectNBT); compound.putBoolean("Mod", this.respectMod); @@ -92,8 +92,8 @@ public class FilterSettings { tag.put(name, compound); } - public void readFromNBT(CompoundNBT tag, String name) { - CompoundNBT compound = tag.getCompound(name); + public void readFromNBT(CompoundTag tag, String name) { + CompoundTag compound = tag.getCompound(name); this.isWhitelist = compound.getBoolean("Whitelist"); this.respectNBT = compound.getBoolean("NBT"); this.respectMod = compound.getBoolean("Mod"); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/ISharingEnergyProvider.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/ISharingEnergyProvider.java index 663afc30b..d91394371 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/ISharingEnergyProvider.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/ISharingEnergyProvider.java @@ -10,8 +10,8 @@ package de.ellpeck.actuallyadditions.mod.tile; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; +import net.minecraft.core.Direction; +import net.minecraft.world.level.block.entity.BlockEntity; public interface ISharingEnergyProvider { @@ -21,5 +21,5 @@ public interface ISharingEnergyProvider { Direction[] getEnergyShareSides(); - boolean canShareTo(TileEntity tile); + boolean canShareTo(BlockEntity tile); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/ISharingFluidHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/ISharingFluidHandler.java index 363772946..139de199a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/ISharingFluidHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/ISharingFluidHandler.java @@ -10,7 +10,7 @@ package de.ellpeck.actuallyadditions.mod.tile; -import net.minecraft.util.Direction; +import net.minecraft.core.Direction; public interface ISharingFluidHandler { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java index 50aee0808..328e8ba1f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java @@ -20,16 +20,17 @@ import de.ellpeck.actuallyadditions.mod.config.CommonConfig; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; -import net.minecraft.block.BlockState; -import net.minecraft.item.Item; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.util.Direction; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.sounds.SoundSource; +import net.minecraft.util.Mth; +import net.minecraft.world.item.Item; +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.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.phys.AABB; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.energy.IEnergyStorage; @@ -45,23 +46,23 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple private int maxAge = 0; private int beamColor = 0x1b6dff; - public TileEntityAtomicReconstructor() { - super(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.getTileEntityType(), 1); + public TileEntityAtomicReconstructor(BlockPos pos, BlockState state) { + super(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.getTileEntityType(), pos, state, 1); int power = CommonConfig.Machines.RECONSTRUCTOR_POWER.get(); - int recieve = MathHelper.ceil(power * 0.016666F); + int recieve = Mth.ceil(power * 0.016666F); this.storage = new CustomEnergyStorage(power, recieve, 0); this.lazyEnergy = LazyOptional.of(() -> this.storage); } - public static void shootLaser(IAtomicReconstructor tile, World world, double startX, double startY, double startZ, double endX, double endY, double endZ, Lens currentLens) { - world.playSound(null, startX, startY, startZ, AASounds.RECONSTRUCTOR.get(), SoundCategory.BLOCKS, 0.35F, 1.0F); + public static void shootLaser(IAtomicReconstructor tile, Level world, double startX, double startY, double startZ, double endX, double endY, double endZ, Lens currentLens) { + world.playSound(null, startX, startY, startZ, AASounds.RECONSTRUCTOR.get(), SoundSource.BLOCKS, 0.35F, 1.0F); AssetUtil.spawnLaserWithTimeServer(world, startX, startY, startZ, endX, endY, endZ, currentLens.getColor(), 25, 0, 0.2F, 0.8F); } @Override - public AxisAlignedBB getRenderBoundingBox() { + public AABB getRenderBoundingBox() { if (getProgress() > 0.0f) - return new AxisAlignedBB(getPosition(), getPosition().offset(1,1,1).relative(getBlockState().getValue(BlockStateProperties.FACING), 11)); + return new AABB(getPosition(), getPosition().offset(1,1,1).relative(getBlockState().getValue(BlockStateProperties.FACING), 11)); else return super.getRenderBoundingBox(); } @@ -100,7 +101,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { compound.putInt("CurrentTime", this.currentTime); @@ -115,7 +116,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { this.currentTime = compound.getInt("CurrentTime"); @@ -125,27 +126,32 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple this.storage.readFromNBT(compound); } - @Override - public void updateEntity() { - super.updateEntity(); - if (!this.level.isClientSide) { - if (!this.isRedstonePowered && !this.isPulseMode) { - if (this.currentTime > 0) { - this.currentTime--; - if (this.currentTime <= 0) { - ActuallyAdditionsAPI.methodHandler.invokeReconstructor(this); + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityAtomicReconstructor tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityAtomicReconstructor tile) { + tile.serverTick(); + + if (!tile.isRedstonePowered && !tile.isPulseMode) { + if (tile.currentTime > 0) { + tile.currentTime--; + if (tile.currentTime <= 0) { + ActuallyAdditionsAPI.methodHandler.invokeReconstructor(tile); } } else { - this.currentTime = 100; + tile.currentTime = 100; } } - if (this.oldEnergy != this.storage.getEnergyStored() && this.sendUpdateWithInterval()) { - this.oldEnergy = this.storage.getEnergyStored(); - this.level.updateNeighbourForOutputSignal(this.worldPosition, ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get()); + if (tile.oldEnergy != tile.storage.getEnergyStored() && tile.sendUpdateWithInterval()) { + tile.oldEnergy = tile.storage.getEnergyStored(); + level.updateNeighbourForOutputSignal(pos, ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get()); } } - } @Override @@ -184,7 +190,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple } @Override - public World getWorldObject() { + public Level getWorldObject() { return this.getLevel(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java index a8d4c0738..ce37cc284 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java @@ -10,20 +10,17 @@ package de.ellpeck.actuallyadditions.mod.tile; -import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.util.VanillaPacketDispatcher; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; -import net.minecraft.block.BlockState; -import net.minecraft.client.renderer.texture.ITickable; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.play.server.SUpdateTileEntityPacket; -import net.minecraft.tileentity.ITickableTileEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.Connection; +import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; +import net.minecraft.world.entity.player.Player; +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.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.energy.CapabilityEnergy; @@ -36,23 +33,23 @@ import net.minecraftforge.items.IItemHandler; import javax.annotation.Nonnull; import javax.annotation.Nullable; -public abstract class TileEntityBase extends TileEntity implements ITickableTileEntity { +public abstract class TileEntityBase extends BlockEntity { public boolean isRedstonePowered; public boolean isPulseMode; public boolean stopFromDropping; protected int ticksElapsed; - protected TileEntity[] tilesAround = new TileEntity[6]; + protected BlockEntity[] tilesAround = new BlockEntity[6]; protected boolean hasSavedDataOnChangeOrWorldStart; - public TileEntityBase(TileEntityType type) { - super(type); + public TileEntityBase(BlockEntityType type, BlockPos pos, BlockState state) { + super(type, pos, state); } @Override - public CompoundNBT save(CompoundNBT compound) { + protected void saveAdditional(CompoundTag compound) { + super.saveAdditional(compound); this.writeSyncableNBT(compound, NBTType.SAVE_TILE); - return compound; } // TODO: [port] remove if the above is correct @@ -63,10 +60,11 @@ public abstract class TileEntityBase extends TileEntity implements ITickableTile // } @Override - public void load(BlockState state, CompoundNBT compound) { + public void load(CompoundTag compound) { this.readSyncableNBT(compound, NBTType.SAVE_TILE); } + // TODO: [port] remove if the above is correct // @Override // public final void readFromNBT(CompoundNBT compound) { @@ -75,26 +73,26 @@ public abstract class TileEntityBase extends TileEntity implements ITickableTile @Nullable @Override - public SUpdateTileEntityPacket getUpdatePacket() { - CompoundNBT compound = new CompoundNBT(); + public ClientboundBlockEntityDataPacket getUpdatePacket() { + CompoundTag compound = new CompoundTag(); this.writeSyncableNBT(compound, NBTType.SYNC); - return new SUpdateTileEntityPacket(this.worldPosition, -1, compound); + return ClientboundBlockEntityDataPacket.create(this); } @Override - public void onDataPacket(NetworkManager net, SUpdateTileEntityPacket pkt) { + public void onDataPacket(Connection net, ClientboundBlockEntityDataPacket pkt) { this.readSyncableNBT(pkt.getTag(), NBTType.SYNC); } @Override - public final CompoundNBT getUpdateTag() { - CompoundNBT compound = new CompoundNBT(); + public final CompoundTag getUpdateTag() { + CompoundTag compound = new CompoundTag(); this.writeSyncableNBT(compound, NBTType.SYNC); return compound; } @Override - public void handleUpdateTag(BlockState state, CompoundNBT tag) { + public void handleUpdateTag(CompoundTag tag) { this.readSyncableNBT(tag, NBTType.SYNC); } @@ -116,9 +114,9 @@ public abstract class TileEntityBase extends TileEntity implements ITickableTile }*/ } - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { if (type != NBTType.SAVE_BLOCK) { - super.save(compound); + super.saveAdditional(compound); } if (type == NBTType.SAVE_TILE) { @@ -134,9 +132,9 @@ public abstract class TileEntityBase extends TileEntity implements ITickableTile } } - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { if (type != NBTType.SAVE_BLOCK) { - super.load(null, compound); // FIXME: [port] flag as possible crash source + super.load(compound); // FIXME: [port] flag as possible crash source } if (type == NBTType.SAVE_TILE) { @@ -168,12 +166,6 @@ public abstract class TileEntityBase extends TileEntity implements ITickableTile // return new TranslationTextComponent(this.getNameForTranslation()); // } - - @Override - public void tick() { - this.updateEntity(); - } - public int getComparatorStrength() { return 0; } @@ -181,61 +173,63 @@ public abstract class TileEntityBase extends TileEntity implements ITickableTile private boolean shareEnergy = this instanceof ISharingEnergyProvider; private boolean shareFluid = this instanceof ISharingFluidHandler; - public void updateEntity() { + protected void clientTick() { + this.ticksElapsed++; + } + + protected void serverTick() { this.ticksElapsed++; - if (!this.level.isClientSide) { - if (this.shareEnergy) { - ISharingEnergyProvider provider = (ISharingEnergyProvider) this; - if (provider.doesShareEnergy()) { - int total = provider.getEnergyToSplitShare(); - if (total > 0) { - Direction[] sides = provider.getEnergyShareSides(); + if (this.shareEnergy) { + ISharingEnergyProvider provider = (ISharingEnergyProvider) this; + if (provider.doesShareEnergy()) { + int total = provider.getEnergyToSplitShare(); + if (total > 0) { + Direction[] sides = provider.getEnergyShareSides(); - int amount = total / sides.length; - if (amount <= 0) { - amount = total; - } + int amount = total / sides.length; + if (amount <= 0) { + amount = total; + } - for (Direction side : sides) { - TileEntity tile = this.tilesAround[side.ordinal()]; - if (tile != null && provider.canShareTo(tile)) { - WorldUtil.doEnergyInteraction(this, tile, side, amount); - } + for (Direction side : sides) { + BlockEntity tile = this.tilesAround[side.ordinal()]; + if (tile != null && provider.canShareTo(tile)) { + WorldUtil.doEnergyInteraction(this, tile, side, amount); } } } } + } - if (this.shareFluid) { - ISharingFluidHandler handler = (ISharingFluidHandler) this; - if (handler.doesShareFluid()) { - int total = handler.getMaxFluidAmountToSplitShare(); - if (total > 0) { - Direction[] sides = handler.getFluidShareSides(); + if (this.shareFluid) { + ISharingFluidHandler handler = (ISharingFluidHandler) this; + if (handler.doesShareFluid()) { + int total = handler.getMaxFluidAmountToSplitShare(); + if (total > 0) { + Direction[] sides = handler.getFluidShareSides(); - int amount = total / sides.length; - if (amount <= 0) { - amount = total; - } + int amount = total / sides.length; + if (amount <= 0) { + amount = total; + } - for (Direction side : sides) { - TileEntity tile = this.tilesAround[side.ordinal()]; - if (tile != null) { - WorldUtil.doFluidInteraction(this, tile, side, amount); - } + for (Direction side : sides) { + BlockEntity tile = this.tilesAround[side.ordinal()]; + if (tile != null) { + WorldUtil.doFluidInteraction(this, tile, side, amount); } } } } + } - if (!this.hasSavedDataOnChangeOrWorldStart) { - if (this.shouldSaveDataOnChangeOrWorldStart()) { - this.saveDataOnChangeOrWorldStart(); - } - - this.hasSavedDataOnChangeOrWorldStart = true; + if (!this.hasSavedDataOnChangeOrWorldStart) { + if (this.shouldSaveDataOnChangeOrWorldStart()) { + this.saveDataOnChangeOrWorldStart(); } + + this.hasSavedDataOnChangeOrWorldStart = true; } } @@ -257,7 +251,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickableTile this.setChanged(); } - public boolean canPlayerUse(PlayerEntity player) { + public boolean canPlayerUse(Player player) { return player.distanceToSqr(this.getBlockPos().getX() + 0.5D, this.worldPosition.getY() + 0.5D, this.worldPosition.getZ() + 0.5D) <= 64 && !this.isRemoved() && this.level.getBlockEntity(this.worldPosition) == this; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBatteryBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBatteryBox.java index 603570473..3d3fa8fd4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBatteryBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBatteryBox.java @@ -14,10 +14,12 @@ import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.items.ItemBattery; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; -import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.energy.IEnergyStorage; @@ -30,8 +32,8 @@ public class TileEntityBatteryBox extends TileEntityInventoryBase implements ISh private int lastEnergyStored; private int lastCompare; - public TileEntityBatteryBox() { - super(ActuallyBlocks.BATTERY_BOX.getTileEntityType(), 1); + public TileEntityBatteryBox(BlockPos pos, BlockState state) { + super(ActuallyBlocks.BATTERY_BOX.getTileEntityType(), pos, state, 1); } @Override @@ -43,18 +45,23 @@ public class TileEntityBatteryBox extends TileEntityInventoryBase implements ISh return LazyOptional.empty(); } - @Override - public void updateEntity() { - super.updateEntity(); + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityBatteryBox tile) { + tile.clientTick(); + } + } - if (!this.level.isClientSide) { - LazyOptional cap = this.getEnergyStorage(null); + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityBatteryBox tile) { + tile.serverTick(); + + LazyOptional cap = tile.getEnergyStorage(null); int currStorage = cap.map(storage -> { - ItemStack stack = this.inv.getStackInSlot(0); + ItemStack stack = tile.inv.getStackInSlot(0); if (!stack.isEmpty() && ItemUtil.isEnabled(stack)) { if (storage.getEnergyStored() > 0) { List tiles = new ArrayList<>(); - this.energyPushOffLoop(this, tiles); + tile.energyPushOffLoop(tile, tiles); if (!tiles.isEmpty()) { int amount = tiles.size(); @@ -65,10 +72,10 @@ public class TileEntityBatteryBox extends TileEntityInventoryBase implements ISh } int maxPer = storage.extractEnergy(energyPer, true); - for (TileEntityBatteryBox tile : tiles) { - ItemStack battery = tile.inv.getStackInSlot(0); + for (TileEntityBatteryBox te : tiles) { + ItemStack battery = te.inv.getStackInSlot(0); if (!battery.isEmpty() && !ItemUtil.isEnabled(battery)) { - int received = tile.getCapability(CapabilityEnergy.ENERGY, null).map(e -> e.receiveEnergy(maxPer, false)).orElse(0); + int received = te.getCapability(CapabilityEnergy.ENERGY, null).map(e -> e.receiveEnergy(maxPer, false)).orElse(0); storage.extractEnergy(received, false); if (storage.getEnergyStored() <= 0) { @@ -82,17 +89,24 @@ public class TileEntityBatteryBox extends TileEntityInventoryBase implements ISh return storage.getEnergyStored(); }).orElse(0); - if (this.lastCompare != this.getComparatorStrength()) { - this.lastCompare = this.getComparatorStrength(); - this.setChanged(); + if (tile.lastCompare != tile.getComparatorStrength()) { + tile.lastCompare = tile.getComparatorStrength(); + tile.setChanged(); } - if (this.lastEnergyStored != currStorage && this.sendUpdateWithInterval()) { - this.lastEnergyStored = currStorage; + if (tile.lastEnergyStored != currStorage && tile.sendUpdateWithInterval()) { + tile.lastEnergyStored = currStorage; } } } + @Override + public void serverTick() { + super.serverTick(); + + + } + @Override public int getComparatorStrength() { return this.getEnergyStorage(null) @@ -119,7 +133,7 @@ public class TileEntityBatteryBox extends TileEntityInventoryBase implements ISh return; } - for (TileEntity tile : startTile.tilesAround) { + for (BlockEntity tile : startTile.tilesAround) { if (tile instanceof TileEntityBatteryBox) { TileEntityBatteryBox box = (TileEntityBatteryBox) tile; if (!pushOffTo.contains(box)) { @@ -159,7 +173,7 @@ public class TileEntityBatteryBox extends TileEntityInventoryBase implements ISh } @Override - public boolean canShareTo(TileEntity tile) { + public boolean canShareTo(BlockEntity tile) { return !(tile instanceof TileEntityBatteryBox); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBioReactor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBioReactor.java index fafe21a99..99fbbab5d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBioReactor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBioReactor.java @@ -15,20 +15,23 @@ import de.ellpeck.actuallyadditions.mod.inventory.ContainerBioReactor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.Block; -import net.minecraft.block.IGrowable; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.INamedContainerProvider; -import net.minecraft.item.BlockItem; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.Item; +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.BonemealableBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.energy.IEnergyStorage; @@ -37,9 +40,7 @@ import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; - -public class TileEntityBioReactor extends TileEntityInventoryBase implements INamedContainerProvider, ISharingEnergyProvider { +public class TileEntityBioReactor extends TileEntityInventoryBase implements MenuProvider, ISharingEnergyProvider { public final CustomEnergyStorage storage = new CustomEnergyStorage(200000, 0, 800); public final LazyOptional lazyEnergy = LazyOptional.of(() -> this.storage); @@ -51,8 +52,8 @@ public class TileEntityBioReactor extends TileEntityInventoryBase implements INa private int lastBurnTime; private int lastProducePerTick; - public TileEntityBioReactor() { - super(ActuallyBlocks.BIOREACTOR.getTileEntityType(), 8); + public TileEntityBioReactor(BlockPos pos, BlockState state) { + super(ActuallyBlocks.BIOREACTOR.getTileEntityType(), pos, state, 8); } public static boolean isValidItem(ItemStack stack) { @@ -68,59 +69,66 @@ public class TileEntityBioReactor extends TileEntityInventoryBase implements INa } private static boolean isValid(Object o) { - return o instanceof IPlantable || o instanceof IGrowable; + return o instanceof IPlantable || o instanceof BonemealableBlock; } - @Override - public void updateEntity() { - super.updateEntity(); + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityBioReactor tile) { + tile.clientTick(); + } + } - if (this.burnTime <= 0) { - List types = null; + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityBioReactor tile) { + tile.serverTick(); - if (!this.isRedstonePowered && this.storage.getEnergyStored() < this.storage.getMaxEnergyStored()) { - for (int i = 0; i < this.inv.getSlots(); i++) { - ItemStack stack = this.inv.getStackInSlot(i); - if (StackUtil.isValid(stack)) { - Item item = stack.getItem(); - if (isValidItem(stack) && (types == null || !types.contains(item))) { - if (types == null) { - types = new ArrayList<>(); + if (tile.burnTime <= 0) { + List types = null; + + if (!tile.isRedstonePowered && tile.storage.getEnergyStored() < tile.storage.getMaxEnergyStored()) { + for (int i = 0; i < tile.inv.getSlots(); i++) { + ItemStack stack = tile.inv.getStackInSlot(i); + if (StackUtil.isValid(stack)) { + Item item = stack.getItem(); + if (isValidItem(stack) && (types == null || !types.contains(item))) { + if (types == null) { + types = new ArrayList<>(); + } + types.add(item); + + tile.inv.setStackInSlot(i, StackUtil.shrink(stack, 1)); } - types.add(item); - - this.inv.setStackInSlot(i, StackUtil.shrink(stack, 1)); } } + + tile.setChanged(); } - this.setChanged(); - } + if (types != null && !types.isEmpty()) { + int amount = types.size(); + tile.producePerTick = (int) Math.pow(amount * 2, 2); - if (types != null && !types.isEmpty()) { - int amount = types.size(); - this.producePerTick = (int) Math.pow(amount * 2, 2); - - this.maxBurnTime = 200 - (int) Math.pow(1.8, amount); - this.burnTime = this.maxBurnTime; + tile.maxBurnTime = 200 - (int) Math.pow(1.8, amount); + tile.burnTime = tile.maxBurnTime; + } else { + tile.burnTime = 0; + tile.maxBurnTime = 0; + tile.producePerTick = 0; + } } else { - this.burnTime = 0; - this.maxBurnTime = 0; - this.producePerTick = 0; + tile.burnTime--; + tile.storage.receiveEnergyInternal(tile.producePerTick, false); } - } else { - this.burnTime--; - this.storage.receiveEnergyInternal(this.producePerTick, false); - } - if ((this.lastBurnTime != this.burnTime || this.lastProducePerTick != this.producePerTick) && this.sendUpdateWithInterval()) { - this.lastBurnTime = this.burnTime; - this.lastProducePerTick = this.producePerTick; + if ((tile.lastBurnTime != tile.burnTime || tile.lastProducePerTick != tile.producePerTick) && tile.sendUpdateWithInterval()) { + tile.lastBurnTime = tile.burnTime; + tile.lastProducePerTick = tile.producePerTick; + } } } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); this.storage.writeToNBT(compound); @@ -130,7 +138,7 @@ public class TileEntityBioReactor extends TileEntityInventoryBase implements INa } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); this.storage.readFromNBT(compound); @@ -165,7 +173,7 @@ public class TileEntityBioReactor extends TileEntityInventoryBase implements INa } @Override - public boolean canShareTo(TileEntity tile) { + public boolean canShareTo(BlockEntity tile) { return true; } @@ -181,13 +189,13 @@ public class TileEntityBioReactor extends TileEntityInventoryBase implements INa } @Override - public ITextComponent getDisplayName() { - return StringTextComponent.EMPTY; + public Component getDisplayName() { + return TextComponent.EMPTY; } @Nullable @Override - public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity playerEntity) { + public AbstractContainerMenu createMenu(int windowId, Inventory playerInventory, Player playerEntity) { return new ContainerBioReactor(windowId, playerInventory, this); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java index f8e9b8d7b..853ebee1a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java @@ -16,22 +16,23 @@ import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.NetHandlerSpaghettiServer; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.INamedContainerProvider; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.server.ServerWorld; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.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.minecraftforge.common.util.FakePlayer; import net.minecraftforge.common.util.FakePlayerFactory; import net.minecraftforge.fluids.IFluidBlock; @@ -40,24 +41,22 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.List; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; - -public class TileEntityBreaker extends TileEntityInventoryBase implements INamedContainerProvider { +public class TileEntityBreaker extends TileEntityInventoryBase implements MenuProvider { public boolean isPlacer; private int currentTime; - public TileEntityBreaker(TileEntityType type, int slots) { - super(type, slots); + public TileEntityBreaker(BlockEntityType type, BlockPos pos, BlockState state, int slots) { + super(type, pos, state, slots); } - public TileEntityBreaker() { - super(ActuallyBlocks.BREAKER.getTileEntityType(), 9); + public TileEntityBreaker(BlockPos pos, BlockState state) { + super(ActuallyBlocks.BREAKER.getTileEntityType(), pos, state, 9); this.isPlacer = false; } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { compound.putInt("CurrentTime", this.currentTime); @@ -65,25 +64,31 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements INamed } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { this.currentTime = compound.getInt("CurrentTime"); } } - @Override - public void updateEntity() { - super.updateEntity(); - if (!this.level.isClientSide) { - if (!this.isRedstonePowered && !this.isPulseMode) { - if (this.currentTime > 0) { - this.currentTime--; - if (this.currentTime <= 0) { - this.doWork(); + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityBreaker tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityBreaker tile) { + tile.serverTick(); + + if (!tile.isRedstonePowered && !tile.isPulseMode) { + if (tile.currentTime > 0) { + tile.currentTime--; + if (tile.currentTime <= 0) { + tile.doWork(); } } else { - this.currentTime = 15; + tile.currentTime = 15; } } } @@ -101,8 +106,8 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements INamed Block blockToBreak = stateToBreak.getBlock(); if (!this.isPlacer && blockToBreak != Blocks.AIR && !(blockToBreak instanceof IFluidBlock) && stateToBreak.getDestroySpeed(this.level, breakCoords) >= 0.0F) { - List drops = Block.getDrops(stateToBreak, (ServerWorld) this.level, breakCoords, this.level.getBlockEntity(breakCoords)); - FakePlayer fake = FakePlayerFactory.getMinecraft((ServerWorld) this.level); + List drops = Block.getDrops(stateToBreak, (ServerLevel) this.level, breakCoords, this.level.getBlockEntity(breakCoords)); + FakePlayer fake = FakePlayerFactory.getMinecraft((ServerLevel) this.level); if (fake.connection == null) { fake.connection = new NetHandlerSpaghettiServer(fake); } @@ -134,13 +139,13 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements INamed @Nonnull @Override - public ITextComponent getDisplayName() { - return new TranslationTextComponent(isPlacer ? "container.actuallyadditions.placer" : "container.actuallyadditions.breaker"); + public Component getDisplayName() { + return new TranslatableComponent(isPlacer ? "container.actuallyadditions.placer" : "container.actuallyadditions.breaker"); } @Nullable @Override - public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity playerEntity) { + public AbstractContainerMenu createMenu(int windowId, Inventory playerInventory, Player playerEntity) { return new ContainerBreaker(windowId, playerInventory, this); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java index a16b95b41..38c4cfe7b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java @@ -14,37 +14,36 @@ import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.crafting.PressingRecipe; import de.ellpeck.actuallyadditions.mod.crafting.SingleItem; -import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.fluids.OutputOnlyFluidTank; import de.ellpeck.actuallyadditions.mod.inventory.ContainerCanolaPress; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import de.ellpeck.actuallyadditions.mod.util.Util; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.INamedContainerProvider; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.Direction; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +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.api.distmarker.OnlyIn; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.fluids.FluidAttributes; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.fluids.capability.IFluidHandler; -import net.minecraftforge.fluids.capability.templates.FluidTank; import javax.annotation.Nullable; import java.util.Optional; -public class TileEntityCanolaPress extends TileEntityInventoryBase implements INamedContainerProvider, ISharingFluidHandler { +public class TileEntityCanolaPress extends TileEntityInventoryBase implements MenuProvider, ISharingFluidHandler { public static final int ENERGY_USE = 35; private static final int TIME = 30; @@ -59,8 +58,8 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IN private int lastTankAmount; private int lastProcessTime; - public TileEntityCanolaPress() { - super(ActuallyBlocks.CANOLA_PRESS.getTileEntityType(), 1); + public TileEntityCanolaPress(BlockPos pos, BlockState state) { + super(ActuallyBlocks.CANOLA_PRESS.getTileEntityType(), pos, state, 1); } @OnlyIn(Dist.CLIENT) @@ -79,7 +78,7 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IN } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { if (type != NBTType.SAVE_BLOCK) { compound.putInt("ProcessTime", this.currentProcessTime); } @@ -89,7 +88,7 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IN } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { if (type != NBTType.SAVE_BLOCK) { this.currentProcessTime = compound.getInt("ProcessTime"); } @@ -98,34 +97,40 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IN super.readSyncableNBT(compound, type); } - @Override - public void updateEntity() { - super.updateEntity(); - if (!this.level.isClientSide) { - Optional recipe = getRecipeForInput(this.inv.getStackInSlot(0)); - recipe.ifPresent(r -> { - if ((r.getOutput().isFluidEqual(this.tank.getFluid()) || this.tank.isEmpty()) && r.getOutput().getAmount() <= this.tank.getCapacity() - this.tank.getFluidAmount()) { - if (this.storage.getEnergyStored() >= ENERGY_USE) { - this.currentProcessTime++; - this.storage.extractEnergyInternal(ENERGY_USE, false); - if (this.currentProcessTime >= TIME) { - this.currentProcessTime = 0; + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityCanolaPress tile) { + tile.clientTick(); + } + } - this.inv.setStackInSlot(0, StackUtil.shrink(this.inv.getStackInSlot(0), 1)); + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityCanolaPress tile) { + tile.serverTick(); + + Optional recipe = getRecipeForInput(tile.inv.getStackInSlot(0)); + recipe.ifPresent(r -> { + if ((r.getOutput().isFluidEqual(tile.tank.getFluid()) || tile.tank.isEmpty()) && r.getOutput().getAmount() <= tile.tank.getCapacity() - tile.tank.getFluidAmount()) { + if (tile.storage.getEnergyStored() >= ENERGY_USE) { + tile.currentProcessTime++; + tile.storage.extractEnergyInternal(ENERGY_USE, false); + if (tile.currentProcessTime >= TIME) { + tile.currentProcessTime = 0; + + tile.inv.setStackInSlot(0, StackUtil.shrink(tile.inv.getStackInSlot(0), 1)); FluidStack produced = r.getOutput().copy(); - this.tank.fillInternal(produced, IFluidHandler.FluidAction.EXECUTE); - this.setChanged(); + tile.tank.fillInternal(produced, IFluidHandler.FluidAction.EXECUTE); + tile.setChanged(); } } } }); if (!recipe.isPresent()) - this.currentProcessTime = 0; + tile.currentProcessTime = 0; - if ((this.storage.getEnergyStored() != this.lastEnergyStored || this.tank.getFluidAmount() != this.lastTankAmount | this.currentProcessTime != this.lastProcessTime) && this.sendUpdateWithInterval()) { - this.lastEnergyStored = this.storage.getEnergyStored(); - this.lastProcessTime = this.currentProcessTime; - this.lastTankAmount = this.tank.getFluidAmount(); + if ((tile.storage.getEnergyStored() != tile.lastEnergyStored || tile.tank.getFluidAmount() != tile.lastTankAmount | tile.currentProcessTime != tile.lastProcessTime) && tile.sendUpdateWithInterval()) { + tile.lastEnergyStored = tile.storage.getEnergyStored(); + tile.lastProcessTime = tile.currentProcessTime; + tile.lastTankAmount = tile.tank.getFluidAmount(); } } } @@ -174,13 +179,13 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IN } @Override - public ITextComponent getDisplayName() { - return new TranslationTextComponent("container.actuallyadditions.canola_press"); + public Component getDisplayName() { + return new TranslatableComponent("container.actuallyadditions.canola_press"); } @Nullable @Override - public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity playerEntity) { + public AbstractContainerMenu createMenu(int windowId, Inventory playerInventory, Player playerEntity) { return new ContainerCanolaPress(windowId, playerInventory, this); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java index be3e1d5dc..4774b8137 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java @@ -12,38 +12,34 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; -import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; -import de.ellpeck.actuallyadditions.mod.crafting.SingleItem; import de.ellpeck.actuallyadditions.mod.crafting.SolidFuelRecipe; import de.ellpeck.actuallyadditions.mod.inventory.ContainerCoalGenerator; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.INamedContainerProvider; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +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.api.distmarker.OnlyIn; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.common.util.RecipeMatcher; import net.minecraftforge.energy.IEnergyStorage; import javax.annotation.Nullable; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; -import net.minecraftforge.fml.server.ServerLifecycleHooks; - -public class TileEntityCoalGenerator extends TileEntityInventoryBase implements INamedContainerProvider, ISharingEnergyProvider, IEnergyDisplay { +public class TileEntityCoalGenerator extends TileEntityInventoryBase implements MenuProvider, ISharingEnergyProvider, IEnergyDisplay { public final CustomEnergyStorage storage = new CustomEnergyStorage(60000, 0, 80); public final LazyOptional lazyEnergy = LazyOptional.of(() -> this.storage); @@ -55,8 +51,8 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements private int lastCompare; private SolidFuelRecipe currentRecipe = null; - public TileEntityCoalGenerator() { - super(ActuallyBlocks.COAL_GENERATOR.getTileEntityType(), 1); + public TileEntityCoalGenerator(BlockPos pos, BlockState state) { + super(ActuallyBlocks.COAL_GENERATOR.getTileEntityType(), pos, state, 1); } @OnlyIn(Dist.CLIENT) @@ -70,7 +66,7 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { if (type != NBTType.SAVE_BLOCK) { compound.putInt("BurnTime", this.currentBurnTime); compound.putInt("MaxBurnTime", this.maxBurnTime); @@ -82,7 +78,7 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { if (type != NBTType.SAVE_BLOCK) { this.currentBurnTime = compound.getInt("BurnTime"); this.maxBurnTime = compound.getInt("MaxBurnTime"); @@ -100,42 +96,48 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements super.readSyncableNBT(compound, type); } - @Override - public void updateEntity() { - super.updateEntity(); - if (!level.isClientSide) { - boolean flag = this.currentBurnTime > 0; + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityCoalGenerator tile) { + tile.clientTick(); + } + } - if (this.currentBurnTime > 0 && currentRecipe != null) { - this.currentBurnTime--; - int produce = currentRecipe.getTotalEnergy() / currentRecipe.getBurnTime(); + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityCoalGenerator tile) { + tile.serverTick(); + + boolean flag = tile.currentBurnTime > 0; + + if (tile.currentBurnTime > 0 && tile.currentRecipe != null) { + tile.currentBurnTime--; + int produce = tile.currentRecipe.getTotalEnergy() / tile.currentRecipe.getBurnTime(); if (produce > 0) { - this.storage.receiveEnergyInternal(produce, false); + tile.storage.receiveEnergyInternal(produce, false); } } - if (!this.isRedstonePowered && this.currentBurnTime <= 0 && this.storage.getEnergyStored() < this.storage.getMaxEnergyStored()) { - ItemStack stack = this.inv.getStackInSlot(0); + if (!tile.isRedstonePowered && tile.currentBurnTime <= 0 && tile.storage.getEnergyStored() < tile.storage.getMaxEnergyStored()) { + ItemStack stack = tile.inv.getStackInSlot(0); if (!stack.isEmpty()) { ActuallyAdditionsAPI.SOLID_FUEL_RECIPES.stream().filter(r -> r.matches(stack)).findFirst().ifPresent(recipe -> { - this.currentRecipe = recipe; - this.maxBurnTime = recipe.getBurnTime(); - this.currentBurnTime = this.maxBurnTime; - this.inv.setStackInSlot(0, StackUtil.shrinkForContainer(stack, 1)); + tile.currentRecipe = recipe; + tile.maxBurnTime = recipe.getBurnTime(); + tile.currentBurnTime = tile.maxBurnTime; + tile.inv.setStackInSlot(0, StackUtil.shrinkForContainer(stack, 1)); }); } else - this.currentRecipe = null; + tile.currentRecipe = null; } - if (flag != this.currentBurnTime > 0 || this.lastCompare != this.getComparatorStrength()) { - this.lastCompare = this.getComparatorStrength(); - this.setChanged(); + if (flag != tile.currentBurnTime > 0 || tile.lastCompare != tile.getComparatorStrength()) { + tile.lastCompare = tile.getComparatorStrength(); + tile.setChanged(); } - if ((this.storage.getEnergyStored() != this.lastEnergy || this.currentBurnTime != this.lastCurrentBurnTime || this.lastBurnTime != this.maxBurnTime) && this.sendUpdateWithInterval()) { - this.lastEnergy = this.storage.getEnergyStored(); - this.lastCurrentBurnTime = this.currentBurnTime; - this.lastBurnTime = this.currentBurnTime; + if ((tile.storage.getEnergyStored() != tile.lastEnergy || tile.currentBurnTime != tile.lastCurrentBurnTime || tile.lastBurnTime != tile.maxBurnTime) && tile.sendUpdateWithInterval()) { + tile.lastEnergy = tile.storage.getEnergyStored(); + tile.lastCurrentBurnTime = tile.currentBurnTime; + tile.lastBurnTime = tile.currentBurnTime; } } } @@ -162,7 +164,7 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements if (!automation) { return true; } - return ForgeHooks.getBurnTime(this.inv.getStackInSlot(0)) <= 0; + return ForgeHooks.getBurnTime(this.inv.getStackInSlot(0), null) <= 0; }; } @@ -182,7 +184,7 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements } @Override - public boolean canShareTo(TileEntity tile) { + public boolean canShareTo(BlockEntity tile) { return true; } @@ -192,13 +194,13 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements } @Override - public ITextComponent getDisplayName() { - return new TranslationTextComponent("container.actuallyadditions.coalGenerator"); + public Component getDisplayName() { + return new TranslatableComponent("container.actuallyadditions.coalGenerator"); } @Nullable @Override - public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) { + public AbstractContainerMenu createMenu(int windowId, Inventory playerInventory, Player player) { return new ContainerCoalGenerator(windowId, playerInventory, this); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java index ff6569633..8dcf83b4c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java @@ -21,19 +21,21 @@ import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import de.ellpeck.actuallyadditions.mod.util.Util; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.fluid.Fluids; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.INamedContainerProvider; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.Direction; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.Fluids; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.util.LazyOptional; @@ -46,7 +48,7 @@ import net.minecraftforge.fluids.capability.templates.FluidTank; import javax.annotation.Nonnull; import javax.annotation.Nullable; -public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements INamedContainerProvider, IButtonReactor, ISharingFluidHandler { +public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements MenuProvider, IButtonReactor, ISharingFluidHandler { public static final int SLOT_COFFEE_BEANS = 0; public static final int SLOT_INPUT = 1; @@ -87,8 +89,8 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements private int lastCoffeeAmount; private int lastBrewTime; - public TileEntityCoffeeMachine() { - super(ActuallyBlocks.COFFEE_MACHINE.getTileEntityType(), 11); + public TileEntityCoffeeMachine(BlockPos pos, BlockState state) { + super(ActuallyBlocks.COFFEE_MACHINE.getTileEntityType(), pos, state, 11); } @OnlyIn(Dist.CLIENT) @@ -112,7 +114,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); this.storage.writeToNBT(compound); this.tank.writeToNBT(compound); @@ -123,7 +125,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); this.storage.readFromNBT(compound); this.tank.readFromNBT(compound); @@ -133,28 +135,34 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements } } - @Override - public void updateEntity() { - super.updateEntity(); - if (!this.level.isClientSide) { - this.storeCoffee(); + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityCoffeeMachine tile) { + tile.clientTick(); + } + } - if (this.brewTime > 0 || this.isRedstonePowered) { - this.brew(); + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityCoffeeMachine tile) { + tile.serverTick(); + + tile.storeCoffee(); + + if (tile.brewTime > 0 || tile.isRedstonePowered) { + tile.brew(); } - if ((this.coffeeCacheAmount != this.lastCoffeeAmount || this.storage.getEnergyStored() != this.lastEnergy || this.tank.getFluidAmount() != this.lastTank || this.brewTime != this.lastBrewTime) && this.sendUpdateWithInterval()) { - this.lastCoffeeAmount = this.coffeeCacheAmount; - this.lastEnergy = this.storage.getEnergyStored(); - this.lastTank = this.tank.getFluidAmount(); - this.lastBrewTime = this.brewTime; + if ((tile.coffeeCacheAmount != tile.lastCoffeeAmount || tile.storage.getEnergyStored() != tile.lastEnergy || tile.tank.getFluidAmount() != tile.lastTank || tile.brewTime != tile.lastBrewTime) && tile.sendUpdateWithInterval()) { + tile.lastCoffeeAmount = tile.coffeeCacheAmount; + tile.lastEnergy = tile.storage.getEnergyStored(); + tile.lastTank = tile.tank.getFluidAmount(); + tile.lastBrewTime = tile.brewTime; } } } @Override public IAcceptor getAcceptor() { - return (slot, stack, automation) -> !automation || slot >= 3 && ItemCoffee.getIngredientFromStack(stack) != null || slot == SLOT_COFFEE_BEANS && ActuallyTags.Items.COFFEE_BEANS.contains(stack.getItem()) || slot == SLOT_INPUT && stack.getItem() == ActuallyItems.COFFEE_CUP.get(); + return (slot, stack, automation) -> !automation || slot >= 3 && ItemCoffee.getIngredientFromStack(stack) != null || slot == SLOT_COFFEE_BEANS && stack.is(ActuallyTags.Items.COFFEE_BEANS) || slot == SLOT_INPUT && stack.getItem() == ActuallyItems.COFFEE_CUP.get(); } @Override @@ -163,7 +171,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements } public void storeCoffee() { - if (StackUtil.isValid(this.inv.getStackInSlot(SLOT_COFFEE_BEANS)) && ActuallyTags.Items.COFFEE_BEANS.contains(this.inv.getStackInSlot(SLOT_COFFEE_BEANS).getItem())) { + if (StackUtil.isValid(this.inv.getStackInSlot(SLOT_COFFEE_BEANS)) && this.inv.getStackInSlot(SLOT_COFFEE_BEANS).is(ActuallyTags.Items.COFFEE_BEANS)) { int toAdd = 2; if (toAdd <= COFFEE_CACHE_MAX_AMOUNT - this.coffeeCacheAmount) { this.inv.setStackInSlot(SLOT_COFFEE_BEANS, StackUtil.shrink(this.inv.getStackInSlot(SLOT_COFFEE_BEANS), 1)); @@ -181,7 +189,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements if (StackUtil.isValid(input) && input.getItem() == ActuallyItems.COFFEE_CUP.get() && !StackUtil.isValid(this.inv.getStackInSlot(SLOT_OUTPUT)) && this.coffeeCacheAmount >= CACHE_USE && this.tank.getFluid().getFluid() == Fluids.WATER && this.tank.getFluidAmount() >= WATER_USE) { if (this.storage.getEnergyStored() >= ENERGY_USED) { if (this.brewTime % 30 == 0) { - this.level.playSound(null, this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ(), AASounds.COFFEE_MACHINE.get(), SoundCategory.BLOCKS, 0.1F, 1.0F); + this.level.playSound(null, this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ(), AASounds.COFFEE_MACHINE.get(), SoundSource.BLOCKS, 0.1F, 1.0F); } this.brewTime++; @@ -211,7 +219,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements } @Override - public void onButtonPressed(int buttonID, PlayerEntity player) { + public void onButtonPressed(int buttonID, Player player) { if (buttonID == 0 && this.brewTime <= 0) { this.brew(); } @@ -243,13 +251,13 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements } @Override - public ITextComponent getDisplayName() { - return new TranslationTextComponent("container.actuallyadditions.coffeeMachine"); + public Component getDisplayName() { + return new TranslatableComponent("container.actuallyadditions.coffeeMachine"); } @Nullable @Override - public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) { + public AbstractContainerMenu createMenu(int windowId, Inventory playerInventory, Player player) { return new ContainerCoffeeMachine(windowId, playerInventory, this); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCrusher.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCrusher.java index a79254e61..b19a637bb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCrusher.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCrusher.java @@ -12,36 +12,36 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.mod.AASounds; -import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe; import de.ellpeck.actuallyadditions.mod.inventory.CrusherContainer; import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; -import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.INamedContainerProvider; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.Direction; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +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.properties.BlockStateProperties; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.energy.IEnergyStorage; import javax.annotation.Nullable; import java.util.Optional; -public class TileEntityCrusher extends TileEntityInventoryBase implements IButtonReactor, INamedContainerProvider { +public class TileEntityCrusher extends TileEntityInventoryBase implements IButtonReactor, MenuProvider { public static final int SLOT_INPUT_1 = 0; public static final int SLOT_OUTPUT_1_1 = 1; @@ -62,17 +62,17 @@ public class TileEntityCrusher extends TileEntityInventoryBase implements IButto private boolean lastAutoSplit; private boolean lastCrushed; - public TileEntityCrusher(TileEntityType type, int slots) { - super(type, slots); + public TileEntityCrusher(BlockEntityType type, BlockPos pos, BlockState state, int slots) { + super(type, pos, state, slots); } - public TileEntityCrusher() { - super(ActuallyBlocks.CRUSHER.getTileEntityType(), 3); + public TileEntityCrusher(BlockPos pos, BlockState state) { + super(ActuallyBlocks.CRUSHER.getTileEntityType(), pos, state, 3); this.isDouble = false; } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { if (type != NBTType.SAVE_BLOCK) { compound.putInt("FirstCrushTime", this.firstCrushTime); compound.putInt("SecondCrushTime", this.secondCrushTime); @@ -83,7 +83,7 @@ public class TileEntityCrusher extends TileEntityInventoryBase implements IButto } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { if (type != NBTType.SAVE_BLOCK) { this.firstCrushTime = compound.getInt("FirstCrushTime"); this.secondCrushTime = compound.getInt("SecondCrushTime"); @@ -93,88 +93,93 @@ public class TileEntityCrusher extends TileEntityInventoryBase implements IButto super.readSyncableNBT(compound, type); } - @Override - public void updateEntity() { - super.updateEntity(); - if (!this.level.isClientSide) { - if (this.isDouble && this.isAutoSplit) { - TileEntityPoweredFurnace.autoSplit(this.inv, SLOT_INPUT_1, SLOT_INPUT_2); + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityCrusher tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityCrusher tile) { + tile.serverTick(); + + if (tile.isDouble && tile.isAutoSplit) { + TileEntityPoweredFurnace.autoSplit(tile.inv, SLOT_INPUT_1, SLOT_INPUT_2); } boolean crushed = false; - boolean canCrushOnFirst = this.canCrushOn(SLOT_INPUT_1, SLOT_OUTPUT_1_1, SLOT_OUTPUT_1_2); + boolean canCrushOnFirst = tile.canCrushOn(SLOT_INPUT_1, SLOT_OUTPUT_1_1, SLOT_OUTPUT_1_2); boolean canCrushOnSecond = false; - if (this.isDouble) { - canCrushOnSecond = this.canCrushOn(SLOT_INPUT_2, SLOT_OUTPUT_2_1, SLOT_OUTPUT_2_2); + if (tile.isDouble) { + canCrushOnSecond = tile.canCrushOn(SLOT_INPUT_2, SLOT_OUTPUT_2_1, SLOT_OUTPUT_2_2); } boolean shouldPlaySound = false; if (canCrushOnFirst) { - if (this.storage.getEnergyStored() >= ENERGY_USE) { - if (this.firstCrushTime % 20 == 0) { + if (tile.storage.getEnergyStored() >= ENERGY_USE) { + if (tile.firstCrushTime % 20 == 0) { shouldPlaySound = true; } - this.firstCrushTime++; - if (this.firstCrushTime >= this.getMaxCrushTime()) { - this.finishCrushing(SLOT_INPUT_1, SLOT_OUTPUT_1_1, SLOT_OUTPUT_1_2); - this.firstCrushTime = 0; + tile.firstCrushTime++; + if (tile.firstCrushTime >= tile.getMaxCrushTime()) { + tile.finishCrushing(SLOT_INPUT_1, SLOT_OUTPUT_1_1, SLOT_OUTPUT_1_2); + tile.firstCrushTime = 0; } - this.storage.extractEnergyInternal(ENERGY_USE, false); + tile.storage.extractEnergyInternal(ENERGY_USE, false); } - crushed = this.storage.getEnergyStored() >= ENERGY_USE; + crushed = tile.storage.getEnergyStored() >= ENERGY_USE; } else { - this.firstCrushTime = 0; + tile.firstCrushTime = 0; } - if (this.isDouble) { + if (tile.isDouble) { if (canCrushOnSecond) { - if (this.storage.getEnergyStored() >= ENERGY_USE) { - if (this.secondCrushTime % 20 == 0) { + if (tile.storage.getEnergyStored() >= ENERGY_USE) { + if (tile.secondCrushTime % 20 == 0) { shouldPlaySound = true; } - this.secondCrushTime++; - if (this.secondCrushTime >= this.getMaxCrushTime()) { - this.finishCrushing(SLOT_INPUT_2, SLOT_OUTPUT_2_1, SLOT_OUTPUT_2_2); - this.secondCrushTime = 0; + tile.secondCrushTime++; + if (tile.secondCrushTime >= tile.getMaxCrushTime()) { + tile.finishCrushing(SLOT_INPUT_2, SLOT_OUTPUT_2_1, SLOT_OUTPUT_2_2); + tile.secondCrushTime = 0; } - this.storage.extractEnergyInternal(ENERGY_USE, false); + tile.storage.extractEnergyInternal(ENERGY_USE, false); } - crushed = this.storage.getEnergyStored() >= ENERGY_USE; + crushed = tile.storage.getEnergyStored() >= ENERGY_USE; } else { - this.secondCrushTime = 0; + tile.secondCrushTime = 0; } } - BlockState currState = this.level.getBlockState(this.worldPosition); - boolean current = currState.getValue(BlockStateProperties.LIT); + boolean current = state.getValue(BlockStateProperties.LIT); boolean changeTo = current; - if (this.lastCrushed != crushed) { + if (tile.lastCrushed != crushed) { changeTo = crushed; } - if (this.isRedstonePowered) { + if (tile.isRedstonePowered) { changeTo = true; } - if (!crushed && !this.isRedstonePowered) { + if (!crushed && !tile.isRedstonePowered) { changeTo = false; } if (changeTo != current) { - this.level.setBlockAndUpdate(this.worldPosition, currState.setValue(BlockStateProperties.LIT, changeTo)); + level.setBlockAndUpdate(pos, state.setValue(BlockStateProperties.LIT, changeTo)); } - this.lastCrushed = crushed; + tile.lastCrushed = crushed; - if ((this.lastEnergy != this.storage.getEnergyStored() || this.lastFirstCrush != this.firstCrushTime || this.lastSecondCrush != this.secondCrushTime || this.isAutoSplit != this.lastAutoSplit) && this.sendUpdateWithInterval()) { - this.lastEnergy = this.storage.getEnergyStored(); - this.lastFirstCrush = this.firstCrushTime; - this.lastSecondCrush = this.secondCrushTime; - this.lastAutoSplit = this.isAutoSplit; + if ((tile.lastEnergy != tile.storage.getEnergyStored() || tile.lastFirstCrush != tile.firstCrushTime || tile.lastSecondCrush != tile.secondCrushTime || tile.isAutoSplit != tile.lastAutoSplit) && tile.sendUpdateWithInterval()) { + tile.lastEnergy = tile.storage.getEnergyStored(); + tile.lastFirstCrush = tile.firstCrushTime; + tile.lastSecondCrush = tile.secondCrushTime; + tile.lastAutoSplit = tile.isAutoSplit; } if (shouldPlaySound) { - this.level.playSound(null, this.worldPosition.getX(), this.worldPosition.getY(), this.worldPosition.getZ(), AASounds.CRUSHER.get(), SoundCategory.BLOCKS, 0.025F, 1.0F); + level.playSound(null, pos.getX(), pos.getY(), pos.getZ(), AASounds.CRUSHER.get(), SoundSource.BLOCKS, 0.025F, 1.0F); } } } @@ -259,7 +264,7 @@ public class TileEntityCrusher extends TileEntityInventoryBase implements IButto } @Override - public void onButtonPressed(int buttonID, PlayerEntity player) { + public void onButtonPressed(int buttonID, Player player) { if (buttonID == 0) { this.isAutoSplit = !this.isAutoSplit; this.setChanged(); @@ -272,13 +277,13 @@ public class TileEntityCrusher extends TileEntityInventoryBase implements IButto } @Override - public ITextComponent getDisplayName() { - return new TranslationTextComponent("container.actuallyadditions.crusher"); + public Component getDisplayName() { + return new TranslatableComponent("container.actuallyadditions.crusher"); } @Nullable @Override - public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) { + public AbstractContainerMenu createMenu(int windowId, Inventory playerInventory, Player player) { return new CrusherContainer(windowId, playerInventory, this); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCrusherDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCrusherDouble.java index 4b496b410..d0c42abfa 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCrusherDouble.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCrusherDouble.java @@ -11,12 +11,27 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; public class TileEntityCrusherDouble extends TileEntityCrusher { - public TileEntityCrusherDouble() { - super(ActuallyBlocks.CRUSHER_DOUBLE.getTileEntityType(), 6); + public TileEntityCrusherDouble(BlockPos pos, BlockState state) { + super(ActuallyBlocks.CRUSHER_DOUBLE.getTileEntityType(), pos, state, 6); this.isDouble = true; } + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityCrusherDouble tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityCrusherDouble tile) { + tile.serverTick(); + } + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDisplayStand.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDisplayStand.java index bc2343916..9e203ddfd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDisplayStand.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDisplayStand.java @@ -13,46 +13,53 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.api.misc.IDisplayStandItem; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.Block; -import net.minecraft.item.BlockItem; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.Direction; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.Item; +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; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.energy.IEnergyStorage; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; - public class TileEntityDisplayStand extends TileEntityInventoryBase implements IEnergyDisplay { public final CustomEnergyStorage storage = new CustomEnergyStorage(80000, 1000, 0); public final LazyOptional lazyEnergy = LazyOptional.of(() -> this.storage); private int oldEnergy; - public TileEntityDisplayStand() { - super(ActuallyBlocks.DISPLAY_STAND.getTileEntityType(), 1); + public TileEntityDisplayStand(BlockPos pos, BlockState state) { + super(ActuallyBlocks.DISPLAY_STAND.getTileEntityType(), pos, state, 1); } - @Override - public void updateEntity() { - super.updateEntity(); + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityDisplayStand tile) { + tile.clientTick(); + } + } - if (!this.level.isClientSide) { - if (StackUtil.isValid(this.inv.getStackInSlot(0)) && !this.isRedstonePowered) { - IDisplayStandItem item = this.convertToDisplayStandItem(this.inv.getStackInSlot(0).getItem()); + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityDisplayStand tile) { + tile.serverTick(); + + if (StackUtil.isValid(tile.inv.getStackInSlot(0)) && !tile.isRedstonePowered) { + IDisplayStandItem item = tile.convertToDisplayStandItem(tile.inv.getStackInSlot(0).getItem()); if (item != null) { - int energy = item.getUsePerTick(this.inv.getStackInSlot(0), this, this.ticksElapsed); - if (this.storage.getEnergyStored() >= energy) { - if (item.update(this.inv.getStackInSlot(0), this, this.ticksElapsed)) { - this.storage.extractEnergyInternal(energy, false); + int energy = item.getUsePerTick(tile.inv.getStackInSlot(0), tile, tile.ticksElapsed); + if (tile.storage.getEnergyStored() >= energy) { + if (item.update(tile.inv.getStackInSlot(0), tile, tile.ticksElapsed)) { + tile.storage.extractEnergyInternal(energy, false); } } } } - if (this.oldEnergy != this.storage.getEnergyStored() && this.sendUpdateWithInterval()) { - this.oldEnergy = this.storage.getEnergyStored(); + if (tile.oldEnergy != tile.storage.getEnergyStored() && tile.sendUpdateWithInterval()) { + tile.oldEnergy = tile.storage.getEnergyStored(); } } } @@ -63,13 +70,13 @@ public class TileEntityDisplayStand extends TileEntityInventoryBase implements I } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); this.storage.writeToNBT(compound); } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); this.storage.readFromNBT(compound); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDropper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDropper.java index 1f1fe75b7..515ab15de 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDropper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDropper.java @@ -14,29 +14,31 @@ import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.inventory.ContainerDropper; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.INamedContainerProvider; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; import javax.annotation.Nullable; -import net.minecraft.util.text.TranslationTextComponent; - -public class TileEntityDropper extends TileEntityInventoryBase implements INamedContainerProvider { +public class TileEntityDropper extends TileEntityInventoryBase implements MenuProvider { private int currentTime; - public TileEntityDropper() { - super(ActuallyBlocks.DROPPER.getTileEntityType(), 9); + public TileEntityDropper(BlockPos pos, BlockState state) { + super(ActuallyBlocks.DROPPER.getTileEntityType(), pos, state,9); } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { compound.putInt("CurrentTime", this.currentTime); @@ -44,25 +46,31 @@ public class TileEntityDropper extends TileEntityInventoryBase implements INamed } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { this.currentTime = compound.getInt("CurrentTime"); } } - @Override - public void updateEntity() { - super.updateEntity(); - if (!this.level.isClientSide) { - if (!this.isRedstonePowered && !this.isPulseMode) { - if (this.currentTime > 0) { - this.currentTime--; - if (this.currentTime <= 0) { - this.doWork(); + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityDropper tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityDropper tile) { + tile.serverTick(); + + if (!tile.isRedstonePowered && !tile.isPulseMode) { + if (tile.currentTime > 0) { + tile.currentTime--; + if (tile.currentTime <= 0) { + tile.doWork(); } } else { - this.currentTime = 5; + tile.currentTime = 5; } } } @@ -104,13 +112,13 @@ public class TileEntityDropper extends TileEntityInventoryBase implements INamed } @Override - public ITextComponent getDisplayName() { - return new TranslationTextComponent("container.actuallyadditions.dropper"); + public Component getDisplayName() { + return new TranslatableComponent("container.actuallyadditions.dropper"); } @Nullable @Override - public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) { + public AbstractContainerMenu createMenu(int windowId, Inventory playerInventory, Player player) { return new ContainerDropper(windowId, playerInventory, this); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEmpowerer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEmpowerer.java index bdf828274..1f9daf72b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEmpowerer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEmpowerer.java @@ -14,24 +14,21 @@ import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.crafting.ActuallyRecipes; import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe; -import de.ellpeck.actuallyadditions.mod.crafting.SolidFuelRecipe; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; -import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.particles.ParticleTypes; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.server.ServerWorld; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.server.ServerLifecycleHooks; import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.List; - -import net.minecraftforge.fml.server.ServerLifecycleHooks; public class TileEntityEmpowerer extends TileEntityInventoryBase { @@ -43,8 +40,8 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase { return this.currentRecipe; } - public TileEntityEmpowerer() { - super(ActuallyBlocks.EMPOWERER.getTileEntityType(), 1); + public TileEntityEmpowerer(BlockPos pos, BlockState state) { + super(ActuallyBlocks.EMPOWERER.getTileEntityType(), pos, state, 1); } public static boolean isPossibleInput(ItemStack stack) { @@ -66,16 +63,21 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase { return null; } - @Override - public void updateEntity() { - super.updateEntity(); + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityEmpowerer tile) { + tile.clientTick(); + } + } - if (!this.level.isClientSide) { - TileEntityDisplayStand[] stands = this.getNearbyStands(); + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityEmpowerer tile) { + tile.serverTick(); + + TileEntityDisplayStand[] stands = tile.getNearbyStands(); if (stands != null) { - EmpowererRecipe recipe = findMatchingRecipe(this.inv.getStackInSlot(0), stands[0].getStack(), stands[1].getStack(), stands[2].getStack(), stands[3].getStack()); + EmpowererRecipe recipe = findMatchingRecipe(tile.inv.getStackInSlot(0), stands[0].getStack(), stands[1].getStack(), stands[2].getStack(), stands[3].getStack()); if (recipe != null) { - currentRecipe = recipe; + tile.currentRecipe = recipe; boolean hasPower = true; @@ -87,8 +89,8 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase { if (hasPower) { - this.processTime++; - boolean done = this.processTime >= recipe.getTime(); + tile.processTime++; + boolean done = tile.processTime >= recipe.getTime(); for (TileEntityDisplayStand stand : stands) { stand.storage.extractEnergyInternal(recipe.getEnergyPerStand() / recipe.getTime(), false); @@ -99,28 +101,28 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase { } } - if (this.processTime % 5 == 0 && this.level instanceof ServerWorld) { - ((ServerWorld) this.level).sendParticles(ParticleTypes.FIREWORK, this.worldPosition.getX() + 0.5, this.worldPosition.getY() + 1.1, this.worldPosition.getZ() + 0.5, 2, 0, 0, 0, 0.1D); + if (tile.processTime % 5 == 0 && level instanceof ServerLevel) { + ((ServerLevel) level).sendParticles(ParticleTypes.FIREWORK, pos.getX() + 0.5, pos.getY() + 1.1, pos.getZ() + 0.5, 2, 0, 0, 0, 0.1D); } if (done) { - ((ServerWorld) this.level).sendParticles(ParticleTypes.END_ROD, this.worldPosition.getX() + 0.5, this.worldPosition.getY() + 1.1, this.worldPosition.getZ() + 0.5, 100, 0, 0, 0, 0.25D); + ((ServerLevel) level).sendParticles(ParticleTypes.END_ROD, pos.getX() + 0.5, pos.getY() + 1.1, pos.getZ() + 0.5, 100, 0, 0, 0, 0.25D); - this.inv.setStackInSlot(0, recipe.getOutput().copy()); - this.setChanged(); + tile.inv.setStackInSlot(0, recipe.getOutput().copy()); + tile.setChanged(); - this.processTime = 0; - this.currentRecipe = null; + tile.processTime = 0; + tile.currentRecipe = null; } } } else { - this.processTime = 0; - this.currentRecipe = null; + tile.processTime = 0; + tile.currentRecipe = null; } - if (this.lastRecipe != this.currentRecipe) { - this.lastRecipe = this.currentRecipe; - this.sendUpdate(); + if (tile.lastRecipe != tile.currentRecipe) { + tile.lastRecipe = tile.currentRecipe; + tile.sendUpdate(); } } } @@ -132,7 +134,7 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase { for (int i = 0; i <= 3; i++) { Direction facing = Direction.from2DDataValue(i); BlockPos offset = this.worldPosition.relative(facing, 3); - TileEntity tile = this.level.getBlockEntity(offset); + BlockEntity tile = this.level.getBlockEntity(offset); if (tile instanceof TileEntityDisplayStand) { stands[i] = (TileEntityDisplayStand) tile; } else { @@ -144,7 +146,7 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase { } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type == NBTType.SAVE_TILE) { compound.putInt("ProcessTime", this.processTime); @@ -158,7 +160,7 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase { } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); if (type == NBTType.SAVE_TILE) { this.processTime = compound.getInt("ProcessTime"); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java index 0e34f03a0..2f3c90e7a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java @@ -15,65 +15,75 @@ import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnergizer; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.INamedContainerProvider; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.Direction; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.enchantment.EnchantmentHelper; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.energy.IEnergyStorage; import javax.annotation.Nullable; -public class TileEntityEnergizer extends TileEntityInventoryBase implements INamedContainerProvider { +public class TileEntityEnergizer extends TileEntityInventoryBase implements MenuProvider { public final CustomEnergyStorage storage = new CustomEnergyStorage(50000, 1000, 0); public final LazyOptional lazyEnergy = LazyOptional.of(() -> this.storage); private int lastEnergy; - public TileEntityEnergizer() { - super(ActuallyBlocks.ENERGIZER.getTileEntityType(), 2); + public TileEntityEnergizer(BlockPos pos, BlockState state) { + super(ActuallyBlocks.ENERGIZER.getTileEntityType(), pos, state, 2); } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { this.storage.writeToNBT(compound); super.writeSyncableNBT(compound, type); } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { this.storage.readFromNBT(compound); super.readSyncableNBT(compound, type); } - @Override - public void updateEntity() { - super.updateEntity(); - if (!this.level.isClientSide) { - if (StackUtil.isValid(this.inv.getStackInSlot(0)) && !StackUtil.isValid(this.inv.getStackInSlot(1))) { - if (this.storage.getEnergyStored() > 0) { - int received = this.inv.getStackInSlot(0).getCapability(CapabilityEnergy.ENERGY, null).map(cap -> cap.receiveEnergy(this.storage.getEnergyStored(), false)).orElse(0); - boolean canTakeUp = this.inv.getStackInSlot(0).getCapability(CapabilityEnergy.ENERGY, null).map(cap -> cap.getEnergyStored() >= cap.getMaxEnergyStored()).orElse(false); + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityEnergizer tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityEnergizer tile) { + tile.serverTick(); + + if (StackUtil.isValid(tile.inv.getStackInSlot(0)) && !StackUtil.isValid(tile.inv.getStackInSlot(1))) { + if (tile.storage.getEnergyStored() > 0) { + int received = tile.inv.getStackInSlot(0).getCapability(CapabilityEnergy.ENERGY, null).map(cap -> cap.receiveEnergy(tile.storage.getEnergyStored(), false)).orElse(0); + boolean canTakeUp = tile.inv.getStackInSlot(0).getCapability(CapabilityEnergy.ENERGY, null).map(cap -> cap.getEnergyStored() >= cap.getMaxEnergyStored()).orElse(false); if (received > 0) { - this.storage.extractEnergyInternal(received, false); + tile.storage.extractEnergyInternal(received, false); } if (canTakeUp) { - this.inv.setStackInSlot(1, this.inv.getStackInSlot(0).copy()); - this.inv.setStackInSlot(0, StackUtil.shrink(this.inv.getStackInSlot(0), 1)); + tile.inv.setStackInSlot(1, tile.inv.getStackInSlot(0).copy()); + tile.inv.setStackInSlot(0, StackUtil.shrink(tile.inv.getStackInSlot(0), 1)); } } } - if (this.lastEnergy != this.storage.getEnergyStored() && this.sendUpdateWithInterval()) { - this.lastEnergy = this.storage.getEnergyStored(); + if (tile.lastEnergy != tile.storage.getEnergyStored() && tile.sendUpdateWithInterval()) { + tile.lastEnergy = tile.storage.getEnergyStored(); } } } @@ -98,13 +108,13 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements INam } @Override - public ITextComponent getDisplayName() { - return StringTextComponent.EMPTY; + public Component getDisplayName() { + return TextComponent.EMPTY; } @Nullable @Override - public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity playerEntity) { + public AbstractContainerMenu createMenu(int windowId, Inventory playerInventory, Player playerEntity) { return new ContainerEnergizer(windowId, playerInventory, this); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java index 57aee3cfd..af743647b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java @@ -15,68 +15,77 @@ import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnervator; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.INamedContainerProvider; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.energy.IEnergyStorage; import javax.annotation.Nullable; -public class TileEntityEnervator extends TileEntityInventoryBase implements ISharingEnergyProvider, INamedContainerProvider { +public class TileEntityEnervator extends TileEntityInventoryBase implements ISharingEnergyProvider, MenuProvider { public final CustomEnergyStorage storage = new CustomEnergyStorage(50000, 0, 1000); public final LazyOptional lazyEnergy = LazyOptional.of(() -> this.storage); private int lastEnergy; - public TileEntityEnervator() { - super(ActuallyBlocks.ENERVATOR.getTileEntityType(), 2); + public TileEntityEnervator(BlockPos pos, BlockState state) { + super(ActuallyBlocks.ENERVATOR.getTileEntityType(), pos, state, 2); } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { this.storage.writeToNBT(compound); super.writeSyncableNBT(compound, type); } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { this.storage.readFromNBT(compound); super.readSyncableNBT(compound, type); } - @Override - public void updateEntity() { - super.updateEntity(); - if (!this.level.isClientSide) { - if (StackUtil.isValid(this.inv.getStackInSlot(0)) && !StackUtil.isValid(this.inv.getStackInSlot(1))) { - if (this.storage.getEnergyStored() < this.storage.getMaxEnergyStored()) { - LazyOptional capability = this.inv.getStackInSlot(0).getCapability(CapabilityEnergy.ENERGY, null); + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityEnervator tile) { + tile.clientTick(); + } + } - int maxExtract = this.storage.getMaxEnergyStored() - this.storage.getEnergyStored(); + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityEnervator tile) { + tile.serverTick(); + + if (StackUtil.isValid(tile.inv.getStackInSlot(0)) && !StackUtil.isValid(tile.inv.getStackInSlot(1))) { + if (tile.storage.getEnergyStored() < tile.storage.getMaxEnergyStored()) { + LazyOptional capability = tile.inv.getStackInSlot(0).getCapability(CapabilityEnergy.ENERGY, null); + + int maxExtract = tile.storage.getMaxEnergyStored() - tile.storage.getEnergyStored(); int extracted = capability.map(cap -> cap.extractEnergy(maxExtract, false)).orElse(0); boolean canTakeUp = capability.map(cap -> cap.getEnergyStored() <= 0).orElse(false); if (extracted > 0) { - this.storage.receiveEnergyInternal(extracted, false); + tile.storage.receiveEnergyInternal(extracted, false); } if (canTakeUp) { - this.inv.setStackInSlot(1, this.inv.getStackInSlot(0).copy()); - this.inv.getStackInSlot(0).shrink(1); + tile.inv.setStackInSlot(1, tile.inv.getStackInSlot(0).copy()); + tile.inv.getStackInSlot(0).shrink(1); } } } - if (this.lastEnergy != this.storage.getEnergyStored() && this.sendUpdateWithInterval()) { - this.lastEnergy = this.storage.getEnergyStored(); + if (tile.lastEnergy != tile.storage.getEnergyStored() && tile.sendUpdateWithInterval()) { + tile.lastEnergy = tile.storage.getEnergyStored(); } } } @@ -111,7 +120,7 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements ISha } @Override - public boolean canShareTo(TileEntity tile) { + public boolean canShareTo(BlockEntity tile) { return true; } @@ -121,13 +130,13 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements ISha } @Override - public ITextComponent getDisplayName() { - return StringTextComponent.EMPTY; + public Component getDisplayName() { + return TextComponent.EMPTY; } @Nullable @Override - public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity playerEntity) { + public AbstractContainerMenu createMenu(int windowId, Inventory playerInventory, Player playerEntity) { return new ContainerEnervator(windowId, playerInventory, this); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java index c990692dd..e0818c858 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java @@ -21,20 +21,21 @@ import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.INamedContainerProvider; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.World; -import net.minecraft.world.server.ServerWorld; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.energy.IEnergyStorage; @@ -43,7 +44,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer, INamedContainerProvider { +public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer, MenuProvider { private static final List SORTED_FARMER_BEHAVIORS = new ArrayList<>(); public final CustomEnergyStorage storage = new CustomEnergyStorage(100000, 1000, 0); @@ -54,12 +55,12 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer private int lastEnergy; - public TileEntityFarmer() { - super(ActuallyBlocks.FARMER.getTileEntityType(), 12); + public TileEntityFarmer(BlockPos pos, BlockState state) { + super(ActuallyBlocks.FARMER.getTileEntityType(), pos, state, 12); } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { if (type != NBTType.SAVE_BLOCK) { compound.putInt("WaitTime", this.waitTime); } @@ -72,7 +73,7 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { if (type != NBTType.SAVE_BLOCK) { this.waitTime = compound.getInt("WaitTime"); } @@ -84,43 +85,48 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer super.readSyncableNBT(compound, type); } - @Override - public void updateEntity() { - super.updateEntity(); - if (!this.level.isClientSide) { - if (!this.isRedstonePowered && this.storage.getEnergyStored() > 0) { - if (this.waitTime > 0) { - this.waitTime--; + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityFarmer tile) { + tile.clientTick(); + } + } - if (this.waitTime <= 0) { + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityFarmer tile) { + tile.serverTick(); + + if (!tile.isRedstonePowered && tile.storage.getEnergyStored() > 0) { + if (tile.waitTime > 0) { + tile.waitTime--; + + if (tile.waitTime <= 0) { int area = CommonConfig.Machines.FARMER_AREA.get(); if (area % 2 == 0) { area++; } int radius = area / 2; - BlockState state = this.level.getBlockState(this.worldPosition); - BlockPos center = this.worldPosition.relative(state.getValue(BlockStateProperties.HORIZONTAL_FACING), radius + 1); + BlockPos center = pos.relative(state.getValue(BlockStateProperties.HORIZONTAL_FACING), radius + 1); - BlockPos query = center.offset(this.checkX, 0, this.checkY); - this.checkBehaviors(query); + BlockPos query = center.offset(tile.checkX, 0, tile.checkY); + tile.checkBehaviors(query); - this.checkX++; - if (this.checkX > radius) { - this.checkX = -radius; - this.checkY++; - if (this.checkY > radius) { - this.checkY = -radius; + tile.checkX++; + if (tile.checkX > radius) { + tile.checkX = -radius; + tile.checkY++; + if (tile.checkY > radius) { + tile.checkY = -radius; } } } } else { - this.waitTime = 5; + tile.waitTime = 5; } } - if (this.lastEnergy != this.storage.getEnergyStored() && this.sendUpdateWithInterval()) { - this.lastEnergy = this.storage.getEnergyStored(); + if (tile.lastEnergy != tile.storage.getEnergyStored() && tile.sendUpdateWithInterval()) { + tile.lastEnergy = tile.storage.getEnergyStored(); } } } @@ -140,7 +146,7 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer } for (IFarmerBehavior behavior : SORTED_FARMER_BEHAVIORS) { - FarmerResult harvestResult = behavior.tryHarvestPlant((ServerWorld) level, query, this); + FarmerResult harvestResult = behavior.tryHarvestPlant((ServerLevel) level, query, this); if (harvestResult == FarmerResult.STOP_PROCESSING) { return; } @@ -203,7 +209,7 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer } @Override - public World getWorldObject() { + public Level getWorldObject() { return this.level; } @@ -238,13 +244,13 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer } @Override - public ITextComponent getDisplayName() { - return new TranslationTextComponent("container.actuallyadditions.farmer"); + public Component getDisplayName() { + return new TranslatableComponent("container.actuallyadditions.farmer"); } @Nullable @Override - public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity p_createMenu_3_) { + public AbstractContainerMenu createMenu(int windowId, Inventory playerInventory, Player p_createMenu_3_) { return new ContainerFarmer(windowId, playerInventory, this); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java index c5fa3ed4c..d2ea8e026 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java @@ -13,27 +13,31 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFeeder; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; -import net.minecraft.entity.passive.AnimalEntity; -import net.minecraft.entity.passive.horse.HorseEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.INamedContainerProvider; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.particles.ParticleTypes; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; +import net.minecraft.core.BlockPos; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.util.Mth; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.animal.Animal; +import net.minecraft.world.entity.animal.horse.Horse; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +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 javax.annotation.Nullable; import java.util.List; import java.util.Optional; -public class TileEntityFeeder extends TileEntityInventoryBase implements INamedContainerProvider { +public class TileEntityFeeder extends TileEntityInventoryBase implements MenuProvider { public static final int THRESHOLD = 30; private static final int TIME = 100; @@ -42,8 +46,8 @@ public class TileEntityFeeder extends TileEntityInventoryBase implements INamedC private int lastAnimalAmount; private int lastTimer; - public TileEntityFeeder() { - super(ActuallyBlocks.FEEDER.getTileEntityType(), 1); + public TileEntityFeeder(BlockPos pos, BlockState state) { + super(ActuallyBlocks.FEEDER.getTileEntityType(), pos, state,1); } public int getCurrentTimerToScale(int i) { @@ -51,7 +55,7 @@ public class TileEntityFeeder extends TileEntityInventoryBase implements INamedC } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); compound.putInt("Timer", this.currentTimer); if (type == NBTType.SYNC) { @@ -60,7 +64,7 @@ public class TileEntityFeeder extends TileEntityInventoryBase implements INamedC } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); this.currentTimer = compound.getInt("Timer"); if (type == NBTType.SYNC) { @@ -68,31 +72,37 @@ public class TileEntityFeeder extends TileEntityInventoryBase implements INamedC } } - @Override - public void updateEntity() { - super.updateEntity(); - this.currentTimer = MathHelper.clamp(++this.currentTimer, 0, 100); - if (this.level.isClientSide) { - return; + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityFeeder tile) { + tile.clientTick(); + tile.currentTimer = Mth.clamp(++tile.currentTimer, 0, 100); } - int range = 5; - ItemStack stack = this.inv.getStackInSlot(0); - if (!stack.isEmpty() && this.currentTimer >= TIME) { - List animals = this.level.getEntitiesOfClass(AnimalEntity.class, new AxisAlignedBB(this.worldPosition.getX() - range, this.worldPosition.getY() - range, this.worldPosition.getZ() - range, this.worldPosition.getX() + range, this.worldPosition.getY() + range, this.worldPosition.getZ() + range)); - this.currentAnimalAmount = animals.size(); - if (this.currentAnimalAmount >= 2 && this.currentAnimalAmount < THRESHOLD) { - Optional opt = animals.stream().filter((e) -> canBeFed(stack, e)).findAny(); - if (opt.isPresent()) { - feedAnimal(opt.get()); - stack.shrink(1); - this.currentTimer = 0; - this.setChanged(); + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityFeeder tile) { + tile.serverTick(); + tile.currentTimer = Mth.clamp(++tile.currentTimer, 0, 100); + + int range = 5; + ItemStack stack = tile.inv.getStackInSlot(0); + if (!stack.isEmpty() && tile.currentTimer >= TIME) { + List animals = level.getEntitiesOfClass(Animal.class, new AABB(tile.worldPosition.getX() - range, tile.worldPosition.getY() - range, tile.worldPosition.getZ() - range, tile.worldPosition.getX() + range, tile.worldPosition.getY() + range, tile.worldPosition.getZ() + range)); + tile.currentAnimalAmount = animals.size(); + if (tile.currentAnimalAmount >= 2 && tile.currentAnimalAmount < THRESHOLD) { + Optional opt = animals.stream().filter((e) -> canBeFed(stack, e)).findAny(); + if (opt.isPresent()) { + feedAnimal(opt.get()); + stack.shrink(1); + tile.currentTimer = 0; + tile.setChanged(); + } } } - } - if ((this.lastAnimalAmount != this.currentAnimalAmount || this.lastTimer != this.currentTimer) && this.sendUpdateWithInterval()) { - this.lastAnimalAmount = this.currentAnimalAmount; - this.lastTimer = this.currentTimer; + if ((tile.lastAnimalAmount != tile.currentAnimalAmount || tile.lastTimer != tile.currentTimer) && tile.sendUpdateWithInterval()) { + tile.lastAnimalAmount = tile.currentAnimalAmount; + tile.lastTimer = tile.currentTimer; + } } } @@ -101,7 +111,7 @@ public class TileEntityFeeder extends TileEntityInventoryBase implements INamedC return (slot, automation) -> !automation; } - private static void feedAnimal(AnimalEntity animal) { + private static void feedAnimal(Animal animal) { animal.setInLove(null); for (int i = 0; i < 7; i++) { double d = animal.level.random.nextGaussian() * 0.02D; @@ -111,8 +121,8 @@ public class TileEntityFeeder extends TileEntityInventoryBase implements INamedC } } - private static boolean canBeFed(ItemStack stack, AnimalEntity animal) { - if (animal instanceof HorseEntity && ((HorseEntity) animal).isTamed()) { + private static boolean canBeFed(ItemStack stack, Animal animal) { + if (animal instanceof Horse && ((Horse) animal).isTamed()) { Item item = stack.getItem(); return animal.getAge() == 0 && !animal.isInLove() && (item == Items.GOLDEN_APPLE || item == Items.GOLDEN_CARROT); } @@ -120,13 +130,13 @@ public class TileEntityFeeder extends TileEntityInventoryBase implements INamedC } @Override - public ITextComponent getDisplayName() { - return StringTextComponent.EMPTY; + public Component getDisplayName() { + return TextComponent.EMPTY; } @Nullable @Override - public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity p_createMenu_3_) { + public AbstractContainerMenu createMenu(int windowId, Inventory playerInventory, Player p_createMenu_3_) { return new ContainerFeeder(windowId, playerInventory, this); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java index 296998943..5c8c0d680 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java @@ -14,14 +14,18 @@ import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.crafting.FermentingRecipe; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFermentingBarrel; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.INamedContainerProvider; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.Direction; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.level.Level; +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.api.distmarker.OnlyIn; import net.minecraftforge.common.util.LazyOptional; @@ -34,7 +38,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.Optional; -public class TileEntityFermentingBarrel extends TileEntityBase implements ISharingFluidHandler, INamedContainerProvider { +public class TileEntityFermentingBarrel extends TileEntityBase implements ISharingFluidHandler, MenuProvider { public final FermentingBarrelMultiTank tanks = new FermentingBarrelMultiTank(); public final LazyOptional fluidOptional = LazyOptional.of(()->tanks); @@ -45,12 +49,12 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari private int lastCompare; private FermentingRecipe currentRecipe; - public TileEntityFermentingBarrel() { - super(ActuallyBlocks.FERMENTING_BARREL.getTileEntityType()); + public TileEntityFermentingBarrel(BlockPos pos, BlockState state) { + super(ActuallyBlocks.FERMENTING_BARREL.getTileEntityType(), pos, state); } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { compound.putInt("ProcessTime", this.currentProcessTime); compound.put("tanks", tanks.writeNBT()); if (currentRecipe != null) @@ -59,7 +63,7 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { this.currentProcessTime = compound.getInt("ProcessTime"); if (compound.contains("tanks")) { tanks.readNBT(compound.getCompound("tanks")); @@ -70,45 +74,50 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari super.readSyncableNBT(compound, type); } - @Override - public void updateEntity() { - super.updateEntity(); - if (this.level.isClientSide) - return; + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityFermentingBarrel tile) { + tile.clientTick(); + } + } - if (currentRecipe == null) { - //No recipe currently selected, check for one every 20 ticks - if (ticksElapsed % 20 == 0) - this.currentRecipe = ActuallyAdditionsAPI.FERMENTING_RECIPES.stream().filter(recipe -> recipe.matches(this.tanks.getFluidInTank(0), this.tanks.getFluidInTank(1))).findFirst().orElse(null); - } else { - if (this.tanks.getFluidInTank(0).getAmount() >= currentRecipe.getInput().getAmount() && - this.tanks.getFluidInTank(0).getFluid().isSame(currentRecipe.getInput().getFluid()) && - (this.tanks.getFluidInTank(1).getFluid().isSame(currentRecipe.getOutput().getFluid()) || tanks.getFluidInTank(1).isEmpty()) && - currentRecipe.getOutput().getAmount() <= this.tanks.getTankCapacity(1) - this.tanks.getFluidInTank(1).getAmount()) { + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityFermentingBarrel tile) { + tile.serverTick(); - this.currentProcessTime++; - if (this.currentProcessTime >= currentRecipe.getTime()) { - this.currentProcessTime = 0; - - this.tanks.outputTank.fill(currentRecipe.getOutput().copy(), IFluidHandler.FluidAction.EXECUTE); - this.tanks.inputTank.getFluid().shrink(currentRecipe.getInput().getAmount()); - } + if (tile.currentRecipe == null) { + //No recipe currently selected, check for one every 20 ticks + if (tile.ticksElapsed % 20 == 0) + tile.currentRecipe = ActuallyAdditionsAPI.FERMENTING_RECIPES.stream().filter(recipe -> recipe.matches(tile.tanks.getFluidInTank(0), tile.tanks.getFluidInTank(1))).findFirst().orElse(null); } else { - this.currentProcessTime = 0; - currentRecipe = null; + if (tile.tanks.getFluidInTank(0).getAmount() >= tile.currentRecipe.getInput().getAmount() && + tile.tanks.getFluidInTank(0).getFluid().isSame(tile.currentRecipe.getInput().getFluid()) && + (tile.tanks.getFluidInTank(1).getFluid().isSame(tile.currentRecipe.getOutput().getFluid()) || tile.tanks.getFluidInTank(1).isEmpty()) && + tile.currentRecipe.getOutput().getAmount() <= tile.tanks.getTankCapacity(1) - tile.tanks.getFluidInTank(1).getAmount()) { + + tile.currentProcessTime++; + if (tile.currentProcessTime >= tile.currentRecipe.getTime()) { + tile.currentProcessTime = 0; + + tile.tanks.outputTank.fill(tile.currentRecipe.getOutput().copy(), IFluidHandler.FluidAction.EXECUTE); + tile.tanks.inputTank.getFluid().shrink(tile.currentRecipe.getInput().getAmount()); + } + } else { + tile.currentProcessTime = 0; + tile.currentRecipe = null; + } } - } - int compare = this.getComparatorStrength(); - if (compare != this.lastCompare) { - this.lastCompare = compare; + int compare = tile.getComparatorStrength(); + if (compare != tile.lastCompare) { + tile.lastCompare = compare; - this.setChanged(); - } + tile.setChanged(); + } - if ((this.tanks.getFluidInTank(0).getAmount() != this.lastInput || this.tanks.getFluidInTank(1).getAmount() != this.lastOutput || this.currentProcessTime != this.lastProcessTime) && this.sendUpdateWithInterval()) { - this.lastProcessTime = this.currentProcessTime; - this.lastInput = this.tanks.getFluidInTank(0).getAmount(); - this.lastOutput = this.tanks.getFluidInTank(1).getAmount(); + if ((tile.tanks.getFluidInTank(0).getAmount() != tile.lastInput || tile.tanks.getFluidInTank(1).getAmount() != tile.lastOutput || tile.currentProcessTime != tile.lastProcessTime) && tile.sendUpdateWithInterval()) { + tile.lastProcessTime = tile.currentProcessTime; + tile.lastInput = tile.tanks.getFluidInTank(0).getAmount(); + tile.lastOutput = tile.tanks.getFluidInTank(1).getAmount(); + } } } @@ -158,13 +167,13 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari @Nonnull @Override - public ITextComponent getDisplayName() { - return new TranslationTextComponent("container.actuallyadditions.fermenting_barrel"); + public Component getDisplayName() { + return new TranslatableComponent("container.actuallyadditions.fermenting_barrel"); } @Nullable @Override - public Container createMenu(int windowId, @Nonnull PlayerInventory playerInventory, @Nonnull PlayerEntity p_createMenu_3_) { + public AbstractContainerMenu createMenu(int windowId, @Nonnull Inventory playerInventory, @Nonnull Player p_createMenu_3_) { return new ContainerFermentingBarrel(windowId, playerInventory, this); } @@ -239,19 +248,19 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari } } - public CompoundNBT writeNBT() { - CompoundNBT inputNBT = new CompoundNBT(); + public CompoundTag writeNBT() { + CompoundTag inputNBT = new CompoundTag(); inputTank.writeToNBT(inputNBT); - CompoundNBT outputNBT = new CompoundNBT(); + CompoundTag outputNBT = new CompoundTag(); outputTank.writeToNBT(outputNBT); - CompoundNBT nbt = new CompoundNBT(); + CompoundTag nbt = new CompoundTag(); nbt.put("inputTank", inputNBT); nbt.put("outputTank", outputNBT); return nbt; } - public void readNBT(CompoundNBT nbt) { + public void readNBT(CompoundTag nbt) { inputTank.readFromNBT(nbt.getCompound("inputTank")); outputTank.readFromNBT(nbt.getCompound("outputTank")); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java index 2914ecdf8..3505f7c6d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java @@ -13,23 +13,27 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFireworkBox; import de.ellpeck.actuallyadditions.mod.network.gui.INumberReactor; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.entity.projectile.FireworkRocketEntity; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.INamedContainerProvider; -import net.minecraft.item.DyeColor; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.nbt.ListNBT; -import net.minecraft.util.Direction; -import net.minecraft.util.WeightedRandom; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.util.Mth; +import net.minecraft.util.random.Weight; +import net.minecraft.util.random.WeightedEntry; +import net.minecraft.util.random.WeightedRandom; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.projectile.FireworkRocketEntity; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.energy.IEnergyStorage; @@ -37,7 +41,7 @@ import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; -public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisplay, INumberReactor, INamedContainerProvider { +public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisplay, INumberReactor, MenuProvider { public static final int USE_PER_SHOT = 500; public final CustomEnergyStorage storage = new CustomEnergyStorage(20000, 200, 0); @@ -57,12 +61,12 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp private int timeUntilNextFirework; private int oldEnergy; - public TileEntityFireworkBox() { - super(ActuallyBlocks.FIREWORK_BOX.getTileEntityType()); + public TileEntityFireworkBox(BlockPos pos, BlockState state) { + super(ActuallyBlocks.FIREWORK_BOX.getTileEntityType(), pos, state); } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); this.storage.writeToNBT(compound); @@ -83,7 +87,7 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); this.storage.readFromNBT(compound); @@ -104,7 +108,7 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp } @Override - public void onNumberReceived(double number, int id, PlayerEntity player) { + public void onNumberReceived(double number, int id, Player player) { switch (id) { case 0: this.intValuePlay = (int) number; @@ -147,7 +151,7 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp this.sendUpdate(); } - public void spawnFireworks(World world, double x, double y, double z) { + public void spawnFireworks(Level world, double x, double y, double z) { ItemStack firework = this.makeFirework(); double newX = x + this.getRandomAoe(); @@ -163,21 +167,21 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp if (this.areaOfEffect <= 0) { return 0.5; } else { - return MathHelper.nextDouble(this.level.random, 0, this.areaOfEffect * 2) - this.areaOfEffect; + return Mth.nextDouble(this.level.random, 0, this.areaOfEffect * 2) - this.areaOfEffect; } } private ItemStack makeFirework() { - ListNBT list = new ListNBT(); + ListTag list = new ListTag(); for (int i = 0; i < this.getRandomWithPlay(this.chargeAmount); i++) { list.add(this.makeFireworkCharge()); } - CompoundNBT compound1 = new CompoundNBT(); + CompoundTag compound1 = new CompoundTag(); compound1.put("Explosions", list); compound1.putByte("Flight", (byte) this.getRandomWithPlay(this.flightTime)); - CompoundNBT compound = new CompoundNBT(); + CompoundTag compound = new CompoundTag(); compound.put("Fireworks", compound1); ItemStack firework = new ItemStack(Items.FIREWORK_ROCKET); @@ -186,8 +190,8 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp return firework; } - private CompoundNBT makeFireworkCharge() { - CompoundNBT compound = new CompoundNBT(); + private CompoundTag makeFireworkCharge() { + CompoundTag compound = new CompoundTag(); if (this.level.random.nextFloat() <= this.trailOrFlickerChance) { if (this.level.random.nextFloat() <= this.flickerChance) { @@ -200,7 +204,7 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp // TODO: [port] Validate this is the correct way to get colors int[] colors = new int[this.getRandomWithPlay(this.colorAmount)]; for (int i = 0; i < colors.length; i++) { - colors[i] = DyeColor.values()[this.level.random.nextInt(DyeColor.values().length)].getColorValue(); + colors[i] = DyeColor.values()[this.level.random.nextInt(DyeColor.values().length)].getFireworkColor(); } compound.putIntArray("Colors", colors); @@ -210,7 +214,7 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp } private int getRandomWithPlay(int value) { - return MathHelper.clamp(MathHelper.nextInt(this.level.random, value - this.intValuePlay, value + this.intValuePlay), 1, 6); + return Mth.clamp(Mth.nextInt(this.level.random, value - this.intValuePlay, value + this.intValuePlay), 1, 6); } private int getRandomType() { @@ -226,28 +230,33 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp if (weight <= 0) { return 0; } else { - return WeightedRandom.getRandomItem(this.level.random, possible, weight).type; + return WeightedRandom.getRandomItem(this.level.random, possible, weight).map(weightedFireworkType -> weightedFireworkType.type).orElse(0); } } - @Override - public void updateEntity() { - super.updateEntity(); + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityFireworkBox tile) { + tile.clientTick(); + } + } - if (!this.level.isClientSide) { - if (!this.isRedstonePowered && !this.isPulseMode) { - if (this.timeUntilNextFirework > 0) { - this.timeUntilNextFirework--; - if (this.timeUntilNextFirework <= 0) { - this.doWork(); + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityFireworkBox tile) { + tile.serverTick(); + + if (!tile.isRedstonePowered && !tile.isPulseMode) { + if (tile.timeUntilNextFirework > 0) { + tile.timeUntilNextFirework--; + if (tile.timeUntilNextFirework <= 0) { + tile.doWork(); } } else { - this.timeUntilNextFirework = 100; + tile.timeUntilNextFirework = 100; } } - if (this.oldEnergy != this.storage.getEnergyStored() && this.sendUpdateWithInterval()) { - this.oldEnergy = this.storage.getEnergyStored(); + if (tile.oldEnergy != tile.storage.getEnergyStored() && tile.sendUpdateWithInterval()) { + tile.oldEnergy = tile.storage.getEnergyStored(); } } } @@ -286,23 +295,29 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp } @Override - public ITextComponent getDisplayName() { - return StringTextComponent.EMPTY; + public Component getDisplayName() { + return TextComponent.EMPTY; } @Nullable @Override - public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity p_createMenu_3_) { + public AbstractContainerMenu createMenu(int windowId, Inventory playerInventory, Player p_createMenu_3_) { return new ContainerFireworkBox(windowId, playerInventory); } - private static class WeightedFireworkType extends WeightedRandom.Item { + private static class WeightedFireworkType implements WeightedEntry { public final int type; + public final Weight chance; public WeightedFireworkType(int type, float chance) { - super((int) (chance * 100F)); this.type = type; + this.chance = Weight.of((int) (chance * 100F)); + } + + @Override + public Weight getWeight() { + return this.chance; } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java index a68442b71..9d8fbe639 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java @@ -13,40 +13,38 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.fluids.AATank; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFluidCollector; -import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.FlowingFluidBlock; -import net.minecraft.block.material.Material; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.fluid.Fluids; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.INamedContainerProvider; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.particles.ParticleTypes; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.Direction; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.server.ServerWorld; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +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.LiquidBlock; +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.material.Material; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fluids.FluidAttributes; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidBlock; import net.minecraftforge.fluids.capability.IFluidHandler; -import net.minecraftforge.fluids.capability.templates.FluidTank; import javax.annotation.Nonnull; import javax.annotation.Nullable; -public class TileEntityFluidCollector extends TileEntityBase implements ISharingFluidHandler, INamedContainerProvider { +public class TileEntityFluidCollector extends TileEntityBase implements ISharingFluidHandler, MenuProvider { public boolean isPlacer; public final AATank tank = new AATank(8 * FluidAttributes.BUCKET_VOLUME) { @@ -81,12 +79,12 @@ public class TileEntityFluidCollector extends TileEntityBase implements ISharing private int currentTime; private int lastCompare; - public TileEntityFluidCollector(TileEntityType type) { - super(type); + public TileEntityFluidCollector(BlockEntityType type, BlockPos pos, BlockState state) { + super(type, pos, state); } - public TileEntityFluidCollector() { - this(ActuallyBlocks.FLUID_COLLECTOR.getTileEntityType()); + public TileEntityFluidCollector(BlockPos pos, BlockState state) { + this(ActuallyBlocks.FLUID_COLLECTOR.getTileEntityType(), pos, state); this.isPlacer = false; } @@ -109,9 +107,9 @@ public class TileEntityFluidCollector extends TileEntityBase implements ISharing BlockState stateToBreak = this.level.getBlockState(coordsBlock); Block blockToBreak = stateToBreak.getBlock(); if (!this.isPlacer && FluidAttributes.BUCKET_VOLUME <= this.tank.getCapacity() - this.tank.getFluidAmount()) { - if (blockToBreak instanceof FlowingFluidBlock && stateToBreak.getFluidState().isSource() && ((FlowingFluidBlock) blockToBreak).getFluid() != null) { - if (this.tank.fillInternal(new FluidStack(((FlowingFluidBlock) blockToBreak).getFluid(), FluidAttributes.BUCKET_VOLUME), IFluidHandler.FluidAction.SIMULATE) >= FluidAttributes.BUCKET_VOLUME) { - this.tank.fillInternal(new FluidStack(((FlowingFluidBlock) blockToBreak).getFluid(), FluidAttributes.BUCKET_VOLUME), IFluidHandler.FluidAction.EXECUTE); + if (blockToBreak instanceof LiquidBlock && stateToBreak.getFluidState().isSource() && ((LiquidBlock) blockToBreak).getFluid() != null) { + if (this.tank.fillInternal(new FluidStack(((LiquidBlock) blockToBreak).getFluid(), FluidAttributes.BUCKET_VOLUME), IFluidHandler.FluidAction.SIMULATE) >= FluidAttributes.BUCKET_VOLUME) { + this.tank.fillInternal(new FluidStack(((LiquidBlock) blockToBreak).getFluid(), FluidAttributes.BUCKET_VOLUME), IFluidHandler.FluidAction.EXECUTE); this.level.setBlockAndUpdate(coordsBlock, Blocks.AIR.defaultBlockState()); } } @@ -126,11 +124,11 @@ public class TileEntityFluidCollector extends TileEntityBase implements ISharing this.tank.drainInternal(FluidAttributes.BUCKET_VOLUME, IFluidHandler.FluidAction.EXECUTE); // TODO: [port] validate this check is still valid. if (this.level.dimensionType().ultraWarm() && fluid.defaultBlockState().getMaterial() == Material.WATER) { - this.level.playSound(null, offsetPos, SoundEvents.FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F + (this.level.random.nextFloat() - this.level.random.nextFloat()) * 0.8F); + this.level.playSound(null, offsetPos, SoundEvents.FIRE_EXTINGUISH, SoundSource.BLOCKS, 0.5F, 2.6F + (this.level.random.nextFloat() - this.level.random.nextFloat()) * 0.8F); - if (this.level instanceof ServerWorld) { + if (this.level instanceof ServerLevel) { for (int l = 0; l < 8; ++l) { - ((ServerWorld) this.level).sendParticles(ParticleTypes.SMOKE, offsetPos.getX() + Math.random(), offsetPos.getY() + Math.random(), offsetPos.getZ() + Math.random(), 1, 0.0D, 0.0D, 0.0D, 0); + ((ServerLevel) this.level).sendParticles(ParticleTypes.SMOKE, offsetPos.getX() + Math.random(), offsetPos.getY() + Math.random(), offsetPos.getZ() + Math.random(), 1, 0.0D, 0.0D, 0.0D, 0); } } } else { @@ -154,7 +152,7 @@ public class TileEntityFluidCollector extends TileEntityBase implements ISharing } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { compound.putInt("CurrentTime", this.currentTime); @@ -163,7 +161,7 @@ public class TileEntityFluidCollector extends TileEntityBase implements ISharing } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { this.currentTime = compound.getInt("CurrentTime"); @@ -171,29 +169,35 @@ public class TileEntityFluidCollector extends TileEntityBase implements ISharing this.tank.readFromNBT(compound); } - @Override - public void updateEntity() { - super.updateEntity(); - if (!this.level.isClientSide) { - if (!this.isRedstonePowered && !this.isPulseMode) { - if (this.currentTime > 0) { - this.currentTime--; - if (this.currentTime <= 0) { - this.doWork(); + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityFluidCollector tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityFluidCollector tile) { + tile.serverTick(); + + if (!tile.isRedstonePowered && !tile.isPulseMode) { + if (tile.currentTime > 0) { + tile.currentTime--; + if (tile.currentTime <= 0) { + tile.doWork(); } } else { - this.currentTime = 15; + tile.currentTime = 15; } } - if (this.lastCompare != this.getComparatorStrength()) { - this.lastCompare = this.getComparatorStrength(); + if (tile.lastCompare != tile.getComparatorStrength()) { + tile.lastCompare = tile.getComparatorStrength(); - this.setChanged(); + tile.setChanged(); } - if (this.lastTankAmount != this.tank.getFluidAmount() && this.sendUpdateWithInterval()) { - this.lastTankAmount = this.tank.getFluidAmount(); + if (tile.lastTankAmount != tile.tank.getFluidAmount() && tile.sendUpdateWithInterval()) { + tile.lastTankAmount = tile.tank.getFluidAmount(); } } } @@ -214,13 +218,13 @@ public class TileEntityFluidCollector extends TileEntityBase implements ISharing } @Override - public ITextComponent getDisplayName() { - return new TranslationTextComponent(isPlacer ? "container.actuallyadditions.fluidPlacer" : "container.actuallyadditions.fluidCollector"); + public Component getDisplayName() { + return new TranslatableComponent(isPlacer ? "container.actuallyadditions.fluidPlacer" : "container.actuallyadditions.fluidCollector"); } @Nullable @Override - public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) { + public AbstractContainerMenu createMenu(int windowId, Inventory playerInventory, Player player) { return new ContainerFluidCollector(windowId, playerInventory, this); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidPlacer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidPlacer.java index e07a091fd..90ccb9e16 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidPlacer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidPlacer.java @@ -11,12 +11,28 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; public class TileEntityFluidPlacer extends TileEntityFluidCollector { - public TileEntityFluidPlacer() { - super(ActuallyBlocks.FLUID_PLACER.getTileEntityType()); + public TileEntityFluidPlacer(BlockPos pos, BlockState state) { + super(ActuallyBlocks.FLUID_PLACER.getTileEntityType(), pos, state); this.isPlacer = true; } + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityFluidPlacer tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityFluidPlacer tile) { + tile.serverTick(); + } + } + } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java index 561382153..b639691d4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java @@ -12,15 +12,16 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.MagmaBlock; -import net.minecraft.block.material.Material; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +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.MagmaBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.Material; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.energy.IEnergyStorage; @@ -35,12 +36,12 @@ public class TileEntityHeatCollector extends TileEntityBase implements ISharingE private int oldEnergy; private int disappearTime; - public TileEntityHeatCollector() { - super(ActuallyBlocks.HEAT_COLLECTOR.getTileEntityType()); + public TileEntityHeatCollector(BlockPos pos, BlockState state) { + super(ActuallyBlocks.HEAT_COLLECTOR.getTileEntityType(), pos, state); } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); this.storage.writeToNBT(compound); @@ -50,7 +51,7 @@ public class TileEntityHeatCollector extends TileEntityBase implements ISharingE } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); this.storage.readFromNBT(compound); @@ -59,39 +60,45 @@ public class TileEntityHeatCollector extends TileEntityBase implements ISharingE } } - @Override - public void updateEntity() { - super.updateEntity(); - if (!this.level.isClientSide) { + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityHeatCollector tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityHeatCollector tile) { + tile.serverTick(); + ArrayList blocksAround = new ArrayList<>(); - if (ENERGY_PRODUCE <= this.storage.getMaxEnergyStored() - this.storage.getEnergyStored()) { + if (ENERGY_PRODUCE <= tile.storage.getMaxEnergyStored() - tile.storage.getEnergyStored()) { for (int i = 1; i <= 5; i++) { - BlockPos coords = this.worldPosition.relative(WorldUtil.getDirectionBySidesInOrder(i)); - BlockState state = this.level.getBlockState(coords); - Block block = state.getBlock(); - if (block != null && this.level.getBlockState(coords).getMaterial() == Material.LAVA || this.level.getBlockState(coords).getBlock() instanceof MagmaBlock) { + BlockPos coords = pos.relative(WorldUtil.getDirectionBySidesInOrder(i)); + BlockState relativeState = level.getBlockState(coords); + Block block = relativeState.getBlock(); + if (block != null && level.getBlockState(coords).getMaterial() == Material.LAVA || level.getBlockState(coords).getBlock() instanceof MagmaBlock) { blocksAround.add(i); } } if (blocksAround.size() >= BLOCKS_NEEDED) { - this.storage.receiveEnergyInternal(ENERGY_PRODUCE, false); - this.setChanged(); + tile.storage.receiveEnergyInternal(ENERGY_PRODUCE, false); + tile.setChanged(); - this.disappearTime++; - if (this.disappearTime >= 1000) { - this.disappearTime = 0; + tile.disappearTime++; + if (tile.disappearTime >= 1000) { + tile.disappearTime = 0; - if (this.level.random.nextInt(200) == 0) { - int randomSide = blocksAround.get(this.level.random.nextInt(blocksAround.size())); - this.level.setBlockAndUpdate(this.worldPosition.relative(WorldUtil.getDirectionBySidesInOrder(randomSide)), Blocks.AIR.defaultBlockState()); + if (level.random.nextInt(200) == 0) { + int randomSide = blocksAround.get(level.random.nextInt(blocksAround.size())); + level.setBlockAndUpdate(pos.relative(WorldUtil.getDirectionBySidesInOrder(randomSide)), Blocks.AIR.defaultBlockState()); } } } } - if (this.oldEnergy != this.storage.getEnergyStored() && this.sendUpdateWithInterval()) { - this.oldEnergy = this.storage.getEnergyStored(); + if (tile.oldEnergy != tile.storage.getEnergyStored() && tile.sendUpdateWithInterval()) { + tile.oldEnergy = tile.storage.getEnergyStored(); } } } @@ -122,7 +129,7 @@ public class TileEntityHeatCollector extends TileEntityBase implements ISharingE } @Override - public boolean canShareTo(TileEntity tile) { + public boolean canShareTo(BlockEntity tile) { return true; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java index 057f206a8..e8d891834 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java @@ -14,11 +14,13 @@ import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.nbt.ListNBT; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.Direction; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +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.util.LazyOptional; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; @@ -29,18 +31,18 @@ public abstract class TileEntityInventoryBase extends TileEntityBase { public final ItemStackHandlerAA inv; public final LazyOptional lazyInv; - public TileEntityInventoryBase(TileEntityType type, int slots) { - super(type); + public TileEntityInventoryBase(BlockEntityType type, BlockPos pos, BlockState state, int slots) { + super(type, pos, state); this.inv = new TileStackHandler(slots); this.lazyInv = LazyOptional.of(() -> this.inv); } - public static void saveSlots(IItemHandler slots, CompoundNBT compound) { + public static void saveSlots(IItemHandler slots, CompoundTag compound) { if (slots != null && slots.getSlots() > 0) { - ListNBT tagList = new ListNBT(); + ListTag tagList = new ListTag(); for (int i = 0; i < slots.getSlots(); i++) { ItemStack slot = slots.getStackInSlot(i); - CompoundNBT tagCompound = new CompoundNBT(); + CompoundTag tagCompound = new CompoundTag(); if (StackUtil.isValid(slot)) { slot.save(tagCompound); } @@ -50,11 +52,11 @@ public abstract class TileEntityInventoryBase extends TileEntityBase { } } - public static void loadSlots(IItemHandlerModifiable slots, CompoundNBT compound) { + public static void loadSlots(IItemHandlerModifiable slots, CompoundTag compound) { if (slots != null && slots.getSlots() > 0) { - ListNBT tagList = compound.getList("Items", 10); + ListTag tagList = compound.getList("Items", 10); for (int i = 0; i < slots.getSlots(); i++) { - CompoundNBT tagCompound = tagList.getCompound(i); + CompoundTag tagCompound = tagList.getCompound(i); slots.setStackInSlot(i, tagCompound.contains("id") ? ItemStack.of(tagCompound) : ItemStack.EMPTY); @@ -63,7 +65,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase { } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type == NBTType.SAVE_TILE || type == NBTType.SYNC && this.shouldSyncSlots()) { saveSlots(this.inv, compound); @@ -106,7 +108,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase { } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); if (type == NBTType.SAVE_TILE || type == NBTType.SYNC && this.shouldSyncSlots()) { loadSlots(this.inv, compound); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemInterface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemInterface.java index 59d292f4e..ae3856891 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemInterface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemInterface.java @@ -17,21 +17,27 @@ import de.ellpeck.actuallyadditions.mod.network.PacketServerToClient; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.server.level.ServerPlayer; +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.entity.BlockEntity; +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 javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; public class TileEntityItemInterface extends TileEntityBase { @@ -44,8 +50,8 @@ public class TileEntityItemInterface extends TileEntityBase { private int lastNetworkChangeAmount = -1; private int slotCount; - public TileEntityItemInterface(TileEntityType type) { - super(type); + public TileEntityItemInterface(BlockEntityType type, BlockPos pos, BlockState state) { + super(type, pos, state); IItemHandler normalHandler = new IItemHandler() { @Override @@ -118,8 +124,20 @@ public class TileEntityItemInterface extends TileEntityBase { this.itemHandler = new SlotlessableItemHandlerWrapper(this.lazyHandlers, slotlessHandler); } - public TileEntityItemInterface() { - this(ActuallyBlocks.ITEM_INTERFACE.getTileEntityType()); + public TileEntityItemInterface(BlockPos pos, BlockState state) { + this(ActuallyBlocks.ITEM_INTERFACE.getTileEntityType(), pos, state); + } + + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityItemInterface tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityItemInterface tile) { + tile.serverTick(); + } } @Override @@ -155,7 +173,7 @@ public class TileEntityItemInterface extends TileEntityBase { public void doItemParticle(ItemStack stack, BlockPos input, BlockPos output) { if (!this.level.isClientSide) { - CompoundNBT compound = new CompoundNBT(); + CompoundTag compound = new CompoundTag(); stack.save(compound); compound.putDouble("InX", input.getX()); @@ -167,10 +185,10 @@ public class TileEntityItemInterface extends TileEntityBase { compound.putDouble("OutZ", output.getZ()); int rangeSq = 16 * 16; - for (PlayerEntity player : this.level.players()) { - if (player instanceof ServerPlayerEntity) { + for (Player player : this.level.players()) { + if (player instanceof ServerPlayer) { if (player.distanceToSqr(input.getX(), input.getY(), input.getZ()) <= rangeSq || player.distanceToSqr(output.getX(), output.getY(), output.getZ()) <= rangeSq) { - PacketHandler.sendTo(new PacketServerToClient(compound, PacketHandler.LASER_PARTICLE_HANDLER), (ServerPlayerEntity) player); + PacketHandler.sendTo(new PacketServerToClient(compound, PacketHandler.LASER_PARTICLE_HANDLER), (ServerPlayer) player); } } } @@ -256,7 +274,7 @@ public class TileEntityItemInterface extends TileEntityBase { BlockPos pos = this.getBlockPos().relative(side); if (this.level.isLoaded(pos)) { - TileEntity tile = this.level.getBlockEntity(pos); + BlockEntity tile = this.level.getBlockEntity(pos); if (tile instanceof TileEntityLaserRelayItem) { if (tileFound != null) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemInterfaceHopping.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemInterfaceHopping.java index 1bdbbf337..9557da360 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemInterfaceHopping.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemInterfaceHopping.java @@ -15,16 +15,17 @@ import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper; -import net.minecraft.block.BlockState; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; -import net.minecraft.util.EntityPredicates; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.entity.EntitySelector; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.phys.AABB; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; @@ -36,60 +37,67 @@ public class TileEntityItemInterfaceHopping extends TileEntityItemInterface { private SlotlessableItemHandlerWrapper handlerToPullFrom; private SlotlessableItemHandlerWrapper handlerToPushTo; - public TileEntityItemInterfaceHopping() { - super(ActuallyBlocks.ITEM_INTERFACE_HOPPING.getTileEntityType()); + public TileEntityItemInterfaceHopping(BlockPos pos, BlockState state) { + super(ActuallyBlocks.ITEM_INTERFACE_HOPPING.getTileEntityType(), pos, state); } - @Override - public void updateEntity() { - super.updateEntity(); + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityItemInterfaceHopping tile) { + tile.clientTick(); + } + } - // TODO: [port] validate this is the correct way to get total game time getGameTime - if (!this.level.isClientSide && this.level.getLevelData().getGameTime() % 10 == 0) { - if (this.handlerToPullFrom != null) { - WorldUtil.doItemInteraction(this.handlerToPullFrom, this.itemHandler, 4); - } else { - if (this.level.getLevelData().getGameTime() % 20 == 0) { - //TODO hmm? - AxisAlignedBB axisAlignedBB = new AxisAlignedBB(this.getBlockPos().getX(), this.getBlockPos().getY() + 0.5, this.getBlockPos().getZ(), this.getBlockPos().getX() + 1, this.getBlockPos().getY() + 2, this.getBlockPos().getZ() + 1); - List items = this.level.getEntities(EntityType.ITEM, axisAlignedBB, EntityPredicates.ENTITY_STILL_ALIVE); - if (items != null && !items.isEmpty()) { - for (ItemEntity item : items) { - if (item != null && item.isAlive()) { - if (ActuallyAdditions.commonCapsLoaded) { - Object slotless = this.itemHandler.getSlotlessHandler(); - // TODO: [port] add back? - // if (slotless instanceof ISlotlessItemHandler) { - // ItemStack left = ((ISlotlessItemHandler) slotless).insertItem(item.getItem(), false); - // item.setItem(left); - // - // if (!StackUtil.isValid(left)) { - // item.remove(); - // continue; - // } - // } - } + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityItemInterfaceHopping tile) { + tile.serverTick(); - LazyOptional handler = this.itemHandler.getNormalHandler(); - handler.ifPresent(cap -> { - for (int i = 0; i < cap.getSlots(); i++) { - ItemStack left = cap.insertItem(i, item.getItem(), false); - item.setItem(left); - - if (!StackUtil.isValid(left)) { - item.remove(); - break; - } + // TODO: [port] validate tile is the correct way to get total game time getGameTime + if (level.getLevelData().getGameTime() % 10 == 0) { + if (tile.handlerToPullFrom != null) { + WorldUtil.doItemInteraction(tile.handlerToPullFrom, tile.itemHandler, 4); + } else { + if (level.getLevelData().getGameTime() % 20 == 0) { + //TODO hmm? + AABB axisAlignedBB = new AABB(pos.getX(), pos.getY() + 0.5, pos.getZ(), pos.getX() + 1, pos.getY() + 2, pos.getZ() + 1); + List items = level.getEntities(EntityType.ITEM, axisAlignedBB, EntitySelector.ENTITY_STILL_ALIVE); + if (items != null && !items.isEmpty()) { + for (ItemEntity item : items) { + if (item != null && item.isAlive()) { + if (ActuallyAdditions.commonCapsLoaded) { + Object slotless = tile.itemHandler.getSlotlessHandler(); + // TODO: [port] add back? + // if (slotless instanceof ISlotlessItemHandler) { + // ItemStack left = ((ISlotlessItemHandler) slotless).insertItem(item.getItem(), false); + // item.setItem(left); + // + // if (!StackUtil.isValid(left)) { + // item.remove(); + // continue; + // } + // } } - }); + + LazyOptional handler = tile.itemHandler.getNormalHandler(); + handler.ifPresent(cap -> { + for (int i = 0; i < cap.getSlots(); i++) { + ItemStack left = cap.insertItem(i, item.getItem(), false); + item.setItem(left); + + if (!StackUtil.isValid(left)) { + item.discard(); + break; + } + } + }); + } } } } } - } - if (this.handlerToPushTo != null) { - WorldUtil.doItemInteraction(this.itemHandler, this.handlerToPushTo, 4); + if (tile.handlerToPushTo != null) { + WorldUtil.doItemInteraction(tile.itemHandler, tile.handlerToPushTo, 4); + } } } } @@ -101,7 +109,7 @@ public class TileEntityItemInterfaceHopping extends TileEntityItemInterface { this.handlerToPullFrom = null; this.handlerToPushTo = null; - TileEntity from = this.level.getBlockEntity(this.getBlockPos().relative(Direction.UP)); + BlockEntity from = this.level.getBlockEntity(this.getBlockPos().relative(Direction.UP)); if (from != null && !(from instanceof TileEntityItemInterface)) { LazyOptional normal = from.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.DOWN); @@ -122,7 +130,7 @@ public class TileEntityItemInterfaceHopping extends TileEntityItemInterface { BlockPos toPos = this.getBlockPos().relative(facing); if (this.level.isLoaded(toPos)) { - TileEntity to = this.level.getBlockEntity(toPos); + BlockEntity to = this.level.getBlockEntity(toPos); if (to != null && !(to instanceof TileEntityItemInterface)) { LazyOptional normal = to.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite()); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java index 3eaea8908..552e9ff85 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java @@ -18,20 +18,20 @@ import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import de.ellpeck.actuallyadditions.mod.misc.apiimpl.ConnectionPair; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import io.netty.util.internal.ConcurrentSet; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.nbt.ListNBT; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.Direction; -import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.AABB; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.IItemHandler; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; - public abstract class TileEntityLaserRelay extends TileEntityInventoryBase { public static final int MAX_DISTANCE = 15; @@ -45,20 +45,20 @@ public abstract class TileEntityLaserRelay extends TileEntityInventoryBase { // List of connections that are synced to the client for RenderLaserRelay to use private final ConcurrentSet connections = new ConcurrentSet<>(); - public TileEntityLaserRelay(TileEntityType tileType, LaserType type) { - super(tileType, 1); + public TileEntityLaserRelay(BlockEntityType tileType, BlockPos pos, BlockState state, LaserType type) { + super(tileType, pos, state,1); this.type = type; } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); if (type == NBTType.SYNC) { ActuallyAdditionsAPI.connectionHandler.removeRelayFromNetwork(this.worldPosition, this.level); this.connections.clear(); - ListNBT list = compound.getList("Connections", 10); + ListTag list = compound.getList("Connections", 10); if (!list.isEmpty()) { for (int i = 0; i < list.size(); i++) { ConnectionPair pair = new ConnectionPair(); @@ -71,16 +71,16 @@ public abstract class TileEntityLaserRelay extends TileEntityInventoryBase { } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type == NBTType.SYNC) { - ListNBT list = new ListNBT(); + ListTag list = new ListTag(); ConcurrentSet connections = ActuallyAdditionsAPI.connectionHandler.getConnectionsFor(this.worldPosition, this.level); if (connections != null && !connections.isEmpty()) { for (IConnectionPair pair : connections) { - CompoundNBT tag = new CompoundNBT(); + CompoundTag tag = new CompoundTag(); pair.writeToNBT(tag); list.add(tag); } @@ -91,9 +91,28 @@ public abstract class TileEntityLaserRelay extends TileEntityInventoryBase { } @Override - public void updateEntity() { - super.updateEntity(); + protected void clientTick() { + super.clientTick(); + int range = this.getMaxRange(); + if (this.lastRange != range) { + ConcurrentSet connections = ActuallyAdditionsAPI.connectionHandler.getConnectionsFor(this.worldPosition, this.level); + if (connections != null && !connections.isEmpty()) { + for (IConnectionPair pair : connections) { + int distanceSq = (int) pair.getPositions()[0].distSqr(pair.getPositions()[1]); + if (distanceSq > range * range) { + this.connections.remove(pair); + ActuallyAdditionsAPI.connectionHandler.removeConnection(this.level, pair.getPositions()[0], pair.getPositions()[1]); + } + } + } + this.lastRange = range; + } + } + + @Override + protected void serverTick() { + super.serverTick(); int range = this.getMaxRange(); if (this.lastRange != range) { ConcurrentSet connections = ActuallyAdditionsAPI.connectionHandler.getConnectionsFor(this.worldPosition, this.level); @@ -159,7 +178,7 @@ public abstract class TileEntityLaserRelay extends TileEntityInventoryBase { @Override @OnlyIn(Dist.CLIENT) - public AxisAlignedBB getRenderBoundingBox() { + public AABB getRenderBoundingBox() { return INFINITE_EXTENT_AABB; } @@ -188,7 +207,7 @@ public abstract class TileEntityLaserRelay extends TileEntityInventoryBase { @OnlyIn(Dist.CLIENT) public abstract String getCompassDisplayString(); - public abstract void onCompassAction(PlayerEntity player); + public abstract void onCompassAction(Player player); public ConcurrentSet getConnections() { return connections; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayEnergy.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayEnergy.java index 38ba8b877..3a43611ef 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayEnergy.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayEnergy.java @@ -17,15 +17,17 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.config.CommonConfig; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.text.TextFormatting; +import net.minecraft.ChatFormatting; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; +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.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.util.LazyOptional; @@ -40,12 +42,12 @@ import java.util.concurrent.ConcurrentHashMap; public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay { public static final int CAP = 1000; - public final ConcurrentHashMap receiversAround = new ConcurrentHashMap<>(); + public final ConcurrentHashMap receiversAround = new ConcurrentHashMap<>(); private final IEnergyStorage[] energyStorages = new IEnergyStorage[6]; private Mode mode = Mode.BOTH; - public TileEntityLaserRelayEnergy(TileEntityType type) { - super(type, LaserType.ENERGY); + public TileEntityLaserRelayEnergy(BlockEntityType type, BlockPos pos, BlockState state) { + super(type, pos, state, LaserType.ENERGY); for (int i = 0; i < this.energyStorages.length; i++) { Direction facing = Direction.values()[i]; @@ -83,8 +85,20 @@ public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay { } } - public TileEntityLaserRelayEnergy() { - this(ActuallyBlocks.LASER_RELAY.getTileEntityType()); + public TileEntityLaserRelayEnergy(BlockPos pos, BlockState state) { + this(ActuallyBlocks.LASER_RELAY.getTileEntityType(), pos, state); + } + + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityLaserRelayEnergy tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityLaserRelayEnergy tile) { + tile.serverTick(); + } } private int transmitEnergy(Direction from, int maxTransmit, boolean simulate) { @@ -113,19 +127,19 @@ public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay { @Override public void saveDataOnChangeOrWorldStart() { - Map old = new HashMap<>(this.receiversAround); + Map old = new HashMap<>(this.receiversAround); boolean change = false; this.receiversAround.clear(); for (Direction side : Direction.values()) { BlockPos pos = this.getBlockPos().relative(side); if (this.level.hasChunkAt(pos)) { - TileEntity tile = this.level.getBlockEntity(pos); + BlockEntity tile = this.level.getBlockEntity(pos); if (tile != null && !(tile instanceof TileEntityLaserRelay)) { if (tile.getCapability(CapabilityEnergy.ENERGY, side.getOpposite()).isPresent()) { this.receiversAround.put(side, tile); - TileEntity oldTile = old.get(side); + BlockEntity oldTile = old.get(side); if (oldTile == null || !tile.equals(oldTile)) { change = true; } @@ -154,7 +168,7 @@ public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay { for (BlockPos relay : pair.getPositions()) { if (relay != null && this.level.hasChunkAt(relay) && !alreadyChecked.contains(relay)) { alreadyChecked.add(relay); - TileEntity relayTile = this.level.getBlockEntity(relay); + BlockEntity relayTile = this.level.getBlockEntity(relay); if (relayTile instanceof TileEntityLaserRelayEnergy) { TileEntityLaserRelayEnergy theRelay = (TileEntityLaserRelayEnergy) relayTile; if (theRelay.mode != Mode.INPUT_ONLY) { @@ -162,7 +176,7 @@ public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay { for (Direction facing : theRelay.receiversAround.keySet()) { if (theRelay != this || facing != from) { - TileEntity tile = theRelay.receiversAround.get(facing); + BlockEntity tile = theRelay.receiversAround.get(facing); Direction opp = facing.getOpposite(); if (tile != null) { @@ -192,11 +206,11 @@ public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay { for (TileEntityLaserRelayEnergy theRelay : relaysThatWork) { double highestLoss = Math.max(theRelay.getLossPercentage(), this.getLossPercentage()); int lowestCap = Math.min(theRelay.getEnergyCap(), this.getEnergyCap()); - for (Map.Entry receiver : theRelay.receiversAround.entrySet()) { + for (Map.Entry receiver : theRelay.receiversAround.entrySet()) { if (receiver != null) { Direction side = receiver.getKey(); Direction opp = side.getOpposite(); - TileEntity tile = receiver.getValue(); + BlockEntity tile = receiver.getValue(); if (!alreadyChecked.contains(tile.getBlockPos())) { alreadyChecked.add(tile.getBlockPos()); if (theRelay != this || side != from) { @@ -232,7 +246,7 @@ public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay { private int calcDeduction(int theoreticalReceived, double highestLoss) { return CommonConfig.Machines.LASER_RELAY_LOSS.get() - ? MathHelper.ceil(theoreticalReceived * (highestLoss / 100)) + ? Mth.ceil(theoreticalReceived * (highestLoss / 100)) : 0; } @@ -247,22 +261,22 @@ public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay { @Override @OnlyIn(Dist.CLIENT) public String getExtraDisplayString() { - return I18n.get("info." + ActuallyAdditions.MODID + ".laserRelay.energy.extra") + ": " + TextFormatting.DARK_RED + I18n.get(this.mode.name) + TextFormatting.RESET; + return I18n.get("info." + ActuallyAdditions.MODID + ".laserRelay.energy.extra") + ": " + ChatFormatting.DARK_RED + I18n.get(this.mode.name) + ChatFormatting.RESET; } @Override @OnlyIn(Dist.CLIENT) public String getCompassDisplayString() { - return TextFormatting.GREEN + I18n.get("info." + ActuallyAdditions.MODID + ".laserRelay.energy.display"); + return ChatFormatting.GREEN + I18n.get("info." + ActuallyAdditions.MODID + ".laserRelay.energy.display"); } @Override - public void onCompassAction(PlayerEntity player) { + public void onCompassAction(Player player) { this.mode = this.mode.getNext(); } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { @@ -271,7 +285,7 @@ public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay { } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayEnergyAdvanced.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayEnergyAdvanced.java index 2656c195f..5b92bfbbc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayEnergyAdvanced.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayEnergyAdvanced.java @@ -11,13 +11,29 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; public class TileEntityLaserRelayEnergyAdvanced extends TileEntityLaserRelayEnergy { public static final int CAP = 10000; - public TileEntityLaserRelayEnergyAdvanced() { - super(ActuallyBlocks.LASER_RELAY_ADVANCED.getTileEntityType()); + public TileEntityLaserRelayEnergyAdvanced(BlockPos pos, BlockState state) { + super(ActuallyBlocks.LASER_RELAY_ADVANCED.getTileEntityType(), pos, state); + } + + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityLaserRelayEnergyAdvanced tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityLaserRelayEnergyAdvanced tile) { + tile.serverTick(); + } } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayEnergyExtreme.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayEnergyExtreme.java index 3e5c5a44b..2d2900efb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayEnergyExtreme.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayEnergyExtreme.java @@ -11,13 +11,29 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; public class TileEntityLaserRelayEnergyExtreme extends TileEntityLaserRelayEnergy { public static final int CAP = 100000; - public TileEntityLaserRelayEnergyExtreme() { - super(ActuallyBlocks.LASER_RELAY_EXTREME.getTileEntityType()); + public TileEntityLaserRelayEnergyExtreme(BlockPos pos, BlockState state) { + super(ActuallyBlocks.LASER_RELAY_EXTREME.getTileEntityType(), pos, state); + } + + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityLaserRelayEnergyExtreme tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityLaserRelayEnergyExtreme tile) { + tile.serverTick(); + } } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayFluids.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayFluids.java index f2ff7cb1d..4f1d13c08 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayFluids.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayFluids.java @@ -17,13 +17,15 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergy.Mode; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.TextFormatting; +import net.minecraft.ChatFormatting; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; +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.api.distmarker.OnlyIn; import net.minecraftforge.common.util.LazyOptional; @@ -40,12 +42,12 @@ import java.util.concurrent.ConcurrentHashMap; public class TileEntityLaserRelayFluids extends TileEntityLaserRelay { - public final ConcurrentHashMap handlersAround = new ConcurrentHashMap<>(); + public final ConcurrentHashMap handlersAround = new ConcurrentHashMap<>(); private final IFluidHandler[] fluidHandlers = new IFluidHandler[6]; private Mode mode = Mode.BOTH; - public TileEntityLaserRelayFluids() { - super(ActuallyBlocks.LASER_RELAY_FLUIDS.getTileEntityType(), LaserType.FLUID); + public TileEntityLaserRelayFluids(BlockPos pos, BlockState state) { + super(ActuallyBlocks.LASER_RELAY_FLUIDS.getTileEntityType(), pos, state, LaserType.FLUID); for (int i = 0; i < this.fluidHandlers.length; i++) { Direction facing = Direction.values()[i]; @@ -93,15 +95,24 @@ public class TileEntityLaserRelayFluids extends TileEntityLaserRelay { } } - @Override - public void updateEntity() { - super.updateEntity(); + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityLaserRelayFluids tile) { + tile.clientTick(); + } + } - if (!this.level.isClientSide) { - if (this.mode == Mode.INPUT_ONLY) { - for (Direction side : this.handlersAround.keySet()) { - WorldUtil.doFluidInteraction(this.handlersAround.get(side), this, side.getOpposite(), Integer.MAX_VALUE); - } + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityLaserRelayFluids tile) { + tile.serverTick(); + } + } + + @Override + protected void serverTick() { + super.serverTick(); + if (this.mode == Mode.INPUT_ONLY) { + for (Direction side : this.handlersAround.keySet()) { + WorldUtil.doFluidInteraction(this.handlersAround.get(side), this, side.getOpposite(), Integer.MAX_VALUE); } } } @@ -113,19 +124,19 @@ public class TileEntityLaserRelayFluids extends TileEntityLaserRelay { @Override public void saveDataOnChangeOrWorldStart() { - Map old = new HashMap<>(this.handlersAround); + Map old = new HashMap<>(this.handlersAround); boolean change = false; this.handlersAround.clear(); for (Direction side : Direction.values()) { BlockPos pos = this.getBlockPos().relative(side); if (this.level.hasChunkAt(pos)) { - TileEntity tile = this.level.getBlockEntity(pos); + BlockEntity tile = this.level.getBlockEntity(pos); if (tile != null && !(tile instanceof TileEntityLaserRelay)) { if (tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side.getOpposite()).isPresent()) { this.handlersAround.put(side, tile); - TileEntity oldTile = old.get(side); + BlockEntity oldTile = old.get(side); if (oldTile == null || !tile.equals(oldTile)) { change = true; } @@ -173,7 +184,7 @@ public class TileEntityLaserRelayFluids extends TileEntityLaserRelay { for (BlockPos relay : pair.getPositions()) { if (relay != null && this.level.hasChunkAt(relay) && !alreadyChecked.contains(relay)) { alreadyChecked.add(relay); - TileEntity relayTile = this.level.getBlockEntity(relay); + BlockEntity relayTile = this.level.getBlockEntity(relay); if (relayTile instanceof TileEntityLaserRelayFluids) { TileEntityLaserRelayFluids theRelay = (TileEntityLaserRelayFluids) relayTile; if (theRelay.mode != Mode.INPUT_ONLY) { @@ -181,7 +192,7 @@ public class TileEntityLaserRelayFluids extends TileEntityLaserRelay { for (Direction facing : theRelay.handlersAround.keySet()) { if (theRelay != this || facing != from) { - TileEntity tile = theRelay.handlersAround.get(facing); + BlockEntity tile = theRelay.handlersAround.get(facing); Direction opp = facing.getOpposite(); boolean received = tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, opp).map(cap -> cap.fill(stack, IFluidHandler.FluidAction.SIMULATE) > 0).orElse(false); @@ -207,11 +218,11 @@ public class TileEntityLaserRelayFluids extends TileEntityLaserRelay { : stack.getAmount(); for (TileEntityLaserRelayFluids theRelay : relaysThatWork) { - for (Map.Entry receiver : theRelay.handlersAround.entrySet()) { + for (Map.Entry receiver : theRelay.handlersAround.entrySet()) { if (receiver != null) { Direction side = receiver.getKey(); Direction opp = side.getOpposite(); - TileEntity tile = receiver.getValue(); + BlockEntity tile = receiver.getValue(); if (!alreadyChecked.contains(tile.getBlockPos())) { alreadyChecked.add(tile.getBlockPos()); if (theRelay != this || side != from) { @@ -240,22 +251,22 @@ public class TileEntityLaserRelayFluids extends TileEntityLaserRelay { @Override @OnlyIn(Dist.CLIENT) public String getExtraDisplayString() { - return I18n.get("info." + ActuallyAdditions.MODID + ".laserRelay.fluid.extra") + ": " + TextFormatting.DARK_RED + I18n.get(this.mode.name) + TextFormatting.RESET; + return I18n.get("info." + ActuallyAdditions.MODID + ".laserRelay.fluid.extra") + ": " + ChatFormatting.DARK_RED + I18n.get(this.mode.name) + ChatFormatting.RESET; } @Override @OnlyIn(Dist.CLIENT) public String getCompassDisplayString() { - return TextFormatting.GREEN + I18n.get("info." + ActuallyAdditions.MODID + ".laserRelay.energy.display"); + return ChatFormatting.GREEN + I18n.get("info." + ActuallyAdditions.MODID + ".laserRelay.energy.display"); } @Override - public void onCompassAction(PlayerEntity player) { + public void onCompassAction(Player player) { this.mode = this.mode.getNext(); } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { @@ -264,7 +275,7 @@ public class TileEntityLaserRelayFluids extends TileEntityLaserRelay { } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItem.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItem.java index 154f2569f..53cf3f8b9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItem.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItem.java @@ -18,22 +18,28 @@ import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemInterface.GenericItemHandlerInfo; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.TextFormatting; +import net.minecraft.ChatFormatting; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +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.entity.BlockEntity; +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.LazyOptional; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; -import java.util.*; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.concurrent.ConcurrentHashMap; public class TileEntityLaserRelayItem extends TileEntityLaserRelay { @@ -41,12 +47,24 @@ public class TileEntityLaserRelayItem extends TileEntityLaserRelay { public final Map handlersAround = new ConcurrentHashMap<>(); public int priority; - public TileEntityLaserRelayItem(TileEntityType type) { - super(type, LaserType.ITEM); + public TileEntityLaserRelayItem(BlockEntityType type, BlockPos pos, BlockState state) { + super(type, pos, state, LaserType.ITEM); } - public TileEntityLaserRelayItem() { - this(ActuallyBlocks.LASER_RELAY_ITEM.getTileEntityType()); + public TileEntityLaserRelayItem(BlockPos pos, BlockState state) { + this(ActuallyBlocks.LASER_RELAY_ITEM.getTileEntityType(), pos, state); + } + + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityLaserRelayItem tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityLaserRelayItem tile) { + tile.serverTick(); + } } public int getPriority() { @@ -72,7 +90,7 @@ public class TileEntityLaserRelayItem extends TileEntityLaserRelay { Direction side = WorldUtil.getDirectionBySidesInOrder(i); BlockPos pos = this.getBlockPos().relative(side); if (this.level.hasChunkAt(pos)) { - TileEntity tile = this.level.getBlockEntity(pos); + BlockEntity tile = this.level.getBlockEntity(pos); if (tile != null && !(tile instanceof TileEntityItemInterface) && !(tile instanceof TileEntityLaserRelay)) { LazyOptional itemHandler = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side.getOpposite()); @@ -112,7 +130,7 @@ public class TileEntityLaserRelayItem extends TileEntityLaserRelay { for (BlockPos relay : pair.getPositions()) { if (relay != null && this.level.hasChunkAt(relay) && !alreadyChecked.contains(relay)) { alreadyChecked.add(relay); - TileEntity aRelayTile = this.level.getBlockEntity(relay); + BlockEntity aRelayTile = this.level.getBlockEntity(relay); if (aRelayTile instanceof TileEntityLaserRelayItem) { TileEntityLaserRelayItem relayTile = (TileEntityLaserRelayItem) aRelayTile; GenericItemHandlerInfo info = new GenericItemHandlerInfo(relayTile); @@ -133,7 +151,7 @@ public class TileEntityLaserRelayItem extends TileEntityLaserRelay { } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { compound.putInt("Priority", this.priority); @@ -143,17 +161,17 @@ public class TileEntityLaserRelayItem extends TileEntityLaserRelay { @Override @OnlyIn(Dist.CLIENT) public String getExtraDisplayString() { - return I18n.get("info." + ActuallyAdditions.MODID + ".laserRelay.item.extra") + ": " + TextFormatting.DARK_RED + this.getPriority() + TextFormatting.RESET; + return I18n.get("info." + ActuallyAdditions.MODID + ".laserRelay.item.extra") + ": " + ChatFormatting.DARK_RED + this.getPriority() + ChatFormatting.RESET; } @Override @OnlyIn(Dist.CLIENT) public String getCompassDisplayString() { - return TextFormatting.GREEN + I18n.get("info." + ActuallyAdditions.MODID + ".laserRelay.item.display.1") + "\n" + I18n.get("info." + ActuallyAdditions.MODID + ".laserRelay.item.display.2"); + return ChatFormatting.GREEN + I18n.get("info." + ActuallyAdditions.MODID + ".laserRelay.item.display.1") + "\n" + I18n.get("info." + ActuallyAdditions.MODID + ".laserRelay.item.display.2"); } @Override - public void onCompassAction(PlayerEntity player) { + public void onCompassAction(Player player) { if (player.isShiftKeyDown()) { this.priority--; } else { @@ -162,7 +180,7 @@ public class TileEntityLaserRelayItem extends TileEntityLaserRelay { } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { this.priority = compound.getInt("Priority"); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemAdvanced.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemAdvanced.java index 46c3a3f77..c0f9e9202 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemAdvanced.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemAdvanced.java @@ -18,24 +18,45 @@ import de.ellpeck.actuallyadditions.mod.items.DrillItem; import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.INamedContainerProvider; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; import javax.annotation.Nullable; -public class TileEntityLaserRelayItemAdvanced extends TileEntityLaserRelayItem implements IButtonReactor, INamedContainerProvider { +public class TileEntityLaserRelayItemAdvanced extends TileEntityLaserRelayItem implements IButtonReactor, MenuProvider { public FilterSettings leftFilter = new FilterSettings(12, true, false, false); public FilterSettings rightFilter = new FilterSettings(12, true, false, false); - public TileEntityLaserRelayItemAdvanced() { - super(ActuallyBlocks.LASER_RELAY_ITEM_ADVANCED.getTileEntityType()); + public TileEntityLaserRelayItemAdvanced(BlockPos pos, BlockState state) { + super(ActuallyBlocks.LASER_RELAY_ITEM_ADVANCED.getTileEntityType(), pos, state); + } + + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityLaserRelayItemAdvanced tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityLaserRelayItemAdvanced tile) { + tile.serverTick(); + + if ((tile.leftFilter.needsUpdateSend() || tile.rightFilter.needsUpdateSend()) && tile.sendUpdateWithInterval()) { + tile.leftFilter.updateLasts(); + tile.rightFilter.updateLasts(); + } + } } @Override @@ -51,7 +72,7 @@ public class TileEntityLaserRelayItemAdvanced extends TileEntityLaserRelayItem i } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); this.leftFilter.writeToNBT(compound, "LeftFilter"); @@ -59,7 +80,7 @@ public class TileEntityLaserRelayItemAdvanced extends TileEntityLaserRelayItem i } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); this.leftFilter.readFromNBT(compound, "LeftFilter"); @@ -67,7 +88,7 @@ public class TileEntityLaserRelayItemAdvanced extends TileEntityLaserRelayItem i } @Override - public void onButtonPressed(int buttonID, PlayerEntity player) { + public void onButtonPressed(int buttonID, Player player) { this.leftFilter.onButtonPressed(buttonID); this.rightFilter.onButtonPressed(buttonID); if (buttonID == 2) { @@ -128,25 +149,13 @@ public class TileEntityLaserRelayItemAdvanced extends TileEntityLaserRelayItem i } @Override - public void updateEntity() { - super.updateEntity(); - - if (!this.level.isClientSide) { - if ((this.leftFilter.needsUpdateSend() || this.rightFilter.needsUpdateSend()) && this.sendUpdateWithInterval()) { - this.leftFilter.updateLasts(); - this.rightFilter.updateLasts(); - } - } - } - - @Override - public ITextComponent getDisplayName() { - return StringTextComponent.EMPTY; + public Component getDisplayName() { + return TextComponent.EMPTY; } @Nullable @Override - public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) { + public AbstractContainerMenu createMenu(int windowId, Inventory playerInventory, Player player) { return new ContainerLaserRelayItemWhitelist(windowId, playerInventory, this); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java index 66238473a..fdc8227f5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java @@ -12,12 +12,14 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +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.state.BlockState; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.energy.IEnergyStorage; @@ -33,12 +35,12 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I private int currentWorkTime; private int oldEnergy; - public TileEntityLavaFactoryController() { - super(ActuallyBlocks.LAVA_FACTORY_CONTROLLER.getTileEntityType()); + public TileEntityLavaFactoryController(BlockPos pos, BlockState state) { + super(ActuallyBlocks.LAVA_FACTORY_CONTROLLER.getTileEntityType(), pos, state); } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); this.storage.writeToNBT(compound); if (type != NBTType.SAVE_BLOCK) { @@ -47,7 +49,7 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); this.storage.readFromNBT(compound); if (type != NBTType.SAVE_BLOCK) { @@ -55,23 +57,29 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I } } - @Override - public void updateEntity() { - super.updateEntity(); - if (!this.level.isClientSide) { - if (this.storage.getEnergyStored() >= ENERGY_USE && this.isMultiblock() == HAS_AIR) { - this.currentWorkTime++; - if (this.currentWorkTime >= 200) { - this.currentWorkTime = 0; - this.level.setBlock(this.worldPosition.above(), Blocks.LAVA.defaultBlockState(), 2); - this.storage.extractEnergyInternal(ENERGY_USE, false); + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityLavaFactoryController tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityLavaFactoryController tile) { + tile.serverTick(); + + if (tile.storage.getEnergyStored() >= ENERGY_USE && tile.isMultiblock() == HAS_AIR) { + tile.currentWorkTime++; + if (tile.currentWorkTime >= 200) { + tile.currentWorkTime = 0; + level.setBlock(tile.worldPosition.above(), Blocks.LAVA.defaultBlockState(), 2); + tile.storage.extractEnergyInternal(ENERGY_USE, false); } } else { - this.currentWorkTime = 0; + tile.currentWorkTime = 0; } - if (this.oldEnergy != this.storage.getEnergyStored() && this.sendUpdateWithInterval()) { - this.oldEnergy = this.storage.getEnergyStored(); + if (tile.oldEnergy != tile.storage.getEnergyStored() && tile.sendUpdateWithInterval()) { + tile.oldEnergy = tile.storage.getEnergyStored(); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java index ca28c4e4a..94987a76a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java @@ -13,13 +13,15 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; -import net.minecraft.block.LeavesBlock; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +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.LeavesBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.energy.IEnergyStorage; @@ -27,8 +29,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; - public class TileEntityLeafGenerator extends TileEntityBase implements ISharingEnergyProvider, IEnergyDisplay { public final CustomEnergyStorage storage = new CustomEnergyStorage(35000, 0, 450); @@ -36,43 +36,49 @@ public class TileEntityLeafGenerator extends TileEntityBase implements ISharingE private int nextUseCounter; private int oldEnergy; - public TileEntityLeafGenerator() { - super(ActuallyBlocks.LEAF_GENERATOR.getTileEntityType()); + public TileEntityLeafGenerator(BlockPos pos, BlockState state) { + super(ActuallyBlocks.LEAF_GENERATOR.getTileEntityType(), pos, state); } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); this.storage.writeToNBT(compound); } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); this.storage.readFromNBT(compound); } - @Override - public void updateEntity() { - super.updateEntity(); - if (!this.level.isClientSide) { - if (!this.isRedstonePowered) { + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityLeafGenerator tile) { + tile.clientTick(); + } + } - if (this.nextUseCounter >= ConfigIntValues.LEAF_GENERATOR_COOLDOWN.getValue()) { - this.nextUseCounter = 0; + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityLeafGenerator tile) { + tile.serverTick(); + + if (!tile.isRedstonePowered) { + + if (tile.nextUseCounter >= ConfigIntValues.LEAF_GENERATOR_COOLDOWN.getValue()) { + tile.nextUseCounter = 0; int energyProduced = ConfigIntValues.LEAF_GENERATOR_CF_PER_LEAF.getValue(); - if (energyProduced > 0 && energyProduced <= this.storage.getMaxEnergyStored() - this.storage.getEnergyStored()) { + if (energyProduced > 0 && energyProduced <= tile.storage.getMaxEnergyStored() - tile.storage.getEnergyStored()) { List breakPositions = new ArrayList<>(); int range = ConfigIntValues.LEAF_GENERATOR_AREA.getValue(); for (int reachX = -range; reachX < range + 1; reachX++) { for (int reachZ = -range; reachZ < range + 1; reachZ++) { for (int reachY = -range; reachY < range + 1; reachY++) { - BlockPos pos = this.worldPosition.offset(reachX, reachY, reachZ); - Block block = this.level.getBlockState(pos).getBlock(); - if (block instanceof LeavesBlock) { // TODO: [port] validate this is a good way of checking if something is a leaf - breakPositions.add(pos); + BlockPos offsetPos = pos.offset(reachX, reachY, reachZ); + Block block = level.getBlockState(offsetPos).getBlock(); + if (block instanceof LeavesBlock) { // TODO: [port] validate tile is a good way of checking if something is a leaf + breakPositions.add(offsetPos); } } } @@ -82,22 +88,22 @@ public class TileEntityLeafGenerator extends TileEntityBase implements ISharingE Collections.shuffle(breakPositions); BlockPos theCoord = breakPositions.get(0); - this.level.levelEvent(2001, theCoord, Block.getId(this.level.getBlockState(theCoord))); + level.levelEvent(2001, theCoord, Block.getId(level.getBlockState(theCoord))); - this.level.setBlockAndUpdate(theCoord, Blocks.AIR.defaultBlockState()); + level.setBlockAndUpdate(theCoord, Blocks.AIR.defaultBlockState()); - this.storage.receiveEnergyInternal(energyProduced, false); + tile.storage.receiveEnergyInternal(energyProduced, false); - AssetUtil.spawnLaserWithTimeServer(this.level, this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ(), theCoord.getX(), theCoord.getY(), theCoord.getZ(), 0x3EA34A, 25, 0, 0.075F, 0.8F); + AssetUtil.spawnLaserWithTimeServer(level, pos.getX(), pos.getY(), pos.getZ(), theCoord.getX(), theCoord.getY(), theCoord.getZ(), 0x3EA34A, 25, 0, 0.075F, 0.8F); } } } else { - this.nextUseCounter++; + tile.nextUseCounter++; } } - if (this.oldEnergy != this.storage.getEnergyStored() && this.sendUpdateWithInterval()) { - this.oldEnergy = this.storage.getEnergyStored(); + if (tile.oldEnergy != tile.storage.getEnergyStored() && tile.sendUpdateWithInterval()) { + tile.oldEnergy = tile.storage.getEnergyStored(); } } } @@ -128,7 +134,7 @@ public class TileEntityLeafGenerator extends TileEntityBase implements ISharingE } @Override - public boolean canShareTo(TileEntity tile) { + public boolean canShareTo(BlockEntity tile) { return true; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLongRangeBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLongRangeBreaker.java index ca5473437..021e5aac0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLongRangeBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLongRangeBreaker.java @@ -15,27 +15,29 @@ import de.ellpeck.actuallyadditions.mod.inventory.ContainerDirectionalBreaker; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.INamedContainerProvider; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.world.server.ServerWorld; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.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.state.BlockState; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.energy.IEnergyStorage; import javax.annotation.Nullable; import java.util.List; -public class TileEntityLongRangeBreaker extends TileEntityInventoryBase implements INamedContainerProvider { +public class TileEntityLongRangeBreaker extends TileEntityInventoryBase implements MenuProvider { public static final int RANGE = 8; public static final int ENERGY_USE = 5; @@ -44,12 +46,12 @@ public class TileEntityLongRangeBreaker extends TileEntityInventoryBase implemen private int lastEnergy; private int currentTime; - public TileEntityLongRangeBreaker() { - super(ActuallyBlocks.LONG_RANGE_BREAKER.getTileEntityType(), 9); + public TileEntityLongRangeBreaker(BlockPos pos, BlockState state) { + super(ActuallyBlocks.LONG_RANGE_BREAKER.getTileEntityType(), pos, state, 9); } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); this.storage.writeToNBT(compound); if (type != NBTType.SAVE_BLOCK) { @@ -58,7 +60,7 @@ public class TileEntityLongRangeBreaker extends TileEntityInventoryBase implemen } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); this.storage.readFromNBT(compound); if (type != NBTType.SAVE_BLOCK) { @@ -66,23 +68,29 @@ public class TileEntityLongRangeBreaker extends TileEntityInventoryBase implemen } } - @Override - public void updateEntity() { - super.updateEntity(); - if (!this.level.isClientSide) { - if (!this.isRedstonePowered && !this.isPulseMode) { - if (this.currentTime > 0) { - this.currentTime--; - if (this.currentTime <= 0) { - this.doWork(); + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityLongRangeBreaker tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityLongRangeBreaker tile) { + tile.serverTick(); + + if (!tile.isRedstonePowered && !tile.isPulseMode) { + if (tile.currentTime > 0) { + tile.currentTime--; + if (tile.currentTime <= 0) { + tile.doWork(); } } else { - this.currentTime = 15; + tile.currentTime = 15; } } - if (this.storage.getEnergyStored() != this.lastEnergy && this.sendUpdateWithInterval()) { - this.lastEnergy = this.storage.getEnergyStored(); + if (tile.storage.getEnergyStored() != tile.lastEnergy && tile.sendUpdateWithInterval()) { + tile.lastEnergy = tile.storage.getEnergyStored(); } } } @@ -97,7 +105,7 @@ public class TileEntityLongRangeBreaker extends TileEntityInventoryBase implemen BlockState breakState = this.level.getBlockState(coordsBlock); Block blockToBreak = breakState.getBlock(); if (blockToBreak != null && !this.level.isEmptyBlock(coordsBlock) && this.level.getBlockState(coordsBlock).getDestroySpeed(this.level, coordsBlock) > -1.0F) { - List drops = Block.getDrops(breakState, (ServerWorld) this.level, coordsBlock, this.level.getBlockEntity(coordsBlock)); + List drops = Block.getDrops(breakState, (ServerLevel) this.level, coordsBlock, this.level.getBlockEntity(coordsBlock)); float chance = WorldUtil.fireFakeHarvestEventsForDropChance(this, drops, this.level, coordsBlock); if (chance > 0 && this.level.random.nextFloat() <= chance) { @@ -139,13 +147,13 @@ public class TileEntityLongRangeBreaker extends TileEntityInventoryBase implemen } @Override - public ITextComponent getDisplayName() { - return StringTextComponent.EMPTY; + public Component getDisplayName() { + return TextComponent.EMPTY; } @Nullable @Override - public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity playerEntity) { + public AbstractContainerMenu createMenu(int windowId, Inventory playerInventory, Player playerEntity) { return new ContainerDirectionalBreaker(windowId, playerInventory, this); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java index 2c3884acf..14daa11a7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java @@ -15,16 +15,18 @@ import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.config.CommonConfig; import de.ellpeck.actuallyadditions.mod.crafting.LiquidFuelRecipe; import de.ellpeck.actuallyadditions.mod.inventory.ContainerOilGenerator; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.INamedContainerProvider; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.level.Level; +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.api.distmarker.OnlyIn; import net.minecraftforge.common.util.LazyOptional; @@ -37,7 +39,7 @@ import net.minecraftforge.fluids.capability.templates.FluidTank; import javax.annotation.Nonnull; import javax.annotation.Nullable; -public class TileEntityOilGenerator extends TileEntityBase implements ISharingEnergyProvider, ISharingFluidHandler, INamedContainerProvider { +public class TileEntityOilGenerator extends TileEntityBase implements ISharingEnergyProvider, ISharingFluidHandler, MenuProvider { public final CustomEnergyStorage storage = new CustomEnergyStorage(50000, 0, CommonConfig.Machines.OIL_GENERATOR_TRANSFER.get()); public final LazyOptional lazyEnergy = LazyOptional.of(() -> this.storage); public final FluidTank tank = new FluidTank(2 * FluidAttributes.BUCKET_VOLUME, fluid -> getRecipeForFluid(fluid) != null) { @@ -65,8 +67,8 @@ public class TileEntityOilGenerator extends TileEntityBase implements ISharingEn private int lastCompare; public int fuelUsage; - public TileEntityOilGenerator() { - super(ActuallyBlocks.OIL_GENERATOR.getTileEntityType()); + public TileEntityOilGenerator(BlockPos pos, BlockState state) { + super(ActuallyBlocks.OIL_GENERATOR.getTileEntityType(), pos, state); } private static LiquidFuelRecipe getRecipeForFluid(FluidStack fluid) { @@ -94,7 +96,7 @@ public class TileEntityOilGenerator extends TileEntityBase implements ISharingEn } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { if (type != NBTType.SAVE_BLOCK) { compound.putInt("BurnTime", this.currentBurnTime); compound.putInt("CurrentEnergy", this.currentEnergyProduce); @@ -107,7 +109,7 @@ public class TileEntityOilGenerator extends TileEntityBase implements ISharingEn } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { if (type != NBTType.SAVE_BLOCK) { this.currentBurnTime = compound.getInt("BurnTime"); this.currentEnergyProduce = compound.getInt("CurrentEnergy"); @@ -119,46 +121,52 @@ public class TileEntityOilGenerator extends TileEntityBase implements ISharingEn super.readSyncableNBT(compound, type); } - @Override - public void updateEntity() { - super.updateEntity(); - if (!this.level.isClientSide) { - boolean flag = this.currentBurnTime > 0; + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityOilGenerator tile) { + tile.clientTick(); + } + } - if (this.currentBurnTime > 0 && this.currentEnergyProduce > 0) { - this.currentBurnTime--; + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityOilGenerator tile) { + tile.serverTick(); - this.storage.receiveEnergyInternal(this.currentEnergyProduce, false); - } else if (!this.isRedstonePowered) { + boolean flag = tile.currentBurnTime > 0; - LiquidFuelRecipe recipe = this.getRecipeForCurrentFluid(); - if (recipe != null && this.storage.getEnergyStored() < this.storage.getMaxEnergyStored() && this.tank.getFluidAmount() >= recipe.getFuelAmount()) { - fuelUsage = recipe.getFuelAmount(); - this.currentEnergyProduce = recipe.getTotalEnergy() / recipe.getBurnTime(); - this.maxBurnTime = recipe.getBurnTime(); - this.currentBurnTime = this.maxBurnTime; + if (tile.currentBurnTime > 0 && tile.currentEnergyProduce > 0) { + tile.currentBurnTime--; - this.tank.getFluid().shrink(fuelUsage); + tile.storage.receiveEnergyInternal(tile.currentEnergyProduce, false); + } else if (!tile.isRedstonePowered) { + + LiquidFuelRecipe recipe = tile.getRecipeForCurrentFluid(); + if (recipe != null && tile.storage.getEnergyStored() < tile.storage.getMaxEnergyStored() && tile.tank.getFluidAmount() >= recipe.getFuelAmount()) { + tile.fuelUsage = recipe.getFuelAmount(); + tile.currentEnergyProduce = recipe.getTotalEnergy() / recipe.getBurnTime(); + tile.maxBurnTime = recipe.getBurnTime(); + tile.currentBurnTime = tile.maxBurnTime; + + tile.tank.getFluid().shrink(tile.fuelUsage); } else { - this.currentEnergyProduce = 0; - this.currentBurnTime = 0; - this.maxBurnTime = 0; - this.fuelUsage = 0; + tile.currentEnergyProduce = 0; + tile.currentBurnTime = 0; + tile.maxBurnTime = 0; + tile.fuelUsage = 0; } } - if (flag != this.currentBurnTime > 0 || this.lastCompare != this.getComparatorStrength()) { - this.lastCompare = this.getComparatorStrength(); + if (flag != tile.currentBurnTime > 0 || tile.lastCompare != tile.getComparatorStrength()) { + tile.lastCompare = tile.getComparatorStrength(); - this.setChanged(); + tile.setChanged(); } - if ((this.storage.getEnergyStored() != this.lastEnergy || this.tank.getFluidAmount() != this.lastTank || this.lastBurnTime != this.currentBurnTime || this.lastEnergyProduce != this.currentEnergyProduce || this.lastMaxBurnTime != this.maxBurnTime) && this.sendUpdateWithInterval()) { - this.lastEnergy = this.storage.getEnergyStored(); - this.lastTank = this.tank.getFluidAmount(); - this.lastBurnTime = this.currentBurnTime; - this.lastEnergyProduce = this.currentEnergyProduce; - this.lastMaxBurnTime = this.maxBurnTime; + if ((tile.storage.getEnergyStored() != tile.lastEnergy || tile.tank.getFluidAmount() != tile.lastTank || tile.lastBurnTime != tile.currentBurnTime || tile.lastEnergyProduce != tile.currentEnergyProduce || tile.lastMaxBurnTime != tile.maxBurnTime) && tile.sendUpdateWithInterval()) { + tile.lastEnergy = tile.storage.getEnergyStored(); + tile.lastTank = tile.tank.getFluidAmount(); + tile.lastBurnTime = tile.currentBurnTime; + tile.lastEnergyProduce = tile.currentEnergyProduce; + tile.lastMaxBurnTime = tile.maxBurnTime; } } } @@ -205,7 +213,7 @@ public class TileEntityOilGenerator extends TileEntityBase implements ISharingEn } @Override - public boolean canShareTo(TileEntity tile) { + public boolean canShareTo(BlockEntity tile) { return true; } @@ -215,13 +223,13 @@ public class TileEntityOilGenerator extends TileEntityBase implements ISharingEn } @Override - public ITextComponent getDisplayName() { - return new TranslationTextComponent("container.actuallyadditions.oilGenerator"); + public Component getDisplayName() { + return new TranslatableComponent("container.actuallyadditions.oilGenerator"); } @Nullable @Override - public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) { + public AbstractContainerMenu createMenu(int windowId, Inventory playerInventory, Player player) { return new ContainerOilGenerator(windowId, playerInventory, this); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomBooster.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomBooster.java index 1d04a13f6..6f1f2deb1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomBooster.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomBooster.java @@ -11,10 +11,26 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; public class TileEntityPhantomBooster extends TileEntityBase { - public TileEntityPhantomBooster() { - super(ActuallyBlocks.PHANTOM_BOOSTER.getTileEntityType()); + public TileEntityPhantomBooster(BlockPos pos, BlockState state) { + super(ActuallyBlocks.PHANTOM_BOOSTER.getTileEntityType(), pos, state); + } + + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityPhantomBooster tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityPhantomBooster tile) { + tile.serverTick(); + } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomBreaker.java index cf8d5a2da..a6ef3d5f8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomBreaker.java @@ -14,14 +14,30 @@ import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; public class TileEntityPhantomBreaker extends TileEntityPhantomPlacer { - public TileEntityPhantomBreaker() { - super(ActuallyBlocks.PHANTOM_BREAKER.getTileEntityType(), 9); + public TileEntityPhantomBreaker(BlockPos pos, BlockState state) { + super(ActuallyBlocks.PHANTOM_BREAKER.getTileEntityType(), pos, state, 9); this.isBreaker = true; } + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityPhantomBreaker tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityPhantomBreaker tile) { + tile.serverTick(); + } + } + @Override public IAcceptor getAcceptor() { return (slot, stack, automation) -> !automation; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomEnergyface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomEnergyface.java index b2f891491..ea1cf69ab 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomEnergyface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomEnergyface.java @@ -12,22 +12,37 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.blocks.BlockPhantom; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.energy.CapabilityEnergy; public class TileEntityPhantomEnergyface extends TileEntityPhantomface implements ISharingEnergyProvider { - public TileEntityPhantomEnergyface() { - super(ActuallyBlocks.PHANTOM_ENERGYFACE.getTileEntityType()); + public TileEntityPhantomEnergyface(BlockPos pos, BlockState state) { + super(ActuallyBlocks.PHANTOM_ENERGYFACE.getTileEntityType(), pos, state); this.type = BlockPhantom.Type.ENERGYFACE; } + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityPhantomEnergyface tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityPhantomEnergyface tile) { + tile.serverTick(); + } + } + @Override public boolean isBoundThingInRange() { if (super.isBoundThingInRange()) { - TileEntity tile = this.level.getBlockEntity(this.boundPosition); + BlockEntity tile = this.level.getBlockEntity(this.boundPosition); if (tile != null && !(tile instanceof TileEntityLaserRelayEnergy)) { for (Direction facing : Direction.values()) { if (tile.getCapability(CapabilityEnergy.ENERGY, facing).isPresent()) { @@ -60,7 +75,7 @@ public class TileEntityPhantomEnergyface extends TileEntityPhantomface implement } @Override - public boolean canShareTo(TileEntity tile) { + public boolean canShareTo(BlockEntity tile) { return true; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomItemface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomItemface.java index 3d9d5a579..38ffdf134 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomItemface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomItemface.java @@ -14,18 +14,33 @@ import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.blocks.BlockPhantom; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.items.CapabilityItemHandler; public class TileEntityPhantomItemface extends TileEntityPhantomface { - public TileEntityPhantomItemface() { - super(ActuallyBlocks.PHANTOM_ITEMFACE.getTileEntityType()); + public TileEntityPhantomItemface(BlockPos pos, BlockState state) { + super(ActuallyBlocks.PHANTOM_ITEMFACE.getTileEntityType(), pos, state); this.type = BlockPhantom.Type.ITEMFACE; } + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityPhantomItemface tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityPhantomItemface tile) { + tile.serverTick(); + } + } + @Override public IAcceptor getAcceptor() { return (slot, stack, automation) -> !automation || this.isBoundThingInRange(); @@ -34,7 +49,7 @@ public class TileEntityPhantomItemface extends TileEntityPhantomface { @Override public boolean isBoundThingInRange() { if (super.isBoundThingInRange()) { - TileEntity tile = this.level.getBlockEntity(this.getBoundPosition()); + BlockEntity tile = this.level.getBlockEntity(this.getBoundPosition()); if (tile != null) { for (Direction facing : Direction.values()) { if (tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing).isPresent()) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomLiquiface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomLiquiface.java index 1b445406c..27bf1587c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomLiquiface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomLiquiface.java @@ -12,22 +12,37 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.blocks.BlockPhantom; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; public class TileEntityPhantomLiquiface extends TileEntityPhantomface implements ISharingFluidHandler { - public TileEntityPhantomLiquiface() { - super(ActuallyBlocks.PHANTOM_LIQUIFACE.getTileEntityType()); + public TileEntityPhantomLiquiface(BlockPos pos, BlockState state) { + super(ActuallyBlocks.PHANTOM_LIQUIFACE.getTileEntityType(), pos, state); this.type = BlockPhantom.Type.LIQUIFACE; } + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityPhantomLiquiface tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityPhantomLiquiface tile) { + tile.serverTick(); + } + } + @Override public boolean isBoundThingInRange() { if (super.isBoundThingInRange()) { - TileEntity tile = this.level.getBlockEntity(this.boundPosition); + BlockEntity tile = this.level.getBlockEntity(this.boundPosition); if (tile != null && !(tile instanceof TileEntityLaserRelayFluids)) { for (Direction facing : Direction.values()) { if (tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, facing).isPresent()) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java index 53881fe5f..c075857ec 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java @@ -19,26 +19,29 @@ import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.INamedContainerProvider; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.particles.ParticleTypes; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.world.server.ServerWorld; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.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 javax.annotation.Nullable; import java.util.List; -public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements IPhantomTile, IButtonReactor, INamedContainerProvider { +public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements IPhantomTile, IButtonReactor, MenuProvider { public static final int RANGE = 3; public BlockPos boundPosition; @@ -48,17 +51,17 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements public int side; private int oldRange; - public TileEntityPhantomPlacer(TileEntityType type, int slots) { - super(type, slots); + public TileEntityPhantomPlacer(BlockEntityType type, BlockPos pos, BlockState state, int slots) { + super(type, pos, state, slots); } - public TileEntityPhantomPlacer() { - super(ActuallyBlocks.PHANTOM_PLACER.getTileEntityType(), 9); + public TileEntityPhantomPlacer(BlockPos pos, BlockState state) { + super(ActuallyBlocks.PHANTOM_PLACER.getTileEntityType(), pos, state, 9); this.isBreaker = false; } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { compound.putInt("Range", this.range); @@ -74,7 +77,7 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { int x = compound.getInt("xOfTileStored"); @@ -91,37 +94,43 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements } } - @Override - public void updateEntity() { - super.updateEntity(); - if (!this.level.isClientSide) { - this.range = TileEntityPhantomface.upgradeRange(RANGE, this.level, this.worldPosition); + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityPhantomPlacer tile) { + tile.clientTick(); - if (!this.hasBoundPosition()) { - this.boundPosition = null; + if (tile.boundPosition != null) { + tile.renderParticles(); + } + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityPhantomPlacer tile) { + tile.serverTick(); + + tile.range = TileEntityPhantomface.upgradeRange(RANGE, tile.level, tile.worldPosition); + + if (!tile.hasBoundPosition()) { + tile.boundPosition = null; } - if (this.isBoundThingInRange()) { - if (!this.isRedstonePowered && !this.isPulseMode) { - if (this.currentTime > 0) { - this.currentTime--; - if (this.currentTime <= 0) { - this.doWork(); + if (tile.isBoundThingInRange()) { + if (!tile.isRedstonePowered && !tile.isPulseMode) { + if (tile.currentTime > 0) { + tile.currentTime--; + if (tile.currentTime <= 0) { + tile.doWork(); } } else { - this.currentTime = 30; + tile.currentTime = 30; } } } - if (this.oldRange != this.range) { - this.oldRange = this.range; + if (tile.oldRange != tile.range) { + tile.oldRange = tile.range; - this.sendUpdate(); - } - } else { - if (this.boundPosition != null) { - this.renderParticles(); + tile.sendUpdate(); } } } @@ -144,7 +153,7 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements if (this.isBreaker) { Block blockToBreak = this.level.getBlockState(this.boundPosition).getBlock(); if (blockToBreak != null && this.level.getBlockState(this.boundPosition).getDestroySpeed(this.level, this.boundPosition) > -1.0F) { - List drops = Block.getDrops(this.level.getBlockState(this.boundPosition), (ServerWorld) this.level, this.worldPosition, this.level.getBlockEntity(this.worldPosition)); + List drops = Block.getDrops(this.level.getBlockState(this.boundPosition), (ServerLevel) this.level, this.worldPosition, this.level.getBlockEntity(this.worldPosition)); if (StackUtil.canAddAll(this.inv, drops, false)) { this.level.levelEvent(2001, this.boundPosition, Block.getId(this.level.getBlockState(this.boundPosition))); @@ -218,7 +227,7 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements } @Override - public void onButtonPressed(int buttonID, PlayerEntity player) { + public void onButtonPressed(int buttonID, Player player) { if (this.side + 1 >= Direction.values().length) { this.side = 0; } else { @@ -229,13 +238,13 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements } @Override - public ITextComponent getDisplayName() { - return StringTextComponent.EMPTY; + public Component getDisplayName() { + return TextComponent.EMPTY; } @Nullable @Override - public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) { + public AbstractContainerMenu createMenu(int windowId, Inventory playerInventory, Player player) { return new ContainerPhantomPlacer(windowId, playerInventory, this); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomRedstoneface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomRedstoneface.java index 4f6bff578..d266e0b13 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomRedstoneface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomRedstoneface.java @@ -11,9 +11,12 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.util.Direction; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +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.state.BlockState; import net.minecraftforge.common.capabilities.Capability; import java.util.Arrays; @@ -26,29 +29,34 @@ public class TileEntityPhantomRedstoneface extends TileEntityPhantomface { private final int[] lastProvidesStrong = new int[this.providesStrong.length]; private final int[] lastProvidesWeak = new int[this.providesWeak.length]; - public TileEntityPhantomRedstoneface() { - super(ActuallyBlocks.PHANTOM_REDSTONEFACE.getTileEntityType()); + public TileEntityPhantomRedstoneface(BlockPos pos, BlockState state) { + super(ActuallyBlocks.PHANTOM_REDSTONEFACE.getTileEntityType(), pos, state); } - @Override - public void updateEntity() { - if (!this.level.isClientSide) { - if (this.isBoundThingInRange()) { - BlockState boundState = this.level.getBlockState(this.boundPosition); + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityPhantomRedstoneface tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityPhantomRedstoneface tile) { + tile.serverTick(); + + if (tile.isBoundThingInRange()) { + BlockState boundState = tile.level.getBlockState(tile.boundPosition); if (boundState != null) { Block boundBlock = boundState.getBlock(); if (boundBlock != null) { for (int i = 0; i < Direction.values().length; i++) { Direction facing = Direction.values()[i]; - this.providesWeak[i] = boundState.getSignal(this.level, this.boundPosition, facing); - this.providesStrong[i] = boundState.getDirectSignal(this.level, this.boundPosition, facing); + tile.providesWeak[i] = boundState.getSignal(tile.level, tile.boundPosition, facing); + tile.providesStrong[i] = boundState.getDirectSignal(tile.level, tile.boundPosition, facing); } } } } } - - super.updateEntity(); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java index c3dc2cfa0..ee832905f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java @@ -13,15 +13,15 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.api.tile.IPhantomTile; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.blocks.BlockPhantom; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.particles.ParticleTypes; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.nbt.CompoundTag; +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.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.capabilities.Capability; @@ -40,12 +40,12 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl private Block boundBlockBefore; private int lastStrength; - public TileEntityPhantomface(TileEntityType type) { - super(type, 0); + public TileEntityPhantomface(BlockEntityType type, BlockPos pos, BlockState state) { + super(type, pos, state, 0); } - public static int upgradeRange(int defaultRange, World world, BlockPos pos) { + public static int upgradeRange(int defaultRange, Level world, BlockPos pos) { int newRange = defaultRange; for (int i = 0; i < 3; i++) { Block block = world.getBlockState(pos.above(1 + i)).getBlock(); @@ -59,7 +59,7 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { compound.putInt("Range", this.range); @@ -72,7 +72,7 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { int x = compound.getInt("xOfTileStored"); @@ -87,29 +87,31 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl } @Override - public void updateEntity() { - super.updateEntity(); - if (!this.level.isClientSide) { - this.range = upgradeRange(RANGE, this.level, this.getBlockPos()); + protected void serverTick() { + super.serverTick(); + this.range = upgradeRange(RANGE, this.level, this.getBlockPos()); - if (!this.hasBoundPosition()) { - this.boundPosition = null; - } + if (!this.hasBoundPosition()) { + this.boundPosition = null; + } - if (this.doesNeedUpdateSend()) { - this.onUpdateSent(); - } + if (this.doesNeedUpdateSend()) { + this.onUpdateSent(); + } - int strength = this.getComparatorStrength(); - if (this.lastStrength != strength) { - this.lastStrength = strength; + int strength = this.getComparatorStrength(); + if (this.lastStrength != strength) { + this.lastStrength = strength; - this.setChanged(); - } - } else { - if (this.boundPosition != null) { - this.renderParticles(); - } + this.setChanged(); + } + } + + @Override + protected void clientTick() { + super.clientTick(); + if (this.boundPosition != null) { + this.renderParticles(); } } @@ -190,7 +192,7 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl @Override public LazyOptional getCapability(@Nonnull Capability capability, @Nullable Direction side) { if (this.isBoundThingInRange() && this.isCapabilitySupported(capability)) { - TileEntity tile = this.level.getBlockEntity(this.getBoundPosition()); + BlockEntity tile = this.level.getBlockEntity(this.getBoundPosition()); if (tile != null) { return tile.getCapability(capability, side); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPlacer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPlacer.java index 982fd1cea..07ba0b4b3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPlacer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPlacer.java @@ -13,17 +13,32 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; public class TileEntityPlacer extends TileEntityBreaker { - public TileEntityPlacer() { - super(ActuallyBlocks.PLACER.getTileEntityType(), 9); - this.isPlacer = true; - } + public TileEntityPlacer(BlockPos pos, BlockState state) { + super(ActuallyBlocks.PLACER.getTileEntityType(), pos, state, 9); + this.isPlacer = true; + } - @Override - public IAcceptor getAcceptor() { - return ItemStackHandlerAA.ACCEPT_TRUE; - } + @Override + public IAcceptor getAcceptor() { + return ItemStackHandlerAA.ACCEPT_TRUE; + } + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityPlacer tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityPlacer tile) { + tile.serverTick(); + } + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPlayerInterface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPlayerInterface.java index 4492b9bea..08e3392bf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPlayerInterface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPlayerInterface.java @@ -12,10 +12,14 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.Direction; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +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.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.energy.IEnergyStorage; @@ -24,8 +28,6 @@ import net.minecraftforge.items.wrapper.PlayerInvWrapper; import java.util.UUID; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; - public class TileEntityPlayerInterface extends TileEntityBase implements IEnergyDisplay { public static final int DEFAULT_RANGE = 32; @@ -34,17 +36,17 @@ public class TileEntityPlayerInterface extends TileEntityBase implements IEnergy public UUID connectedPlayer; public String playerName; private IItemHandler playerHandler; - private PlayerEntity oldPlayer; + private Player oldPlayer; private int oldEnergy; private int range; - public TileEntityPlayerInterface() { - super(ActuallyBlocks.PLAYER_INTERFACE.getTileEntityType()); + public TileEntityPlayerInterface(BlockPos pos, BlockState state) { + super(ActuallyBlocks.PLAYER_INTERFACE.getTileEntityType(), pos, state); } - private PlayerEntity getPlayer() { + private Player getPlayer() { if (this.connectedPlayer != null && this.level != null) { - PlayerEntity player = this.level.getPlayerByUUID(this.connectedPlayer); + Player player = this.level.getPlayerByUUID(this.connectedPlayer); if (player != null) { if (player.distanceToSqr(this.worldPosition.getX(), this.worldPosition.getY(), this.worldPosition.getZ()) <= this.range) { return player; @@ -57,37 +59,43 @@ public class TileEntityPlayerInterface extends TileEntityBase implements IEnergy // TODO: [port] this might not be a stable way of doing this. @Override public LazyOptional getItemHandler(Direction facing) { - PlayerEntity player = this.getPlayer(); + Player player = this.getPlayer(); if (this.oldPlayer != player) { this.oldPlayer = player; this.playerHandler = player == null ? null - : new PlayerInvWrapper(player.inventory); + : new PlayerInvWrapper(player.getInventory()); } return LazyOptional.of(() -> this.playerHandler); } - @Override - public void updateEntity() { - super.updateEntity(); - if (!this.level.isClientSide) { + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityPlayerInterface tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityPlayerInterface tile) { + tile.serverTick(); + boolean changed = false; - this.range = TileEntityPhantomface.upgradeRange(DEFAULT_RANGE, this.level, this.worldPosition); + tile.range = TileEntityPhantomface.upgradeRange(DEFAULT_RANGE, level, pos); - PlayerEntity player = this.getPlayer(); + Player player = tile.getPlayer(); if (player != null) { - for (int i = 0; i < player.inventory.getContainerSize(); i++) { - if (this.storage.getEnergyStored() > 0) { - ItemStack slot = player.inventory.getItem(i); + for (int i = 0; i < player.getInventory().getContainerSize(); i++) { + if (tile.storage.getEnergyStored() > 0) { + ItemStack slot = player.getInventory().getItem(i); if (StackUtil.isValid(slot) && slot.getCount() == 1) { - int received = slot.getCapability(CapabilityEnergy.ENERGY).map(cap -> cap.receiveEnergy(this.storage.getEnergyStored(), false)).orElse(0); + int received = slot.getCapability(CapabilityEnergy.ENERGY).map(cap -> cap.receiveEnergy(tile.storage.getEnergyStored(), false)).orElse(0); if (received > 0) { - this.storage.extractEnergyInternal(received, false); + tile.storage.extractEnergyInternal(received, false); } } } else { @@ -97,18 +105,18 @@ public class TileEntityPlayerInterface extends TileEntityBase implements IEnergy } if (changed) { - this.setChanged(); - this.sendUpdate(); + tile.setChanged(); + tile.sendUpdate(); } - if (this.storage.getEnergyStored() != this.oldEnergy && this.sendUpdateWithInterval()) { - this.oldEnergy = this.storage.getEnergyStored(); + if (tile.storage.getEnergyStored() != tile.oldEnergy && tile.sendUpdateWithInterval()) { + tile.oldEnergy = tile.storage.getEnergyStored(); } } } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); this.storage.writeToNBT(compound); @@ -119,7 +127,7 @@ public class TileEntityPlayerInterface extends TileEntityBase implements IEnergy } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); this.storage.readFromNBT(compound); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPoweredFurnace.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPoweredFurnace.java index 7aad62cc9..e50bd7295 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPoweredFurnace.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPoweredFurnace.java @@ -10,7 +10,6 @@ package de.ellpeck.actuallyadditions.mod.tile; -import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.crafting.SingleItem; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFurnaceDouble; @@ -19,23 +18,24 @@ import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; -import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.INamedContainerProvider; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.AbstractCookingRecipe; -import net.minecraft.item.crafting.FurnaceRecipe; -import net.minecraft.item.crafting.IRecipeType; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.util.Direction; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TranslationTextComponent; -import net.minecraftforge.common.util.Constants; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.AbstractCookingRecipe; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.item.crafting.SmeltingRecipe; +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.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.energy.IEnergyStorage; @@ -43,7 +43,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.Optional; -public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements IButtonReactor, INamedContainerProvider { +public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements IButtonReactor, MenuProvider { public static final int SLOT_INPUT_1 = 0; public static final int SLOT_OUTPUT_1 = 1; @@ -62,8 +62,8 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements private boolean lastAutoSplit; private boolean lastSmelted; - public TileEntityPoweredFurnace() { - super(ActuallyBlocks.POWERED_FURNACE.getTileEntityType(), 4); + public TileEntityPoweredFurnace(BlockPos pos, BlockState state) { + super(ActuallyBlocks.POWERED_FURNACE.getTileEntityType(), pos, state, 4); } public static void autoSplit(ItemStackHandlerAA inv, int slot1, int slot2) { @@ -95,7 +95,7 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { compound.putInt("FirstSmeltTime", this.firstSmeltTime); @@ -106,7 +106,7 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { this.firstSmeltTime = compound.getInt("FirstSmeltTime"); @@ -116,72 +116,77 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements this.storage.readFromNBT(compound); } - @Override - public void updateEntity() { - super.updateEntity(); - if (!this.level.isClientSide) { - if (this.isAutoSplit) { - autoSplit(this.inv, SLOT_INPUT_1, SLOT_INPUT_2); + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityPoweredFurnace tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityPoweredFurnace tile) { + tile.serverTick(); + + if (tile.isAutoSplit) { + autoSplit(tile.inv, SLOT_INPUT_1, SLOT_INPUT_2); } - //TODO all this logic needs redone someday + //TODO all tile logic needs redone someday boolean smelted = false; - boolean canSmeltOnFirst = this.canSmeltOn(SLOT_INPUT_1, SLOT_OUTPUT_1); - boolean canSmeltOnSecond = this.canSmeltOn(SLOT_INPUT_2, SLOT_OUTPUT_2); + boolean canSmeltOnFirst = tile.canSmeltOn(SLOT_INPUT_1, SLOT_OUTPUT_1); + boolean canSmeltOnSecond = tile.canSmeltOn(SLOT_INPUT_2, SLOT_OUTPUT_2); if (canSmeltOnFirst) { - if (this.storage.getEnergyStored() >= ENERGY_USE) { - this.firstSmeltTime++; - if (this.firstSmeltTime >= SMELT_TIME) { - this.finishBurning(SLOT_INPUT_1, SLOT_OUTPUT_1); - this.firstSmeltTime = 0; + if (tile.storage.getEnergyStored() >= ENERGY_USE) { + tile.firstSmeltTime++; + if (tile.firstSmeltTime >= SMELT_TIME) { + tile.finishBurning(SLOT_INPUT_1, SLOT_OUTPUT_1); + tile.firstSmeltTime = 0; } - this.storage.extractEnergyInternal(ENERGY_USE, false); + tile.storage.extractEnergyInternal(ENERGY_USE, false); } smelted = true; } else { - this.firstSmeltTime = 0; + tile.firstSmeltTime = 0; } if (canSmeltOnSecond) { - if (this.storage.getEnergyStored() >= ENERGY_USE) { - this.secondSmeltTime++; - if (this.secondSmeltTime >= SMELT_TIME) { - this.finishBurning(SLOT_INPUT_2, SLOT_OUTPUT_2); - this.secondSmeltTime = 0; + if (tile.storage.getEnergyStored() >= ENERGY_USE) { + tile.secondSmeltTime++; + if (tile.secondSmeltTime >= SMELT_TIME) { + tile.finishBurning(SLOT_INPUT_2, SLOT_OUTPUT_2); + tile.secondSmeltTime = 0; } - this.storage.extractEnergyInternal(ENERGY_USE, false); + tile.storage.extractEnergyInternal(ENERGY_USE, false); } smelted = true; } else { - this.secondSmeltTime = 0; + tile.secondSmeltTime = 0; } - BlockState currState = this.level.getBlockState(this.getBlockPos()); - boolean current = currState.getValue(BlockStateProperties.LIT); + boolean current = state.getValue(BlockStateProperties.LIT); boolean changeTo = current; - if (this.lastSmelted != smelted) { + if (tile.lastSmelted != smelted) { changeTo = smelted; } - if (this.isRedstonePowered) { + if (tile.isRedstonePowered) { changeTo = true; } - if (!smelted && !this.isRedstonePowered) { + if (!smelted && !tile.isRedstonePowered) { changeTo = false; } if (changeTo != current) { - this.level.setBlock(this.worldPosition, currState.setValue(BlockStateProperties.LIT, changeTo), Constants.BlockFlags.DEFAULT); + tile.level.setBlock(tile.worldPosition, state.setValue(BlockStateProperties.LIT, changeTo), Block.UPDATE_ALL); } - this.lastSmelted = smelted; + tile.lastSmelted = smelted; - if ((this.lastEnergy != this.storage.getEnergyStored() || this.lastFirstSmelt != this.firstSmeltTime || this.lastSecondSmelt != this.secondSmeltTime || this.isAutoSplit != this.lastAutoSplit) && this.sendUpdateWithInterval()) { - this.lastEnergy = this.storage.getEnergyStored(); - this.lastFirstSmelt = this.firstSmeltTime; - this.lastAutoSplit = this.isAutoSplit; - this.lastSecondSmelt = this.secondSmeltTime; + if ((tile.lastEnergy != tile.storage.getEnergyStored() || tile.lastFirstSmelt != tile.firstSmeltTime || tile.lastSecondSmelt != tile.secondSmeltTime || tile.isAutoSplit != tile.lastAutoSplit) && tile.sendUpdateWithInterval()) { + tile.lastEnergy = tile.storage.getEnergyStored(); + tile.lastFirstSmelt = tile.firstSmeltTime; + tile.lastAutoSplit = tile.isAutoSplit; + tile.lastSecondSmelt = tile.secondSmeltTime; } } } @@ -191,11 +196,11 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements } public Optional getOutputForInput(ItemStack stack) { - return level.getServer().getRecipeManager().getRecipeFor(IRecipeType.SMELTING, new SingleItem(stack), level).map(AbstractCookingRecipe::getResultItem); + return level.getServer().getRecipeManager().getRecipeFor(RecipeType.SMELTING, new SingleItem(stack), level).map(AbstractCookingRecipe::getResultItem); } - public Optional getRecipeForInput(ItemStack stack) { - return level.getServer().getRecipeManager().getRecipeFor(IRecipeType.SMELTING, new SingleItem(stack), level); + public Optional getRecipeForInput(ItemStack stack) { + return level.getServer().getRecipeManager().getRecipeFor(RecipeType.SMELTING, new SingleItem(stack), level); } @Override @@ -212,7 +217,7 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements ItemStack input = this.inv.getStackInSlot(theInput); ItemStack output = this.inv.getStackInSlot(theOutput); if (!input.isEmpty()) { - Optional recipe = getRecipeForInput(input); + Optional recipe = getRecipeForInput(input); return recipe.map($ -> output.isEmpty() || output.sameItem($.getResultItem()) && output.getCount() <= output.getMaxStackSize() - $.getResultItem().getCount()).orElse(false); } return false; @@ -238,7 +243,7 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements } @Override - public void onButtonPressed(int buttonID, PlayerEntity player) { + public void onButtonPressed(int buttonID, Player player) { if (buttonID == 0) { this.isAutoSplit = !this.isAutoSplit; this.setChanged(); @@ -252,13 +257,13 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements @Nonnull @Override - public ITextComponent getDisplayName() { - return new TranslationTextComponent("container.actuallyadditions.powered_furnace"); + public Component getDisplayName() { + return new TranslatableComponent("container.actuallyadditions.powered_furnace"); } @Nullable @Override - public Container createMenu(int windowId, @Nonnull PlayerInventory playerInventory, @Nonnull PlayerEntity player) { + public AbstractContainerMenu createMenu(int windowId, @Nonnull Inventory playerInventory, @Nonnull Player player) { return new ContainerFurnaceDouble(windowId, playerInventory, this); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java index 49c269c5c..022979ba5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java @@ -15,41 +15,45 @@ import de.ellpeck.actuallyadditions.mod.inventory.ContainerRangedCollector; import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.INamedContainerProvider; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.particles.ParticleTypes; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.world.server.ServerWorld; +import net.minecraft.core.BlockPos; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.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 javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; -public class TileEntityRangedCollector extends TileEntityInventoryBase implements IButtonReactor, INamedContainerProvider { +public class TileEntityRangedCollector extends TileEntityInventoryBase implements IButtonReactor, MenuProvider { public static final int RANGE = 6; public FilterSettings filter = new FilterSettings(12, true, false, false); - public TileEntityRangedCollector() { - super(ActuallyBlocks.RANGED_COLLECTOR.getTileEntityType(), 6); + public TileEntityRangedCollector(BlockPos pos, BlockState state) { + super(ActuallyBlocks.RANGED_COLLECTOR.getTileEntityType(), pos, state, 6); } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); this.filter.writeToNBT(compound, "Filter"); } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); this.filter.readFromNBT(compound, "Filter"); @@ -62,7 +66,7 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement @Override public void activateOnPulse() { - List items = this.level.getEntitiesOfClass(ItemEntity.class, new AxisAlignedBB(this.worldPosition.getX() - RANGE, this.worldPosition.getY() - RANGE, this.worldPosition.getZ() - RANGE, this.worldPosition.getX() + RANGE, this.worldPosition.getY() + RANGE, this.worldPosition.getZ() + RANGE)); + List items = this.level.getEntitiesOfClass(ItemEntity.class, new AABB(this.worldPosition.getX() - RANGE, this.worldPosition.getY() - RANGE, this.worldPosition.getZ() - RANGE, this.worldPosition.getX() + RANGE, this.worldPosition.getY() + RANGE, this.worldPosition.getZ() + RANGE)); if (!items.isEmpty()) { for (ItemEntity item : items) { if (item.isAlive() && !item.hasPickUpDelay() && !item.getItem().isEmpty()) { @@ -72,8 +76,8 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement checkList.add(toAdd); if (StackUtil.canAddAll(this.inv, checkList, false)) { StackUtil.addAll(this.inv, checkList, false); - ((ServerWorld) this.level).sendParticles(ParticleTypes.CLOUD, item.getX(), item.getY() + 0.45F, item.getZ(), 5, 0, 0, 0, 0.03D); - item.remove(); + ((ServerLevel) this.level).sendParticles(ParticleTypes.CLOUD, item.getX(), item.getY() + 0.45F, item.getZ(), 5, 0, 0, 0, 0.03D); + item.discard(); } } } @@ -81,16 +85,22 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement } } - @Override - public void updateEntity() { - super.updateEntity(); - if (!this.level.isClientSide) { - if (!this.isRedstonePowered && !this.isPulseMode) { - this.activateOnPulse(); + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityRangedCollector tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityRangedCollector tile) { + tile.serverTick(); + + if (!tile.isRedstonePowered && !tile.isPulseMode) { + tile.activateOnPulse(); } - if (this.filter.needsUpdateSend() && this.sendUpdateWithInterval()) { - this.filter.updateLasts(); + if (tile.filter.needsUpdateSend() && tile.sendUpdateWithInterval()) { + tile.filter.updateLasts(); } } } @@ -101,18 +111,18 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement } @Override - public void onButtonPressed(int buttonID, PlayerEntity player) { + public void onButtonPressed(int buttonID, Player player) { //this.filter.onButtonPressed(buttonID); } //TODO @Override - public ITextComponent getDisplayName() { - return StringTextComponent.EMPTY; + public Component getDisplayName() { + return TextComponent.EMPTY; } @Nullable @Override - public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) { + public AbstractContainerMenu createMenu(int windowId, Inventory playerInventory, Player player) { return new ContainerRangedCollector(windowId, playerInventory, this); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityShockSuppressor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityShockSuppressor.java index a8ab3239b..274a037a5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityShockSuppressor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityShockSuppressor.java @@ -11,8 +11,12 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.Direction; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.energy.IEnergyStorage; @@ -30,8 +34,8 @@ public class TileEntityShockSuppressor extends TileEntityBase implements IEnergy public final LazyOptional lazyEnergy = LazyOptional.of(() -> this.storage); private int oldEnergy; - public TileEntityShockSuppressor() { - super(ActuallyBlocks.SHOCK_SUPPRESSOR.getTileEntityType()); + public TileEntityShockSuppressor(BlockPos pos, BlockState state) { + super(ActuallyBlocks.SHOCK_SUPPRESSOR.getTileEntityType(), pos, state); } @Override @@ -52,30 +56,34 @@ public class TileEntityShockSuppressor extends TileEntityBase implements IEnergy } } + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityShockSuppressor tile) { + tile.clientTick(); + } + } - @Override - public void updateEntity() { - super.updateEntity(); + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityShockSuppressor tile) { + tile.serverTick(); - if (!this.level.isClientSide) { - if (!this.isRemoved() && !SUPPRESSORS.contains(this)) { - SUPPRESSORS.add(this); + if (!tile.isRemoved() && !SUPPRESSORS.contains(tile)) { + SUPPRESSORS.add(tile); } - if (this.oldEnergy != this.storage.getEnergyStored() && this.sendUpdateWithInterval()) { - this.oldEnergy = this.storage.getEnergyStored(); + if (tile.oldEnergy != tile.storage.getEnergyStored() && tile.sendUpdateWithInterval()) { + tile.oldEnergy = tile.storage.getEnergyStored(); } } } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); this.storage.writeToNBT(compound); } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); this.storage.readFromNBT(compound); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityVerticalDigger.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityVerticalDigger.java index 29e1678a7..ec4c3f0d2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityVerticalDigger.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityVerticalDigger.java @@ -19,22 +19,26 @@ import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.INamedContainerProvider; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.world.server.ServerWorld; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Tiers; +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.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.Vec3; +import net.minecraftforge.common.TierSortingRegistry; import net.minecraftforge.common.util.FakePlayerFactory; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.energy.IEnergyStorage; @@ -43,7 +47,7 @@ import net.minecraftforge.fluids.IFluidBlock; import javax.annotation.Nullable; import java.util.List; -public class TileEntityVerticalDigger extends TileEntityInventoryBase implements IButtonReactor, IEnergyDisplay, INamedContainerProvider { +public class TileEntityVerticalDigger extends TileEntityInventoryBase implements IButtonReactor, IEnergyDisplay, MenuProvider { public static final int ENERGY_USE_PER_BLOCK = 650; public static final int DEFAULT_RANGE = 2; @@ -58,12 +62,12 @@ public class TileEntityVerticalDigger extends TileEntityInventoryBase implements private int oldCheckY; private int oldCheckZ; - public TileEntityVerticalDigger() { - super(ActuallyBlocks.VERTICAL_DIGGER.getTileEntityType(), 9); + public TileEntityVerticalDigger(BlockPos pos, BlockState state) { + super(ActuallyBlocks.VERTICAL_DIGGER.getTileEntityType(), pos, state, 9); } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); this.storage.writeToNBT(compound); if (type != NBTType.SAVE_BLOCK) { @@ -77,7 +81,7 @@ public class TileEntityVerticalDigger extends TileEntityInventoryBase implements } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); this.storage.readFromNBT(compound); if (type != NBTType.SAVE_BLOCK) { @@ -88,29 +92,34 @@ public class TileEntityVerticalDigger extends TileEntityInventoryBase implements this.onlyMineOres = compound.getBoolean("OnlyOres"); } - @Override - public void updateEntity() { - super.updateEntity(); - if (!this.level.isClientSide) { + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityVerticalDigger tile) { + tile.clientTick(); + } + } - if (!this.isRedstonePowered && this.ticksElapsed % 5 == 0) { - if (this.checkY != 0) { - int range = TileEntityPhantomface.upgradeRange(DEFAULT_RANGE, this.level, this.worldPosition); - if (this.checkY < 0) { - this.checkY = this.worldPosition.getY() - 1; - this.checkX = -range; - this.checkZ = -range; + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityVerticalDigger tile) { + tile.serverTick(); + + if (!tile.isRedstonePowered && tile.ticksElapsed % 5 == 0) { + if (tile.checkY != 0) { + int range = TileEntityPhantomface.upgradeRange(DEFAULT_RANGE, level, pos); + if (tile.checkY < 0) { + tile.checkY = tile.worldPosition.getY() - 1; + tile.checkX = -range; + tile.checkZ = -range; } - if (this.checkY > 0) { - if (this.mine()) { - this.checkX++; - if (this.checkX > range) { - this.checkX = -range; - this.checkZ++; - if (this.checkZ > range) { - this.checkZ = -range; - this.checkY--; + if (tile.checkY > 0) { + if (tile.mine()) { + tile.checkX++; + if (tile.checkX > range) { + tile.checkX = -range; + tile.checkZ++; + if (tile.checkZ > range) { + tile.checkZ = -range; + tile.checkY--; } } } @@ -118,11 +127,11 @@ public class TileEntityVerticalDigger extends TileEntityInventoryBase implements } } - if ((this.oldEnergy != this.storage.getEnergyStored() || this.oldCheckX != this.checkX || this.oldCheckY != this.checkY || this.oldCheckZ != this.checkZ) && this.sendUpdateWithInterval()) { - this.oldEnergy = this.storage.getEnergyStored(); - this.oldCheckX = this.checkX; - this.oldCheckY = this.checkY; - this.oldCheckZ = this.checkZ; + if ((tile.oldEnergy != tile.storage.getEnergyStored() || tile.oldCheckX != tile.checkX || tile.oldCheckY != tile.checkY || tile.oldCheckZ != tile.checkZ) && tile.sendUpdateWithInterval()) { + tile.oldEnergy = tile.storage.getEnergyStored(); + tile.oldCheckX = tile.checkX; + tile.oldCheckY = tile.checkY; + tile.oldCheckZ = tile.checkZ; } } } @@ -136,15 +145,16 @@ public class TileEntityVerticalDigger extends TileEntityInventoryBase implements BlockState state = this.level.getBlockState(pos); Block block = state.getBlock(); - ItemStack stack = block.getPickBlock(state, new BlockRayTraceResult(new Vector3d(0, 0, 0), Direction.DOWN, pos, false), this.level, pos, FakePlayerFactory.getMinecraft((ServerWorld) this.level)); - if (!block.isAir(this.level.getBlockState(pos), this.level, pos)) { - if (block.getHarvestLevel(this.level.getBlockState(pos)) <= DrillItem.HARVEST_LEVEL && state.getDestroySpeed(this.level, pos) >= 0F && !(block instanceof IFluidBlock) && this.isMinable(block, stack)) { - List drops = Block.getDrops(state, (ServerWorld) this.level, pos, this.level.getBlockEntity(pos)); + ItemStack stack = block.getCloneItemStack(state, new BlockHitResult(new Vec3(0, 0, 0), Direction.DOWN, pos, false), this.level, pos, FakePlayerFactory.getMinecraft((ServerLevel) this.level)); + if (!state.isAir()) { + //block.getHarvestLevel(state) <= DrillItem.HARVEST_LEVEL + if (TierSortingRegistry.isCorrectTierForDrops(Tiers.NETHERITE, state) && state.getDestroySpeed(this.level, pos) >= 0F && !(block instanceof IFluidBlock) && this.isMinable(block, stack)) { + List drops = Block.getDrops(state, (ServerLevel) this.level, pos, this.level.getBlockEntity(pos)); float chance = WorldUtil.fireFakeHarvestEventsForDropChance(this, drops, this.level, pos); if (chance > 0 && this.level.random.nextFloat() <= chance) { if (StackUtil.canAddAll(this.inv, drops, false)) { - this.level.levelEvent(2001, pos, Block.getId(this.level.getBlockState(pos))); + this.level.levelEvent(2001, pos, Block.getId(state)); this.level.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); StackUtil.addAll(this.inv, drops, false); @@ -218,7 +228,7 @@ public class TileEntityVerticalDigger extends TileEntityInventoryBase implements } @Override - public void onButtonPressed(int buttonID, PlayerEntity player) { + public void onButtonPressed(int buttonID, Player player) { if (buttonID == 0) { this.onlyMineOres = !this.onlyMineOres; this.sendUpdate(); @@ -245,13 +255,13 @@ public class TileEntityVerticalDigger extends TileEntityInventoryBase implements } @Override - public ITextComponent getDisplayName() { - return StringTextComponent.EMPTY; + public Component getDisplayName() { + return TextComponent.EMPTY; } @Nullable @Override - public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) { + public AbstractContainerMenu createMenu(int windowId, Inventory playerInventory, Player player) { return new ContainerMiner(windowId, playerInventory, this); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java index 6db2c283d..2912c3a52 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java @@ -18,24 +18,26 @@ import de.ellpeck.actuallyadditions.mod.items.ItemSolidifiedExperience; import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.item.ExperienceOrbEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.INamedContainerProvider; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.util.Mth; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.ExperienceOrb; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.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 javax.annotation.Nullable; import java.util.List; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; - -public class TileEntityXPSolidifier extends TileEntityInventoryBase implements IButtonReactor, INamedContainerProvider { +public class TileEntityXPSolidifier extends TileEntityInventoryBase implements IButtonReactor, MenuProvider { private static final int[] XP_MAP = new int[256]; @@ -50,8 +52,8 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I private int lastAmount; private int singlePointAmount; - public TileEntityXPSolidifier() { - super(ActuallyBlocks.XP_SOLIDIFIER.getTileEntityType(), 2); + public TileEntityXPSolidifier(BlockPos pos, BlockState state) { + super(ActuallyBlocks.XP_SOLIDIFIER.getTileEntityType(), pos, state, 2); } /* @@ -101,11 +103,11 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I return i - 1; } - public static int getPlayerXP(PlayerEntity player) { + public static int getPlayerXP(Player player) { return (int) (getExperienceForLevel(player.experienceLevel) + player.experienceProgress * player.getXpNeededForNextLevel()); } - public static void addPlayerXP(PlayerEntity player, int amount) { + public static void addPlayerXP(Player player, int amount) { int experience = Math.max(0, getPlayerXP(player) + amount); player.totalExperience = experience; player.experienceLevel = getLevelForExperience(experience); @@ -114,75 +116,81 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I } @Override - public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + public void writeSyncableNBT(CompoundTag compound, NBTType type) { super.writeSyncableNBT(compound, type); compound.putInt("Amount", this.amount); compound.putInt("SinglePointAmount", this.singlePointAmount); } @Override - public void readSyncableNBT(CompoundNBT compound, NBTType type) { + public void readSyncableNBT(CompoundTag compound, NBTType type) { super.readSyncableNBT(compound, type); this.amount = compound.getInt("Amount"); this.singlePointAmount = compound.getInt("SinglePointAmount"); } - @Override - public void updateEntity() { - super.updateEntity(); - if (!this.level.isClientSide) { - if (this.amount > 0) { - ItemStack stack = this.inv.getStackInSlot(0); + public static void clientTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityXPSolidifier tile) { + tile.clientTick(); + } + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, T t) { + if (t instanceof TileEntityXPSolidifier tile) { + tile.serverTick(); + + if (tile.amount > 0) { + ItemStack stack = tile.inv.getStackInSlot(0); if (stack.isEmpty()) { - int toSet = Math.min(this.amount, 64); - this.inv.setStackInSlot(0, new ItemStack(ActuallyItems.SOLIDIFIED_EXPERIENCE.get(), toSet)); - this.amount -= toSet; - this.setChanged(); + int toSet = Math.min(tile.amount, 64); + tile.inv.setStackInSlot(0, new ItemStack(ActuallyItems.SOLIDIFIED_EXPERIENCE.get(), toSet)); + tile.amount -= toSet; + tile.setChanged(); } else if (stack.getCount() < 64) { int needed = 64 - stack.getCount(); - int toAdd = Math.min(needed, this.amount); + int toAdd = Math.min(needed, tile.amount); stack.grow(toAdd); - this.amount -= toAdd; - this.setChanged(); + tile.amount -= toAdd; + tile.setChanged(); } } - if (!this.isRedstonePowered) { + if (!tile.isRedstonePowered) { int range = 5; - List orbs = this.level.getEntitiesOfClass(ExperienceOrbEntity.class, new AxisAlignedBB(this.worldPosition.getX() - range, this.worldPosition.getY() - range, this.worldPosition.getZ() - range, this.worldPosition.getX() + 1 + range, this.worldPosition.getY() + 1 + range, this.worldPosition.getZ() + 1 + range)); + List orbs = level.getEntitiesOfClass(ExperienceOrb.class, new AABB(pos.getX() - range, pos.getY() - range, pos.getZ() - range, pos.getX() + 1 + range, pos.getY() + 1 + range, pos.getZ() + 1 + range)); if (orbs != null && !orbs.isEmpty()) { - for (ExperienceOrbEntity orb : orbs) { + for (ExperienceOrb orb : orbs) { // TODO: [port] validate the getPersistentData is correct if (orb != null && orb.isAlive() && !orb.getPersistentData().getBoolean(ActuallyAdditions.MODID + "FromSolidified")) { - this.singlePointAmount += orb.getValue(); - orb.remove(); + tile.singlePointAmount += orb.getValue(); + orb.discard(); - if (this.singlePointAmount >= ItemSolidifiedExperience.SOLID_XP_AMOUNT) { - this.amount += this.singlePointAmount / ItemSolidifiedExperience.SOLID_XP_AMOUNT; - this.singlePointAmount = 0; - this.setChanged(); + if (tile.singlePointAmount >= ItemSolidifiedExperience.SOLID_XP_AMOUNT) { + tile.amount += tile.singlePointAmount / ItemSolidifiedExperience.SOLID_XP_AMOUNT; + tile.singlePointAmount = 0; + tile.setChanged(); } } } } } - ItemStack stack = this.inv.getStackInSlot(1); + ItemStack stack = tile.inv.getStackInSlot(1); if (StackUtil.isValid(stack) && stack.getItem() instanceof ItemSolidifiedExperience) { - int remainingSpace = MathHelper.clamp(Integer.MAX_VALUE - this.amount, 0, stack.getCount()); + int remainingSpace = Mth.clamp(Integer.MAX_VALUE - tile.amount, 0, stack.getCount()); if (stack.getCount() >= remainingSpace && remainingSpace != 0) { - this.amount += remainingSpace; + tile.amount += remainingSpace; stack.shrink(remainingSpace); - this.setChanged(); + tile.setChanged(); } } - if (this.lastAmount != this.amount && this.sendUpdateWithInterval()) { - this.lastAmount = this.amount; + if (tile.lastAmount != tile.amount && tile.sendUpdateWithInterval()) { + tile.lastAmount = tile.amount; } } } - + @Override public IAcceptor getAcceptor() { return (slot, stack, automation) -> slot == 1 && stack.getItem() == ActuallyItems.SOLIDIFIED_EXPERIENCE.get(); @@ -197,7 +205,7 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I } @Override - public void onButtonPressed(int buttonID, PlayerEntity player) { + public void onButtonPressed(int buttonID, Player player) { if (buttonID < this.buttonAmounts.length) { int playerXP = getPlayerXP(player); if (playerXP > 0) { @@ -215,13 +223,13 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I } @Override - public ITextComponent getDisplayName() { - return StringTextComponent.EMPTY; + public Component getDisplayName() { + return TextComponent.EMPTY; } @Nullable @Override - public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) { + public AbstractContainerMenu createMenu(int windowId, Inventory playerInventory, Player player) { return new ContainerXPSolidifier(windowId, playerInventory, this); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/update/UpdateChecker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/update/UpdateChecker.java index 9c3f929ba..11887e870 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/update/UpdateChecker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/update/UpdateChecker.java @@ -11,11 +11,10 @@ package de.ellpeck.actuallyadditions.mod.update; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.player.Player; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.MinecraftForge; @@ -44,13 +43,13 @@ public class UpdateChecker { @SubscribeEvent(receiveCanceled = true) public void onTick(TickEvent.ClientTickEvent event) { if (Minecraft.getInstance().player != null) { - PlayerEntity player = Minecraft.getInstance().player; + Player player = Minecraft.getInstance().player; if (UpdateChecker.checkFailed) { - player.displayClientMessage(ITextComponent.Serializer.fromJson(I18n.get("info." + ActuallyAdditions.MODID + ".update.failed")), false); + player.displayClientMessage(Component.Serializer.fromJson(I18n.get("info." + ActuallyAdditions.MODID + ".update.failed")), false); } else if (UpdateChecker.needsUpdateNotify) { - player.displayClientMessage(ITextComponent.Serializer.fromJson(I18n.get("info." + ActuallyAdditions.MODID + ".update.generic")), false); - player.displayClientMessage(ITextComponent.Serializer.fromJson(I18n.get("info." + ActuallyAdditions.MODID + ".update.versionCompare", ActuallyAdditions.VERSION, UpdateChecker.updateVersionString)), false); - player.displayClientMessage(ITextComponent.Serializer.fromJson(I18n.get("info." + ActuallyAdditions.MODID + ".update.buttons", UpdateChecker.CHANGELOG_LINK, UpdateChecker.DOWNLOAD_LINK)), false); + player.displayClientMessage(Component.Serializer.fromJson(I18n.get("info." + ActuallyAdditions.MODID + ".update.generic")), false); + player.displayClientMessage(Component.Serializer.fromJson(I18n.get("info." + ActuallyAdditions.MODID + ".update.versionCompare", ActuallyAdditions.VERSION, UpdateChecker.updateVersionString)), false); + player.displayClientMessage(Component.Serializer.fromJson(I18n.get("info." + ActuallyAdditions.MODID + ".update.buttons", UpdateChecker.CHANGELOG_LINK, UpdateChecker.DOWNLOAD_LINK)), false); } if (threadFinished) { MinecraftForge.EVENT_BUS.unregister(this); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java index 066c2a948..2e47e0f10 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java @@ -10,10 +10,14 @@ package de.ellpeck.actuallyadditions.mod.util; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.IVertexBuilder; +import com.mojang.blaze3d.vertex.BufferBuilder; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.Tesselator; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.math.Matrix4f; +import com.mojang.math.Vector3f; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.render.RenderTypes; import de.ellpeck.actuallyadditions.mod.network.PacketHandler; @@ -21,27 +25,27 @@ import de.ellpeck.actuallyadditions.mod.network.PacketServerToClient; import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.*; -import net.minecraft.client.renderer.model.IBakedModel; -import net.minecraft.client.renderer.model.ItemCameraTransforms; -import net.minecraft.client.renderer.texture.AtlasTexture; +import net.minecraft.client.gui.Font; +import net.minecraft.client.renderer.LightTexture; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.block.model.ItemTransforms; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.client.resources.I18n; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.NonNullList; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.vector.Matrix4f; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.util.math.vector.Vector3f; -import net.minecraft.world.World; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.core.BlockPos; +import net.minecraft.core.NonNullList; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.phys.Vec3; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.ForgeHooksClient; -import net.minecraftforge.fml.network.PacketDistributor; +import net.minecraftforge.network.PacketDistributor; public final class AssetUtil { @@ -59,12 +63,12 @@ public final class AssetUtil { } @OnlyIn(Dist.CLIENT) - public static void displayNameString(MatrixStack matrices, FontRenderer font, int xSize, int yPositionOfMachineText, String text) { + public static void displayNameString(PoseStack matrices, Font font, int xSize, int yPositionOfMachineText, String text) { font.draw(matrices, text, xSize / 2f - font.width(text) / 2f, yPositionOfMachineText, 0xFFFFFF); } @OnlyIn(Dist.CLIENT) - public static void displayNameString(MatrixStack matrices, FontRenderer font, int xSize, int yPositionOfMachineText, TileEntityBase tile) { + public static void displayNameString(PoseStack matrices, Font font, int xSize, int yPositionOfMachineText, TileEntityBase tile) { displayNameString(matrices, font, xSize, yPositionOfMachineText, I18n.get(tile.getNameForTranslation())); } @@ -73,10 +77,10 @@ public final class AssetUtil { // } @OnlyIn(Dist.CLIENT) - public static void renderItemInWorld(ItemStack stack, int combinedLight, int combinedOverlay, MatrixStack matrices, IRenderTypeBuffer buffer) { + public static void renderItemInWorld(ItemStack stack, int combinedLight, int combinedOverlay, PoseStack matrices, MultiBufferSource buffer) { if (!stack.isEmpty()) { Minecraft.getInstance().getItemRenderer().renderStatic( - stack, ItemCameraTransforms.TransformType.FIXED, combinedLight, combinedOverlay, matrices, buffer + stack, ItemTransforms.TransformType.FIXED, combinedLight, combinedOverlay, matrices, buffer, 0 ); } } @@ -96,28 +100,30 @@ public final class AssetUtil { // } @OnlyIn(Dist.CLIENT) - public static void renderItemWithoutScrewingWithColors(ItemStack stack, MatrixStack matrices, int combinedOverlay, int combinedLight) { + public static void renderItemWithoutScrewingWithColors(ItemStack stack, PoseStack matrices, int combinedOverlay, int combinedLight) { if (StackUtil.isValid(stack)) { Minecraft mc = Minecraft.getInstance(); ItemRenderer renderer = mc.getItemRenderer(); TextureManager manager = mc.getTextureManager(); - IRenderTypeBuffer.Impl irendertypebuffer$impl = mc.renderBuffers().bufferSource(); + MultiBufferSource.BufferSource bufferSource = mc.renderBuffers().bufferSource(); - IBakedModel model = renderer.getModel(stack, null, null); - manager.bind(AtlasTexture.LOCATION_BLOCKS); - manager.getTexture(AtlasTexture.LOCATION_BLOCKS).setBlurMipmap(false, false); - RenderSystem.enableRescaleNormal(); + BakedModel model = renderer.getModel(stack, null, null, 0); + manager.bindForSetup(TextureAtlas.LOCATION_BLOCKS); //bind + manager.getTexture(TextureAtlas.LOCATION_BLOCKS).setBlurMipmap(false, false); +// RenderSystem.enableRescaleNormal(); RenderSystem.enableBlend(); - RenderSystem.pushMatrix(); - model = ForgeHooksClient.handleCameraTransforms(matrices, model, ItemCameraTransforms.TransformType.FIXED, false); - renderer.render(stack, ItemCameraTransforms.TransformType.FIXED, false, matrices, irendertypebuffer$impl, +// RenderSystem.pushMatrix(); + matrices.pushPose(); + model = ForgeHooksClient.handleCameraTransforms(matrices, model, ItemTransforms.TransformType.FIXED, false); + renderer.render(stack, ItemTransforms.TransformType.FIXED, false, matrices, bufferSource, combinedOverlay, combinedLight, model); - RenderSystem.popMatrix(); - RenderSystem.disableRescaleNormal(); +// RenderSystem.popMatrix(); + matrices.popPose(); +// RenderSystem.disableRescaleNormal(); RenderSystem.disableBlend(); - manager.bind(AtlasTexture.LOCATION_BLOCKS); - manager.getTexture(AtlasTexture.LOCATION_BLOCKS).restoreLastBlurMipmap(); - irendertypebuffer$impl.endBatch(); + manager.bindForSetup(TextureAtlas.LOCATION_BLOCKS); //bind + manager.getTexture(TextureAtlas.LOCATION_BLOCKS).restoreLastBlurMipmap(); + bufferSource.endBatch(); } } @@ -211,9 +217,9 @@ public final class AssetUtil { // GlStateManager._popMatrix(); // } - public static void spawnLaserWithTimeServer(World world, double startX, double startY, double startZ, double endX, double endY, double endZ, int color, int maxAge, double rotationTime, float size, float alpha) { + public static void spawnLaserWithTimeServer(Level world, double startX, double startY, double startZ, double endX, double endY, double endZ, int color, int maxAge, double rotationTime, float size, float alpha) { if (!world.isClientSide) { - CompoundNBT data = new CompoundNBT(); + CompoundTag data = new CompoundTag(); data.putDouble("StartX", startX); data.putDouble("StartY", startY); data.putDouble("StartZ", startZ); @@ -232,7 +238,7 @@ public final class AssetUtil { @OnlyIn(Dist.CLIENT) public static void spawnLaserWithTimeClient(double startX, double startY, double startZ, double endX, double endY, double endZ, int color, int maxAge, double rotationTime, float size, float alpha) { Minecraft mc = Minecraft.getInstance(); - TileEntity tile = mc.level.getBlockEntity(new BlockPos(startX, startY, startZ)); + BlockEntity tile = mc.level.getBlockEntity(new BlockPos(startX, startY, startZ)); if(tile instanceof TileEntityAtomicReconstructor) ((TileEntityAtomicReconstructor) tile).resetBeam(maxAge, color); @@ -249,8 +255,8 @@ public final class AssetUtil { }*/ @OnlyIn(Dist.CLIENT) - public static void renderLaser(MatrixStack matrixStack, IRenderTypeBuffer buffer, float offX, float offY, float offZ, float yaw, float pitch, float length, float rotationTime, int color, float alpha, float beamWidth) { - World world = Minecraft.getInstance().level; + public static void renderLaser(PoseStack matrixStack, MultiBufferSource buffer, float offX, float offY, float offZ, float yaw, float pitch, float length, float rotationTime, int color, float alpha, float beamWidth) { + Level world = Minecraft.getInstance().level; int r = (color >> 16) & 0xFF; int g = (color >> 8) & 0xFF; int b = color & 0xFF; @@ -260,7 +266,7 @@ public final class AssetUtil { float roll = rotationTime > 0.0f ? 360.0f * (world.getGameTime() % rotationTime / rotationTime) : 0.0f; - IVertexBuilder builder = buffer.getBuffer(RenderTypes.LASER); + VertexConsumer builder = buffer.getBuffer(RenderTypes.LASER); matrixStack.pushPose(); matrixStack.translate(0.5f, 0.5f, 0.5f); matrixStack.translate(offX, offY, offZ); @@ -300,8 +306,8 @@ public final class AssetUtil { matrixStack.popPose(); } - public static void renderLaser(MatrixStack matrixStack, IRenderTypeBuffer buffer, Vector3d startOffset, Vector3d endOffset, float rotationTime, int color, float alpha, float beamWidth) { - Vector3d combined = endOffset.subtract(startOffset); + public static void renderLaser(PoseStack matrixStack, MultiBufferSource buffer, Vec3 startOffset, Vec3 endOffset, float rotationTime, int color, float alpha, float beamWidth) { + Vec3 combined = endOffset.subtract(startOffset); double pitch = Math.toDegrees(Math.atan2(combined.y, Math.sqrt(combined.x * combined.x + combined.z * combined.z))); double yaw = Math.toDegrees(Math.atan2(-combined.z, combined.x)); @@ -314,17 +320,17 @@ public final class AssetUtil { //I can't do rendering code. Ever. @OnlyIn(Dist.CLIENT) public static void renderLaser(double firstX, double firstY, double firstZ, double secondX, double secondY, double secondZ, double rotationTime, float alpha, double beamWidth, float[] color) { - Tessellator tessy = Tessellator.getInstance(); + Tesselator tessy = Tesselator.getInstance(); BufferBuilder render = tessy.getBuilder(); - World world = Minecraft.getInstance().level; + Level world = Minecraft.getInstance().level; float r = color[0]; float g = color[1]; float b = color[2]; - Vector3d vec1 = new Vector3d(firstX, firstY, firstZ); - Vector3d vec2 = new Vector3d(secondX, secondY, secondZ); - Vector3d combinedVec = vec2.subtract(vec1); + Vec3 vec1 = new Vec3(firstX, firstY, firstZ); + Vec3 vec2 = new Vec3(secondX, secondY, secondZ); + Vec3 combinedVec = vec2.subtract(vec1); double rot = rotationTime > 0 ? 360D * (world.getGameTime() % rotationTime / rotationTime) @@ -334,7 +340,7 @@ public final class AssetUtil { double length = combinedVec.length(); - GlStateManager._pushMatrix(); +// GlStateManager._pushMatrix(); /* GlStateManager._disableLighting(); GlStateManager._enableBlend(); @@ -425,19 +431,19 @@ public final class AssetUtil { //GlStateManager._alphaFunc(func, ref); //GlStateManager._blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager._disableBlend(); - GlStateManager._enableLighting(); - GlStateManager._popMatrix(); +// GlStateManager._enableLighting(); +// GlStateManager._popMatrix(); } @OnlyIn(Dist.CLIENT) - public static void renderTextInWorld(MatrixStack matrixStack, double offsetX, double offsetY, double offsetZ, NonNullList text, int color) { + public static void renderTextInWorld(PoseStack matrixStack, double offsetX, double offsetY, double offsetZ, NonNullList text, int color) { matrixStack.pushPose(); matrixStack.translate(offsetX,offsetY,offsetZ); matrixStack.scale(-1, -1, 1); - matrixStack.mulPose(Vector3f.YP.rotationDegrees(Minecraft.getInstance().cameraEntity.yRot)); + matrixStack.mulPose(Vector3f.YP.rotationDegrees(Minecraft.getInstance().cameraEntity.getYRot())); matrixStack.scale(0.01F, 0.01F, 0.01F); - FontRenderer font = Minecraft.getInstance().font; + Font font = Minecraft.getInstance().font; int y = 0; for (String s : text) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemStackHandlerAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemStackHandlerAA.java index 4d747a86f..2c194298c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemStackHandlerAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemStackHandlerAA.java @@ -10,8 +10,8 @@ package de.ellpeck.actuallyadditions.mod.util; -import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; +import net.minecraft.core.NonNullList; +import net.minecraft.world.item.ItemStack; import net.minecraftforge.items.ItemStackHandler; /** diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemUtil.java index 48c272e9c..7779515b2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemUtil.java @@ -10,13 +10,13 @@ package de.ellpeck.actuallyadditions.mod.util; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Hand; -import net.minecraft.util.ResourceLocation; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraftforge.registries.ForgeRegistries; import java.util.Map; @@ -82,7 +82,7 @@ public final class ItemUtil { return stack.getOrCreateTag().getBoolean("IsEnabled"); } - public static void changeEnabled(PlayerEntity player, Hand hand) { + public static void changeEnabled(Player player, InteractionHand hand) { changeEnabled(player.getItemInHand(hand)); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/Lang.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/Lang.java index 8be58c350..ffb261931 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/Lang.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/Lang.java @@ -1,9 +1,6 @@ package de.ellpeck.actuallyadditions.mod.util; -import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import net.minecraft.util.text.TranslationTextComponent; import net.minecraftforge.energy.IEnergyStorage; -import net.minecraftforge.fml.ForgeI18n; import java.text.NumberFormat; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/NetHandlerSpaghettiServer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/NetHandlerSpaghettiServer.java index a1085bd76..a0ed8500c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/NetHandlerSpaghettiServer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/NetHandlerSpaghettiServer.java @@ -2,106 +2,149 @@ package de.ellpeck.actuallyadditions.mod.util; import io.netty.util.concurrent.Future; import io.netty.util.concurrent.GenericFutureListener; -import net.minecraft.network.IPacket; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.PacketDirection; -import net.minecraft.network.play.ServerPlayNetHandler; -import net.minecraft.network.play.client.*; -import net.minecraft.network.play.server.SPlayerPositionLookPacket; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.network.Connection; +import net.minecraft.network.chat.Component; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.PacketFlow; +import net.minecraft.network.protocol.game.ClientboundPlayerPositionPacket; +import net.minecraft.network.protocol.game.ServerboundAcceptTeleportationPacket; +import net.minecraft.network.protocol.game.ServerboundBlockEntityTagQuery; +import net.minecraft.network.protocol.game.ServerboundChangeDifficultyPacket; +import net.minecraft.network.protocol.game.ServerboundChatPacket; +import net.minecraft.network.protocol.game.ServerboundClientCommandPacket; +import net.minecraft.network.protocol.game.ServerboundClientInformationPacket; +import net.minecraft.network.protocol.game.ServerboundCommandSuggestionPacket; +import net.minecraft.network.protocol.game.ServerboundContainerButtonClickPacket; +import net.minecraft.network.protocol.game.ServerboundContainerClickPacket; +import net.minecraft.network.protocol.game.ServerboundContainerClosePacket; +import net.minecraft.network.protocol.game.ServerboundCustomPayloadPacket; +import net.minecraft.network.protocol.game.ServerboundEditBookPacket; +import net.minecraft.network.protocol.game.ServerboundEntityTagQuery; +import net.minecraft.network.protocol.game.ServerboundInteractPacket; +import net.minecraft.network.protocol.game.ServerboundJigsawGeneratePacket; +import net.minecraft.network.protocol.game.ServerboundKeepAlivePacket; +import net.minecraft.network.protocol.game.ServerboundLockDifficultyPacket; +import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket; +import net.minecraft.network.protocol.game.ServerboundMoveVehiclePacket; +import net.minecraft.network.protocol.game.ServerboundPaddleBoatPacket; +import net.minecraft.network.protocol.game.ServerboundPickItemPacket; +import net.minecraft.network.protocol.game.ServerboundPlaceRecipePacket; +import net.minecraft.network.protocol.game.ServerboundPlayerAbilitiesPacket; +import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket; +import net.minecraft.network.protocol.game.ServerboundPlayerCommandPacket; +import net.minecraft.network.protocol.game.ServerboundPlayerInputPacket; +import net.minecraft.network.protocol.game.ServerboundRecipeBookChangeSettingsPacket; +import net.minecraft.network.protocol.game.ServerboundRecipeBookSeenRecipePacket; +import net.minecraft.network.protocol.game.ServerboundRenameItemPacket; +import net.minecraft.network.protocol.game.ServerboundResourcePackPacket; +import net.minecraft.network.protocol.game.ServerboundSeenAdvancementsPacket; +import net.minecraft.network.protocol.game.ServerboundSelectTradePacket; +import net.minecraft.network.protocol.game.ServerboundSetBeaconPacket; +import net.minecraft.network.protocol.game.ServerboundSetCarriedItemPacket; +import net.minecraft.network.protocol.game.ServerboundSetCommandBlockPacket; +import net.minecraft.network.protocol.game.ServerboundSetCommandMinecartPacket; +import net.minecraft.network.protocol.game.ServerboundSetCreativeModeSlotPacket; +import net.minecraft.network.protocol.game.ServerboundSetJigsawBlockPacket; +import net.minecraft.network.protocol.game.ServerboundSetStructureBlockPacket; +import net.minecraft.network.protocol.game.ServerboundSignUpdatePacket; +import net.minecraft.network.protocol.game.ServerboundSwingPacket; +import net.minecraft.network.protocol.game.ServerboundTeleportToEntityPacket; +import net.minecraft.network.protocol.game.ServerboundUseItemOnPacket; +import net.minecraft.network.protocol.game.ServerboundUseItemPacket; +import net.minecraft.server.network.ServerGamePacketListenerImpl; import net.minecraftforge.common.util.FakePlayer; import javax.annotation.Nullable; import java.util.Set; -public class NetHandlerSpaghettiServer extends ServerPlayNetHandler { +public class NetHandlerSpaghettiServer extends ServerGamePacketListenerImpl { public NetHandlerSpaghettiServer(FakePlayer player) { - super(null, new NetworkManager(PacketDirection.CLIENTBOUND), player); + super(null, new Connection(PacketFlow.CLIENTBOUND), player); } @Override - public void disconnect(ITextComponent textComponent) { + public void disconnect(Component textComponent) { } @Override - public void handlePlayerInput(CInputPacket p_147358_1_) { + public void handlePlayerInput(ServerboundPlayerInputPacket p_147358_1_) { } @Override - public void handleMoveVehicle(CMoveVehiclePacket p_184338_1_) { + public void handleMoveVehicle(ServerboundMoveVehiclePacket p_184338_1_) { } @Override - public void handleAcceptTeleportPacket(CConfirmTeleportPacket p_184339_1_) { + public void handleAcceptTeleportPacket(ServerboundAcceptTeleportationPacket p_184339_1_) { } @Override - public void handleRecipeBookSeenRecipePacket(CMarkRecipeSeenPacket p_191984_1_) { + public void handleRecipeBookSeenRecipePacket(ServerboundRecipeBookSeenRecipePacket p_191984_1_) { } @Override - public void handleRecipeBookChangeSettingsPacket(CUpdateRecipeBookStatusPacket p_241831_1_) { + public void handleRecipeBookChangeSettingsPacket(ServerboundRecipeBookChangeSettingsPacket p_241831_1_) { } @Override - public void handleSeenAdvancements(CSeenAdvancementsPacket p_194027_1_) { + public void handleSeenAdvancements(ServerboundSeenAdvancementsPacket p_194027_1_) { } @Override - public void handleCustomCommandSuggestions(CTabCompletePacket p_195518_1_) { + public void handleCustomCommandSuggestions(ServerboundCommandSuggestionPacket p_195518_1_) { } @Override - public void handleSetCommandBlock(CUpdateCommandBlockPacket p_210153_1_) { + public void handleSetCommandBlock(ServerboundSetCommandBlockPacket p_210153_1_) { } @Override - public void handleSetCommandMinecart(CUpdateMinecartCommandBlockPacket p_210158_1_) { + public void handleSetCommandMinecart(ServerboundSetCommandMinecartPacket p_210158_1_) { } @Override - public void handlePickItem(CPickItemPacket p_210152_1_) { + public void handlePickItem(ServerboundPickItemPacket p_210152_1_) { } @Override - public void handleRenameItem(CRenameItemPacket p_210155_1_) { + public void handleRenameItem(ServerboundRenameItemPacket p_210155_1_) { } @Override - public void handleSetBeaconPacket(CUpdateBeaconPacket p_210154_1_) { + public void handleSetBeaconPacket(ServerboundSetBeaconPacket p_210154_1_) { } @Override - public void handleSetStructureBlock(CUpdateStructureBlockPacket p_210157_1_) { + public void handleSetStructureBlock(ServerboundSetStructureBlockPacket p_210157_1_) { } @Override - public void handleSetJigsawBlock(CUpdateJigsawBlockPacket p_217262_1_) { + public void handleSetJigsawBlock(ServerboundSetJigsawBlockPacket p_217262_1_) { } @Override - public void handleJigsawGenerate(CJigsawBlockGeneratePacket p_230549_1_) { + public void handleJigsawGenerate(ServerboundJigsawGeneratePacket p_230549_1_) { } @Override - public void handleSelectTrade(CSelectTradePacket p_210159_1_) { + public void handleSelectTrade(ServerboundSelectTradePacket p_210159_1_) { } @Override - public void handleEditBook(CEditBookPacket p_210156_1_) { + public void handleEditBook(ServerboundEditBookPacket p_210156_1_) { } @Override - public void handleEntityTagQuery(CQueryEntityNBTPacket p_211526_1_) { + public void handleEntityTagQuery(ServerboundEntityTagQuery p_211526_1_) { } @Override - public void handleBlockEntityTagQuery(CQueryTileEntityNBTPacket p_211525_1_) { + public void handleBlockEntityTagQuery(ServerboundBlockEntityTagQuery p_211525_1_) { } @Override - public void handleMovePlayer(CPlayerPacket p_147347_1_) { + public void handleMovePlayer(ServerboundMovePlayerPacket p_147347_1_) { } @Override @@ -109,118 +152,114 @@ public class NetHandlerSpaghettiServer extends ServerPlayNetHandler { } @Override - public void teleport(double p_175089_1_, double p_175089_3_, double p_175089_5_, float p_175089_7_, float p_175089_8_, Set p_175089_9_) { + public void teleport(double p_175089_1_, double p_175089_3_, double p_175089_5_, float p_175089_7_, float p_175089_8_, Set p_175089_9_) { } @Override - public void handlePlayerAction(CPlayerDiggingPacket p_147345_1_) { + public void handlePlayerAction(ServerboundPlayerActionPacket p_147345_1_) { } @Override - public void handleUseItemOn(CPlayerTryUseItemOnBlockPacket p_184337_1_) { + public void handleUseItemOn(ServerboundUseItemOnPacket p_184337_1_) { } @Override - public void handleUseItem(CPlayerTryUseItemPacket p_147346_1_) { + public void handleUseItem(ServerboundUseItemPacket p_147346_1_) { } @Override - public void handleTeleportToEntityPacket(CSpectatePacket p_175088_1_) { + public void handleTeleportToEntityPacket(ServerboundTeleportToEntityPacket p_175088_1_) { } @Override - public void handleResourcePackResponse(CResourcePackStatusPacket p_175086_1_) { + public void handleResourcePackResponse(ServerboundResourcePackPacket p_175086_1_) { } @Override - public void handlePaddleBoat(CSteerBoatPacket p_184340_1_) { + public void handlePaddleBoat(ServerboundPaddleBoatPacket p_184340_1_) { } @Override - public void onDisconnect(ITextComponent p_147231_1_) { + public void onDisconnect(Component p_147231_1_) { } @Override - public void send(IPacket p_147359_1_) { + public void send(Packet p_147359_1_) { } @Override - public void send(IPacket p_211148_1_, @Nullable GenericFutureListener> p_211148_2_) { + public void send(Packet p_211148_1_, @Nullable GenericFutureListener> p_211148_2_) { } @Override - public void handleSetCarriedItem(CHeldItemChangePacket p_147355_1_) { + public void handleSetCarriedItem(ServerboundSetCarriedItemPacket p_147355_1_) { } @Override - public void handleChat(CChatMessagePacket p_147354_1_) { + public void handleChat(ServerboundChatPacket p_147354_1_) { } @Override - public void handleAnimate(CAnimateHandPacket p_175087_1_) { + public void handleAnimate(ServerboundSwingPacket p_175087_1_) { } @Override - public void handlePlayerCommand(CEntityActionPacket p_147357_1_) { + public void handlePlayerCommand(ServerboundPlayerCommandPacket p_147357_1_) { } @Override - public void handleInteract(CUseEntityPacket p_147340_1_) { + public void handleInteract(ServerboundInteractPacket p_147340_1_) { } @Override - public void handleClientCommand(CClientStatusPacket p_147342_1_) { + public void handleClientCommand(ServerboundClientCommandPacket p_147342_1_) { } @Override - public void handleContainerClose(CCloseWindowPacket p_147356_1_) { + public void handleContainerClose(ServerboundContainerClosePacket p_147356_1_) { } @Override - public void handleContainerClick(CClickWindowPacket p_147351_1_) { + public void handleContainerClick(ServerboundContainerClickPacket p_147351_1_) { } @Override - public void handlePlaceRecipe(CPlaceRecipePacket p_194308_1_) { + public void handlePlaceRecipe(ServerboundPlaceRecipePacket p_194308_1_) { } @Override - public void handleContainerButtonClick(CEnchantItemPacket p_147338_1_) { + public void handleContainerButtonClick(ServerboundContainerButtonClickPacket p_147338_1_) { } @Override - public void handleSetCreativeModeSlot(CCreativeInventoryActionPacket p_147344_1_) { + public void handleSetCreativeModeSlot(ServerboundSetCreativeModeSlotPacket p_147344_1_) { } @Override - public void handleContainerAck(CConfirmTransactionPacket p_147339_1_) { + public void handleSignUpdate(ServerboundSignUpdatePacket p_147343_1_) { } @Override - public void handleSignUpdate(CUpdateSignPacket p_147343_1_) { + public void handleKeepAlive(ServerboundKeepAlivePacket p_147353_1_) { } @Override - public void handleKeepAlive(CKeepAlivePacket p_147353_1_) { + public void handlePlayerAbilities(ServerboundPlayerAbilitiesPacket p_147348_1_) { } @Override - public void handlePlayerAbilities(CPlayerAbilitiesPacket p_147348_1_) { + public void handleClientInformation(ServerboundClientInformationPacket p_147352_1_) { } @Override - public void handleClientInformation(CClientSettingsPacket p_147352_1_) { + public void handleCustomPayload(ServerboundCustomPayloadPacket p_147349_1_) { } @Override - public void handleCustomPayload(CCustomPayloadPacket p_147349_1_) { + public void handleChangeDifficulty(ServerboundChangeDifficultyPacket p_217263_1_) { } @Override - public void handleChangeDifficulty(CSetDifficultyPacket p_217263_1_) { - } - - @Override - public void handleLockDifficulty(CLockDifficultyPacket p_217261_1_) { + public void handleLockDifficulty(ServerboundLockDifficultyPacket p_217261_1_) { } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/ResourceReloader.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/ResourceReloader.java index 7545a7299..229edd1d7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/ResourceReloader.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/ResourceReloader.java @@ -3,23 +3,20 @@ package de.ellpeck.actuallyadditions.mod.util; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.mod.crafting.ActuallyRecipes; -import net.minecraft.item.crafting.IRecipeType; -import net.minecraft.item.crafting.RecipeManager; -import net.minecraft.resources.DataPackRegistries; -import net.minecraft.resources.IResourceManager; -import net.minecraft.resources.IResourceManagerReloadListener; - -import java.util.List; +import net.minecraft.server.ReloadableServerResources; +import net.minecraft.server.packs.resources.ResourceManager; +import net.minecraft.server.packs.resources.ResourceManagerReloadListener; +import net.minecraft.world.item.crafting.RecipeManager; @SuppressWarnings("deprecation") -public class ResourceReloader implements IResourceManagerReloadListener { - private final DataPackRegistries data; - public ResourceReloader(DataPackRegistries dataPackRegistries) { +public class ResourceReloader implements ResourceManagerReloadListener { + private final ReloadableServerResources data; + public ResourceReloader(ReloadableServerResources dataPackRegistries) { data = dataPackRegistries; } @Override - public void onResourceManagerReload(IResourceManager pResourceManager) { + public void onResourceManagerReload(ResourceManager pResourceManager) { RecipeManager recipeManager = data.getRecipeManager(); ActuallyAdditionsAPI.EMPOWERER_RECIPES.clear(); ActuallyAdditionsAPI.EMPOWERER_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.EMPOWERING)); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/StackUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/StackUtil.java index fca43a11d..8fbb0597a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/StackUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/StackUtil.java @@ -12,8 +12,8 @@ package de.ellpeck.actuallyadditions.mod.util; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper; -import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; +import net.minecraft.core.NonNullList; +import net.minecraft.world.item.ItemStack; import net.minecraftforge.items.IItemHandler; import java.util.Collection; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java index a01efef0a..7c646177d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java @@ -10,9 +10,9 @@ package de.ellpeck.actuallyadditions.mod.util; -import com.mojang.blaze3d.matrix.MatrixStack; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.resources.I18n; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.Font; +import net.minecraft.client.resources.language.I18n; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -29,7 +29,7 @@ public final class StringUtil { // TODO: Move to official @OnlyIn(Dist.CLIENT) - public static void drawSplitString(FontRenderer renderer, String strg, int x, int y, int width, int color, boolean shadow) { + public static void drawSplitString(Font renderer, String strg, int x, int y, int width, int color, boolean shadow) { // ResourcePackList <- holds the correct way // List list = renderer.listFormattedStringToWidth(strg, width); // for (int i = 0; i < list.size(); i++) { @@ -47,7 +47,7 @@ public final class StringUtil { // } @OnlyIn(Dist.CLIENT) - public static void renderScaledString(MatrixStack matrices, FontRenderer font, String text, float x, float y, int color, boolean shadow, float scale) { + public static void renderScaledString(PoseStack matrices, Font font, String text, float x, float y, int color, boolean shadow, float scale) { matrices.pushPose(); matrices.translate(x, y, 0); matrices.scale(scale, scale, 1.0F); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/VanillaPacketDispatcher.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/VanillaPacketDispatcher.java index f6d2f9172..64940333f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/VanillaPacketDispatcher.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/VanillaPacketDispatcher.java @@ -1,27 +1,27 @@ package de.ellpeck.actuallyadditions.mod.util; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraft.world.chunk.Chunk; -import net.minecraft.world.server.ServerWorld; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.chunk.LevelChunk; public final class VanillaPacketDispatcher { //Don't call from the client. - public static void dispatchTEToNearbyPlayers(TileEntity tile) { - ServerWorld world = (ServerWorld) tile.getLevel(); - Chunk chunk = world.getChunk(tile.getBlockPos().getX() >> 4, tile.getBlockPos().getZ() >> 4); + public static void dispatchTEToNearbyPlayers(BlockEntity blockEntity) { + ServerLevel serverLevel = (ServerLevel) blockEntity.getLevel(); + LevelChunk chunk = serverLevel.getChunk(blockEntity.getBlockPos().getX() >> 4, blockEntity.getBlockPos().getZ() >> 4); - world.getChunkSource().chunkMap.getPlayers(chunk.getPos(), false).forEach(e -> { - e.connection.send(tile.getUpdatePacket()); + serverLevel.getChunkSource().chunkMap.getPlayers(chunk.getPos(), false).forEach(e -> { + e.connection.send(blockEntity.getUpdatePacket()); }); } - public static void dispatchTEToNearbyPlayers(World world, BlockPos pos) { - TileEntity tile = world.getBlockEntity(pos); - if (tile != null) { - dispatchTEToNearbyPlayers(tile); + public static void dispatchTEToNearbyPlayers(Level level, BlockPos pos) { + BlockEntity blockEntity = level.getBlockEntity(pos); + if (blockEntity != null) { + dispatchTEToNearbyPlayers(blockEntity); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java index 25ce81db8..4a0334249 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java @@ -14,26 +14,26 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditionsClient; import de.ellpeck.actuallyadditions.mod.tile.FilterSettings; import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.material.Material; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.world.World; -import net.minecraft.world.server.ServerWorld; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.util.Mth; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +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.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.material.Material; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.FakePlayer; @@ -115,7 +115,7 @@ public final class WorldUtil { return extracted; } - public static void doEnergyInteraction(TileEntity tileFrom, TileEntity tileTo, Direction sideTo, int maxTransfer) { + public static void doEnergyInteraction(BlockEntity tileFrom, BlockEntity tileTo, Direction sideTo, int maxTransfer) { if (maxTransfer > 0) { Direction opp = sideTo == null ? null @@ -134,7 +134,7 @@ public final class WorldUtil { } } - public static void doFluidInteraction(TileEntity tileFrom, TileEntity tileTo, Direction sideTo, int maxTransfer) { + public static void doFluidInteraction(BlockEntity tileFrom, BlockEntity tileTo, Direction sideTo, int maxTransfer) { if (maxTransfer > 0) { LazyOptional optionalFrom = tileFrom.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, sideTo); LazyOptional optionalTo = tileTo.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, sideTo.getOpposite()); @@ -155,12 +155,12 @@ public final class WorldUtil { * * @param positions The Positions, an array of {x, y, z} arrays containing Positions * @param block The Block - * @param world The World + * @param level The World * @return Is every block present? */ - public static boolean hasBlocksInPlacesGiven(BlockPos[] positions, Block block, World world) { + public static boolean hasBlocksInPlacesGiven(BlockPos[] positions, Block block, Level level) { for (BlockPos pos : positions) { - BlockState state = world.getBlockState(pos); + BlockState state = level.getBlockState(pos); if (!(state.getBlock() == block)) { return false; } @@ -168,16 +168,16 @@ public final class WorldUtil { return true; } - public static ItemStack useItemAtSide(Direction side, World world, BlockPos pos, ItemStack stack) { - if (world instanceof ServerWorld && StackUtil.isValid(stack) && pos != null) { + public static ItemStack useItemAtSide(Direction side, Level level, BlockPos pos, ItemStack stack) { + if (level instanceof ServerLevel && StackUtil.isValid(stack) && pos != null) { BlockPos offsetPos = pos.relative(side); - BlockState state = world.getBlockState(offsetPos); + BlockState state = level.getBlockState(offsetPos); Block block = state.getBlock(); boolean replaceable = false; //= block.canBeReplaced(world, offsetPos); //TODO //Redstone if (replaceable && stack.getItem() == Items.REDSTONE) { - world.setBlock(offsetPos, Blocks.REDSTONE_WIRE.defaultBlockState(), 2); + level.setBlock(offsetPos, Blocks.REDSTONE_WIRE.defaultBlockState(), 2); return StackUtil.shrink(stack, 1); } @@ -192,31 +192,31 @@ public final class WorldUtil { //Everything else try { - FakePlayer fake = FakePlayerFactory.getMinecraft((ServerWorld) world); + FakePlayer fake = FakePlayerFactory.getMinecraft((ServerLevel) level); if (fake.connection == null) { fake.connection = new NetHandlerSpaghettiServer(fake); } //ItemStack heldBefore = fake.getMainHandItem(); - setHandItemWithoutAnnoyingSound(fake, Hand.MAIN_HAND, stack.copy()); - BlockRayTraceResult ray = new BlockRayTraceResult(new Vector3d(0.5, 0.5, 0.5), side.getOpposite(), offsetPos, true); - fake.gameMode.useItemOn(fake, world, fake.getMainHandItem(), Hand.MAIN_HAND, ray); - ItemStack result = fake.getItemInHand(Hand.MAIN_HAND); + setHandItemWithoutAnnoyingSound(fake, InteractionHand.MAIN_HAND, stack.copy()); + BlockHitResult ray = new BlockHitResult(new Vec3(0.5, 0.5, 0.5), side.getOpposite(), offsetPos, true); + fake.gameMode.useItemOn(fake, level, fake.getMainHandItem(), InteractionHand.MAIN_HAND, ray); + ItemStack result = fake.getItemInHand(InteractionHand.MAIN_HAND); //setHandItemWithoutAnnoyingSound(fake, Hand.MAIN_HAND, heldBefore); return result; } catch (Exception e) { - ActuallyAdditions.LOGGER.error("Something that places Blocks at " + offsetPos.getX() + ", " + offsetPos.getY() + ", " + offsetPos.getZ() + " in World " + world.dimension() + " threw an Exception! Don't let that happen again!", e); + ActuallyAdditions.LOGGER.error("Something that places Blocks at " + offsetPos.getX() + ", " + offsetPos.getY() + ", " + offsetPos.getZ() + " in World " + level.dimension() + " threw an Exception! Don't let that happen again!", e); } } return stack; } - public static boolean dropItemAtSide(Direction side, World world, BlockPos pos, ItemStack stack) { + public static boolean dropItemAtSide(Direction side, Level level, BlockPos pos, ItemStack stack) { BlockPos coords = pos.relative(side); - if (world.hasChunkAt(coords)) { - ItemEntity item = new ItemEntity(world, coords.getX() + 0.5, coords.getY() + 0.5, coords.getZ() + 0.5, stack); + if (level.hasChunkAt(coords)) { + ItemEntity item = new ItemEntity(level, coords.getX() + 0.5, coords.getY() + 0.5, coords.getZ() + 0.5, stack); item.setDeltaMovement(0,0,0); - return world.addFreshEntity(item); + return level.addFreshEntity(item); } return false; } @@ -242,64 +242,64 @@ public final class WorldUtil { return state.getValue(BlockStateProperties.FACING); } - public static ArrayList getMaterialsAround(World world, BlockPos pos) { + public static ArrayList getMaterialsAround(Level level, BlockPos pos) { ArrayList blocks = new ArrayList<>(); - blocks.add(world.getBlockState(pos.relative(Direction.NORTH)).getMaterial()); - blocks.add(world.getBlockState(pos.relative(Direction.EAST)).getMaterial()); - blocks.add(world.getBlockState(pos.relative(Direction.SOUTH)).getMaterial()); - blocks.add(world.getBlockState(pos.relative(Direction.WEST)).getMaterial()); + blocks.add(level.getBlockState(pos.relative(Direction.NORTH)).getMaterial()); + blocks.add(level.getBlockState(pos.relative(Direction.EAST)).getMaterial()); + blocks.add(level.getBlockState(pos.relative(Direction.SOUTH)).getMaterial()); + blocks.add(level.getBlockState(pos.relative(Direction.WEST)).getMaterial()); return blocks; } - public static RayTraceResult getNearestPositionWithAir(World world, PlayerEntity player, int reach) { - return getMovingObjectPosWithReachDistance(world, player, reach, false, false, true); + public static HitResult getNearestPositionWithAir(Level level, Player player, int reach) { + return getMovingObjectPosWithReachDistance(level, player, reach, false, false, true); } - private static RayTraceResult getMovingObjectPosWithReachDistance(World world, PlayerEntity player, double distance, boolean p1, boolean p2, boolean p3) { - float f = player.xRot; - float f1 = player.yRot; + private static HitResult getMovingObjectPosWithReachDistance(Level level, Player player, double distance, boolean p1, boolean p2, boolean p3) { + float f = player.getXRot(); + float f1 = player.getYRot(); double d0 = player.position().x; double d1 = player.position().y + player.getEyeHeight(); double d2 = player.position().z; - Vector3d vec3 = new Vector3d(d0, d1, d2); - float f2 = MathHelper.cos(-f1 * 0.017453292F - (float) Math.PI); - float f3 = MathHelper.sin(-f1 * 0.017453292F - (float) Math.PI); - float f4 = -MathHelper.cos(-f * 0.017453292F); - float f5 = MathHelper.sin(-f * 0.017453292F); + Vec3 vec3 = new Vec3(d0, d1, d2); + float f2 = Mth.cos(-f1 * 0.017453292F - (float) Math.PI); + float f3 = Mth.sin(-f1 * 0.017453292F - (float) Math.PI); + float f4 = -Mth.cos(-f * 0.017453292F); + float f5 = Mth.sin(-f * 0.017453292F); float f6 = f3 * f4; float f7 = f2 * f4; - Vector3d vec31 = vec3.add(f6 * distance, f5 * distance, f7 * distance); + Vec3 vec31 = vec3.add(f6 * distance, f5 * distance, f7 * distance); //return world.clipWithInteractionOverride(vec3, vec31, p1, p2, p3); //TODO - return new BlockRayTraceResult(Vector3d.ZERO, Direction.DOWN, BlockPos.ZERO, false); + return new BlockHitResult(Vec3.ZERO, Direction.DOWN, BlockPos.ZERO, false); } - public static RayTraceResult getNearestBlockWithDefaultReachDistance(World world, PlayerEntity player) { - return getNearestBlockWithDefaultReachDistance(world, player, false, true, false); + public static HitResult getNearestBlockWithDefaultReachDistance(Level level, Player player) { + return getNearestBlockWithDefaultReachDistance(level, player, false, true, false); } - public static RayTraceResult getNearestBlockWithDefaultReachDistance(World world, PlayerEntity player, boolean stopOnLiquids, boolean ignoreBlockWithoutBoundingBox, boolean returnLastUncollidableBlock) { - return new BlockRayTraceResult(Vector3d.ZERO, Direction.DOWN, BlockPos.ZERO, false); //TODO + public static HitResult getNearestBlockWithDefaultReachDistance(Level level, Player player, boolean stopOnLiquids, boolean ignoreBlockWithoutBoundingBox, boolean returnLastUncollidableBlock) { + return new BlockHitResult(Vec3.ZERO, Direction.DOWN, BlockPos.ZERO, false); //TODO //return getMovingObjectPosWithReachDistance(world, player, player.getAttribute(PlayerEntity.REACH_DISTANCE).getAttributeValue(), stopOnLiquids, ignoreBlockWithoutBoundingBox, returnLastUncollidableBlock); } - public static void setHandItemWithoutAnnoyingSound(PlayerEntity player, Hand hand, ItemStack stack) { - if (hand == Hand.MAIN_HAND) { - player.inventory.items.set(player.inventory.selected, stack); - } else if (hand == Hand.OFF_HAND) { - player.inventory.offhand.set(0, stack); + public static void setHandItemWithoutAnnoyingSound(Player player, InteractionHand hand, ItemStack stack) { + if (hand == InteractionHand.MAIN_HAND) { + player.getInventory().items.set(player.getInventory().selected, stack); + } else if (hand == InteractionHand.OFF_HAND) { + player.getInventory().offhand.set(0, stack); } } //I think something is up with this, but I'm not entirely certain what. - public static float fireFakeHarvestEventsForDropChance(TileEntity caller, List drops, World world, BlockPos pos) { - if (world instanceof ServerWorld) { - FakePlayer fake = FakePlayerFactory.getMinecraft((ServerWorld) world); + public static float fireFakeHarvestEventsForDropChance(BlockEntity caller, List drops, Level level, BlockPos pos) { + if (level instanceof ServerLevel) { + FakePlayer fake = FakePlayerFactory.getMinecraft((ServerLevel) level); BlockPos tePos = caller.getBlockPos(); fake.setPos(tePos.getX() + 0.5, tePos.getY() + 0.5, tePos.getZ() + 0.5); - BlockState state = world.getBlockState(pos); + BlockState state = level.getBlockState(pos); - BreakEvent event = new BreakEvent(world, pos, state, fake); + BreakEvent event = new BreakEvent(level, pos, state, fake); if (!MinecraftForge.EVENT_BUS.post(event)) { //return ForgeEventFactory.fireBlockHarvesting(drops, world, pos, state, 0, 1, false, fake); //TODO what?! } @@ -311,43 +311,43 @@ public final class WorldUtil { * Tries to break a block as if this player had broken it. This is a complex operation. * * @param stack The player's current held stack, main hand. - * @param world The player's world. + * @param level The player's world. * @param player The player that is breaking this block. * @param pos The pos to break. * @return If the break was successful. */ - public static boolean breakExtraBlock(ItemStack stack, World world, PlayerEntity player, BlockPos pos) { - BlockState state = world.getBlockState(pos); + public static boolean breakExtraBlock(ItemStack stack, Level level, Player player, BlockPos pos) { + BlockState state = level.getBlockState(pos); Block block = state.getBlock(); if (player.isCreative()) { - if (block.removedByPlayer(state, world, pos, player, false, state.getFluidState())) { - block.destroy(world, pos, state); + if (block.onDestroyedByPlayer(state, level, pos, player, false, state.getFluidState())) { + block.destroy(level, pos, state); } // send update to client - if (!world.isClientSide) { + if (!level.isClientSide) { //((ServerPlayerEntity) player).connection.send(new SPacketBlockChange(world, pos)); //TODO dunno what this is } return true; } // callback to the tool the player uses. Called on both sides. This damages the tool n stuff. - stack.mineBlock(world, state, pos, player); + stack.mineBlock(level, state, pos, player); // server sided handling - if (!world.isClientSide) { + if (!level.isClientSide) { // send the blockbreak event - int xp = ForgeHooks.onBlockBreakEvent(world, ((ServerPlayerEntity) player).gameMode.getGameModeForPlayer(), (ServerPlayerEntity) player, pos); + int xp = ForgeHooks.onBlockBreakEvent(level, ((ServerPlayer) player).gameMode.getGameModeForPlayer(), (ServerPlayer) player, pos); if (xp == -1) { return false; } - TileEntity tileEntity = world.getBlockEntity(pos); - if (block.removedByPlayer(state, world, pos, player, true, state.getFluidState())) { // boolean is if block can be harvested, checked above - block.destroy(world, pos, state); - block.playerDestroy(world, player, pos, state, tileEntity, stack); - block.popExperience(((ServerWorld) world), pos, xp); + BlockEntity blockEntity = level.getBlockEntity(pos); + if (block.onDestroyedByPlayer(state, level, pos, player, true, state.getFluidState())) { // boolean is if block can be harvested, checked above + block.destroy(level, pos, state); + block.playerDestroy(level, player, pos, state, blockEntity, stack); + block.popExperience(((ServerLevel) level), pos, xp); } // always send block update to client @@ -360,12 +360,12 @@ public final class WorldUtil { // the code above, executed on the server, sends a block-updates that give us the correct state of the block we destroy. // following code can be found in PlayerControllerMP.onPlayerDestroyBlock - world.levelEvent(2001, pos, Block.getId(state)); - if (block.removedByPlayer(state, world, pos, player, true, state.getFluidState())) { - block.destroy(world, pos, state); + level.levelEvent(2001, pos, Block.getId(state)); + if (block.onDestroyedByPlayer(state, level, pos, player, true, state.getFluidState())) { + block.destroy(level, pos, state); } // callback to the tool - stack.mineBlock(world, state, pos, player); + stack.mineBlock(level, state, pos, player); // send an update to the server, so we get an update back diff --git a/src/main/java/de/ellpeck/actuallyadditions/registration/AABlockReg.java b/src/main/java/de/ellpeck/actuallyadditions/registration/AABlockReg.java index 6b1d59789..a5529448d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/registration/AABlockReg.java +++ b/src/main/java/de/ellpeck/actuallyadditions/registration/AABlockReg.java @@ -2,29 +2,29 @@ package de.ellpeck.actuallyadditions.registration; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; -import net.minecraft.block.Block; -import net.minecraft.item.BlockItem; -import net.minecraft.item.Item; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityType; -import net.minecraftforge.fml.RegistryObject; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.Item; +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.minecraftforge.registries.RegistryObject; import javax.annotation.Nonnull; import java.util.Objects; import java.util.function.Function; import java.util.function.Supplier; -public class AABlockReg implements Supplier { +public class AABlockReg implements Supplier { private final String name; private RegistryObject block; private RegistryObject item; - private RegistryObject> tileEntityType; + private RegistryObject> tileEntityType; - public AABlockReg(String name, Supplier blockSupplier, Function itemSupplier, Supplier tileSupplier) { + public AABlockReg(String name, Supplier blockSupplier, Function itemSupplier, BlockEntityType.BlockEntitySupplier tileSupplier) { this.name = name; this.block = ActuallyBlocks.BLOCKS.register(name, blockSupplier); this.item = ActuallyItems.ITEMS.register(name, () -> itemSupplier.apply(block.get())); - this.tileEntityType = ActuallyBlocks.TILES.register(name, () -> TileEntityType.Builder.of(tileSupplier, block.get()).build(null)); + this.tileEntityType = ActuallyBlocks.TILES.register(name, () -> BlockEntityType.Builder.of(tileSupplier, block.get()).build(null)); } public AABlockReg(String name, Supplier blockSupplier, Function itemSupplier) { this.name = name; @@ -59,7 +59,7 @@ public class AABlockReg i } @Nonnull - public TileEntityType getTileEntityType() { return Objects.requireNonNull(tileEntityType.get());} + public BlockEntityType getTileEntityType() { return Objects.requireNonNull(tileEntityType.get());} public static class BlockBuilder { @@ -67,7 +67,7 @@ public class AABlockReg i private Supplier blockSupplier; private Function itemSupplier = (b) -> new BlockItem(b, ActuallyItems.defaultProps()); private boolean hasTile = false; - private Supplier> tileSupplier; + private Supplier> tileSupplier; private BlockBuilder(String nameIn, Supplier blockSupplierIn) { this.name = nameIn; @@ -84,7 +84,7 @@ public class AABlockReg i return this; } - public BlockBuilder tile(Supplier> tileSupplierIn) { + public BlockBuilder tile(Supplier> tileSupplierIn) { tileSupplier = tileSupplierIn; hasTile = true; diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 4899be19f..1f7524923 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -1,6 +1,6 @@ modLoader="javafml" -loaderVersion="[36,)" +loaderVersion="[40,)" license="MIT" [[mods]] modId="actuallyadditions" @@ -16,13 +16,13 @@ Do you want Automation? Wireless Transport? Better Machines? A cup o' Coffee? Ch [[dependencies.actuallyadditions]] modId="forge" mandatory=true - versionRange="[36,)" + versionRange="[40,)" ordering="NONE" side="BOTH" [[dependencies.actuallyadditions]] modId="minecraft" mandatory=true - versionRange="[1.16.5,1.17)" + versionRange="[1.18.2,1.21)" ordering="NONE" side="BOTH"