Update Iron Chests to 1.17.1, and implemented trapped versions of every chest. Silver Chests have been removed.

This commit is contained in:
Alexander Behrhof 2021-11-26 19:51:46 -05:00
parent 94aa7cbbd6
commit b2f78dbdb5
120 changed files with 2236 additions and 1107 deletions

View File

@ -9,6 +9,9 @@ max_line_length = 500
# tab_width = 4
# ij_continuation_indent_size = 4
[*.json]
indent_size = 2
[*.java]
indent_size = 2
# tab_width = 8

View File

@ -6,7 +6,7 @@ buildscript {
jcenter()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.24', changing: true
}
}

View File

@ -12,8 +12,8 @@ minecraft_range=[1.17.1,1.18)
# Forge Version Information
loader_range=[33.0,)
forge_version=37.0.13
forge_range=[37.0.13,)
forge_version=37.0.126
forge_range=[37.0.126,)
# Mappings Information
mappings_version=1.17.1

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions-snapshots/gradle-7.2-20210702220150+0000-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

269
gradlew vendored
View File

@ -1,7 +1,7 @@
#!/usr/bin/env sh
#!/bin/sh
#
# Copyright 2015 the original author or authors.
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -17,67 +17,101 @@
#
##############################################################################
##
## 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='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
MAX_FD=maximum
warn () {
echo "$*"
}
} >&2
die () {
echo
echo "$*"
echo
exit 1
}
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MSYS* | MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD="$JAVA_HOME/bin/java"
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@ -98,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
@ -106,80 +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 or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
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=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
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" )
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" "$@"

View File

@ -1,42 +1,44 @@
7296cff6a6eca7b425e197d3fb7888e6fa3cd5dd data/ironchest/advancements/recipes/ironchest/chests/copper_iron_chest.json
64007c8c3c70a2d994bc386cc4a7f7f7fc8dd51b data/ironchest/advancements/recipes/ironchest/chests/copper_silver_chest.json
365d1d3c70e95c535001aa21e2f0d28480c976e2 data/ironchest/advancements/recipes/ironchest/chests/diamond_crystal_chest.json
41aa40a17cfee1c9fa9e562bc7b00f2308f294e2 data/ironchest/advancements/recipes/ironchest/chests/diamond_obsidian_chest.json
14cfaa8fa7e949d583f5f0cd1babf9bc572d52f1 data/ironchest/advancements/recipes/ironchest/chests/diamond_obsidian_chest.json
82f46e3026d29292107f3508efe9f51ccd04dd9f data/ironchest/advancements/recipes/ironchest/chests/gold_diamond_chest.json
b5137f5fe7c01b7d17e8fdb6e3566259495b6e9e data/ironchest/advancements/recipes/ironchest/chests/iron_gold_chest.json
d5188d8cab8209e2c2f6ad50b488a6508c1a21cb data/ironchest/advancements/recipes/ironchest/chests/iron_silver_chest.json
f49760070cb2123df231396d273bae1ca7f23075 data/ironchest/advancements/recipes/ironchest/chests/silver_diamond_chest.json
574f5b8a6828085b8f5dee0182d0b8a1c9adc7b5 data/ironchest/advancements/recipes/ironchest/chests/silver_gold_chest.json
3e82879f9cdb33048a4954e227dc1cbe74e99b88 data/ironchest/advancements/recipes/ironchest/chests/vanilla_copper_chest.json
1116c768d875a33c025328b6c5fb3575af8c3a7d data/ironchest/advancements/recipes/ironchest/chests/vanilla_dirt_chest.json
7d082e5fba21b16e47a2b18a056c3dd5f23446f7 data/ironchest/advancements/recipes/ironchest/chests/trapped_copper_chest.json
142c7602ee97d7ff8d90be8a079c9194399823ba data/ironchest/advancements/recipes/ironchest/chests/trapped_crystal_chest.json
647b32ea931ab295e543ff2c9764c54f8d7c60bc data/ironchest/advancements/recipes/ironchest/chests/trapped_diamond_chest.json
face9559d8ebe33ba328907c7972008500a0e479 data/ironchest/advancements/recipes/ironchest/chests/trapped_dirt_chest.json
5daf3624699118447c3e0a5301d2867e1316d496 data/ironchest/advancements/recipes/ironchest/chests/trapped_gold_chest.json
672915e6909fab99e26a279cc0fb602194ee0fbd data/ironchest/advancements/recipes/ironchest/chests/trapped_iron_chest.json
a18efb9a37526e310f8fd0c416afe5b9e0cdb60a data/ironchest/advancements/recipes/ironchest/chests/trapped_obsidian_chest.json
9af9bbe7112085d5bf3506ff5382bca94583ba87 data/ironchest/advancements/recipes/ironchest/chests/vanilla_copper_chest.json
fe5a597181eb84fdb45abedc4acc1e3851408fd5 data/ironchest/advancements/recipes/ironchest/chests/vanilla_dirt_chest.json
2b35db8b04b0d148e17560f71ca159acdda5d44c data/ironchest/advancements/recipes/ironchest/chests/vanilla_iron_chest.json
5f8f57815f58b45b193e9a660a13824ca545ad7b data/ironchest/advancements/recipes/ironchest/upgrades/copper_to_iron_chest_upgrade.json
4d18ed56e5c25472809d5df677d8ccf8cfb439e6 data/ironchest/advancements/recipes/ironchest/upgrades/copper_to_silver_chest_upgrade.json
321e75477afceb6f187f15cf1f7568c6d31d6c87 data/ironchest/advancements/recipes/ironchest/upgrades/diamond_to_crystal_chest_upgrade.json
17ed7dbb2c69090dacd0efea29dbaf949a4e876d data/ironchest/advancements/recipes/ironchest/upgrades/diamond_to_obsidian_chest_upgrade.json
13c40784d2a492f1ea186962d08fc2fb74250cba data/ironchest/advancements/recipes/ironchest/upgrades/gold_to_diamond_chest_upgrade.json
9a594bfd16844d98c31e3b15932142d335cff104 data/ironchest/advancements/recipes/ironchest/upgrades/iron_to_gold_chest_upgrade.json
7ae2982f918d4cfb9ce23235f059a272eb0201d8 data/ironchest/advancements/recipes/ironchest/upgrades/silver_to_gold_chest_upgrade.json
160649754eab1cf0e5c51bb0fb86e7da3591aa04 data/ironchest/advancements/recipes/ironchest/upgrades/wood_to_copper_chest_upgrade.json
6045f50aafba06668e0f221d3e7d62827a3ed368 data/ironchest/advancements/recipes/ironchest/upgrades/wood_to_iron_chest_upgrade.json
db1c86a602b40793abc52cebf70fad24cf6409d9 data/ironchest/recipes/chests/copper_iron_chest.json
378066487ddb32d47b0bd66bce156b4a41fa93d6 data/ironchest/recipes/chests/copper_silver_chest.json
5b6d438390722b031bb97e4c5501449c18c4bbca data/ironchest/recipes/chests/diamond_crystal_chest.json
9f141ad7e75e7ac70b175129c058180da5e04ab7 data/ironchest/recipes/chests/diamond_obsidian_chest.json
00cad996bebebe268e2e0a4c59c024127c6f4a06 data/ironchest/recipes/chests/gold_diamond_chest.json
401d6ab7ffb4e815dc1a6562dd70bc7bd1f6d524 data/ironchest/recipes/chests/iron_gold_chest.json
27a78a2d11f8a8cd82ee7560eb64bae5ed61cdaf data/ironchest/recipes/chests/iron_silver_chest.json
f9187402fa4f5768064b0f5071709048c1bf0d24 data/ironchest/recipes/chests/silver_diamond_chest.json
e3d600f97882251c94f14c0bffa63f0b5ff81350 data/ironchest/recipes/chests/silver_gold_chest.json
75b39983c0c9f2ca8218d92944d7a7f4690836cc data/ironchest/recipes/chests/trapped_copper_chest.json
bea47276cee81c561d994e74676c8c395d2beb16 data/ironchest/recipes/chests/trapped_crystal_chest.json
455756f75eb3c1461f8b9b18685ca9c9b85b7715 data/ironchest/recipes/chests/trapped_diamond_chest.json
1025e3d03c72c912241eac954cd1fe73b3afe32d data/ironchest/recipes/chests/trapped_dirt_chest.json
be5121a75023e6b3498c1f5f70a10d0018462933 data/ironchest/recipes/chests/trapped_gold_chest.json
66d6b68613ec306bde252f802d46373c4df540c9 data/ironchest/recipes/chests/trapped_iron_chest.json
20846ca266bf0374f5abe21c4957566f5e065b6e data/ironchest/recipes/chests/trapped_obsidian_chest.json
c4ce3a2d83ee91bc30b7f88fef054b6331f71d8d data/ironchest/recipes/chests/vanilla_copper_chest.json
6a2a1c0af03d5d3ea12ee4ee2f9ccebbb4f86196 data/ironchest/recipes/chests/vanilla_dirt_chest.json
12878399ae3ea231cd4b73f5883cd741938bbd5f data/ironchest/recipes/chests/vanilla_iron_chest.json
4511348163faf1009f48d5f7fa0f158aab35a971 data/ironchest/recipes/upgrades/copper_to_iron_chest_upgrade.json
476f824dc9b7721cfacf02d81472d2c2ecbe35ba data/ironchest/recipes/upgrades/copper_to_silver_chest_upgrade.json
e25f174a4a36d367d96d2e61561d526e83a5e155 data/ironchest/recipes/upgrades/diamond_to_crystal_chest_upgrade.json
9f0931b4d648fcea11dd2a7953d8e09df623d539 data/ironchest/recipes/upgrades/diamond_to_obsidian_chest_upgrade.json
793e25f4ae9a93636292036ceb9b0aaa821d299b data/ironchest/recipes/upgrades/gold_to_diamond_chest_upgrade.json
1b70eef2a303cf31300a5a5bc20780f9cea7e444 data/ironchest/recipes/upgrades/iron_to_gold_chest_upgrade.json
aaa8c0135a8ca7c2146337d0a42e7fb84015e4c4 data/ironchest/recipes/upgrades/silver_to_gold_chest_upgrade.json
058c4081d18ddcff952f218a1e1e31ea1c26fa04 data/ironchest/recipes/upgrades/wood_to_copper_chest_upgrade.json
1098d6ebd2e6e1065324fd6314481fe40df132e7 data/ironchest/recipes/upgrades/wood_to_iron_chest_upgrade.json

View File

@ -1,47 +0,0 @@
{
"advancements": [
{
"conditions": [
{
"value": {
"tag": "forge:ingots/silver",
"type": "forge:tag_empty"
},
"type": "forge:not"
}
],
"advancement": {
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"ironchest:chests/copper_silver_chest"
]
},
"criteria": {
"has_item": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "forge:ingots/silver"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "ironchest:chests/copper_silver_chest"
}
}
},
"requirements": [
[
"has_item",
"has_the_recipe"
]
]
}
}
]
}

View File

@ -11,7 +11,9 @@
"conditions": {
"items": [
{
"item": "minecraft:obsidian"
"items": [
"minecraft:obsidian"
]
}
]
}

View File

@ -1,47 +0,0 @@
{
"advancements": [
{
"conditions": [
{
"value": {
"tag": "forge:ingots/silver",
"type": "forge:tag_empty"
},
"type": "forge:not"
}
],
"advancement": {
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"ironchest:chests/iron_silver_chest"
]
},
"criteria": {
"has_item": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "forge:ingots/silver"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "ironchest:chests/iron_silver_chest"
}
}
},
"requirements": [
[
"has_item",
"has_the_recipe"
]
]
}
}
]
}

View File

@ -1,47 +0,0 @@
{
"advancements": [
{
"conditions": [
{
"value": {
"tag": "forge:ingots/silver",
"type": "forge:tag_empty"
},
"type": "forge:not"
}
],
"advancement": {
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"ironchest:chests/silver_diamond_chest"
]
},
"criteria": {
"has_item": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "forge:gems/diamond"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "ironchest:chests/silver_diamond_chest"
}
}
},
"requirements": [
[
"has_item",
"has_the_recipe"
]
]
}
}
]
}

View File

@ -1,47 +0,0 @@
{
"advancements": [
{
"conditions": [
{
"value": {
"tag": "forge:ingots/silver",
"type": "forge:tag_empty"
},
"type": "forge:not"
}
],
"advancement": {
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"ironchest:chests/silver_gold_chest"
]
},
"criteria": {
"has_item": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "forge:ingots/silver"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "ironchest:chests/silver_gold_chest"
}
}
},
"requirements": [
[
"has_item",
"has_the_recipe"
]
]
}
}
]
}

View File

@ -0,0 +1,34 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"ironchest:chests/trapped_copper_chest"
]
},
"criteria": {
"has_tripwire_hook": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": [
"minecraft:tripwire_hook"
]
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "ironchest:chests/trapped_copper_chest"
}
}
},
"requirements": [
[
"has_tripwire_hook",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,34 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"ironchest:chests/trapped_crystal_chest"
]
},
"criteria": {
"has_tripwire_hook": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": [
"minecraft:tripwire_hook"
]
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "ironchest:chests/trapped_crystal_chest"
}
}
},
"requirements": [
[
"has_tripwire_hook",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,34 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"ironchest:chests/trapped_diamond_chest"
]
},
"criteria": {
"has_tripwire_hook": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": [
"minecraft:tripwire_hook"
]
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "ironchest:chests/trapped_diamond_chest"
}
}
},
"requirements": [
[
"has_tripwire_hook",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,34 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"ironchest:chests/trapped_dirt_chest"
]
},
"criteria": {
"has_tripwire_hook": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": [
"minecraft:tripwire_hook"
]
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "ironchest:chests/trapped_dirt_chest"
}
}
},
"requirements": [
[
"has_tripwire_hook",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,34 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"ironchest:chests/trapped_gold_chest"
]
},
"criteria": {
"has_tripwire_hook": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": [
"minecraft:tripwire_hook"
]
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "ironchest:chests/trapped_gold_chest"
}
}
},
"requirements": [
[
"has_tripwire_hook",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,34 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"ironchest:chests/trapped_iron_chest"
]
},
"criteria": {
"has_tripwire_hook": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": [
"minecraft:tripwire_hook"
]
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "ironchest:chests/trapped_iron_chest"
}
}
},
"requirements": [
[
"has_tripwire_hook",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,34 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"ironchest:chests/trapped_obsidian_chest"
]
},
"criteria": {
"has_tripwire_hook": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": [
"minecraft:tripwire_hook"
]
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "ironchest:chests/trapped_obsidian_chest"
}
}
},
"requirements": [
[
"has_tripwire_hook",
"has_the_recipe"
]
]
}

View File

@ -4,7 +4,7 @@
"conditions": [
{
"value": {
"tag": "forge:ingots/silver",
"tag": "forge:ingots/copper",
"type": "forge:tag_empty"
},
"type": "forge:not"

View File

@ -11,7 +11,9 @@
"conditions": {
"items": [
{
"item": "minecraft:dirt"
"items": [
"minecraft:dirt"
]
}
]
}

View File

@ -1,59 +0,0 @@
{
"advancements": [
{
"conditions": [
{
"values": [
{
"value": {
"tag": "forge:ingots/copper",
"type": "forge:tag_empty"
},
"type": "forge:not"
},
{
"value": {
"tag": "forge:ingots/silver",
"type": "forge:tag_empty"
},
"type": "forge:not"
}
],
"type": "forge:and"
}
],
"advancement": {
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"ironchest:upgrades/copper_to_silver_chest_upgrade"
]
},
"criteria": {
"has_item": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "forge:ingots/copper"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "ironchest:upgrades/copper_to_silver_chest_upgrade"
}
}
},
"requirements": [
[
"has_item",
"has_the_recipe"
]
]
}
}
]
}

View File

@ -1,47 +0,0 @@
{
"advancements": [
{
"conditions": [
{
"value": {
"tag": "forge:ingots/silver",
"type": "forge:tag_empty"
},
"type": "forge:not"
}
],
"advancement": {
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"ironchest:upgrades/silver_to_gold_chest_upgrade"
]
},
"criteria": {
"has_item": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "forge:glass"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "ironchest:upgrades/silver_to_gold_chest_upgrade"
}
}
},
"requirements": [
[
"has_item",
"has_the_recipe"
]
]
}
}
]
}

View File

@ -1,35 +0,0 @@
{
"type": "forge:conditional",
"recipes": [
{
"conditions": [
{
"value": {
"tag": "forge:ingots/silver",
"type": "forge:tag_empty"
},
"type": "forge:not"
}
],
"recipe": {
"type": "minecraft:crafting_shaped",
"pattern": [
"MMM",
"MSM",
"MMM"
],
"key": {
"M": {
"tag": "forge:ingots/silver"
},
"S": {
"item": "ironchest:copper_chest"
}
},
"result": {
"item": "ironchest:silver_chest"
}
}
}
]
}

View File

@ -1,38 +0,0 @@
{
"type": "forge:conditional",
"recipes": [
{
"conditions": [
{
"value": {
"tag": "forge:ingots/silver",
"type": "forge:tag_empty"
},
"type": "forge:not"
}
],
"recipe": {
"type": "minecraft:crafting_shaped",
"pattern": [
"MGM",
"MSM",
"MGM"
],
"key": {
"M": {
"tag": "forge:ingots/silver"
},
"S": {
"item": "ironchest:iron_chest"
},
"G": {
"tag": "forge:glass"
}
},
"result": {
"item": "ironchest:silver_chest"
}
}
}
]
}

View File

@ -1,38 +0,0 @@
{
"type": "forge:conditional",
"recipes": [
{
"conditions": [
{
"value": {
"tag": "forge:ingots/copper",
"type": "forge:tag_empty"
},
"type": "forge:not"
}
],
"recipe": {
"type": "minecraft:crafting_shaped",
"pattern": [
"GGG",
"GSG",
"MMM"
],
"key": {
"M": {
"tag": "forge:gems/diamond"
},
"S": {
"item": "ironchest:silver_chest"
},
"G": {
"tag": "forge:glass"
}
},
"result": {
"item": "ironchest:diamond_chest"
}
}
}
]
}

View File

@ -1,38 +0,0 @@
{
"type": "forge:conditional",
"recipes": [
{
"conditions": [
{
"value": {
"tag": "forge:ingots/copper",
"type": "forge:tag_empty"
},
"type": "forge:not"
}
],
"recipe": {
"type": "minecraft:crafting_shaped",
"pattern": [
"MGM",
"GSG",
"MGM"
],
"key": {
"M": {
"tag": "forge:ingots/gold"
},
"S": {
"item": "ironchest:silver_chest"
},
"G": {
"tag": "forge:glass"
}
},
"result": {
"item": "ironchest:gold_chest"
}
}
}
]
}

View File

@ -0,0 +1,14 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "ironchest:copper_chest"
},
{
"item": "minecraft:tripwire_hook"
}
],
"result": {
"item": "ironchest:trapped_copper_chest"
}
}

View File

@ -0,0 +1,14 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "ironchest:crystal_chest"
},
{
"item": "minecraft:tripwire_hook"
}
],
"result": {
"item": "ironchest:trapped_crystal_chest"
}
}

View File

@ -0,0 +1,14 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "ironchest:diamond_chest"
},
{
"item": "minecraft:tripwire_hook"
}
],
"result": {
"item": "ironchest:trapped_diamond_chest"
}
}

View File

@ -0,0 +1,14 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "ironchest:dirt_chest"
},
{
"item": "minecraft:tripwire_hook"
}
],
"result": {
"item": "ironchest:trapped_dirt_chest"
}
}

View File

@ -0,0 +1,14 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "ironchest:gold_chest"
},
{
"item": "minecraft:tripwire_hook"
}
],
"result": {
"item": "ironchest:trapped_gold_chest"
}
}

View File

@ -0,0 +1,14 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "ironchest:iron_chest"
},
{
"item": "minecraft:tripwire_hook"
}
],
"result": {
"item": "ironchest:trapped_iron_chest"
}
}

View File

@ -0,0 +1,14 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "ironchest:obsidian_chest"
},
{
"item": "minecraft:tripwire_hook"
}
],
"result": {
"item": "ironchest:trapped_obsidian_chest"
}
}

View File

@ -1,47 +0,0 @@
{
"type": "forge:conditional",
"recipes": [
{
"conditions": [
{
"values": [
{
"value": {
"tag": "forge:ingots/copper",
"type": "forge:tag_empty"
},
"type": "forge:not"
},
{
"value": {
"tag": "forge:ingots/silver",
"type": "forge:tag_empty"
},
"type": "forge:not"
}
],
"type": "forge:and"
}
],
"recipe": {
"type": "minecraft:crafting_shaped",
"pattern": [
"MMM",
"MSM",
"MMM"
],
"key": {
"M": {
"tag": "forge:ingots/silver"
},
"S": {
"tag": "forge:ingots/copper"
}
},
"result": {
"item": "ironchest:copper_to_silver_chest_upgrade"
}
}
}
]
}

View File

@ -1,38 +0,0 @@
{
"type": "forge:conditional",
"recipes": [
{
"conditions": [
{
"value": {
"tag": "forge:ingots/silver",
"type": "forge:tag_empty"
},
"type": "forge:not"
}
],
"recipe": {
"type": "minecraft:crafting_shaped",
"pattern": [
"MGM",
"GSG",
"MGM"
],
"key": {
"M": {
"tag": "forge:ingots/gold"
},
"S": {
"tag": "forge:ingots/silver"
},
"G": {
"tag": "forge:glass"
}
},
"result": {
"item": "ironchest:silver_to_gold_chest_upgrade"
}
}
}
]
}

View File

@ -64,7 +64,6 @@ public class IronChests {
MenuScreens.register(IronChestsContainerTypes.DIAMOND_CHEST.get(), IronChestScreen::new);
MenuScreens.register(IronChestsContainerTypes.CRYSTAL_CHEST.get(), IronChestScreen::new);
MenuScreens.register(IronChestsContainerTypes.COPPER_CHEST.get(), IronChestScreen::new);
MenuScreens.register(IronChestsContainerTypes.SILVER_CHEST.get(), IronChestScreen::new);
MenuScreens.register(IronChestsContainerTypes.OBSIDIAN_CHEST.get(), IronChestScreen::new);
MenuScreens.register(IronChestsContainerTypes.DIRT_CHEST.get(), IronChestScreen::new);
@ -72,10 +71,17 @@ public class IronChests {
BlockEntityRenderers.register(IronChestsBlockEntityTypes.GOLD_CHEST.get(), IronChestRenderer::new);
BlockEntityRenderers.register(IronChestsBlockEntityTypes.DIAMOND_CHEST.get(), IronChestRenderer::new);
BlockEntityRenderers.register(IronChestsBlockEntityTypes.COPPER_CHEST.get(), IronChestRenderer::new);
BlockEntityRenderers.register(IronChestsBlockEntityTypes.SILVER_CHEST.get(), IronChestRenderer::new);
BlockEntityRenderers.register(IronChestsBlockEntityTypes.CRYSTAL_CHEST.get(), IronChestRenderer::new);
BlockEntityRenderers.register(IronChestsBlockEntityTypes.OBSIDIAN_CHEST.get(), IronChestRenderer::new);
BlockEntityRenderers.register(IronChestsBlockEntityTypes.DIRT_CHEST.get(), IronChestRenderer::new);
BlockEntityRenderers.register(IronChestsBlockEntityTypes.TRAPPED_IRON_CHEST.get(), IronChestRenderer::new);
BlockEntityRenderers.register(IronChestsBlockEntityTypes.TRAPPED_GOLD_CHEST.get(), IronChestRenderer::new);
BlockEntityRenderers.register(IronChestsBlockEntityTypes.TRAPPED_DIAMOND_CHEST.get(), IronChestRenderer::new);
BlockEntityRenderers.register(IronChestsBlockEntityTypes.TRAPPED_COPPER_CHEST.get(), IronChestRenderer::new);
BlockEntityRenderers.register(IronChestsBlockEntityTypes.TRAPPED_CRYSTAL_CHEST.get(), IronChestRenderer::new);
BlockEntityRenderers.register(IronChestsBlockEntityTypes.TRAPPED_OBSIDIAN_CHEST.get(), IronChestRenderer::new);
BlockEntityRenderers.register(IronChestsBlockEntityTypes.TRAPPED_DIRT_CHEST.get(), IronChestRenderer::new);
}
private void setup(final FMLCommonSetupEvent event) {

View File

@ -16,24 +16,43 @@ public class IronChestsModels {
public static final ResourceLocation GOLD_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/gold_chest");
public static final ResourceLocation DIAMOND_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/diamond_chest");
public static final ResourceLocation COPPER_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/copper_chest");
public static final ResourceLocation SILVER_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/silver_chest");
public static final ResourceLocation CRYSTAL_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/crystal_chest");
public static final ResourceLocation OBSIDIAN_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/obsidian_chest");
public static final ResourceLocation DIRT_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/dirt_chest");
public static final ResourceLocation VANILLA_CHEST_LOCATION = new ResourceLocation("entity/chest/normal");
public static ResourceLocation chooseChestTexture(IronChestsTypes type) {
return switch (type) {
case IRON -> IRON_CHEST_LOCATION;
case GOLD -> GOLD_CHEST_LOCATION;
case DIAMOND -> DIAMOND_CHEST_LOCATION;
case COPPER -> COPPER_CHEST_LOCATION;
case SILVER -> SILVER_CHEST_LOCATION;
case CRYSTAL -> CRYSTAL_CHEST_LOCATION;
case OBSIDIAN -> OBSIDIAN_CHEST_LOCATION;
case DIRT -> DIRT_CHEST_LOCATION;
default -> VANILLA_CHEST_LOCATION;
};
public static final ResourceLocation TRAPPED_IRON_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/trapped_iron_chest");
public static final ResourceLocation TRAPPED_GOLD_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/trapped_gold_chest");
public static final ResourceLocation TRAPPED_DIAMOND_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/trapped_diamond_chest");
public static final ResourceLocation TRAPPED_COPPER_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/trapped_copper_chest");
public static final ResourceLocation TRAPPED_CRYSTAL_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/trapped_crystal_chest");
public static final ResourceLocation TRAPPED_OBSIDIAN_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/trapped_obsidian_chest");
public static final ResourceLocation TRAPPED_DIRT_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/trapped_dirt_chest");
public static final ResourceLocation TRAPPED_VANILLA_CHEST_LOCATION = new ResourceLocation("entity/chest/trapped");
public static ResourceLocation chooseChestTexture(IronChestsTypes type, boolean trapped) {
if (trapped)
return switch (type) {
case IRON -> TRAPPED_IRON_CHEST_LOCATION;
case GOLD -> TRAPPED_GOLD_CHEST_LOCATION;
case DIAMOND -> TRAPPED_DIAMOND_CHEST_LOCATION;
case COPPER -> TRAPPED_COPPER_CHEST_LOCATION;
case CRYSTAL -> TRAPPED_CRYSTAL_CHEST_LOCATION;
case OBSIDIAN -> TRAPPED_OBSIDIAN_CHEST_LOCATION;
case DIRT -> TRAPPED_DIRT_CHEST_LOCATION;
default -> TRAPPED_VANILLA_CHEST_LOCATION;
};
else
return switch (type) {
case IRON -> IRON_CHEST_LOCATION;
case GOLD -> GOLD_CHEST_LOCATION;
case DIAMOND -> DIAMOND_CHEST_LOCATION;
case COPPER -> COPPER_CHEST_LOCATION;
case CRYSTAL -> CRYSTAL_CHEST_LOCATION;
case OBSIDIAN -> OBSIDIAN_CHEST_LOCATION;
case DIRT -> DIRT_CHEST_LOCATION;
default -> VANILLA_CHEST_LOCATION;
};
}
@SubscribeEvent
@ -46,9 +65,16 @@ public class IronChestsModels {
event.addSprite(GOLD_CHEST_LOCATION);
event.addSprite(DIAMOND_CHEST_LOCATION);
event.addSprite(COPPER_CHEST_LOCATION);
event.addSprite(SILVER_CHEST_LOCATION);
event.addSprite(CRYSTAL_CHEST_LOCATION);
event.addSprite(OBSIDIAN_CHEST_LOCATION);
event.addSprite(DIRT_CHEST_LOCATION);
event.addSprite(TRAPPED_IRON_CHEST_LOCATION);
event.addSprite(TRAPPED_GOLD_CHEST_LOCATION);
event.addSprite(TRAPPED_DIAMOND_CHEST_LOCATION);
event.addSprite(TRAPPED_COPPER_CHEST_LOCATION);
event.addSprite(TRAPPED_CRYSTAL_CHEST_LOCATION);
event.addSprite(TRAPPED_OBSIDIAN_CHEST_LOCATION);
event.addSprite(TRAPPED_DIRT_CHEST_LOCATION);
}
}

View File

@ -1,15 +1,15 @@
package com.progwml6.ironchest.client.render;
import com.google.common.primitives.SignedBytes;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.progwml6.ironchest.IronChestsClientEvents;
import com.progwml6.ironchest.client.model.IronChestsModels;
import com.progwml6.ironchest.client.model.inventory.ModelItem;
import com.progwml6.ironchest.common.block.AbstractIronChestBlock;
import com.progwml6.ironchest.common.block.entity.CrystalChestBlockEntity;
import com.progwml6.ironchest.common.block.regular.AbstractIronChestBlock;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.entity.AbstractIronChestBlockEntity;
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
import com.progwml6.ironchest.common.block.entity.ICrystalChest;
import com.progwml6.ironchest.common.block.trapped.entity.AbstractTrappedIronChestBlockEntity;
import it.unimi.dsi.fastutil.floats.Float2FloatFunction;
import it.unimi.dsi.fastutil.ints.Int2IntFunction;
import net.minecraft.client.model.geom.PartPose;
@ -17,22 +17,20 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder;
import net.minecraft.client.model.geom.builders.LayerDefinition;
import net.minecraft.client.model.geom.builders.MeshDefinition;
import net.minecraft.client.model.geom.builders.PartDefinition;
import net.minecraft.client.renderer.block.model.ItemTransforms;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Sheets;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.ItemEntityRenderer;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.resources.model.Material;
import net.minecraft.client.renderer.blockentity.BrightnessCombiner;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.entity.LidBlockEntity;
import net.minecraft.world.level.block.entity.BlockEntity;
@ -54,8 +52,6 @@ public class IronChestRenderer<T extends BlockEntity & LidBlockEntity> implement
private final ModelPart bottom;
private final ModelPart lock;
private static ItemEntity customItem;
private static ItemEntityRenderer itemRenderer;
private final BlockEntityRenderDispatcher renderer;
private static final List<ModelItem> MODEL_ITEMS = Arrays.asList(
@ -129,7 +125,9 @@ public class IronChestRenderer<T extends BlockEntity & LidBlockEntity> implement
int brightness = neighborCombineResult.<Int2IntFunction>apply(new BrightnessCombiner<>()).applyAsInt(combinedLightIn);
Material material = new Material(Sheets.CHEST_SHEET, IronChestsModels.chooseChestTexture(chestType));
boolean trapped = tileEntityIn instanceof AbstractTrappedIronChestBlockEntity;
Material material = new Material(Sheets.CHEST_SHEET, IronChestsModels.chooseChestTexture(chestType, trapped));
VertexConsumer vertexConsumer = material.buffer(bufferSource, RenderType::entityCutout);
@ -137,16 +135,11 @@ public class IronChestRenderer<T extends BlockEntity & LidBlockEntity> implement
poseStack.popPose();
if (chestType.isTransparent() && tileEntity instanceof CrystalChestBlockEntity crystalChestTileEntity && Vec3.atCenterOf(tileEntityIn.getBlockPos()).closerThan(this.renderer.camera.getPosition(), 128d)) {
if (chestType.isTransparent() && tileEntity instanceof ICrystalChest crystalChest && Vec3.atCenterOf(tileEntityIn.getBlockPos()).closerThan(this.renderer.camera.getPosition(), 128d)) {
float rotation = (float) (360D * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL) - partialTicks;
if (customItem == null) {
assert level != null;
customItem = new ItemEntity(EntityType.ITEM, level);
}
for (int j = 0; j < MODEL_ITEMS.size() - 1; j++) {
renderItem(poseStack, bufferSource, crystalChestTileEntity.getTopItems().get(j), MODEL_ITEMS.get(j), rotation, combinedLightIn, partialTicks);
renderItem(poseStack, bufferSource, crystalChest.getTopItems().get(j), MODEL_ITEMS.get(j), rotation, combinedLightIn);
}
}
}
@ -170,12 +163,10 @@ public class IronChestRenderer<T extends BlockEntity & LidBlockEntity> implement
* @param modelItem Model items for render information
* @param light Model light
*/
public static void renderItem(PoseStack matrices, MultiBufferSource buffer, ItemStack item, ModelItem modelItem, float rotation, int light, float partialTicks) {
public static void renderItem(PoseStack matrices, MultiBufferSource buffer, ItemStack item, ModelItem modelItem, float rotation, int light) {
// if no stack, skip
if (item.isEmpty()) return;
customItem.setItem(item);
// start rendering
matrices.pushPose();
Vector3f center = modelItem.getCenter();
@ -188,26 +179,8 @@ public class IronChestRenderer<T extends BlockEntity & LidBlockEntity> implement
matrices.scale(scale, scale, scale);
// render the actual item
if (itemRenderer == null) {
itemRenderer = new ItemEntityRenderer(new EntityRendererProvider.Context(Minecraft.getInstance().getEntityRenderDispatcher(), Minecraft.getInstance().getItemRenderer(), Minecraft.getInstance().getResourceManager(), Minecraft.getInstance().getEntityModels(), Minecraft.getInstance().font)) {
@Override
public int getRenderAmount(ItemStack stack) {
return SignedBytes.saturatedCast(Math.min(stack.getCount() / 32, 15) + 1);
}
Minecraft.getInstance().getItemRenderer().renderStatic(item, ItemTransforms.TransformType.NONE, light, OverlayTexture.NO_OVERLAY, matrices, buffer, 0);
@Override
public boolean shouldBob() {
return false;
}
@Override
public boolean shouldSpreadItems() {
return true;
}
};
}
itemRenderer.render(customItem, 0F, partialTicks, matrices, buffer, light);
matrices.popPose();
}
}

View File

@ -1,7 +1,7 @@
package com.progwml6.ironchest.common.ai;
import com.progwml6.ironchest.common.block.AbstractIronChestBlock;
import com.progwml6.ironchest.common.block.entity.AbstractIronChestBlockEntity;
import com.progwml6.ironchest.common.block.regular.AbstractIronChestBlock;
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.entity.ai.goal.CatSitOnBlockGoal;

View File

@ -1,6 +1,20 @@
package com.progwml6.ironchest.common.block;
import com.progwml6.ironchest.IronChests;
import com.progwml6.ironchest.common.block.regular.CopperChestBlock;
import com.progwml6.ironchest.common.block.regular.CrystalChestBlock;
import com.progwml6.ironchest.common.block.regular.DiamondChestBlock;
import com.progwml6.ironchest.common.block.regular.DirtChestBlock;
import com.progwml6.ironchest.common.block.regular.GoldChestBlock;
import com.progwml6.ironchest.common.block.regular.IronChestBlock;
import com.progwml6.ironchest.common.block.regular.ObsidianChestBlock;
import com.progwml6.ironchest.common.block.trapped.TrappedCopperChestBlock;
import com.progwml6.ironchest.common.block.trapped.TrappedCrystalChestBlock;
import com.progwml6.ironchest.common.block.trapped.TrappedDiamondChestBlock;
import com.progwml6.ironchest.common.block.trapped.TrappedDirtChestBlock;
import com.progwml6.ironchest.common.block.trapped.TrappedGoldChestBlock;
import com.progwml6.ironchest.common.block.trapped.TrappedIronChestBlock;
import com.progwml6.ironchest.common.block.trapped.TrappedObsidianChestBlock;
import com.progwml6.ironchest.common.item.IronChestBlockItem;
import com.progwml6.ironchest.common.item.IronChestsItems;
import net.minecraft.world.item.BlockItem;
@ -22,40 +36,65 @@ public class IronChestsBlocks {
public static final RegistryObject<IronChestBlock> IRON_CHEST = register(
"iron_chest", () -> new IronChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
IronChestsTypes.IRON);
IronChestsTypes.IRON, false);
public static final RegistryObject<GoldChestBlock> GOLD_CHEST = register(
"gold_chest", () -> new GoldChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
IronChestsTypes.GOLD);
IronChestsTypes.GOLD, false);
public static final RegistryObject<DiamondChestBlock> DIAMOND_CHEST = register(
"diamond_chest", () -> new DiamondChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
IronChestsTypes.DIAMOND);
IronChestsTypes.DIAMOND, false);
public static final RegistryObject<CopperChestBlock> COPPER_CHEST = register(
"copper_chest", () -> new CopperChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
IronChestsTypes.COPPER);
public static final RegistryObject<SilverChestBlock> SILVER_CHEST = register(
"silver_chest", () -> new SilverChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
IronChestsTypes.SILVER);
IronChestsTypes.COPPER, false);
public static final RegistryObject<CrystalChestBlock> CRYSTAL_CHEST = register(
"crystal_chest", () -> new CrystalChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
IronChestsTypes.CRYSTAL);
IronChestsTypes.CRYSTAL, false);
public static final RegistryObject<ObsidianChestBlock> OBSIDIAN_CHEST = register(
"obsidian_chest", () -> new ObsidianChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
IronChestsTypes.OBSIDIAN);
IronChestsTypes.OBSIDIAN, false);
public static final RegistryObject<DirtChestBlock> DIRT_CHEST = register(
"dirt_chest", () -> new DirtChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
IronChestsTypes.DIRT);
IronChestsTypes.DIRT, false);
// Trapped Chests
public static final RegistryObject<TrappedIronChestBlock> TRAPPED_IRON_CHEST = register(
"trapped_iron_chest", () -> new TrappedIronChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
IronChestsTypes.IRON, true);
public static final RegistryObject<TrappedGoldChestBlock> TRAPPED_GOLD_CHEST = register(
"trapped_gold_chest", () -> new TrappedGoldChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
IronChestsTypes.GOLD, true);
public static final RegistryObject<TrappedDiamondChestBlock> TRAPPED_DIAMOND_CHEST = register(
"trapped_diamond_chest", () -> new TrappedDiamondChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
IronChestsTypes.DIAMOND, true);
public static final RegistryObject<TrappedCopperChestBlock> TRAPPED_COPPER_CHEST = register(
"trapped_copper_chest", () -> new TrappedCopperChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
IronChestsTypes.COPPER, true);
public static final RegistryObject<TrappedCrystalChestBlock> TRAPPED_CRYSTAL_CHEST = register(
"trapped_crystal_chest", () -> new TrappedCrystalChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
IronChestsTypes.CRYSTAL, true);
public static final RegistryObject<TrappedObsidianChestBlock> TRAPPED_OBSIDIAN_CHEST = register(
"trapped_obsidian_chest", () -> new TrappedObsidianChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
IronChestsTypes.OBSIDIAN, true);
public static final RegistryObject<TrappedDirtChestBlock> TRAPPED_DIRT_CHEST = register(
"trapped_dirt_chest", () -> new TrappedDirtChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
IronChestsTypes.DIRT, true);
//HELPERS
private static <T extends Block> RegistryObject<T> register(String name, Supplier<? extends T> sup, IronChestsTypes chestType) {
return register(name, sup, block -> item(block, () -> () -> chestType));
private static <T extends Block> RegistryObject<T> register(String name, Supplier<? extends T> sup, IronChestsTypes chestType, boolean trapped) {
return register(name, sup, block -> item(block, () -> () -> chestType, () -> () -> trapped));
}
private static <T extends Block> RegistryObject<T> register(String name, Supplier<? extends T> sup, Function<RegistryObject<T>, Supplier<? extends Item>> itemCreator) {
@ -68,7 +107,7 @@ public class IronChestsBlocks {
return BLOCKS.register(name, sup);
}
private static Supplier<BlockItem> item(final RegistryObject<? extends Block> block, Supplier<Callable<IronChestsTypes>> chestType) {
return () -> new IronChestBlockItem(block.get(), new Item.Properties().tab(IronChests.IRONCHESTS_ITEM_GROUP), chestType);
private static Supplier<BlockItem> item(final RegistryObject<? extends Block> block, Supplier<Callable<IronChestsTypes>> chestType, Supplier<Callable<Boolean>> trapped) {
return () -> new IronChestBlockItem(block.get(), new Item.Properties().tab(IronChests.IRONCHESTS_ITEM_GROUP), chestType, trapped);
}
}

View File

@ -1,15 +1,21 @@
package com.progwml6.ironchest.common.block;
import com.progwml6.ironchest.common.Util;
import com.progwml6.ironchest.common.block.entity.AbstractIronChestBlockEntity;
import com.progwml6.ironchest.common.block.entity.CopperChestBlockEntity;
import com.progwml6.ironchest.common.block.entity.CrystalChestBlockEntity;
import com.progwml6.ironchest.common.block.entity.DiamondChestBlockEntity;
import com.progwml6.ironchest.common.block.entity.DirtChestBlockEntity;
import com.progwml6.ironchest.common.block.entity.GoldChestBlockEntity;
import com.progwml6.ironchest.common.block.entity.IronChestBlockEntity;
import com.progwml6.ironchest.common.block.entity.ObsidianChestBlockEntity;
import com.progwml6.ironchest.common.block.entity.SilverChestBlockEntity;
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
import com.progwml6.ironchest.common.block.regular.entity.CopperChestBlockEntity;
import com.progwml6.ironchest.common.block.regular.entity.CrystalChestBlockEntity;
import com.progwml6.ironchest.common.block.regular.entity.DiamondChestBlockEntity;
import com.progwml6.ironchest.common.block.regular.entity.DirtChestBlockEntity;
import com.progwml6.ironchest.common.block.regular.entity.GoldChestBlockEntity;
import com.progwml6.ironchest.common.block.regular.entity.IronChestBlockEntity;
import com.progwml6.ironchest.common.block.regular.entity.ObsidianChestBlockEntity;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedCopperChestBlockEntity;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedCrystalChestBlockEntity;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedDiamondChestBlockEntity;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedDirtChestBlockEntity;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedGoldChestBlockEntity;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedIronChestBlockEntity;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedObsidianChestBlockEntity;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
@ -18,6 +24,8 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.state.BlockState;
import javax.annotation.Nullable;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
public enum IronChestsTypes implements StringRepresentable {
@ -26,7 +34,6 @@ public enum IronChestsTypes implements StringRepresentable {
GOLD(81, 9, 184, 276, new ResourceLocation("ironchest", "textures/gui/gold_container.png"), 256, 276),
DIAMOND(108, 12, 238, 276, new ResourceLocation("ironchest", "textures/gui/diamond_container.png"), 256, 276),
COPPER(45, 9, 184, 204, new ResourceLocation("ironchest", "textures/gui/copper_container.png"), 256, 256),
SILVER(72, 9, 184, 258, new ResourceLocation("ironchest", "textures/gui/silver_container.png"), 256, 276),
CRYSTAL(108, 12, 238, 276, new ResourceLocation("ironchest", "textures/gui/diamond_container.png"), 256, 276),
OBSIDIAN(108, 12, 238, 276, new ResourceLocation("ironchest", "textures/gui/diamond_container.png"), 256, 276),
DIRT(1, 1, 184, 184, new ResourceLocation("ironchest", "textures/gui/dirt_container.png"), 256, 256),
@ -77,32 +84,43 @@ public enum IronChestsTypes implements StringRepresentable {
return this == CRYSTAL;
}
public static Block get(IronChestsTypes type) {
public static List<Block> get(IronChestsTypes type) {
return switch (type) {
case IRON -> IronChestsBlocks.IRON_CHEST.get();
case GOLD -> IronChestsBlocks.GOLD_CHEST.get();
case DIAMOND -> IronChestsBlocks.DIAMOND_CHEST.get();
case COPPER -> IronChestsBlocks.COPPER_CHEST.get();
case SILVER -> IronChestsBlocks.SILVER_CHEST.get();
case CRYSTAL -> IronChestsBlocks.CRYSTAL_CHEST.get();
case OBSIDIAN -> IronChestsBlocks.OBSIDIAN_CHEST.get();
case DIRT -> IronChestsBlocks.DIRT_CHEST.get();
default -> Blocks.CHEST;
case IRON -> Arrays.asList(IronChestsBlocks.IRON_CHEST.get(), IronChestsBlocks.TRAPPED_IRON_CHEST.get());
case GOLD -> Arrays.asList(IronChestsBlocks.GOLD_CHEST.get(), IronChestsBlocks.TRAPPED_GOLD_CHEST.get());
case DIAMOND -> Arrays.asList(IronChestsBlocks.DIAMOND_CHEST.get(), IronChestsBlocks.TRAPPED_DIAMOND_CHEST.get());
case COPPER -> Arrays.asList(IronChestsBlocks.COPPER_CHEST.get(), IronChestsBlocks.TRAPPED_COPPER_CHEST.get());
case CRYSTAL -> Arrays.asList(IronChestsBlocks.CRYSTAL_CHEST.get(), IronChestsBlocks.TRAPPED_CRYSTAL_CHEST.get());
case OBSIDIAN -> Arrays.asList(IronChestsBlocks.OBSIDIAN_CHEST.get(), IronChestsBlocks.TRAPPED_OBSIDIAN_CHEST.get());
case DIRT -> Arrays.asList(IronChestsBlocks.DIRT_CHEST.get(), IronChestsBlocks.TRAPPED_DIRT_CHEST.get());
default -> List.of(Blocks.CHEST);
};
}
@Nullable
public AbstractIronChestBlockEntity makeEntity(BlockPos blockPos, BlockState blockState) {
return switch (this) {
case IRON -> new IronChestBlockEntity(blockPos, blockState);
case GOLD -> new GoldChestBlockEntity(blockPos, blockState);
case DIAMOND -> new DiamondChestBlockEntity(blockPos, blockState);
case COPPER -> new CopperChestBlockEntity(blockPos, blockState);
case SILVER -> new SilverChestBlockEntity(blockPos, blockState);
case CRYSTAL -> new CrystalChestBlockEntity(blockPos, blockState);
case OBSIDIAN -> new ObsidianChestBlockEntity(blockPos, blockState);
case DIRT -> new DirtChestBlockEntity(blockPos, blockState);
default -> null;
};
public AbstractIronChestBlockEntity makeEntity(BlockPos blockPos, BlockState blockState, boolean trapped) {
if(trapped) {
return switch (this) {
case IRON -> new TrappedIronChestBlockEntity(blockPos, blockState);
case GOLD -> new TrappedGoldChestBlockEntity(blockPos, blockState);
case DIAMOND -> new TrappedDiamondChestBlockEntity(blockPos, blockState);
case COPPER -> new TrappedCopperChestBlockEntity(blockPos, blockState);
case CRYSTAL -> new TrappedCrystalChestBlockEntity(blockPos, blockState);
case OBSIDIAN -> new TrappedObsidianChestBlockEntity(blockPos, blockState);
case DIRT -> new TrappedDirtChestBlockEntity(blockPos, blockState);
default -> null;
};
} else {
return switch (this) {
case IRON -> new IronChestBlockEntity(blockPos, blockState);
case GOLD -> new GoldChestBlockEntity(blockPos, blockState);
case DIAMOND -> new DiamondChestBlockEntity(blockPos, blockState);
case COPPER -> new CopperChestBlockEntity(blockPos, blockState);
case CRYSTAL -> new CrystalChestBlockEntity(blockPos, blockState);
case OBSIDIAN -> new ObsidianChestBlockEntity(blockPos, blockState);
case DIRT -> new DirtChestBlockEntity(blockPos, blockState);
default -> null;
};
}
}
}

View File

@ -1,22 +0,0 @@
package com.progwml6.ironchest.common.block;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import com.progwml6.ironchest.common.block.entity.SilverChestBlockEntity;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import javax.annotation.Nullable;
public class SilverChestBlock extends AbstractIronChestBlock {
public SilverChestBlock(Properties properties) {
super(properties, IronChestsBlockEntityTypes.SILVER_CHEST::get, IronChestsTypes.SILVER);
}
@Nullable
@Override
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
return new SilverChestBlockEntity(blockPos, blockState);
}
}

View File

@ -1,66 +1,59 @@
package com.progwml6.ironchest.common.block.entity;
import com.progwml6.ironchest.common.block.IronChestsBlocks;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.inventory.IronChestMenu;
import com.progwml6.ironchest.common.network.InventoryTopStacksSyncPacket;
import com.progwml6.ironchest.common.network.IronChestNetwork;
import net.minecraft.core.BlockPos;
import net.minecraft.core.NonNullList;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
public class CrystalChestBlockEntity extends AbstractIronChestBlockEntity {
public interface ICrystalChest {
private NonNullList<ItemStack> topStacks;
private boolean inventoryTouched;
private boolean hadStuff;
default NonNullList<ItemStack> buildItemStackDataList() {
if (this.getChestType().isTransparent()) {
NonNullList<ItemStack> sortList = NonNullList.<ItemStack>withSize(this.getTopItems().size(), ItemStack.EMPTY);
public CrystalChestBlockEntity(BlockPos blockPos, BlockState blockState) {
super(IronChestsBlockEntityTypes.CRYSTAL_CHEST.get(), blockPos, blockState, IronChestsTypes.CRYSTAL, IronChestsBlocks.CRYSTAL_CHEST::get);
int pos = 0;
this.topStacks = NonNullList.withSize(8, ItemStack.EMPTY);
}
for (ItemStack is : this.getTopItems()) {
if (!is.isEmpty()) {
sortList.set(pos, is);
} else {
sortList.set(pos, ItemStack.EMPTY);
}
@Override
protected AbstractContainerMenu createMenu(int containerId, Inventory playerInventory) {
return IronChestMenu.createCrystalContainer(containerId, playerInventory, this);
}
public static void tick(Level level, BlockPos blockPos, BlockState blockState, AbstractIronChestBlockEntity chestBlockEntity) {
if (chestBlockEntity instanceof CrystalChestBlockEntity crystalChestBlockEntity) {
if (!level.isClientSide && crystalChestBlockEntity.inventoryTouched) {
crystalChestBlockEntity.inventoryTouched = false;
crystalChestBlockEntity.sortTopStacks();
pos++;
}
return sortList;
}
return NonNullList.<ItemStack>withSize(this.getTopItems().size(), ItemStack.EMPTY);
}
IronChestsTypes getChestType();
default void sendTopStacksPacket() {
NonNullList<ItemStack> stacks = this.buildItemStackDataList();
if (this.getChestLevel() != null && this.getChestLevel() instanceof ServerLevel && !this.getChestLevel().isClientSide) {
IronChestNetwork.getInstance().sendToClientsAround(new InventoryTopStacksSyncPacket(stacks, this.getChestWorldPosition()), (ServerLevel) this.getChestLevel(), this.getChestWorldPosition());
}
}
@Override
public void setItems(NonNullList<ItemStack> contents) {
super.setItems(contents);
NonNullList<ItemStack> getTopItems();
this.inventoryTouched = true;
}
Level getChestLevel();
@Override
public ItemStack getItem(int index) {
this.inventoryTouched = true;
BlockPos getChestWorldPosition();
return super.getItem(index);
}
void receiveMessageFromServer(NonNullList<ItemStack> topStacks);
public NonNullList<ItemStack> getTopItems() {
return this.topStacks;
}
private void sortTopStacks() {
if (!this.getChestType().isTransparent() || (this.level != null && this.level.isClientSide)) {
default void sortTopStacks() {
if (!this.getChestType().isTransparent() || (this.getChestLevel() != null && this.getChestLevel().isClientSide)) {
return;
}
@ -95,23 +88,23 @@ public class CrystalChestBlockEntity extends AbstractIronChestBlockEntity {
}
}
if (!hasStuff && this.hadStuff) {
this.hadStuff = false;
if (!hasStuff && this.getHadStuff()) {
this.setHadStuff(false);
for (int i = 0; i < this.getTopItems().size(); i++) {
this.getTopItems().set(i, ItemStack.EMPTY);
}
if (this.level != null) {
BlockState blockState = this.level.getBlockState(this.worldPosition);
if (this.getChestLevel() != null) {
BlockState blockState = this.getChestLevel().getBlockState(this.getChestWorldPosition());
this.level.sendBlockUpdated(this.worldPosition, blockState, blockState, 3);
this.getChestLevel().sendBlockUpdated(this.getChestWorldPosition(), blockState, blockState, 3);
}
return;
}
this.hadStuff = true;
this.setHadStuff(true);
tempCopy.sort((stack1, stack2) -> {
if (stack1.isEmpty()) {
@ -141,46 +134,20 @@ public class CrystalChestBlockEntity extends AbstractIronChestBlockEntity {
this.getTopItems().set(i, ItemStack.EMPTY);
}
if (this.level != null) {
BlockState blockState = this.level.getBlockState(this.worldPosition);
if (this.getChestLevel() != null) {
BlockState blockState = this.getChestLevel().getBlockState(this.getChestWorldPosition());
this.level.sendBlockUpdated(this.worldPosition, blockState, blockState, 3);
this.getChestLevel().sendBlockUpdated(this.getChestWorldPosition(), blockState, blockState, 3);
}
this.sendTopStacksPacket();
}
public NonNullList<ItemStack> buildItemStackDataList() {
if (this.getChestType().isTransparent()) {
NonNullList<ItemStack> sortList = NonNullList.<ItemStack>withSize(this.getTopItems().size(), ItemStack.EMPTY);
NonNullList<ItemStack> getItems();
int pos = 0;
void setHadStuff(boolean hadStuff);
boolean getHadStuff();
for (ItemStack is : this.topStacks) {
if (!is.isEmpty()) {
sortList.set(pos, is);
} else {
sortList.set(pos, ItemStack.EMPTY);
}
pos++;
}
return sortList;
}
return NonNullList.<ItemStack>withSize(this.getTopItems().size(), ItemStack.EMPTY);
}
protected void sendTopStacksPacket() {
NonNullList<ItemStack> stacks = this.buildItemStackDataList();
if (this.level != null && this.level instanceof ServerLevel && !this.level.isClientSide) {
IronChestNetwork.getInstance().sendToClientsAround(new InventoryTopStacksSyncPacket(stacks, this.worldPosition), (ServerLevel) this.level, this.worldPosition);
}
}
public void receiveMessageFromServer(NonNullList<ItemStack> topStacks) {
this.topStacks = topStacks;
}
int getContainerSize();
}

View File

@ -2,6 +2,21 @@ package com.progwml6.ironchest.common.block.entity;
import com.progwml6.ironchest.IronChests;
import com.progwml6.ironchest.common.block.IronChestsBlocks;
import com.progwml6.ironchest.common.block.regular.entity.CopperChestBlockEntity;
import com.progwml6.ironchest.common.block.regular.entity.CrystalChestBlockEntity;
import com.progwml6.ironchest.common.block.regular.entity.DiamondChestBlockEntity;
import com.progwml6.ironchest.common.block.regular.entity.DirtChestBlockEntity;
import com.progwml6.ironchest.common.block.regular.entity.GoldChestBlockEntity;
import com.progwml6.ironchest.common.block.regular.entity.IronChestBlockEntity;
import com.progwml6.ironchest.common.block.regular.entity.ObsidianChestBlockEntity;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedCopperChestBlockEntity;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedCrystalChestBlockEntity;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedDiamondChestBlockEntity;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedDirtChestBlockEntity;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedGoldChestBlockEntity;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedIronChestBlockEntity;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedObsidianChestBlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraftforge.fmllegacy.RegistryObject;
import net.minecraftforge.registries.DeferredRegister;
@ -22,9 +37,6 @@ public class IronChestsBlockEntityTypes {
public static final RegistryObject<BlockEntityType<CopperChestBlockEntity>> COPPER_CHEST = BLOCK_ENTITIES.register(
"copper_chest", () -> BlockEntityType.Builder.of(CopperChestBlockEntity::new, IronChestsBlocks.COPPER_CHEST.get()).build(null));
public static final RegistryObject<BlockEntityType<SilverChestBlockEntity>> SILVER_CHEST = BLOCK_ENTITIES.register(
"silver_chest", () -> BlockEntityType.Builder.of(SilverChestBlockEntity::new, IronChestsBlocks.SILVER_CHEST.get()).build(null));
public static final RegistryObject<BlockEntityType<CrystalChestBlockEntity>> CRYSTAL_CHEST = BLOCK_ENTITIES.register(
"crystal_chest", () -> BlockEntityType.Builder.of(CrystalChestBlockEntity::new, IronChestsBlocks.CRYSTAL_CHEST.get()).build(null));
@ -33,4 +45,27 @@ public class IronChestsBlockEntityTypes {
public static final RegistryObject<BlockEntityType<DirtChestBlockEntity>> DIRT_CHEST = BLOCK_ENTITIES.register(
"dirt_chest", () -> BlockEntityType.Builder.of(DirtChestBlockEntity::new, IronChestsBlocks.DIRT_CHEST.get()).build(null));
// Trapped Chests
public static final RegistryObject<BlockEntityType<TrappedIronChestBlockEntity>> TRAPPED_IRON_CHEST = BLOCK_ENTITIES.register(
"trapped_iron_chest", () -> BlockEntityType.Builder.of(TrappedIronChestBlockEntity::new, IronChestsBlocks.TRAPPED_IRON_CHEST.get()).build(null));
public static final RegistryObject<BlockEntityType<TrappedGoldChestBlockEntity>> TRAPPED_GOLD_CHEST = BLOCK_ENTITIES.register(
"trapped_gold_chest", () -> BlockEntityType.Builder.of(TrappedGoldChestBlockEntity::new, IronChestsBlocks.TRAPPED_GOLD_CHEST.get()).build(null));
public static final RegistryObject<BlockEntityType<TrappedDiamondChestBlockEntity>> TRAPPED_DIAMOND_CHEST = BLOCK_ENTITIES.register(
"trapped_diamond_chest", () -> BlockEntityType.Builder.of(TrappedDiamondChestBlockEntity::new, IronChestsBlocks.TRAPPED_DIAMOND_CHEST.get()).build(null));
public static final RegistryObject<BlockEntityType<TrappedCopperChestBlockEntity>> TRAPPED_COPPER_CHEST = BLOCK_ENTITIES.register(
"trapped_copper_chest", () -> BlockEntityType.Builder.of(TrappedCopperChestBlockEntity::new, IronChestsBlocks.TRAPPED_COPPER_CHEST.get()).build(null));
public static final RegistryObject<BlockEntityType<TrappedCrystalChestBlockEntity>> TRAPPED_CRYSTAL_CHEST = BLOCK_ENTITIES.register(
"trapped_crystal_chest", () -> BlockEntityType.Builder.of(TrappedCrystalChestBlockEntity::new, IronChestsBlocks.TRAPPED_CRYSTAL_CHEST.get()).build(null));
public static final RegistryObject<BlockEntityType<TrappedObsidianChestBlockEntity>> TRAPPED_OBSIDIAN_CHEST = BLOCK_ENTITIES.register(
"trapped_obsidian_chest", () -> BlockEntityType.Builder.of(TrappedObsidianChestBlockEntity::new, IronChestsBlocks.TRAPPED_OBSIDIAN_CHEST.get()).build(null));
public static final RegistryObject<BlockEntityType<TrappedDirtChestBlockEntity>> TRAPPED_DIRT_CHEST = BLOCK_ENTITIES.register(
"trapped_dirt_chest", () -> BlockEntityType.Builder.of(TrappedDirtChestBlockEntity::new, IronChestsBlocks.TRAPPED_DIRT_CHEST.get()).build(null));
}

View File

@ -1,21 +0,0 @@
package com.progwml6.ironchest.common.block.entity;
import com.progwml6.ironchest.common.block.IronChestsBlocks;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.inventory.IronChestMenu;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.level.block.state.BlockState;
public class SilverChestBlockEntity extends AbstractIronChestBlockEntity {
public SilverChestBlockEntity(BlockPos blockPos, BlockState blockState) {
super(IronChestsBlockEntityTypes.SILVER_CHEST.get(), blockPos, blockState, IronChestsTypes.SILVER, IronChestsBlocks.SILVER_CHEST::get);
}
@Override
protected AbstractContainerMenu createMenu(int containerId, Inventory playerInventory) {
return IronChestMenu.createSilverContainer(containerId, playerInventory, this);
}
}

View File

@ -1,6 +1,7 @@
package com.progwml6.ironchest.common.block;
package com.progwml6.ironchest.common.block.regular;
import com.progwml6.ironchest.common.block.entity.AbstractIronChestBlockEntity;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
import it.unimi.dsi.fastutil.floats.Float2FloatFunction;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;

View File

@ -1,6 +1,7 @@
package com.progwml6.ironchest.common.block;
package com.progwml6.ironchest.common.block.regular;
import com.progwml6.ironchest.common.block.entity.CopperChestBlockEntity;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.regular.entity.CopperChestBlockEntity;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.entity.BlockEntity;

View File

@ -1,7 +1,8 @@
package com.progwml6.ironchest.common.block;
package com.progwml6.ironchest.common.block.regular;
import com.progwml6.ironchest.common.block.entity.AbstractIronChestBlockEntity;
import com.progwml6.ironchest.common.block.entity.CrystalChestBlockEntity;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
import com.progwml6.ironchest.common.block.regular.entity.CrystalChestBlockEntity;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;

View File

@ -1,6 +1,7 @@
package com.progwml6.ironchest.common.block;
package com.progwml6.ironchest.common.block.regular;
import com.progwml6.ironchest.common.block.entity.DiamondChestBlockEntity;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.regular.entity.DiamondChestBlockEntity;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.entity.BlockEntity;

View File

@ -1,6 +1,7 @@
package com.progwml6.ironchest.common.block;
package com.progwml6.ironchest.common.block.regular;
import com.progwml6.ironchest.common.block.entity.DirtChestBlockEntity;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.regular.entity.DirtChestBlockEntity;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.entity.BlockEntity;

View File

@ -1,6 +1,7 @@
package com.progwml6.ironchest.common.block;
package com.progwml6.ironchest.common.block.regular;
import com.progwml6.ironchest.common.block.entity.GoldChestBlockEntity;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.regular.entity.GoldChestBlockEntity;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.entity.BlockEntity;

View File

@ -1,6 +1,7 @@
package com.progwml6.ironchest.common.block;
package com.progwml6.ironchest.common.block.regular;
import com.progwml6.ironchest.common.block.entity.IronChestBlockEntity;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.regular.entity.IronChestBlockEntity;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.entity.BlockEntity;

View File

@ -1,7 +1,8 @@
package com.progwml6.ironchest.common.block;
package com.progwml6.ironchest.common.block.regular;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import com.progwml6.ironchest.common.block.entity.ObsidianChestBlockEntity;
import com.progwml6.ironchest.common.block.regular.entity.ObsidianChestBlockEntity;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockBehaviour;

View File

@ -1,7 +1,7 @@
package com.progwml6.ironchest.common.block.entity;
package com.progwml6.ironchest.common.block.regular.entity;
import com.progwml6.ironchest.IronChests;
import com.progwml6.ironchest.common.block.AbstractIronChestBlock;
import com.progwml6.ironchest.common.block.regular.AbstractIronChestBlock;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.inventory.IronChestMenu;
import net.minecraft.core.BlockPos;

View File

@ -1,7 +1,8 @@
package com.progwml6.ironchest.common.block.entity;
package com.progwml6.ironchest.common.block.regular.entity;
import com.progwml6.ironchest.common.block.IronChestsBlocks;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import com.progwml6.ironchest.common.inventory.IronChestMenu;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.player.Inventory;

View File

@ -0,0 +1,86 @@
package com.progwml6.ironchest.common.block.regular.entity;
import com.progwml6.ironchest.common.block.IronChestsBlocks;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.entity.ICrystalChest;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import com.progwml6.ironchest.common.inventory.IronChestMenu;
import net.minecraft.core.BlockPos;
import net.minecraft.core.NonNullList;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
public class CrystalChestBlockEntity extends AbstractIronChestBlockEntity implements ICrystalChest {
private NonNullList<ItemStack> topStacks;
private boolean inventoryTouched;
private boolean hadStuff;
public CrystalChestBlockEntity(BlockPos blockPos, BlockState blockState) {
super(IronChestsBlockEntityTypes.CRYSTAL_CHEST.get(), blockPos, blockState, IronChestsTypes.CRYSTAL, IronChestsBlocks.CRYSTAL_CHEST::get);
this.topStacks = NonNullList.withSize(8, ItemStack.EMPTY);
}
@Override
protected AbstractContainerMenu createMenu(int containerId, Inventory playerInventory) {
return IronChestMenu.createCrystalContainer(containerId, playerInventory, this);
}
public static void tick(Level level, BlockPos blockPos, BlockState blockState, AbstractIronChestBlockEntity chestBlockEntity) {
if (chestBlockEntity instanceof CrystalChestBlockEntity crystalChestBlockEntity) {
if (!level.isClientSide && crystalChestBlockEntity.inventoryTouched) {
crystalChestBlockEntity.inventoryTouched = false;
crystalChestBlockEntity.sortTopStacks();
}
}
}
@Override
public void setItems(NonNullList<ItemStack> contents) {
super.setItems(contents);
this.inventoryTouched = true;
}
@Override
public ItemStack getItem(int index) {
this.inventoryTouched = true;
return super.getItem(index);
}
@Override
public NonNullList<ItemStack> getTopItems() {
return this.topStacks;
}
@Override
public Level getChestLevel() {
return this.level;
}
@Override
public BlockPos getChestWorldPosition() {
return this.worldPosition;
}
@Override
public void receiveMessageFromServer(NonNullList<ItemStack> topStacks) {
this.topStacks = topStacks;
}
@Override
public void setHadStuff(boolean hadStuff) {
this.hadStuff = hadStuff;
}
@Override
public boolean getHadStuff() {
return this.hadStuff;
}
}

View File

@ -1,7 +1,8 @@
package com.progwml6.ironchest.common.block.entity;
package com.progwml6.ironchest.common.block.regular.entity;
import com.progwml6.ironchest.common.block.IronChestsBlocks;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import com.progwml6.ironchest.common.inventory.IronChestMenu;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.player.Inventory;

View File

@ -1,7 +1,8 @@
package com.progwml6.ironchest.common.block.entity;
package com.progwml6.ironchest.common.block.regular.entity;
import com.progwml6.ironchest.common.block.IronChestsBlocks;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import com.progwml6.ironchest.common.inventory.IronChestMenu;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.core.BlockPos;

View File

@ -1,7 +1,8 @@
package com.progwml6.ironchest.common.block.entity;
package com.progwml6.ironchest.common.block.regular.entity;
import com.progwml6.ironchest.common.block.IronChestsBlocks;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import com.progwml6.ironchest.common.inventory.IronChestMenu;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.player.Inventory;

View File

@ -1,7 +1,8 @@
package com.progwml6.ironchest.common.block.entity;
package com.progwml6.ironchest.common.block.regular.entity;
import com.progwml6.ironchest.common.block.IronChestsBlocks;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import com.progwml6.ironchest.common.inventory.IronChestMenu;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.player.Inventory;

View File

@ -1,7 +1,8 @@
package com.progwml6.ironchest.common.block.entity;
package com.progwml6.ironchest.common.block.regular.entity;
import com.progwml6.ironchest.common.block.IronChestsBlocks;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import com.progwml6.ironchest.common.inventory.IronChestMenu;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.player.Inventory;

View File

@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package com.progwml6.ironchest.common.block.regular;
import net.minecraft.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;

View File

@ -0,0 +1,44 @@
package com.progwml6.ironchest.common.block.trapped;
import com.progwml6.ironchest.common.block.regular.AbstractIronChestBlock;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
import com.progwml6.ironchest.common.block.trapped.entity.AbstractTrappedIronChestBlockEntity;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.stats.Stat;
import net.minecraft.stats.Stats;
import net.minecraft.util.Mth;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import java.util.function.Supplier;
public abstract class AbstractTrappedIronChestBlock extends AbstractIronChestBlock {
public AbstractTrappedIronChestBlock(Properties properties, Supplier<BlockEntityType<? extends AbstractIronChestBlockEntity>> blockEntityType, IronChestsTypes type) {
super(properties, blockEntityType, type);
}
@Override
protected Stat<ResourceLocation> getOpenChestStat() {
return Stats.CUSTOM.get(Stats.TRIGGER_TRAPPED_CHEST);
}
@Override
public boolean isSignalSource(BlockState blockState) {
return true;
}
@Override
public int getSignal(BlockState blockState, BlockGetter blockGetter, BlockPos blockPos, Direction direction) {
return Mth.clamp(AbstractTrappedIronChestBlockEntity.getOpenCount(blockGetter, blockPos), 0, 15);
}
@Override
public int getDirectSignal(BlockState blockState, BlockGetter blockGetter, BlockPos blockPos, Direction direction) {
return direction == Direction.UP ? blockState.getSignal(blockGetter, blockPos, direction) : 0;
}
}

View File

@ -0,0 +1,23 @@
package com.progwml6.ironchest.common.block.trapped;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedCopperChestBlockEntity;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import javax.annotation.Nullable;
public class TrappedCopperChestBlock extends AbstractTrappedIronChestBlock {
public TrappedCopperChestBlock(Properties properties) {
super(properties, IronChestsBlockEntityTypes.TRAPPED_COPPER_CHEST::get, IronChestsTypes.COPPER);
}
@Nullable
@Override
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
return new TrappedCopperChestBlockEntity(blockPos, blockState);
}
}

View File

@ -0,0 +1,33 @@
package com.progwml6.ironchest.common.block.trapped;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedCrystalChestBlockEntity;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
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.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import javax.annotation.Nullable;
public class TrappedCrystalChestBlock extends AbstractTrappedIronChestBlock {
public TrappedCrystalChestBlock(Properties properties) {
super(properties, IronChestsBlockEntityTypes.TRAPPED_CRYSTAL_CHEST::get, IronChestsTypes.CRYSTAL);
}
@Nullable
@Override
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
return new TrappedCrystalChestBlockEntity(blockPos, blockState);
}
@Override
@Nullable
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState blockState, BlockEntityType<T> blockEntityType) {
return level.isClientSide ? createTickerHelper(blockEntityType, this.blockEntityType(), AbstractIronChestBlockEntity::lidAnimateTick) : createTickerHelper(blockEntityType, this.blockEntityType(), TrappedCrystalChestBlockEntity::tick);
}
}

View File

@ -0,0 +1,23 @@
package com.progwml6.ironchest.common.block.trapped;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedDiamondChestBlockEntity;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import javax.annotation.Nullable;
public class TrappedDiamondChestBlock extends AbstractTrappedIronChestBlock {
public TrappedDiamondChestBlock(Properties properties) {
super(properties, IronChestsBlockEntityTypes.TRAPPED_DIAMOND_CHEST::get, IronChestsTypes.DIAMOND);
}
@Nullable
@Override
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
return new TrappedDiamondChestBlockEntity(blockPos, blockState);
}
}

View File

@ -0,0 +1,23 @@
package com.progwml6.ironchest.common.block.trapped;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedDirtChestBlockEntity;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import javax.annotation.Nullable;
public class TrappedDirtChestBlock extends AbstractTrappedIronChestBlock {
public TrappedDirtChestBlock(Properties properties) {
super(properties, IronChestsBlockEntityTypes.TRAPPED_DIRT_CHEST::get, IronChestsTypes.DIRT);
}
@Nullable
@Override
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
return new TrappedDirtChestBlockEntity(blockPos, blockState);
}
}

View File

@ -0,0 +1,23 @@
package com.progwml6.ironchest.common.block.trapped;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedGoldChestBlockEntity;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import javax.annotation.Nullable;
public class TrappedGoldChestBlock extends AbstractTrappedIronChestBlock {
public TrappedGoldChestBlock(Properties properties) {
super(properties, IronChestsBlockEntityTypes.TRAPPED_GOLD_CHEST::get, IronChestsTypes.GOLD);
}
@Nullable
@Override
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
return new TrappedGoldChestBlockEntity(blockPos, blockState);
}
}

View File

@ -0,0 +1,25 @@
package com.progwml6.ironchest.common.block.trapped;
import com.progwml6.ironchest.common.block.regular.AbstractIronChestBlock;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.regular.entity.IronChestBlockEntity;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedIronChestBlockEntity;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import javax.annotation.Nullable;
public class TrappedIronChestBlock extends AbstractTrappedIronChestBlock {
public TrappedIronChestBlock(Properties properties) {
super(properties, IronChestsBlockEntityTypes.TRAPPED_IRON_CHEST::get, IronChestsTypes.IRON);
}
@Nullable
@Override
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
return new TrappedIronChestBlockEntity(blockPos, blockState);
}
}

View File

@ -0,0 +1,23 @@
package com.progwml6.ironchest.common.block.trapped;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedObsidianChestBlockEntity;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import javax.annotation.Nullable;
public class TrappedObsidianChestBlock extends AbstractTrappedIronChestBlock {
public TrappedObsidianChestBlock(Properties properties) {
super(properties, IronChestsBlockEntityTypes.TRAPPED_OBSIDIAN_CHEST::get, IronChestsTypes.OBSIDIAN);
}
@Nullable
@Override
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
return new TrappedObsidianChestBlockEntity(blockPos, blockState);
}
}

View File

@ -0,0 +1,30 @@
package com.progwml6.ironchest.common.block.trapped.entity;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import java.util.function.Supplier;
public abstract class AbstractTrappedIronChestBlockEntity extends AbstractIronChestBlockEntity {
protected AbstractTrappedIronChestBlockEntity(BlockEntityType<?> blockEntityType, BlockPos blockPos, BlockState blockState, IronChestsTypes chestTypeIn, Supplier<Block> blockToUseIn) {
super(blockEntityType, blockPos, blockState, chestTypeIn, blockToUseIn);
}
@Override
protected void signalOpenCount(Level level, BlockPos blockPos, BlockState blockState, int previousCount, int newCount) {
super.signalOpenCount(level, blockPos, blockState, previousCount, newCount);
if (previousCount != newCount) {
Block block = blockState.getBlock();
level.updateNeighborsAt(blockPos, block);
level.updateNeighborsAt(blockPos.below(), block);
}
}
}

View File

@ -0,0 +1,22 @@
package com.progwml6.ironchest.common.block.trapped.entity;
import com.progwml6.ironchest.common.block.IronChestsBlocks;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import com.progwml6.ironchest.common.inventory.IronChestMenu;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.level.block.state.BlockState;
public class TrappedCopperChestBlockEntity extends AbstractTrappedIronChestBlockEntity {
public TrappedCopperChestBlockEntity(BlockPos blockPos, BlockState blockState) {
super(IronChestsBlockEntityTypes.TRAPPED_COPPER_CHEST.get(), blockPos, blockState, IronChestsTypes.COPPER, IronChestsBlocks.TRAPPED_COPPER_CHEST::get);
}
@Override
protected AbstractContainerMenu createMenu(int containerId, Inventory playerInventory) {
return IronChestMenu.createCopperContainer(containerId, playerInventory, this);
}
}

View File

@ -0,0 +1,87 @@
package com.progwml6.ironchest.common.block.trapped.entity;
import com.progwml6.ironchest.common.block.IronChestsBlocks;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
import com.progwml6.ironchest.common.block.entity.ICrystalChest;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import com.progwml6.ironchest.common.inventory.IronChestMenu;
import net.minecraft.core.BlockPos;
import net.minecraft.core.NonNullList;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
public class TrappedCrystalChestBlockEntity extends AbstractTrappedIronChestBlockEntity implements ICrystalChest {
private NonNullList<ItemStack> topStacks;
private boolean inventoryTouched;
private boolean hadStuff;
public TrappedCrystalChestBlockEntity(BlockPos blockPos, BlockState blockState) {
super(IronChestsBlockEntityTypes.TRAPPED_CRYSTAL_CHEST.get(), blockPos, blockState, IronChestsTypes.CRYSTAL, IronChestsBlocks.TRAPPED_CRYSTAL_CHEST::get);
this.topStacks = NonNullList.withSize(8, ItemStack.EMPTY);
}
@Override
protected AbstractContainerMenu createMenu(int containerId, Inventory playerInventory) {
return IronChestMenu.createCrystalContainer(containerId, playerInventory, this);
}
public static void tick(Level level, BlockPos blockPos, BlockState blockState, AbstractIronChestBlockEntity chestBlockEntity) {
if (chestBlockEntity instanceof TrappedCrystalChestBlockEntity crystalChest) {
if (!level.isClientSide && crystalChest.inventoryTouched) {
crystalChest.inventoryTouched = false;
crystalChest.sortTopStacks();
}
}
}
@Override
public void setItems(NonNullList<ItemStack> contents) {
super.setItems(contents);
this.inventoryTouched = true;
}
@Override
public ItemStack getItem(int index) {
this.inventoryTouched = true;
return super.getItem(index);
}
@Override
public NonNullList<ItemStack> getTopItems() {
return this.topStacks;
}
@Override
public Level getChestLevel() {
return this.level;
}
@Override
public BlockPos getChestWorldPosition() {
return this.worldPosition;
}
@Override
public void receiveMessageFromServer(NonNullList<ItemStack> topStacks) {
this.topStacks = topStacks;
}
@Override
public void setHadStuff(boolean hadStuff) {
this.hadStuff = hadStuff;
}
@Override
public boolean getHadStuff() {
return this.hadStuff;
}
}

View File

@ -0,0 +1,23 @@
package com.progwml6.ironchest.common.block.trapped.entity;
import com.progwml6.ironchest.common.block.IronChestsBlocks;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
import com.progwml6.ironchest.common.inventory.IronChestMenu;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.level.block.state.BlockState;
public class TrappedDiamondChestBlockEntity extends AbstractTrappedIronChestBlockEntity {
public TrappedDiamondChestBlockEntity(BlockPos blockPos, BlockState blockState) {
super(IronChestsBlockEntityTypes.TRAPPED_DIAMOND_CHEST.get(), blockPos, blockState, IronChestsTypes.DIAMOND, IronChestsBlocks.TRAPPED_DIAMOND_CHEST::get);
}
@Override
protected AbstractContainerMenu createMenu(int containerId, Inventory playerInventory) {
return IronChestMenu.createDiamondContainer(containerId, playerInventory, this);
}
}

View File

@ -0,0 +1,74 @@
package com.progwml6.ironchest.common.block.trapped.entity;
import com.progwml6.ironchest.common.block.IronChestsBlocks;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
import com.progwml6.ironchest.common.inventory.IronChestMenu;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.StringTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.state.BlockState;
import javax.annotation.Nullable;
import java.util.Objects;
public class TrappedDirtChestBlockEntity extends AbstractTrappedIronChestBlockEntity {
private static ItemStack DIRT_CHEST_BOOK = new ItemStack(Items.WRITTEN_BOOK);
private static boolean bookDataCreated = false;
public TrappedDirtChestBlockEntity(BlockPos blockPos, BlockState blockState) {
super(IronChestsBlockEntityTypes.TRAPPED_DIRT_CHEST.get(), blockPos, blockState, IronChestsTypes.DIRT, IronChestsBlocks.TRAPPED_DIRT_CHEST::get);
}
@Override
protected AbstractContainerMenu createMenu(int containerId, Inventory playerInventory) {
return IronChestMenu.createDirtContainer(containerId, playerInventory, this);
}
@Override
public void wasPlaced(@Nullable LivingEntity livingEntity, ItemStack itemStack) {
if (!(itemStack.hasTag() && Objects.requireNonNull(itemStack.getTag()).getBoolean("been_placed"))) {
//TODO FIX BOOK
//this.setInventorySlotContents(0, DIRT_CHEST_BOOK.copy());
}
if (!bookDataCreated) {
//createBookData();
}
}
@Override
public void removeAdornments() {
if (!this.getItems().get(0).isEmpty() && this.getItems().get(0).sameItem(DIRT_CHEST_BOOK)) {
this.getItems().set(0, ItemStack.EMPTY);
}
}
private static void createBookData() {
DIRT_CHEST_BOOK.addTagElement("author", StringTag.valueOf("cpw"));
DIRT_CHEST_BOOK.addTagElement("title", StringTag.valueOf(I18n.get("book.ironchest.dirtchest9000.title")));
ListTag pages = new ListTag();
pages.add(StringTag.valueOf(Component.Serializer.toJson(new TranslatableComponent("book.ironchest.dirtchest9000.page1"))));
pages.add(StringTag.valueOf(Component.Serializer.toJson(new TranslatableComponent("book.ironchest.dirtchest9000.page2"))));
pages.add(StringTag.valueOf(Component.Serializer.toJson(new TranslatableComponent("book.ironchest.dirtchest9000.page3"))));
pages.add(StringTag.valueOf(Component.Serializer.toJson(new TranslatableComponent("book.ironchest.dirtchest9000.page4"))));
pages.add(StringTag.valueOf(Component.Serializer.toJson(new TranslatableComponent("book.ironchest.dirtchest9000.page5"))));
DIRT_CHEST_BOOK.addTagElement("pages", pages);
bookDataCreated = true;
}
}

View File

@ -0,0 +1,23 @@
package com.progwml6.ironchest.common.block.trapped.entity;
import com.progwml6.ironchest.common.block.IronChestsBlocks;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
import com.progwml6.ironchest.common.inventory.IronChestMenu;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.level.block.state.BlockState;
public class TrappedGoldChestBlockEntity extends AbstractTrappedIronChestBlockEntity {
public TrappedGoldChestBlockEntity(BlockPos blockPos, BlockState blockState) {
super(IronChestsBlockEntityTypes.TRAPPED_GOLD_CHEST.get(), blockPos, blockState, IronChestsTypes.GOLD, IronChestsBlocks.TRAPPED_GOLD_CHEST::get);
}
@Override
protected AbstractContainerMenu createMenu(int containerId, Inventory playerInventory) {
return IronChestMenu.createGoldContainer(containerId, playerInventory, this);
}
}

View File

@ -0,0 +1,22 @@
package com.progwml6.ironchest.common.block.trapped.entity;
import com.progwml6.ironchest.common.block.IronChestsBlocks;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import com.progwml6.ironchest.common.inventory.IronChestMenu;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.level.block.state.BlockState;
public class TrappedIronChestBlockEntity extends AbstractTrappedIronChestBlockEntity {
public TrappedIronChestBlockEntity(BlockPos blockPos, BlockState blockState) {
super(IronChestsBlockEntityTypes.TRAPPED_IRON_CHEST.get(), blockPos, blockState, IronChestsTypes.IRON, IronChestsBlocks.TRAPPED_IRON_CHEST::get);
}
@Override
protected AbstractContainerMenu createMenu(int containerId, Inventory playerInventory) {
return IronChestMenu.createIronContainer(containerId, playerInventory, this);
}
}

View File

@ -0,0 +1,23 @@
package com.progwml6.ironchest.common.block.trapped.entity;
import com.progwml6.ironchest.common.block.IronChestsBlocks;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
import com.progwml6.ironchest.common.inventory.IronChestMenu;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.level.block.state.BlockState;
public class TrappedObsidianChestBlockEntity extends AbstractTrappedIronChestBlockEntity {
public TrappedObsidianChestBlockEntity(BlockPos blockPos, BlockState blockState) {
super(IronChestsBlockEntityTypes.TRAPPED_OBSIDIAN_CHEST.get(), blockPos, blockState, IronChestsTypes.OBSIDIAN, IronChestsBlocks.TRAPPED_OBSIDIAN_CHEST::get);
}
@Override
protected AbstractContainerMenu createMenu(int containerId, Inventory playerInventory) {
return IronChestMenu.createObsidianContainer(containerId, playerInventory, this);
}
}

View File

@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package com.progwml6.ironchest.common.block.trapped.entity;
import net.minecraft.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;

View File

@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package com.progwml6.ironchest.common.block.trapped;
import net.minecraft.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;

View File

@ -8,6 +8,7 @@ import net.minecraft.advancements.Advancement;
import net.minecraft.advancements.AdvancementRewards;
import net.minecraft.advancements.RequirementsStrategy;
import net.minecraft.advancements.critereon.RecipeUnlockedTrigger;
import net.minecraft.data.recipes.ShapelessRecipeBuilder;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.recipes.FinishedRecipe;
@ -30,7 +31,6 @@ import java.util.function.Consumer;
public class IronChestsRecipeProvider extends RecipeProvider implements IConditionBuilder {
public static final Tags.IOptionalNamedTag<Item> INGOTS_COPPER = tag("ingots/copper");
public static final Tags.IOptionalNamedTag<Item> INGOTS_SILVER = tag("ingots/silver");
public IronChestsRecipeProvider(DataGenerator generatorIn) {
super(generatorIn);
@ -100,6 +100,48 @@ public class IronChestsRecipeProvider extends RecipeProvider implements IConditi
.unlockedBy("has_iron_ingot", has(Blocks.DIRT))
.save(consumer, location(folder + "vanilla_dirt_chest"));
ShapelessRecipeBuilder.shapeless(IronChestsBlocks.TRAPPED_IRON_CHEST.get())
.requires(IronChestsBlocks.IRON_CHEST.get())
.requires(Blocks.TRIPWIRE_HOOK)
.unlockedBy("has_tripwire_hook", has(Blocks.TRIPWIRE_HOOK))
.save(consumer, location(folder + "trapped_iron_chest"));
ShapelessRecipeBuilder.shapeless(IronChestsBlocks.TRAPPED_GOLD_CHEST.get())
.requires(IronChestsBlocks.GOLD_CHEST.get())
.requires(Blocks.TRIPWIRE_HOOK)
.unlockedBy("has_tripwire_hook", has(Blocks.TRIPWIRE_HOOK))
.save(consumer, location(folder + "trapped_gold_chest"));
ShapelessRecipeBuilder.shapeless(IronChestsBlocks.TRAPPED_DIAMOND_CHEST.get())
.requires(IronChestsBlocks.DIAMOND_CHEST.get())
.requires(Blocks.TRIPWIRE_HOOK)
.unlockedBy("has_tripwire_hook", has(Blocks.TRIPWIRE_HOOK))
.save(consumer, location(folder + "trapped_diamond_chest"));
ShapelessRecipeBuilder.shapeless(IronChestsBlocks.TRAPPED_COPPER_CHEST.get())
.requires(IronChestsBlocks.COPPER_CHEST.get())
.requires(Blocks.TRIPWIRE_HOOK)
.unlockedBy("has_tripwire_hook", has(Blocks.TRIPWIRE_HOOK))
.save(consumer, location(folder + "trapped_copper_chest"));
ShapelessRecipeBuilder.shapeless(IronChestsBlocks.TRAPPED_CRYSTAL_CHEST.get())
.requires(IronChestsBlocks.CRYSTAL_CHEST.get())
.requires(Blocks.TRIPWIRE_HOOK)
.unlockedBy("has_tripwire_hook", has(Blocks.TRIPWIRE_HOOK))
.save(consumer, location(folder + "trapped_crystal_chest"));
ShapelessRecipeBuilder.shapeless(IronChestsBlocks.TRAPPED_OBSIDIAN_CHEST.get())
.requires(IronChestsBlocks.OBSIDIAN_CHEST.get())
.requires(Blocks.TRIPWIRE_HOOK)
.unlockedBy("has_tripwire_hook", has(Blocks.TRIPWIRE_HOOK))
.save(consumer, location(folder + "trapped_obsidian_chest"));
ShapelessRecipeBuilder.shapeless(IronChestsBlocks.TRAPPED_DIRT_CHEST.get())
.requires(IronChestsBlocks.DIRT_CHEST.get())
.requires(Blocks.TRIPWIRE_HOOK)
.unlockedBy("has_tripwire_hook", has(Blocks.TRIPWIRE_HOOK))
.save(consumer, location(folder + "trapped_dirt_chest"));
ResourceLocation copperToIronChest = location(folder + "copper_iron_chest");
ConditionalRecipe.builder()
.addCondition(not(new TagEmptyCondition("forge:ingots/copper")))
@ -121,47 +163,6 @@ public class IronChestsRecipeProvider extends RecipeProvider implements IConditi
.requirements(RequirementsStrategy.OR))
).build(consumer, copperToIronChest);
ResourceLocation copperToSilverChest = location(folder + "copper_silver_chest");
ConditionalRecipe.builder()
.addCondition(not(new TagEmptyCondition("forge:ingots/silver")))
.addRecipe(ShapedRecipeBuilder.shaped(IronChestsBlocks.SILVER_CHEST.get())
.define('M', INGOTS_SILVER)
.define('S', IronChestsBlocks.COPPER_CHEST.get())
.pattern("MMM")
.pattern("MSM")
.pattern("MMM")
.unlockedBy("has_item", has(INGOTS_SILVER))::save)
.setAdvancement(location("recipes/ironchest/chests/copper_silver_chest"), ConditionalAdvancement.builder()
.addCondition(not(new TagEmptyCondition("forge:ingots/silver")))
.addAdvancement(Advancement.Builder.advancement()
.parent(new ResourceLocation("recipes/root"))
.rewards(AdvancementRewards.Builder.recipe(copperToSilverChest))
.addCriterion("has_item", has(INGOTS_SILVER))
.addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(copperToSilverChest))
.requirements(RequirementsStrategy.OR))
).build(consumer, copperToSilverChest);
ResourceLocation ironToSilverChest = location(folder + "iron_silver_chest");
ConditionalRecipe.builder()
.addCondition(not(new TagEmptyCondition("forge:ingots/silver")))
.addRecipe(ShapedRecipeBuilder.shaped(IronChestsBlocks.SILVER_CHEST.get())
.define('M', INGOTS_SILVER)
.define('S', IronChestsBlocks.IRON_CHEST.get())
.define('G', Tags.Items.GLASS)
.pattern("MGM")
.pattern("MSM")
.pattern("MGM")
.unlockedBy("has_item", has(INGOTS_SILVER))::save)
.setAdvancement(location("recipes/ironchest/chests/iron_silver_chest"), ConditionalAdvancement.builder()
.addCondition(not(new TagEmptyCondition("forge:ingots/silver")))
.addAdvancement(Advancement.Builder.advancement()
.parent(new ResourceLocation("recipes/root"))
.rewards(AdvancementRewards.Builder.recipe(ironToSilverChest))
.addCriterion("has_item", has(INGOTS_SILVER))
.addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(ironToSilverChest))
.requirements(RequirementsStrategy.OR))
).build(consumer, ironToSilverChest);
ResourceLocation vanillaToCopperChest = location(folder + "vanilla_copper_chest");
ConditionalRecipe.builder()
.addCondition(not(new TagEmptyCondition("forge:ingots/copper")))
@ -173,7 +174,7 @@ public class IronChestsRecipeProvider extends RecipeProvider implements IConditi
.pattern("MMM")
.unlockedBy("has_item", has(INGOTS_COPPER))::save)
.setAdvancement(location("recipes/ironchest/chests/vanilla_copper_chest"), ConditionalAdvancement.builder()
.addCondition(not(new TagEmptyCondition("forge:ingots/silver")))
.addCondition(not(new TagEmptyCondition("forge:ingots/copper")))
.addAdvancement(Advancement.Builder.advancement()
.parent(new ResourceLocation("recipes/root"))
.rewards(AdvancementRewards.Builder.recipe(vanillaToCopperChest))
@ -181,48 +182,6 @@ public class IronChestsRecipeProvider extends RecipeProvider implements IConditi
.addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(vanillaToCopperChest))
.requirements(RequirementsStrategy.OR))
).build(consumer, vanillaToCopperChest);
ResourceLocation silverToGoldChest = location(folder + "silver_gold_chest");
ConditionalRecipe.builder()
.addCondition(not(new TagEmptyCondition("forge:ingots/copper")))
.addRecipe(ShapedRecipeBuilder.shaped(IronChestsBlocks.GOLD_CHEST.get())
.define('M', Tags.Items.INGOTS_GOLD)
.define('S', IronChestsBlocks.SILVER_CHEST.get())
.define('G', Tags.Items.GLASS)
.pattern("MGM")
.pattern("GSG")
.pattern("MGM")
.unlockedBy("has_item", has(INGOTS_SILVER))::save)
.setAdvancement(location("recipes/ironchest/chests/silver_gold_chest"), ConditionalAdvancement.builder()
.addCondition(not(new TagEmptyCondition("forge:ingots/silver")))
.addAdvancement(Advancement.Builder.advancement()
.parent(new ResourceLocation("recipes/root"))
.rewards(AdvancementRewards.Builder.recipe(silverToGoldChest))
.addCriterion("has_item", has(INGOTS_SILVER))
.addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(silverToGoldChest))
.requirements(RequirementsStrategy.OR))
).build(consumer, silverToGoldChest);
ResourceLocation silverToDiamondChest = location(folder + "silver_diamond_chest");
ConditionalRecipe.builder()
.addCondition(not(new TagEmptyCondition("forge:ingots/copper")))
.addRecipe(ShapedRecipeBuilder.shaped(IronChestsBlocks.DIAMOND_CHEST.get())
.define('M', Tags.Items.GEMS_DIAMOND)
.define('S', IronChestsBlocks.SILVER_CHEST.get())
.define('G', Tags.Items.GLASS)
.pattern("GGG")
.pattern("GSG")
.pattern("MMM")
.unlockedBy("has_item", has(Tags.Items.GEMS_DIAMOND))::save)
.setAdvancement(location("recipes/ironchest/chests/silver_diamond_chest"), ConditionalAdvancement.builder()
.addCondition(not(new TagEmptyCondition("forge:ingots/silver")))
.addAdvancement(Advancement.Builder.advancement()
.parent(new ResourceLocation("recipes/root"))
.rewards(AdvancementRewards.Builder.recipe(silverToDiamondChest))
.addCriterion("has_item", has(Tags.Items.GEMS_DIAMOND))
.addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(silverToDiamondChest))
.requirements(RequirementsStrategy.OR))
).build(consumer, silverToDiamondChest);
}
private void addUpgradesRecipes(Consumer<FinishedRecipe> consumer) {
@ -314,47 +273,6 @@ public class IronChestsRecipeProvider extends RecipeProvider implements IConditi
.addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(copperToIronChestUpgrade))
.requirements(RequirementsStrategy.OR))
).build(consumer, copperToIronChestUpgrade);
ResourceLocation copperToSilverChestUpgrade = prefix(IronChestsItems.UPGRADES.get(IronChestsUpgradeType.COPPER_TO_SILVER).get(), folder);
ConditionalRecipe.builder()
.addCondition(and(not(new TagEmptyCondition("forge:ingots/copper")), not(new TagEmptyCondition("forge:ingots/silver"))))
.addRecipe(ShapedRecipeBuilder.shaped(IronChestsItems.UPGRADES.get(IronChestsUpgradeType.COPPER_TO_SILVER).get())
.define('M', INGOTS_SILVER)
.define('S', INGOTS_COPPER)
.pattern("MMM")
.pattern("MSM")
.pattern("MMM")
.unlockedBy("has_item", has(INGOTS_COPPER))::save)
.setAdvancement(location("recipes/ironchest/upgrades/copper_to_silver_chest_upgrade"), ConditionalAdvancement.builder()
.addCondition(and(not(new TagEmptyCondition("forge:ingots/copper")), not(new TagEmptyCondition("forge:ingots/silver"))))
.addAdvancement(Advancement.Builder.advancement()
.parent(new ResourceLocation("recipes/root"))
.rewards(AdvancementRewards.Builder.recipe(copperToSilverChestUpgrade))
.addCriterion("has_item", has(INGOTS_COPPER))
.addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(copperToSilverChestUpgrade))
.requirements(RequirementsStrategy.OR))
).build(consumer, copperToSilverChestUpgrade);
ResourceLocation silverToGoldChestUpgrade = prefix(IronChestsItems.UPGRADES.get(IronChestsUpgradeType.SILVER_TO_GOLD).get(), folder);
ConditionalRecipe.builder()
.addCondition(not(new TagEmptyCondition("forge:ingots/silver")))
.addRecipe(ShapedRecipeBuilder.shaped(IronChestsItems.UPGRADES.get(IronChestsUpgradeType.SILVER_TO_GOLD).get())
.define('M', Tags.Items.INGOTS_GOLD)
.define('S', INGOTS_SILVER)
.define('G', Tags.Items.GLASS)
.pattern("MGM")
.pattern("GSG")
.pattern("MGM")
.unlockedBy("has_item", has(Tags.Items.GLASS))::save)
.setAdvancement(location("recipes/ironchest/upgrades/silver_to_gold_chest_upgrade"), ConditionalAdvancement.builder()
.addCondition(not(new TagEmptyCondition("forge:ingots/silver")))
.addAdvancement(Advancement.Builder.advancement()
.parent(new ResourceLocation("recipes/root"))
.rewards(AdvancementRewards.Builder.recipe(silverToGoldChestUpgrade))
.addCriterion("has_item", has(Tags.Items.GLASS))
.addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(silverToGoldChestUpgrade))
.requirements(RequirementsStrategy.OR))
).build(consumer, silverToGoldChestUpgrade);
}
protected static ResourceLocation prefix(ItemLike item, String prefix) {

View File

@ -64,14 +64,6 @@ public class IronChestMenu extends AbstractContainerMenu {
return new IronChestMenu(IronChestsContainerTypes.COPPER_CHEST.get(), containerId, playerInventory, inventory, IronChestsTypes.COPPER);
}
public static IronChestMenu createSilverContainer(int containerId, Inventory playerInventory) {
return new IronChestMenu(IronChestsContainerTypes.SILVER_CHEST.get(), containerId, playerInventory, new SimpleContainer(IronChestsTypes.CRYSTAL.size), IronChestsTypes.SILVER);
}
public static IronChestMenu createSilverContainer(int containerId, Inventory playerInventory, Container inventory) {
return new IronChestMenu(IronChestsContainerTypes.SILVER_CHEST.get(), containerId, playerInventory, inventory, IronChestsTypes.SILVER);
}
public static IronChestMenu createObsidianContainer(int containerId, Inventory playerInventory) {
return new IronChestMenu(IronChestsContainerTypes.OBSIDIAN_CHEST.get(), containerId, playerInventory, new SimpleContainer(IronChestsTypes.OBSIDIAN.size), IronChestsTypes.OBSIDIAN);
}

View File

@ -20,8 +20,6 @@ public class IronChestsContainerTypes {
public static final RegistryObject<MenuType<IronChestMenu>> COPPER_CHEST = CONTAINERS.register("copper_chest", () -> new MenuType<>(IronChestMenu::createCopperContainer));
public static final RegistryObject<MenuType<IronChestMenu>> SILVER_CHEST = CONTAINERS.register("silver_chest", () -> new MenuType<>(IronChestMenu::createSilverContainer));
public static final RegistryObject<MenuType<IronChestMenu>> OBSIDIAN_CHEST = CONTAINERS.register("obsidian_chest", () -> new MenuType<>(IronChestMenu::createObsidianContainer));
public static final RegistryObject<MenuType<IronChestMenu>> DIRT_CHEST = CONTAINERS.register("dirt_chest", () -> new MenuType<>(IronChestMenu::createDirtContainer));

View File

@ -1,8 +1,12 @@
package com.progwml6.ironchest.common.item;
import com.progwml6.ironchest.common.block.AbstractIronChestBlock;
import com.progwml6.ironchest.common.block.IronChestsBlocks;
import com.progwml6.ironchest.common.block.regular.AbstractIronChestBlock;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.entity.AbstractIronChestBlockEntity;
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
import com.progwml6.ironchest.common.block.trapped.entity.AbstractTrappedIronChestBlockEntity;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.TrappedChestBlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.ChestBlock;
import net.minecraft.world.entity.player.Player;
@ -33,6 +37,7 @@ public class ChestUpgradeItem extends Item {
BlockPos blockPos = context.getClickedPos();
Level world = context.getLevel();
ItemStack itemStack = context.getItemInHand();
boolean passed = false;
if (world.isClientSide) {
return InteractionResult.PASS;
@ -47,11 +52,17 @@ public class ChestUpgradeItem extends Item {
return InteractionResult.PASS;
}
} else {
if (world.getBlockState(blockPos).getBlock().defaultBlockState() != IronChestsTypes.get(this.type.source).defaultBlockState()) {
return InteractionResult.PASS;
for (Block block : IronChestsTypes.get(this.type.source)) {
if (!passed)
passed = world.getBlockState(blockPos).getBlock().defaultBlockState() == block.defaultBlockState();
}
}
if (!passed) {
return InteractionResult.PASS;
}
BlockEntity tileEntity = world.getBlockEntity(blockPos);
if (this.type.canUpgrade(IronChestsTypes.WOOD)) {
@ -64,7 +75,7 @@ public class ChestUpgradeItem extends Item {
Component customName = null;
NonNullList<ItemStack> chestContents = NonNullList.withSize(27, ItemStack.EMPTY);
Direction chestFacing = Direction.NORTH;
BlockState iBlockState = IronChestsTypes.get(this.type.target).defaultBlockState();
BlockState iBlockState = IronChestsBlocks.COPPER_CHEST.get().defaultBlockState();
if (tileEntity != null) {
if (tileEntity instanceof AbstractIronChestBlockEntity chest) {
@ -78,11 +89,20 @@ public class ChestUpgradeItem extends Item {
return InteractionResult.PASS;
}
boolean trapped = tileEntity instanceof AbstractTrappedIronChestBlockEntity;
if(trapped) {
iBlockState = IronChestsTypes.get(this.type.target).get(1).defaultBlockState();
} else {
iBlockState = IronChestsTypes.get(this.type.target).get(0).defaultBlockState();
}
chestContents = chest.getItems();
chestFacing = chestState.getValue(AbstractIronChestBlock.FACING);
customName = chest.getCustomName();
iBlockState = iBlockState.setValue(AbstractIronChestBlock.FACING, chestFacing);
newChest = this.type.target.makeEntity(blockPos, iBlockState);
newChest = this.type.target.makeEntity(blockPos, iBlockState, trapped);
} else if (tileEntity instanceof ChestBlockEntity chest) {
BlockState chestState = world.getBlockState(blockPos);
chestFacing = chestState.getValue(ChestBlock.FACING);
@ -107,9 +127,17 @@ public class ChestUpgradeItem extends Item {
customName = chest.getCustomName();
boolean trapped = tileEntity instanceof TrappedChestBlockEntity;
if(trapped) {
iBlockState = IronChestsTypes.get(this.type.source).get(1).defaultBlockState();
} else {
iBlockState = IronChestsTypes.get(this.type.source).get(0).defaultBlockState();
}
iBlockState = iBlockState.setValue(AbstractIronChestBlock.FACING, chestFacing);
newChest = this.type.target.makeEntity(blockPos, iBlockState);
newChest = this.type.target.makeEntity(blockPos, iBlockState, trapped);
}
}

View File

@ -3,14 +3,20 @@ package com.progwml6.ironchest.common.item;
import com.progwml6.ironchest.client.model.inventory.IronChestItemStackRenderer;
import com.progwml6.ironchest.common.block.IronChestsBlocks;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.entity.CopperChestBlockEntity;
import com.progwml6.ironchest.common.block.entity.CrystalChestBlockEntity;
import com.progwml6.ironchest.common.block.entity.DiamondChestBlockEntity;
import com.progwml6.ironchest.common.block.entity.DirtChestBlockEntity;
import com.progwml6.ironchest.common.block.entity.GoldChestBlockEntity;
import com.progwml6.ironchest.common.block.entity.IronChestBlockEntity;
import com.progwml6.ironchest.common.block.entity.ObsidianChestBlockEntity;
import com.progwml6.ironchest.common.block.entity.SilverChestBlockEntity;
import com.progwml6.ironchest.common.block.regular.entity.CopperChestBlockEntity;
import com.progwml6.ironchest.common.block.regular.entity.CrystalChestBlockEntity;
import com.progwml6.ironchest.common.block.regular.entity.DiamondChestBlockEntity;
import com.progwml6.ironchest.common.block.regular.entity.DirtChestBlockEntity;
import com.progwml6.ironchest.common.block.regular.entity.GoldChestBlockEntity;
import com.progwml6.ironchest.common.block.regular.entity.IronChestBlockEntity;
import com.progwml6.ironchest.common.block.regular.entity.ObsidianChestBlockEntity;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedCopperChestBlockEntity;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedCrystalChestBlockEntity;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedDiamondChestBlockEntity;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedDirtChestBlockEntity;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedGoldChestBlockEntity;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedIronChestBlockEntity;
import com.progwml6.ironchest.common.block.trapped.entity.TrappedObsidianChestBlockEntity;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
import net.minecraft.core.BlockPos;
@ -29,12 +35,16 @@ public class IronChestBlockItem extends BlockItem {
protected Supplier<IronChestsTypes> type;
public IronChestBlockItem(Block block, Properties properties, Supplier<Callable<IronChestsTypes>> type) {
protected Supplier<Boolean> trapped;
public IronChestBlockItem(Block block, Properties properties, Supplier<Callable<IronChestsTypes>> type, Supplier<Callable<Boolean>> trapped) {
super(block, properties);
IronChestsTypes tempType = DistExecutor.callWhenOn(Dist.CLIENT, type);
Boolean tempTrapped = DistExecutor.callWhenOn(Dist.CLIENT, trapped);
this.type = tempType == null ? null : () -> tempType;
this.trapped = tempTrapped == null ? null : () -> tempTrapped;
}
@Override
@ -46,15 +56,26 @@ public class IronChestBlockItem extends BlockItem {
public BlockEntityWithoutLevelRenderer getItemStackRenderer() {
Supplier<BlockEntity> modelToUse;
switch (type.get()) {
case GOLD -> modelToUse = () -> new GoldChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.GOLD_CHEST.get().defaultBlockState());
case DIAMOND -> modelToUse = () -> new DiamondChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.DIAMOND_CHEST.get().defaultBlockState());
case COPPER -> modelToUse = () -> new CopperChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.COPPER_CHEST.get().defaultBlockState());
case SILVER -> modelToUse = () -> new SilverChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.SILVER_CHEST.get().defaultBlockState());
case CRYSTAL -> modelToUse = () -> new CrystalChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.CRYSTAL_CHEST.get().defaultBlockState());
case OBSIDIAN -> modelToUse = () -> new ObsidianChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.OBSIDIAN_CHEST.get().defaultBlockState());
case DIRT -> modelToUse = () -> new DirtChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.DIRT_CHEST.get().defaultBlockState());
default -> modelToUse = () -> new IronChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.IRON_CHEST.get().defaultBlockState());
if (trapped.get()) {
switch (type.get()) {
case GOLD -> modelToUse = () -> new TrappedGoldChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.TRAPPED_GOLD_CHEST.get().defaultBlockState());
case DIAMOND -> modelToUse = () -> new TrappedDiamondChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.TRAPPED_DIAMOND_CHEST.get().defaultBlockState());
case COPPER -> modelToUse = () -> new TrappedCopperChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.TRAPPED_COPPER_CHEST.get().defaultBlockState());
case CRYSTAL -> modelToUse = () -> new TrappedCrystalChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.TRAPPED_CRYSTAL_CHEST.get().defaultBlockState());
case OBSIDIAN -> modelToUse = () -> new TrappedObsidianChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.TRAPPED_OBSIDIAN_CHEST.get().defaultBlockState());
case DIRT -> modelToUse = () -> new TrappedDirtChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.TRAPPED_DIRT_CHEST.get().defaultBlockState());
default -> modelToUse = () -> new TrappedIronChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.TRAPPED_IRON_CHEST.get().defaultBlockState());
}
} else {
switch (type.get()) {
case GOLD -> modelToUse = () -> new GoldChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.GOLD_CHEST.get().defaultBlockState());
case DIAMOND -> modelToUse = () -> new DiamondChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.DIAMOND_CHEST.get().defaultBlockState());
case COPPER -> modelToUse = () -> new CopperChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.COPPER_CHEST.get().defaultBlockState());
case CRYSTAL -> modelToUse = () -> new CrystalChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.CRYSTAL_CHEST.get().defaultBlockState());
case OBSIDIAN -> modelToUse = () -> new ObsidianChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.OBSIDIAN_CHEST.get().defaultBlockState());
case DIRT -> modelToUse = () -> new DirtChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.DIRT_CHEST.get().defaultBlockState());
default -> modelToUse = () -> new IronChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.IRON_CHEST.get().defaultBlockState());
}
}
return new IronChestItemStackRenderer(Minecraft.getInstance().getBlockEntityRenderDispatcher(), Minecraft.getInstance().getEntityModels(), modelToUse);

View File

@ -9,15 +9,12 @@ import static com.progwml6.ironchest.common.block.IronChestsTypes.DIAMOND;
import static com.progwml6.ironchest.common.block.IronChestsTypes.GOLD;
import static com.progwml6.ironchest.common.block.IronChestsTypes.IRON;
import static com.progwml6.ironchest.common.block.IronChestsTypes.OBSIDIAN;
import static com.progwml6.ironchest.common.block.IronChestsTypes.SILVER;
import static com.progwml6.ironchest.common.block.IronChestsTypes.WOOD;
public enum IronChestsUpgradeType {
IRON_TO_GOLD(IRON, GOLD),
GOLD_TO_DIAMOND(GOLD, DIAMOND),
COPPER_TO_SILVER(COPPER, SILVER),
SILVER_TO_GOLD(SILVER, GOLD),
COPPER_TO_IRON(COPPER, IRON),
DIAMOND_TO_CRYSTAL(DIAMOND, CRYSTAL),
WOOD_TO_IRON(WOOD, IRON),

View File

@ -1,6 +1,6 @@
package com.progwml6.ironchest.common.network;
import com.progwml6.ironchest.common.block.entity.CrystalChestBlockEntity;
import com.progwml6.ironchest.common.block.entity.ICrystalChest;
import com.progwml6.ironchest.common.network.helper.IThreadsafePacket;
import net.minecraft.client.Minecraft;
import net.minecraft.world.item.ItemStack;
@ -64,8 +64,8 @@ public class InventoryTopStacksSyncPacket implements IThreadsafePacket {
BlockEntity te = world.getBlockEntity(packet.pos);
if (te != null) {
if (te instanceof CrystalChestBlockEntity) {
((CrystalChestBlockEntity) te).receiveMessageFromServer(packet.topStacks);
if (te instanceof ICrystalChest) {
((ICrystalChest) te).receiveMessageFromServer(packet.topStacks);
Minecraft.getInstance().levelRenderer.blockChanged(null, packet.pos, null, null, 0);
}

View File

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "ironchest:block/silver_chest" }
}
}

View File

@ -0,0 +1,5 @@
{
"variants": {
"": { "model": "ironchest:block/trapped_copper_chest" }
}
}

View File

@ -0,0 +1,5 @@
{
"variants": {
"": { "model": "ironchest:block/trapped_crystal_chest" }
}
}

View File

@ -0,0 +1,5 @@
{
"variants": {
"": { "model": "ironchest:block/trapped_diamond_chest" }
}
}

View File

@ -0,0 +1,5 @@
{
"variants": {
"": { "model": "ironchest:block/trapped_dirt_chest" }
}
}

View File

@ -0,0 +1,5 @@
{
"variants": {
"": { "model": "ironchest:block/trapped_gold_chest" }
}
}

View File

@ -0,0 +1,5 @@
{
"variants": {
"": { "model": "ironchest:block/trapped_iron_chest" }
}
}

View File

@ -0,0 +1,5 @@
{
"variants": {
"": { "model": "ironchest:block/trapped_obsidian_chest" }
}
}

View File

@ -4,11 +4,18 @@
"block.ironchest.gold_chest": "Gold Chest",
"block.ironchest.diamond_chest": "Diamond Chest",
"block.ironchest.copper_chest": "Copper Chest",
"block.ironchest.silver_chest": "Silver Chest",
"block.ironchest.crystal_chest": "Crystal Chest",
"block.ironchest.obsidian_chest": "Obsidian Chest",
"block.ironchest.dirt_chest": "DirtChest 9000!",
"block.ironchest.trapped_iron_chest": "Trapped Iron Chest",
"block.ironchest.trapped_gold_chest": "Trapped Gold Chest",
"block.ironchest.trapped_diamond_chest": "Trapped Diamond Chest",
"block.ironchest.trapped_copper_chest": "Trapped Copper Chest",
"block.ironchest.trapped_crystal_chest": "Trapped Crystal Chest",
"block.ironchest.trapped_obsidian_chest": "Trapped Obsidian Chest",
"block.ironchest.trapped_dirt_chest": "Trapped DirtChest 9000!",
"_comment": "Upgrades",
"item.ironchest.iron_to_gold_chest_upgrade": "Iron to Gold Chest Upgrade",
"item.ironchest.gold_to_diamond_chest_upgrade": "Gold to Diamond Chest Upgrade",

View File

@ -0,0 +1,42 @@
{
"parent": "block/block",
"textures": {
"texture": "ironchest:model/trapped_copper_chest",
"particle": "ironchest:block/copper_break"
},
"elements": [
{ "from": [ 1, 0, 1 ],
"to": [ 15, 10, 15 ],
"faces": {
"down": { "uv": [ 7, 4.75, 10.5, 8.25 ], "texture": "#texture" },
"up": { "uv": [ 3.5, 4.75, 7, 8.25 ], "texture": "#texture" },
"north": { "uv": [ 3.5, 8.25, 7, 10.75 ], "texture": "#texture" },
"south": { "uv": [ 10.5, 8.25, 14, 10.75 ], "texture": "#texture" },
"west": { "uv": [ 7, 8.25, 10.5, 10.75 ], "texture": "#texture" },
"east": { "uv": [ 0, 8.25, 3.5, 10.75 ], "texture": "#texture" }
}
},
{ "from": [ 1, 9, 1 ],
"to": [ 15, 14, 15 ],
"faces": {
"down": { "uv": [ 7, 0, 10.5, 3.5 ], "texture": "#texture" },
"up": { "uv": [ 3.5, 0, 7, 3.5 ], "texture": "#texture" },
"north": { "uv": [ 3.5, 3.5, 7, 4.75 ], "texture": "#texture" },
"south": { "uv": [ 10.5, 3.5, 14, 4.75 ], "texture": "#texture" },
"west": { "uv": [ 7, 3.5, 10.5, 4.75 ], "texture": "#texture" },
"east": { "uv": [ 0, 3.5, 3.5, 4.75 ], "texture": "#texture" }
}
},
{ "from": [ 7, 7, 0 ],
"to": [ 9, 11, 1 ],
"faces": {
"down": { "uv": [ 0, 0.75, 1.25, 0.5 ], "texture": "#texture" },
"up": { "uv": [ 0, 0.25, 0.75, 0.5 ], "texture": "#texture" },
"north": { "uv": [ 0.25, 0.25, 0.75, 1.25 ], "texture": "#texture" },
"south": { "uv": [ 1, 0.25, 1.5, 1.25 ], "texture": "#texture" },
"west": { "uv": [ 0.75, 0.25, 1, 1.25 ], "texture": "#texture" },
"east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" }
}
}
]
}

View File

@ -0,0 +1,42 @@
{
"parent": "block/block",
"textures": {
"texture": "ironchest:model/trapped_crystal_chest",
"particle": "ironchest:block/crystal_break"
},
"elements": [
{ "from": [ 1, 0, 1 ],
"to": [ 15, 10, 15 ],
"faces": {
"down": { "uv": [ 7, 4.75, 10.5, 8.25 ], "texture": "#texture" },
"up": { "uv": [ 3.5, 4.75, 7, 8.25 ], "texture": "#texture" },
"north": { "uv": [ 3.5, 8.25, 7, 10.75 ], "texture": "#texture" },
"south": { "uv": [ 10.5, 8.25, 14, 10.75 ], "texture": "#texture" },
"west": { "uv": [ 7, 8.25, 10.5, 10.75 ], "texture": "#texture" },
"east": { "uv": [ 0, 8.25, 3.5, 10.75 ], "texture": "#texture" }
}
},
{ "from": [ 1, 9, 1 ],
"to": [ 15, 14, 15 ],
"faces": {
"down": { "uv": [ 7, 0, 10.5, 3.5 ], "texture": "#texture" },
"up": { "uv": [ 3.5, 0, 7, 3.5 ], "texture": "#texture" },
"north": { "uv": [ 3.5, 3.5, 7, 4.75 ], "texture": "#texture" },
"south": { "uv": [ 10.5, 3.5, 14, 4.75 ], "texture": "#texture" },
"west": { "uv": [ 7, 3.5, 10.5, 4.75 ], "texture": "#texture" },
"east": { "uv": [ 0, 3.5, 3.5, 4.75 ], "texture": "#texture" }
}
},
{ "from": [ 7, 7, 0 ],
"to": [ 9, 11, 1 ],
"faces": {
"down": { "uv": [ 0, 0.75, 1.25, 0.5 ], "texture": "#texture" },
"up": { "uv": [ 0, 0.25, 0.75, 0.5 ], "texture": "#texture" },
"north": { "uv": [ 0.25, 0.25, 0.75, 1.25 ], "texture": "#texture" },
"south": { "uv": [ 1, 0.25, 1.5, 1.25 ], "texture": "#texture" },
"west": { "uv": [ 0.75, 0.25, 1, 1.25 ], "texture": "#texture" },
"east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" }
}
}
]
}

View File

@ -0,0 +1,42 @@
{
"parent": "block/block",
"textures": {
"texture": "ironchest:model/trapped_diamond_chest",
"particle": "ironchest:block/diamond_break"
},
"elements": [
{ "from": [ 1, 0, 1 ],
"to": [ 15, 10, 15 ],
"faces": {
"down": { "uv": [ 7, 4.75, 10.5, 8.25 ], "texture": "#texture" },
"up": { "uv": [ 3.5, 4.75, 7, 8.25 ], "texture": "#texture" },
"north": { "uv": [ 3.5, 8.25, 7, 10.75 ], "texture": "#texture" },
"south": { "uv": [ 10.5, 8.25, 14, 10.75 ], "texture": "#texture" },
"west": { "uv": [ 7, 8.25, 10.5, 10.75 ], "texture": "#texture" },
"east": { "uv": [ 0, 8.25, 3.5, 10.75 ], "texture": "#texture" }
}
},
{ "from": [ 1, 9, 1 ],
"to": [ 15, 14, 15 ],
"faces": {
"down": { "uv": [ 7, 0, 10.5, 3.5 ], "texture": "#texture" },
"up": { "uv": [ 3.5, 0, 7, 3.5 ], "texture": "#texture" },
"north": { "uv": [ 3.5, 3.5, 7, 4.75 ], "texture": "#texture" },
"south": { "uv": [ 10.5, 3.5, 14, 4.75 ], "texture": "#texture" },
"west": { "uv": [ 7, 3.5, 10.5, 4.75 ], "texture": "#texture" },
"east": { "uv": [ 0, 3.5, 3.5, 4.75 ], "texture": "#texture" }
}
},
{ "from": [ 7, 7, 0 ],
"to": [ 9, 11, 1 ],
"faces": {
"down": { "uv": [ 0, 0.75, 1.25, 0.5 ], "texture": "#texture" },
"up": { "uv": [ 0, 0.25, 0.75, 0.5 ], "texture": "#texture" },
"north": { "uv": [ 0.25, 0.25, 0.75, 1.25 ], "texture": "#texture" },
"south": { "uv": [ 1, 0.25, 1.5, 1.25 ], "texture": "#texture" },
"west": { "uv": [ 0.75, 0.25, 1, 1.25 ], "texture": "#texture" },
"east": { "uv": [ 0, 0.25, 0.25, 1.25 ], "texture": "#texture" }
}
}
]
}

View File

@ -1,8 +1,8 @@
{
"parent": "block/block",
"textures": {
"texture": "ironchest:model/silver_chest",
"particle": "ironchest:block/silver_break"
"texture": "ironchest:model/trapped_dirt_chest",
"particle": "minecraft:block/dirt"
},
"elements": [
{ "from": [ 1, 0, 1 ],

Some files were not shown because too many files have changed in this diff Show More