Merge and fix

This commit is contained in:
paulevsGitch 2020-11-08 15:07:19 +03:00
parent b91c85529d
commit ce9f4add97
548 changed files with 17517 additions and 16862 deletions

62
.gitignore vendored
View file

@ -1,31 +1,31 @@
# gradle # gradle
.gradle/ .gradle/
build/ build/
out/ out/
classes/ classes/
# eclipse # eclipse
*.launch *.launch
# idea # idea
.idea/ .idea/
*.iml *.iml
*.ipr *.ipr
*.iws *.iws
# vscode # vscode
.settings/ .settings/
.vscode/ .vscode/
bin/ bin/
.classpath .classpath
.project .project
# fabric # fabric
run/ run/
output/ output/
*.log *.log

View file

@ -1,17 +1,17 @@
[![](https://jitpack.io/v/paulevsGitch/BetterEnd.svg)](https://jitpack.io/#paulevsGitch/BetterEnd) [![](https://jitpack.io/v/paulevsGitch/BetterEnd.svg)](https://jitpack.io/#paulevsGitch/BetterEnd)
# Better End # Better End
Better End Mod for Fabric, MC 1.16.3 Better End Mod for Fabric, MC 1.16.3
Importing: Importing:
* Clone repo * Clone repo
* Edit gradle.properties if necessary * Edit gradle.properties if necessary
* Run command line in folder: gradlew genSources eclipse (or Another-IDE-Name) * Run command line in folder: gradlew genSources eclipse (or Another-IDE-Name)
* Import project to IDE * Import project to IDE
Building: Building:
* Clone repo * Clone repo
* Run command line in folder: gradlew build * Run command line in folder: gradlew build
* Mod .jar will be in ./build/libs * Mod .jar will be in ./build/libs
Mappings: Mappings:
* https://modmuss50.me/fabric.html?&version=1.16.3 * https://modmuss50.me/fabric.html?&version=1.16.3

View file

@ -1,93 +1,93 @@
plugins { plugins {
id 'fabric-loom' version '0.5-SNAPSHOT' id 'fabric-loom' version '0.5-SNAPSHOT'
id 'maven-publish' id 'maven-publish'
} }
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8
archivesBaseName = project.archives_base_name archivesBaseName = project.archives_base_name
version = project.mod_version version = project.mod_version
group = project.maven_group group = project.maven_group
repositories { repositories {
maven { url "https://maven.dblsaiko.net/" } maven { url "https://maven.dblsaiko.net/" }
maven { url "http://server.bbkr.space:8081/artifactory/libs-release/" } maven { url "http://server.bbkr.space:8081/artifactory/libs-release/" }
maven { url "https://maven.fabricmc.net/" } maven { url "https://maven.fabricmc.net/" }
maven { url 'https://jitpack.io' } maven { url 'https://jitpack.io' }
jcenter() jcenter()
} }
dependencies { dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}" minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.minecraft_version}+build.${project.yarn_mappings}:v2" mappings "net.fabricmc:yarn:${project.minecraft_version}+build.${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
optional "me.shedaniel:RoughlyEnoughItems:${project.rei_version}" optional "me.shedaniel:RoughlyEnoughItems:${project.rei_version}"
optional "me.shedaniel:RoughlyEnoughItems-api:${project.rei_version}" optional "me.shedaniel:RoughlyEnoughItems-api:${project.rei_version}"
optional "grondag:canvas-mc116:${project.canvas_version}" optional "grondag:canvas-mc116:${project.canvas_version}"
} }
def optional(String dep) { def optional(String dep) {
dependencies.modRuntime (dep) { dependencies.modRuntime (dep) {
exclude group: "net.fabricmc.fabric-api" exclude group: "net.fabricmc.fabric-api"
exclude module: "fabric-loader" exclude module: "fabric-loader"
} }
dependencies.modCompileOnly (dep) { dependencies.modCompileOnly (dep) {
exclude group: "net.fabricmc.fabric-api" exclude group: "net.fabricmc.fabric-api"
exclude module: "fabric-loader" exclude module: "fabric-loader"
} }
} }
processResources { processResources {
inputs.property "version", project.version inputs.property "version", project.version
from(sourceSets.main.resources.srcDirs) { from(sourceSets.main.resources.srcDirs) {
include "fabric.mod.json" include "fabric.mod.json"
expand "version": project.version expand "version": project.version
} }
from(sourceSets.main.resources.srcDirs) { from(sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json" exclude "fabric.mod.json"
} }
} }
// ensure that the encoding is set to UTF-8, no matter what the system default is // ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly // this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
tasks.withType(JavaCompile) { tasks.withType(JavaCompile) {
options.encoding = "UTF-8" options.encoding = "UTF-8"
} }
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present. // if it is present.
// If you remove this task, sources will not be generated. // If you remove this task, sources will not be generated.
task sourcesJar(type: Jar, dependsOn: classes) { task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources" classifier = "sources"
from sourceSets.main.allSource from sourceSets.main.allSource
} }
jar { jar {
from "LICENSE" from "LICENSE"
} }
// configure the maven publication // configure the maven publication
publishing { publishing {
publications { publications {
mavenJava(MavenPublication) { mavenJava(MavenPublication) {
artifact(remapJar) { artifact(remapJar) {
builtBy remapJar builtBy remapJar
} }
artifact(sourcesJar) { artifact(sourcesJar) {
builtBy remapSourcesJar builtBy remapSourcesJar
} }
} }
} }
// select the repositories you want to publish to // select the repositories you want to publish to
repositories { repositories {
// uncomment to publish to the local maven // uncomment to publish to the local maven
// mavenLocal() // mavenLocal()
} }
} }

View file

@ -1,21 +1,21 @@
# Done to increase the memory available to gradle. # Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx2G org.gradle.jvmargs=-Xmx2G
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/use # check these on https://fabricmc.net/use
minecraft_version = 1.16.4 minecraft_version = 1.16.4
yarn_mappings = 1 yarn_mappings = 1
loader_version = 0.10.6+build.214 loader_version = 0.10.6+build.214
# Mod Properties # Mod Properties
mod_version = 0.6.0-beta mod_version = 0.6.0-beta
maven_group = ru.betterend maven_group = ru.betterend
archives_base_name = better-end archives_base_name = better-end
# Dependencies # Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version = 0.25.1+build.416-1.16 fabric_version = 0.25.1+build.416-1.16
cloth_config_version = 4.8.2 cloth_config_version = 4.8.2
cloth_events_version = 1.4.8 cloth_events_version = 1.4.8
canvas_version = 1.0.+ canvas_version = 1.0.+
rei_version = 5.6.2 rei_version = 5.6.2

View file

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

366
gradlew vendored
View file

@ -1,183 +1,183 @@
#!/usr/bin/env sh #!/usr/bin/env sh
# #
# Copyright 2015 the original author or authors. # Copyright 2015 the original author or authors.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# https://www.apache.org/licenses/LICENSE-2.0 # https://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
############################################################################## ##############################################################################
## ##
## Gradle start up script for UN*X ## Gradle start up script for UN*X
## ##
############################################################################## ##############################################################################
# Attempt to set APP_HOME # Attempt to set APP_HOME
# Resolve links: $0 may be a link # Resolve links: $0 may be a link
PRG="$0" PRG="$0"
# Need this for relative symlinks. # Need this for relative symlinks.
while [ -h "$PRG" ] ; do while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"` ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'` link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then if expr "$link" : '/.*' > /dev/null; then
PRG="$link" PRG="$link"
else else
PRG=`dirname "$PRG"`"/$link" PRG=`dirname "$PRG"`"/$link"
fi fi
done done
SAVED="`pwd`" SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`" APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null cd "$SAVED" >/dev/null
APP_NAME="Gradle" APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"` APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # 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"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum" MAX_FD="maximum"
warn () { warn () {
echo "$*" echo "$*"
} }
die () { die () {
echo echo
echo "$*" echo "$*"
echo echo
exit 1 exit 1
} }
# OS specific support (must be 'true' or 'false'). # OS specific support (must be 'true' or 'false').
cygwin=false cygwin=false
msys=false msys=false
darwin=false darwin=false
nonstop=false nonstop=false
case "`uname`" in case "`uname`" in
CYGWIN* ) CYGWIN* )
cygwin=true cygwin=true
;; ;;
Darwin* ) Darwin* )
darwin=true darwin=true
;; ;;
MINGW* ) MINGW* )
msys=true msys=true
;; ;;
NONSTOP* ) NONSTOP* )
nonstop=true nonstop=true
;; ;;
esac esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM. # Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables # IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java" JAVACMD="$JAVA_HOME/jre/sh/java"
else else
JAVACMD="$JAVA_HOME/bin/java" JAVACMD="$JAVA_HOME/bin/java"
fi fi
if [ ! -x "$JAVACMD" ] ; then if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi fi
else 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. 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 Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n` MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT" MAX_FD="$MAX_FD_LIMIT"
fi fi
ulimit -n $MAX_FD ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD" warn "Could not set maximum file descriptor limit: $MAX_FD"
fi fi
else else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi fi
fi fi
# For Darwin, add options to specify how the application appears in the dock # For Darwin, add options to specify how the application appears in the dock
if $darwin; then if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi fi
# For Cygwin or MSYS, switch paths to Windows format before running java # For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"` APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"` JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath # We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP="" SEP=""
for dir in $ROOTDIRSRAW ; do for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir" ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|" SEP="|"
done done
OURCYGPATTERN="(^($ROOTDIRS))" OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments # Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh # Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0 i=0
for arg in "$@" ; do for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else else
eval `echo args$i`="\"$arg\"" eval `echo args$i`="\"$arg\""
fi fi
i=`expr $i + 1` i=`expr $i + 1`
done done
case $i in case $i in
0) set -- ;; 0) set -- ;;
1) set -- "$args0" ;; 1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;; 2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;; 3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;; 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac esac
fi fi
# Escape application args # Escape application args
save () { save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " " echo " "
} }
APP_ARGS=`save "$@"` APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules # 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" eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@" exec "$JAVACMD" "$@"

206
gradlew.bat vendored
View file

@ -1,103 +1,103 @@
@rem @rem
@rem Copyright 2015 the original author or authors. @rem Copyright 2015 the original author or authors.
@rem @rem
@rem Licensed under the Apache License, Version 2.0 (the "License"); @rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License. @rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at @rem You may obtain a copy of the License at
@rem @rem
@rem https://www.apache.org/licenses/LICENSE-2.0 @rem https://www.apache.org/licenses/LICENSE-2.0
@rem @rem
@rem Unless required by applicable law or agreed to in writing, software @rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS, @rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@if "%DEBUG%" == "" @echo off @if "%DEBUG%" == "" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem Gradle startup script for Windows @rem Gradle startup script for Windows
@rem @rem
@rem ########################################################################## @rem ##########################################################################
@rem Set local scope for the variables with windows NT shell @rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=. if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter. @rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe @rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init if "%ERRORLEVEL%" == "0" goto init
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo. echo.
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation. echo location of your Java installation.
goto fail goto fail
:findJavaFromJavaHome :findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=% set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init if exist "%JAVA_EXE%" goto init
echo. echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo. echo.
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation. echo location of your Java installation.
goto fail goto fail
:init :init
@rem Get command-line arguments, handling Windows variants @rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args :win9xME_args
@rem Slurp the command line arguments. @rem Slurp the command line arguments.
set CMD_LINE_ARGS= set CMD_LINE_ARGS=
set _SKIP=2 set _SKIP=2
:win9xME_args_slurp :win9xME_args_slurp
if "x%~1" == "x" goto execute if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%* set CMD_LINE_ARGS=%*
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd if "%ERRORLEVEL%"=="0" goto mainEnd
:fail :fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code! rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1 exit /b 1
:mainEnd :mainEnd
if "%OS%"=="Windows_NT" endlocal if "%OS%"=="Windows_NT" endlocal
:omega :omega

View file

@ -1,6 +1,6 @@
{ {
"parent": "block/cube_all", "parent": "block/cube_all",
"textures": { "textures": {
"all": "betterend:block/%name%" "all": "betterend:block/%name%"
} }
} }

View file

@ -1,8 +1,8 @@
{ {
"parent": "block/slab", "parent": "block/slab",
"textures": { "textures": {
"bottom": "betterend:block/%name%_bricks", "bottom": "betterend:block/%name%_bricks",
"side": "betterend:block/%name%_bricks", "side": "betterend:block/%name%_bricks",
"top": "betterend:block/%name%_bricks" "top": "betterend:block/%name%_bricks"
} }
} }

View file

@ -1,8 +1,8 @@
{ {
"parent": "block/inner_stairs", "parent": "block/inner_stairs",
"textures": { "textures": {
"bottom": "betterend:block/%name%_bricks", "bottom": "betterend:block/%name%_bricks",
"side": "betterend:block/%name%_bricks", "side": "betterend:block/%name%_bricks",
"top": "betterend:block/%name%_bricks" "top": "betterend:block/%name%_bricks"
} }
} }

View file

@ -1,8 +1,8 @@
{ {
"parent": "block/outer_stairs", "parent": "block/outer_stairs",
"textures": { "textures": {
"bottom": "betterend:block/%name%_bricks", "bottom": "betterend:block/%name%_bricks",
"side": "betterend:block/%name%_bricks", "side": "betterend:block/%name%_bricks",
"top": "betterend:block/%name%_bricks" "top": "betterend:block/%name%_bricks"
} }
} }

View file

@ -1,8 +1,8 @@
{ {
"parent": "block/stairs", "parent": "block/stairs",
"textures": { "textures": {
"bottom": "betterend:block/%name%_bricks", "bottom": "betterend:block/%name%_bricks",
"side": "betterend:block/%name%_bricks", "side": "betterend:block/%name%_bricks",
"top": "betterend:block/%name%_bricks" "top": "betterend:block/%name%_bricks"
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"parent": "minecraft:block/wall_inventory", "parent": "minecraft:block/wall_inventory",
"textures": { "textures": {
"wall": "betterend:block/%name%_bricks" "wall": "betterend:block/%name%_bricks"
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"parent": "minecraft:block/template_wall_post", "parent": "minecraft:block/template_wall_post",
"textures": { "textures": {
"wall": "betterend:block/%name%_bricks" "wall": "betterend:block/%name%_bricks"
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"parent": "minecraft:block/template_wall_side", "parent": "minecraft:block/template_wall_side",
"textures": { "textures": {
"wall": "betterend:block/%name%_bricks" "wall": "betterend:block/%name%_bricks"
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"parent": "minecraft:block/template_wall_side_tall", "parent": "minecraft:block/template_wall_side_tall",
"textures": { "textures": {
"wall": "betterend:block/%name%_bricks" "wall": "betterend:block/%name%_bricks"
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"parent": "block/cube_all", "parent": "block/cube_all",
"textures": { "textures": {
"all": "betterend:block/%name%_bricks" "all": "betterend:block/%name%_bricks"
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"parent": "block/button", "parent": "block/button",
"textures": { "textures": {
"texture": "betterend:block/%name%" "texture": "betterend:block/%name%"
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"parent": "block/button_inventory", "parent": "block/button_inventory",
"textures": { "textures": {
"texture": "betterend:block/%name%" "texture": "betterend:block/%name%"
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"parent": "block/button_pressed", "parent": "block/button_pressed",
"textures": { "textures": {
"texture": "betterend:block/%name%" "texture": "betterend:block/%name%"
} }
} }

View file

@ -1,8 +1,8 @@
{ {
"parent": "block/slab", "parent": "block/slab",
"textures": { "textures": {
"bottom": "betterend:block/%name%", "bottom": "betterend:block/%name%",
"side": "betterend:block/%name%", "side": "betterend:block/%name%",
"top": "betterend:block/%name%" "top": "betterend:block/%name%"
} }
} }

View file

@ -1,8 +1,8 @@
{ {
"parent": "block/inner_stairs", "parent": "block/inner_stairs",
"textures": { "textures": {
"bottom": "betterend:block/%name%", "bottom": "betterend:block/%name%",
"side": "betterend:block/%name%", "side": "betterend:block/%name%",
"top": "betterend:block/%name%" "top": "betterend:block/%name%"
} }
} }

View file

@ -1,8 +1,8 @@
{ {
"parent": "block/outer_stairs", "parent": "block/outer_stairs",
"textures": { "textures": {
"bottom": "betterend:block/%name%", "bottom": "betterend:block/%name%",
"side": "betterend:block/%name%", "side": "betterend:block/%name%",
"top": "betterend:block/%name%" "top": "betterend:block/%name%"
} }
} }

View file

@ -1,7 +1,7 @@
{ {
"parent": "minecraft:block/cube_column", "parent": "minecraft:block/cube_column",
"textures": { "textures": {
"end": "betterend:block/%name%_pillar_top", "end": "betterend:block/%name%_pillar_top",
"side": "betterend:block/%name%_pillar_side" "side": "betterend:block/%name%_pillar_side"
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"parent": "block/pressure_plate_down", "parent": "block/pressure_plate_down",
"textures": { "textures": {
"texture": "betterend:block/%name%" "texture": "betterend:block/%name%"
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"parent": "block/pressure_plate_up", "parent": "block/pressure_plate_up",
"textures": { "textures": {
"texture": "betterend:block/%name%" "texture": "betterend:block/%name%"
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"parent": "block/cube_all", "parent": "block/cube_all",
"textures": { "textures": {
"all": "betterend:block/%name%_small_tiles" "all": "betterend:block/%name%_small_tiles"
} }
} }

View file

@ -1,8 +1,8 @@
{ {
"parent": "block/stairs", "parent": "block/stairs",
"textures": { "textures": {
"bottom": "betterend:block/%name%", "bottom": "betterend:block/%name%",
"side": "betterend:block/%name%", "side": "betterend:block/%name%",
"top": "betterend:block/%name%" "top": "betterend:block/%name%"
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"parent": "block/cube_all", "parent": "block/cube_all",
"textures": { "textures": {
"all": "betterend:block/%name%_tile" "all": "betterend:block/%name%_tile"
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"parent": "minecraft:block/wall_inventory", "parent": "minecraft:block/wall_inventory",
"textures": { "textures": {
"wall": "betterend:block/%name%" "wall": "betterend:block/%name%"
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"parent": "minecraft:block/template_wall_post", "parent": "minecraft:block/template_wall_post",
"textures": { "textures": {
"wall": "betterend:block/%name%" "wall": "betterend:block/%name%"
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"parent": "minecraft:block/template_wall_side", "parent": "minecraft:block/template_wall_side",
"textures": { "textures": {
"wall": "betterend:block/%name%" "wall": "betterend:block/%name%"
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"parent": "minecraft:block/template_wall_side_tall", "parent": "minecraft:block/template_wall_side_tall",
"textures": { "textures": {
"wall": "betterend:block/%name%" "wall": "betterend:block/%name%"
} }
} }

View file

@ -1,7 +1,7 @@
{ {
"variants": { "variants": {
"": { "": {
"model": "betterend:block/%name%" "model": "betterend:block/%name%"
} }
} }
} }

View file

@ -1,15 +1,15 @@
{ {
"variants": { "variants": {
"type=bottom": { "type=bottom": {
"model": "betterend:block/%name%_brick_half_slab" "model": "betterend:block/%name%_brick_half_slab"
}, },
"type=double": { "type=double": {
"model": "betterend:block/%name%_bricks" "model": "betterend:block/%name%_bricks"
}, },
"type=top": { "type=top": {
"model": "betterend:block/%name%_brick_half_slab", "model": "betterend:block/%name%_brick_half_slab",
"uvlock": true, "uvlock": true,
"x": 180 "x": 180
} }
} }
} }

View file

@ -1,209 +1,209 @@
{ {
"variants": { "variants": {
"facing=east,half=bottom,shape=inner_left": { "facing=east,half=bottom,shape=inner_left": {
"model": "betterend:block/%name%_brick_inner_stairs", "model": "betterend:block/%name%_brick_inner_stairs",
"uvlock": true, "uvlock": true,
"y": 270 "y": 270
}, },
"facing=east,half=bottom,shape=inner_right": { "facing=east,half=bottom,shape=inner_right": {
"model": "betterend:block/%name%_brick_inner_stairs" "model": "betterend:block/%name%_brick_inner_stairs"
}, },
"facing=east,half=bottom,shape=outer_left": { "facing=east,half=bottom,shape=outer_left": {
"model": "betterend:block/%name%_brick_outer_stairs", "model": "betterend:block/%name%_brick_outer_stairs",
"uvlock": true, "uvlock": true,
"y": 270 "y": 270
}, },
"facing=east,half=bottom,shape=outer_right": { "facing=east,half=bottom,shape=outer_right": {
"model": "betterend:block/%name%_brick_outer_stairs" "model": "betterend:block/%name%_brick_outer_stairs"
}, },
"facing=east,half=bottom,shape=straight": { "facing=east,half=bottom,shape=straight": {
"model": "betterend:block/%name%_brick_stairs" "model": "betterend:block/%name%_brick_stairs"
}, },
"facing=east,half=top,shape=inner_left": { "facing=east,half=top,shape=inner_left": {
"model": "betterend:block/%name%_brick_inner_stairs", "model": "betterend:block/%name%_brick_inner_stairs",
"uvlock": true, "uvlock": true,
"x": 180 "x": 180
}, },
"facing=east,half=top,shape=inner_right": { "facing=east,half=top,shape=inner_right": {
"model": "betterend:block/%name%_brick_inner_stairs", "model": "betterend:block/%name%_brick_inner_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 90 "y": 90
}, },
"facing=east,half=top,shape=outer_left": { "facing=east,half=top,shape=outer_left": {
"model": "betterend:block/%name%_brick_outer_stairs", "model": "betterend:block/%name%_brick_outer_stairs",
"uvlock": true, "uvlock": true,
"x": 180 "x": 180
}, },
"facing=east,half=top,shape=outer_right": { "facing=east,half=top,shape=outer_right": {
"model": "betterend:block/%name%_brick_outer_stairs", "model": "betterend:block/%name%_brick_outer_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 90 "y": 90
}, },
"facing=east,half=top,shape=straight": { "facing=east,half=top,shape=straight": {
"model": "betterend:block/%name%_brick_stairs", "model": "betterend:block/%name%_brick_stairs",
"uvlock": true, "uvlock": true,
"x": 180 "x": 180
}, },
"facing=north,half=bottom,shape=inner_left": { "facing=north,half=bottom,shape=inner_left": {
"model": "betterend:block/%name%_brick_inner_stairs", "model": "betterend:block/%name%_brick_inner_stairs",
"uvlock": true, "uvlock": true,
"y": 180 "y": 180
}, },
"facing=north,half=bottom,shape=inner_right": { "facing=north,half=bottom,shape=inner_right": {
"model": "betterend:block/%name%_brick_inner_stairs", "model": "betterend:block/%name%_brick_inner_stairs",
"uvlock": true, "uvlock": true,
"y": 270 "y": 270
}, },
"facing=north,half=bottom,shape=outer_left": { "facing=north,half=bottom,shape=outer_left": {
"model": "betterend:block/%name%_brick_outer_stairs", "model": "betterend:block/%name%_brick_outer_stairs",
"uvlock": true, "uvlock": true,
"y": 180 "y": 180
}, },
"facing=north,half=bottom,shape=outer_right": { "facing=north,half=bottom,shape=outer_right": {
"model": "betterend:block/%name%_brick_outer_stairs", "model": "betterend:block/%name%_brick_outer_stairs",
"uvlock": true, "uvlock": true,
"y": 270 "y": 270
}, },
"facing=north,half=bottom,shape=straight": { "facing=north,half=bottom,shape=straight": {
"model": "betterend:block/%name%_brick_stairs", "model": "betterend:block/%name%_brick_stairs",
"uvlock": true, "uvlock": true,
"y": 270 "y": 270
}, },
"facing=north,half=top,shape=inner_left": { "facing=north,half=top,shape=inner_left": {
"model": "betterend:block/%name%_brick_inner_stairs", "model": "betterend:block/%name%_brick_inner_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 270 "y": 270
}, },
"facing=north,half=top,shape=inner_right": { "facing=north,half=top,shape=inner_right": {
"model": "betterend:block/%name%_brick_inner_stairs", "model": "betterend:block/%name%_brick_inner_stairs",
"uvlock": true, "uvlock": true,
"x": 180 "x": 180
}, },
"facing=north,half=top,shape=outer_left": { "facing=north,half=top,shape=outer_left": {
"model": "betterend:block/%name%_brick_outer_stairs", "model": "betterend:block/%name%_brick_outer_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 270 "y": 270
}, },
"facing=north,half=top,shape=outer_right": { "facing=north,half=top,shape=outer_right": {
"model": "betterend:block/%name%_brick_outer_stairs", "model": "betterend:block/%name%_brick_outer_stairs",
"uvlock": true, "uvlock": true,
"x": 180 "x": 180
}, },
"facing=north,half=top,shape=straight": { "facing=north,half=top,shape=straight": {
"model": "betterend:block/%name%_brick_stairs", "model": "betterend:block/%name%_brick_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 270 "y": 270
}, },
"facing=south,half=bottom,shape=inner_left": { "facing=south,half=bottom,shape=inner_left": {
"model": "betterend:block/%name%_brick_inner_stairs" "model": "betterend:block/%name%_brick_inner_stairs"
}, },
"facing=south,half=bottom,shape=inner_right": { "facing=south,half=bottom,shape=inner_right": {
"model": "betterend:block/%name%_brick_inner_stairs", "model": "betterend:block/%name%_brick_inner_stairs",
"uvlock": true, "uvlock": true,
"y": 90 "y": 90
}, },
"facing=south,half=bottom,shape=outer_left": { "facing=south,half=bottom,shape=outer_left": {
"model": "betterend:block/%name%_brick_outer_stairs" "model": "betterend:block/%name%_brick_outer_stairs"
}, },
"facing=south,half=bottom,shape=outer_right": { "facing=south,half=bottom,shape=outer_right": {
"model": "betterend:block/%name%_brick_outer_stairs", "model": "betterend:block/%name%_brick_outer_stairs",
"uvlock": true, "uvlock": true,
"y": 90 "y": 90
}, },
"facing=south,half=bottom,shape=straight": { "facing=south,half=bottom,shape=straight": {
"model": "betterend:block/%name%_brick_stairs", "model": "betterend:block/%name%_brick_stairs",
"uvlock": true, "uvlock": true,
"y": 90 "y": 90
}, },
"facing=south,half=top,shape=inner_left": { "facing=south,half=top,shape=inner_left": {
"model": "betterend:block/%name%_brick_inner_stairs", "model": "betterend:block/%name%_brick_inner_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 90 "y": 90
}, },
"facing=south,half=top,shape=inner_right": { "facing=south,half=top,shape=inner_right": {
"model": "betterend:block/%name%_brick_inner_stairs", "model": "betterend:block/%name%_brick_inner_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 180 "y": 180
}, },
"facing=south,half=top,shape=outer_left": { "facing=south,half=top,shape=outer_left": {
"model": "betterend:block/%name%_brick_outer_stairs", "model": "betterend:block/%name%_brick_outer_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 90 "y": 90
}, },
"facing=south,half=top,shape=outer_right": { "facing=south,half=top,shape=outer_right": {
"model": "betterend:block/%name%_brick_outer_stairs", "model": "betterend:block/%name%_brick_outer_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 180 "y": 180
}, },
"facing=south,half=top,shape=straight": { "facing=south,half=top,shape=straight": {
"model": "betterend:block/%name%_brick_stairs", "model": "betterend:block/%name%_brick_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 90 "y": 90
}, },
"facing=west,half=bottom,shape=inner_left": { "facing=west,half=bottom,shape=inner_left": {
"model": "betterend:block/%name%_brick_inner_stairs", "model": "betterend:block/%name%_brick_inner_stairs",
"uvlock": true, "uvlock": true,
"y": 90 "y": 90
}, },
"facing=west,half=bottom,shape=inner_right": { "facing=west,half=bottom,shape=inner_right": {
"model": "betterend:block/%name%_brick_inner_stairs", "model": "betterend:block/%name%_brick_inner_stairs",
"uvlock": true, "uvlock": true,
"y": 180 "y": 180
}, },
"facing=west,half=bottom,shape=outer_left": { "facing=west,half=bottom,shape=outer_left": {
"model": "betterend:block/%name%_brick_outer_stairs", "model": "betterend:block/%name%_brick_outer_stairs",
"uvlock": true, "uvlock": true,
"y": 90 "y": 90
}, },
"facing=west,half=bottom,shape=outer_right": { "facing=west,half=bottom,shape=outer_right": {
"model": "betterend:block/%name%_brick_outer_stairs", "model": "betterend:block/%name%_brick_outer_stairs",
"uvlock": true, "uvlock": true,
"y": 180 "y": 180
}, },
"facing=west,half=bottom,shape=straight": { "facing=west,half=bottom,shape=straight": {
"model": "betterend:block/%name%_brick_stairs", "model": "betterend:block/%name%_brick_stairs",
"uvlock": true, "uvlock": true,
"y": 180 "y": 180
}, },
"facing=west,half=top,shape=inner_left": { "facing=west,half=top,shape=inner_left": {
"model": "betterend:block/%name%_brick_inner_stairs", "model": "betterend:block/%name%_brick_inner_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 180 "y": 180
}, },
"facing=west,half=top,shape=inner_right": { "facing=west,half=top,shape=inner_right": {
"model": "betterend:block/%name%_brick_inner_stairs", "model": "betterend:block/%name%_brick_inner_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 270 "y": 270
}, },
"facing=west,half=top,shape=outer_left": { "facing=west,half=top,shape=outer_left": {
"model": "betterend:block/%name%_brick_outer_stairs", "model": "betterend:block/%name%_brick_outer_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 180 "y": 180
}, },
"facing=west,half=top,shape=outer_right": { "facing=west,half=top,shape=outer_right": {
"model": "betterend:block/%name%_brick_outer_stairs", "model": "betterend:block/%name%_brick_outer_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 270 "y": 270
}, },
"facing=west,half=top,shape=straight": { "facing=west,half=top,shape=straight": {
"model": "betterend:block/%name%_brick_stairs", "model": "betterend:block/%name%_brick_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 180 "y": 180
} }
} }
} }

View file

@ -1,90 +1,90 @@
{ {
"multipart": [ "multipart": [
{ {
"when": { "when": {
"up": "true" "up": "true"
}, },
"apply": { "apply": {
"model": "betterend:block/%name%_brick_wall_post" "model": "betterend:block/%name%_brick_wall_post"
} }
}, },
{ {
"when": { "when": {
"north": "low" "north": "low"
}, },
"apply": { "apply": {
"model": "betterend:block/%name%_brick_wall_side", "model": "betterend:block/%name%_brick_wall_side",
"uvlock": true "uvlock": true
} }
}, },
{ {
"when": { "when": {
"east": "low" "east": "low"
}, },
"apply": { "apply": {
"model": "betterend:block/%name%_brick_wall_side", "model": "betterend:block/%name%_brick_wall_side",
"y": 90, "y": 90,
"uvlock": true "uvlock": true
} }
}, },
{ {
"when": { "when": {
"south": "low" "south": "low"
}, },
"apply": { "apply": {
"model": "betterend:block/%name%_brick_wall_side", "model": "betterend:block/%name%_brick_wall_side",
"y": 180, "y": 180,
"uvlock": true "uvlock": true
} }
}, },
{ {
"when": { "when": {
"west": "low" "west": "low"
}, },
"apply": { "apply": {
"model": "betterend:block/%name%_brick_wall_side", "model": "betterend:block/%name%_brick_wall_side",
"y": 270, "y": 270,
"uvlock": true "uvlock": true
} }
}, },
{ {
"when": { "when": {
"north": "tall" "north": "tall"
}, },
"apply": { "apply": {
"model": "betterend:block/%name%_brick_wall_side_tall", "model": "betterend:block/%name%_brick_wall_side_tall",
"uvlock": true "uvlock": true
} }
}, },
{ {
"when": { "when": {
"east": "tall" "east": "tall"
}, },
"apply": { "apply": {
"model": "betterend:block/%name%_brick_wall_side_tall", "model": "betterend:block/%name%_brick_wall_side_tall",
"y": 90, "y": 90,
"uvlock": true "uvlock": true
} }
}, },
{ {
"when": { "when": {
"south": "tall" "south": "tall"
}, },
"apply": { "apply": {
"model": "betterend:block/%name%_brick_wall_side_tall", "model": "betterend:block/%name%_brick_wall_side_tall",
"y": 180, "y": 180,
"uvlock": true "uvlock": true
} }
}, },
{ {
"when": { "when": {
"west": "tall" "west": "tall"
}, },
"apply": { "apply": {
"model": "betterend:block/%name%_brick_wall_side_tall", "model": "betterend:block/%name%_brick_wall_side_tall",
"y": 270, "y": 270,
"uvlock": true "uvlock": true
} }
} }
] ]
} }

View file

@ -1,7 +1,7 @@
{ {
"variants": { "variants": {
"": { "": {
"model": "betterend:block/%name%_bricks" "model": "betterend:block/%name%_bricks"
} }
} }
} }

View file

@ -1,118 +1,118 @@
{ {
"variants": { "variants": {
"face=ceiling,facing=east,powered=false": { "face=ceiling,facing=east,powered=false": {
"model": "betterend:block/%name%_button", "model": "betterend:block/%name%_button",
"x": 180, "x": 180,
"y": 270 "y": 270
}, },
"face=ceiling,facing=east,powered=true": { "face=ceiling,facing=east,powered=true": {
"model": "betterend:block/%name%_button_pressed", "model": "betterend:block/%name%_button_pressed",
"x": 180, "x": 180,
"y": 270 "y": 270
}, },
"face=ceiling,facing=north,powered=false": { "face=ceiling,facing=north,powered=false": {
"model": "betterend:block/%name%_button", "model": "betterend:block/%name%_button",
"x": 180, "x": 180,
"y": 180 "y": 180
}, },
"face=ceiling,facing=north,powered=true": { "face=ceiling,facing=north,powered=true": {
"model": "betterend:block/%name%_button_pressed", "model": "betterend:block/%name%_button_pressed",
"x": 180, "x": 180,
"y": 180 "y": 180
}, },
"face=ceiling,facing=south,powered=false": { "face=ceiling,facing=south,powered=false": {
"model": "betterend:block/%name%_button", "model": "betterend:block/%name%_button",
"x": 180 "x": 180
}, },
"face=ceiling,facing=south,powered=true": { "face=ceiling,facing=south,powered=true": {
"model": "betterend:block/%name%_button_pressed", "model": "betterend:block/%name%_button_pressed",
"x": 180 "x": 180
}, },
"face=ceiling,facing=west,powered=false": { "face=ceiling,facing=west,powered=false": {
"model": "betterend:block/%name%_button", "model": "betterend:block/%name%_button",
"x": 180, "x": 180,
"y": 90 "y": 90
}, },
"face=ceiling,facing=west,powered=true": { "face=ceiling,facing=west,powered=true": {
"model": "betterend:block/%name%_button_pressed", "model": "betterend:block/%name%_button_pressed",
"x": 180, "x": 180,
"y": 90 "y": 90
}, },
"face=floor,facing=east,powered=false": { "face=floor,facing=east,powered=false": {
"model": "betterend:block/%name%_button", "model": "betterend:block/%name%_button",
"y": 90 "y": 90
}, },
"face=floor,facing=east,powered=true": { "face=floor,facing=east,powered=true": {
"model": "betterend:block/%name%_button_pressed", "model": "betterend:block/%name%_button_pressed",
"y": 90 "y": 90
}, },
"face=floor,facing=north,powered=false": { "face=floor,facing=north,powered=false": {
"model": "betterend:block/%name%_button" "model": "betterend:block/%name%_button"
}, },
"face=floor,facing=north,powered=true": { "face=floor,facing=north,powered=true": {
"model": "betterend:block/%name%_button_pressed" "model": "betterend:block/%name%_button_pressed"
}, },
"face=floor,facing=south,powered=false": { "face=floor,facing=south,powered=false": {
"model": "betterend:block/%name%_button", "model": "betterend:block/%name%_button",
"y": 180 "y": 180
}, },
"face=floor,facing=south,powered=true": { "face=floor,facing=south,powered=true": {
"model": "betterend:block/%name%_button_pressed", "model": "betterend:block/%name%_button_pressed",
"y": 180 "y": 180
}, },
"face=floor,facing=west,powered=false": { "face=floor,facing=west,powered=false": {
"model": "betterend:block/%name%_button", "model": "betterend:block/%name%_button",
"y": 270 "y": 270
}, },
"face=floor,facing=west,powered=true": { "face=floor,facing=west,powered=true": {
"model": "betterend:block/%name%_button_pressed", "model": "betterend:block/%name%_button_pressed",
"y": 270 "y": 270
}, },
"face=wall,facing=east,powered=false": { "face=wall,facing=east,powered=false": {
"model": "betterend:block/%name%_button", "model": "betterend:block/%name%_button",
"uvlock": true, "uvlock": true,
"x": 90, "x": 90,
"y": 90 "y": 90
}, },
"face=wall,facing=east,powered=true": { "face=wall,facing=east,powered=true": {
"model": "betterend:block/%name%_button_pressed", "model": "betterend:block/%name%_button_pressed",
"uvlock": true, "uvlock": true,
"x": 90, "x": 90,
"y": 90 "y": 90
}, },
"face=wall,facing=north,powered=false": { "face=wall,facing=north,powered=false": {
"model": "betterend:block/%name%_button", "model": "betterend:block/%name%_button",
"uvlock": true, "uvlock": true,
"x": 90 "x": 90
}, },
"face=wall,facing=north,powered=true": { "face=wall,facing=north,powered=true": {
"model": "betterend:block/%name%_button_pressed", "model": "betterend:block/%name%_button_pressed",
"uvlock": true, "uvlock": true,
"x": 90 "x": 90
}, },
"face=wall,facing=south,powered=false": { "face=wall,facing=south,powered=false": {
"model": "betterend:block/%name%_button", "model": "betterend:block/%name%_button",
"uvlock": true, "uvlock": true,
"x": 90, "x": 90,
"y": 180 "y": 180
}, },
"face=wall,facing=south,powered=true": { "face=wall,facing=south,powered=true": {
"model": "betterend:block/%name%_button_pressed", "model": "betterend:block/%name%_button_pressed",
"uvlock": true, "uvlock": true,
"x": 90, "x": 90,
"y": 180 "y": 180
}, },
"face=wall,facing=west,powered=false": { "face=wall,facing=west,powered=false": {
"model": "betterend:block/%name%_button", "model": "betterend:block/%name%_button",
"uvlock": true, "uvlock": true,
"x": 90, "x": 90,
"y": 270 "y": 270
}, },
"face=wall,facing=west,powered=true": { "face=wall,facing=west,powered=true": {
"model": "betterend:block/%name%_button_pressed", "model": "betterend:block/%name%_button_pressed",
"uvlock": true, "uvlock": true,
"x": 90, "x": 90,
"y": 270 "y": 270
} }
} }
} }

View file

@ -1,7 +1,7 @@
{ {
"variants": { "variants": {
"axis=x": { "model": "betterend:block/%name%_pillar", "x": 90, "y": 90 }, "axis=x": { "model": "betterend:block/%name%_pillar", "x": 90, "y": 90 },
"axis=y": { "model": "betterend:block/%name%_pillar" }, "axis=y": { "model": "betterend:block/%name%_pillar" },
"axis=z": { "model": "betterend:block/%name%_pillar", "x": 90 } "axis=z": { "model": "betterend:block/%name%_pillar", "x": 90 }
} }
} }

View file

@ -1,10 +1,10 @@
{ {
"variants": { "variants": {
"powered=false": { "powered=false": {
"model": "betterend:block/%name%_pressure_plate_up" "model": "betterend:block/%name%_pressure_plate_up"
}, },
"powered=true": { "powered=true": {
"model": "betterend:block/%name%_pressure_plate_down" "model": "betterend:block/%name%_pressure_plate_down"
} }
} }
} }

View file

@ -1,15 +1,15 @@
{ {
"variants": { "variants": {
"type=bottom": { "type=bottom": {
"model": "betterend:block/%name%_half_slab" "model": "betterend:block/%name%_half_slab"
}, },
"type=double": { "type=double": {
"model": "betterend:block/%name%" "model": "betterend:block/%name%"
}, },
"type=top": { "type=top": {
"model": "betterend:block/%name%_half_slab", "model": "betterend:block/%name%_half_slab",
"uvlock": true, "uvlock": true,
"x": 180 "x": 180
} }
} }
} }

View file

@ -1,7 +1,7 @@
{ {
"variants": { "variants": {
"": { "": {
"model": "betterend:block/%name%_small_tiles" "model": "betterend:block/%name%_small_tiles"
} }
} }
} }

View file

@ -1,209 +1,209 @@
{ {
"variants": { "variants": {
"facing=east,half=bottom,shape=inner_left": { "facing=east,half=bottom,shape=inner_left": {
"model": "betterend:block/%name%_inner_stairs", "model": "betterend:block/%name%_inner_stairs",
"uvlock": true, "uvlock": true,
"y": 270 "y": 270
}, },
"facing=east,half=bottom,shape=inner_right": { "facing=east,half=bottom,shape=inner_right": {
"model": "betterend:block/%name%_inner_stairs" "model": "betterend:block/%name%_inner_stairs"
}, },
"facing=east,half=bottom,shape=outer_left": { "facing=east,half=bottom,shape=outer_left": {
"model": "betterend:block/%name%_outer_stairs", "model": "betterend:block/%name%_outer_stairs",
"uvlock": true, "uvlock": true,
"y": 270 "y": 270
}, },
"facing=east,half=bottom,shape=outer_right": { "facing=east,half=bottom,shape=outer_right": {
"model": "betterend:block/%name%_outer_stairs" "model": "betterend:block/%name%_outer_stairs"
}, },
"facing=east,half=bottom,shape=straight": { "facing=east,half=bottom,shape=straight": {
"model": "betterend:block/%name%_stairs" "model": "betterend:block/%name%_stairs"
}, },
"facing=east,half=top,shape=inner_left": { "facing=east,half=top,shape=inner_left": {
"model": "betterend:block/%name%_inner_stairs", "model": "betterend:block/%name%_inner_stairs",
"uvlock": true, "uvlock": true,
"x": 180 "x": 180
}, },
"facing=east,half=top,shape=inner_right": { "facing=east,half=top,shape=inner_right": {
"model": "betterend:block/%name%_inner_stairs", "model": "betterend:block/%name%_inner_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 90 "y": 90
}, },
"facing=east,half=top,shape=outer_left": { "facing=east,half=top,shape=outer_left": {
"model": "betterend:block/%name%_outer_stairs", "model": "betterend:block/%name%_outer_stairs",
"uvlock": true, "uvlock": true,
"x": 180 "x": 180
}, },
"facing=east,half=top,shape=outer_right": { "facing=east,half=top,shape=outer_right": {
"model": "betterend:block/%name%_outer_stairs", "model": "betterend:block/%name%_outer_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 90 "y": 90
}, },
"facing=east,half=top,shape=straight": { "facing=east,half=top,shape=straight": {
"model": "betterend:block/%name%_stairs", "model": "betterend:block/%name%_stairs",
"uvlock": true, "uvlock": true,
"x": 180 "x": 180
}, },
"facing=north,half=bottom,shape=inner_left": { "facing=north,half=bottom,shape=inner_left": {
"model": "betterend:block/%name%_inner_stairs", "model": "betterend:block/%name%_inner_stairs",
"uvlock": true, "uvlock": true,
"y": 180 "y": 180
}, },
"facing=north,half=bottom,shape=inner_right": { "facing=north,half=bottom,shape=inner_right": {
"model": "betterend:block/%name%_inner_stairs", "model": "betterend:block/%name%_inner_stairs",
"uvlock": true, "uvlock": true,
"y": 270 "y": 270
}, },
"facing=north,half=bottom,shape=outer_left": { "facing=north,half=bottom,shape=outer_left": {
"model": "betterend:block/%name%_outer_stairs", "model": "betterend:block/%name%_outer_stairs",
"uvlock": true, "uvlock": true,
"y": 180 "y": 180
}, },
"facing=north,half=bottom,shape=outer_right": { "facing=north,half=bottom,shape=outer_right": {
"model": "betterend:block/%name%_outer_stairs", "model": "betterend:block/%name%_outer_stairs",
"uvlock": true, "uvlock": true,
"y": 270 "y": 270
}, },
"facing=north,half=bottom,shape=straight": { "facing=north,half=bottom,shape=straight": {
"model": "betterend:block/%name%_stairs", "model": "betterend:block/%name%_stairs",
"uvlock": true, "uvlock": true,
"y": 270 "y": 270
}, },
"facing=north,half=top,shape=inner_left": { "facing=north,half=top,shape=inner_left": {
"model": "betterend:block/%name%_inner_stairs", "model": "betterend:block/%name%_inner_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 270 "y": 270
}, },
"facing=north,half=top,shape=inner_right": { "facing=north,half=top,shape=inner_right": {
"model": "betterend:block/%name%_inner_stairs", "model": "betterend:block/%name%_inner_stairs",
"uvlock": true, "uvlock": true,
"x": 180 "x": 180
}, },
"facing=north,half=top,shape=outer_left": { "facing=north,half=top,shape=outer_left": {
"model": "betterend:block/%name%_outer_stairs", "model": "betterend:block/%name%_outer_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 270 "y": 270
}, },
"facing=north,half=top,shape=outer_right": { "facing=north,half=top,shape=outer_right": {
"model": "betterend:block/%name%_outer_stairs", "model": "betterend:block/%name%_outer_stairs",
"uvlock": true, "uvlock": true,
"x": 180 "x": 180
}, },
"facing=north,half=top,shape=straight": { "facing=north,half=top,shape=straight": {
"model": "betterend:block/%name%_stairs", "model": "betterend:block/%name%_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 270 "y": 270
}, },
"facing=south,half=bottom,shape=inner_left": { "facing=south,half=bottom,shape=inner_left": {
"model": "betterend:block/%name%_inner_stairs" "model": "betterend:block/%name%_inner_stairs"
}, },
"facing=south,half=bottom,shape=inner_right": { "facing=south,half=bottom,shape=inner_right": {
"model": "betterend:block/%name%_inner_stairs", "model": "betterend:block/%name%_inner_stairs",
"uvlock": true, "uvlock": true,
"y": 90 "y": 90
}, },
"facing=south,half=bottom,shape=outer_left": { "facing=south,half=bottom,shape=outer_left": {
"model": "betterend:block/%name%_outer_stairs" "model": "betterend:block/%name%_outer_stairs"
}, },
"facing=south,half=bottom,shape=outer_right": { "facing=south,half=bottom,shape=outer_right": {
"model": "betterend:block/%name%_outer_stairs", "model": "betterend:block/%name%_outer_stairs",
"uvlock": true, "uvlock": true,
"y": 90 "y": 90
}, },
"facing=south,half=bottom,shape=straight": { "facing=south,half=bottom,shape=straight": {
"model": "betterend:block/%name%_stairs", "model": "betterend:block/%name%_stairs",
"uvlock": true, "uvlock": true,
"y": 90 "y": 90
}, },
"facing=south,half=top,shape=inner_left": { "facing=south,half=top,shape=inner_left": {
"model": "betterend:block/%name%_inner_stairs", "model": "betterend:block/%name%_inner_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 90 "y": 90
}, },
"facing=south,half=top,shape=inner_right": { "facing=south,half=top,shape=inner_right": {
"model": "betterend:block/%name%_inner_stairs", "model": "betterend:block/%name%_inner_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 180 "y": 180
}, },
"facing=south,half=top,shape=outer_left": { "facing=south,half=top,shape=outer_left": {
"model": "betterend:block/%name%_outer_stairs", "model": "betterend:block/%name%_outer_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 90 "y": 90
}, },
"facing=south,half=top,shape=outer_right": { "facing=south,half=top,shape=outer_right": {
"model": "betterend:block/%name%_outer_stairs", "model": "betterend:block/%name%_outer_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 180 "y": 180
}, },
"facing=south,half=top,shape=straight": { "facing=south,half=top,shape=straight": {
"model": "betterend:block/%name%_stairs", "model": "betterend:block/%name%_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 90 "y": 90
}, },
"facing=west,half=bottom,shape=inner_left": { "facing=west,half=bottom,shape=inner_left": {
"model": "betterend:block/%name%_inner_stairs", "model": "betterend:block/%name%_inner_stairs",
"uvlock": true, "uvlock": true,
"y": 90 "y": 90
}, },
"facing=west,half=bottom,shape=inner_right": { "facing=west,half=bottom,shape=inner_right": {
"model": "betterend:block/%name%_inner_stairs", "model": "betterend:block/%name%_inner_stairs",
"uvlock": true, "uvlock": true,
"y": 180 "y": 180
}, },
"facing=west,half=bottom,shape=outer_left": { "facing=west,half=bottom,shape=outer_left": {
"model": "betterend:block/%name%_outer_stairs", "model": "betterend:block/%name%_outer_stairs",
"uvlock": true, "uvlock": true,
"y": 90 "y": 90
}, },
"facing=west,half=bottom,shape=outer_right": { "facing=west,half=bottom,shape=outer_right": {
"model": "betterend:block/%name%_outer_stairs", "model": "betterend:block/%name%_outer_stairs",
"uvlock": true, "uvlock": true,
"y": 180 "y": 180
}, },
"facing=west,half=bottom,shape=straight": { "facing=west,half=bottom,shape=straight": {
"model": "betterend:block/%name%_stairs", "model": "betterend:block/%name%_stairs",
"uvlock": true, "uvlock": true,
"y": 180 "y": 180
}, },
"facing=west,half=top,shape=inner_left": { "facing=west,half=top,shape=inner_left": {
"model": "betterend:block/%name%_inner_stairs", "model": "betterend:block/%name%_inner_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 180 "y": 180
}, },
"facing=west,half=top,shape=inner_right": { "facing=west,half=top,shape=inner_right": {
"model": "betterend:block/%name%_inner_stairs", "model": "betterend:block/%name%_inner_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 270 "y": 270
}, },
"facing=west,half=top,shape=outer_left": { "facing=west,half=top,shape=outer_left": {
"model": "betterend:block/%name%_outer_stairs", "model": "betterend:block/%name%_outer_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 180 "y": 180
}, },
"facing=west,half=top,shape=outer_right": { "facing=west,half=top,shape=outer_right": {
"model": "betterend:block/%name%_outer_stairs", "model": "betterend:block/%name%_outer_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 270 "y": 270
}, },
"facing=west,half=top,shape=straight": { "facing=west,half=top,shape=straight": {
"model": "betterend:block/%name%_stairs", "model": "betterend:block/%name%_stairs",
"uvlock": true, "uvlock": true,
"x": 180, "x": 180,
"y": 180 "y": 180
} }
} }
} }

View file

@ -1,7 +1,7 @@
{ {
"variants": { "variants": {
"": { "": {
"model": "betterend:block/%name%_tile" "model": "betterend:block/%name%_tile"
} }
} }
} }

View file

@ -1,90 +1,90 @@
{ {
"multipart": [ "multipart": [
{ {
"when": { "when": {
"up": "true" "up": "true"
}, },
"apply": { "apply": {
"model": "betterend:block/%name%_wall_post" "model": "betterend:block/%name%_wall_post"
} }
}, },
{ {
"when": { "when": {
"north": "low" "north": "low"
}, },
"apply": { "apply": {
"model": "betterend:block/%name%_wall_side", "model": "betterend:block/%name%_wall_side",
"uvlock": true "uvlock": true
} }
}, },
{ {
"when": { "when": {
"east": "low" "east": "low"
}, },
"apply": { "apply": {
"model": "betterend:block/%name%_wall_side", "model": "betterend:block/%name%_wall_side",
"y": 90, "y": 90,
"uvlock": true "uvlock": true
} }
}, },
{ {
"when": { "when": {
"south": "low" "south": "low"
}, },
"apply": { "apply": {
"model": "betterend:block/%name%_wall_side", "model": "betterend:block/%name%_wall_side",
"y": 180, "y": 180,
"uvlock": true "uvlock": true
} }
}, },
{ {
"when": { "when": {
"west": "low" "west": "low"
}, },
"apply": { "apply": {
"model": "betterend:block/%name%_wall_side", "model": "betterend:block/%name%_wall_side",
"y": 270, "y": 270,
"uvlock": true "uvlock": true
} }
}, },
{ {
"when": { "when": {
"north": "tall" "north": "tall"
}, },
"apply": { "apply": {
"model": "betterend:block/%name%_wall_side_tall", "model": "betterend:block/%name%_wall_side_tall",
"uvlock": true "uvlock": true
} }
}, },
{ {
"when": { "when": {
"east": "tall" "east": "tall"
}, },
"apply": { "apply": {
"model": "betterend:block/%name%_wall_side_tall", "model": "betterend:block/%name%_wall_side_tall",
"y": 90, "y": 90,
"uvlock": true "uvlock": true
} }
}, },
{ {
"when": { "when": {
"south": "tall" "south": "tall"
}, },
"apply": { "apply": {
"model": "betterend:block/%name%_wall_side_tall", "model": "betterend:block/%name%_wall_side_tall",
"y": 180, "y": 180,
"uvlock": true "uvlock": true
} }
}, },
{ {
"when": { "when": {
"west": "tall" "west": "tall"
}, },
"apply": { "apply": {
"model": "betterend:block/%name%_wall_side_tall", "model": "betterend:block/%name%_wall_side_tall",
"y": 270, "y": 270,
"uvlock": true "uvlock": true
} }
} }
] ]
} }

View file

@ -1,23 +1,23 @@
’®¬ ¢ ãáâனá⢥ D ¨¬¥¥â ¬¥âªã Data ’®¬ ¢ ãáâனá⢥ D ¨¬¥¥â ¬¥âªã Data
‘¥à¨©­ë© ­®¬¥à ⮬ : C7B5-F673 ‘¥à¨©­ë© ­®¬¥à ⮬ : C7B5-F673
‘®¤¥à¦¨¬®¥ ¯ ¯ª¨ D:\BetterEnd\Utilities\src\data\stone\blockstates ‘®¤¥à¦¨¬®¥ ¯ ¯ª¨ D:\BetterEnd\Utilities\src\data\stone\blockstates
11.10.2020 15:54 <DIR> . 11.10.2020 15:54 <DIR> .
11.10.2020 15:54 <DIR> .. 11.10.2020 15:54 <DIR> ..
11.10.2020 15:50 103 %name%.json 11.10.2020 15:50 103 %name%.json
11.10.2020 15:51 110 %name%_bricks.json 11.10.2020 15:51 110 %name%_bricks.json
11.10.2020 15:54 382 %name%_brick_slab.json 11.10.2020 15:54 382 %name%_brick_slab.json
11.10.2020 15:53 7ÿ540 %name%_brick_stairs.json 11.10.2020 15:53 7ÿ540 %name%_brick_stairs.json
11.10.2020 15:52 1ÿ635 %name%_brick_wall.json 11.10.2020 15:52 1ÿ635 %name%_brick_wall.json
26.09.2020 20:35 4ÿ006 %name%_button.json 26.09.2020 20:35 4ÿ006 %name%_button.json
11.10.2020 15:50 253 %name%_pillar.json 11.10.2020 15:50 253 %name%_pillar.json
26.09.2020 20:35 241 %name%_plate.json 26.09.2020 20:35 241 %name%_plate.json
26.09.2020 20:35 364 %name%_slab.json 26.09.2020 20:35 364 %name%_slab.json
11.10.2020 15:50 115 %name%_small_tiles.json 11.10.2020 15:50 115 %name%_small_tiles.json
26.09.2020 20:35 7ÿ300 %name%_stairs.json 26.09.2020 20:35 7ÿ300 %name%_stairs.json
11.10.2020 15:50 108 %name%_tile.json 11.10.2020 15:50 108 %name%_tile.json
11.10.2020 15:52 1ÿ581 %name%_wall.json 11.10.2020 15:52 1ÿ581 %name%_wall.json
11.10.2020 15:58 0 a.txt 11.10.2020 15:58 0 a.txt
14 ä ©«®¢ 23ÿ738 ¡ ©â 14 ä ©«®¢ 23ÿ738 ¡ ©â
2 ¯ ¯®ª 785ÿ301ÿ614ÿ592 ¡ ©â ᢮¡®¤­® 2 ¯ ¯®ª 785ÿ301ÿ614ÿ592 ¡ ©â ᢮¡®¤­®

View file

@ -1,3 +1,3 @@
{ {
"parent": "betterend:block/%name%" "parent": "betterend:block/%name%"
} }

View file

@ -1,3 +1,3 @@
{ {
"parent": "betterend:block/%name%_brick_half_slab" "parent": "betterend:block/%name%_brick_half_slab"
} }

View file

@ -1,3 +1,3 @@
{ {
"parent": "betterend:block/%name%_brick_stairs" "parent": "betterend:block/%name%_brick_stairs"
} }

View file

@ -1,3 +1,3 @@
{ {
"parent": "betterend:block/%name%_brick_wall_inventory" "parent": "betterend:block/%name%_brick_wall_inventory"
} }

View file

@ -1,3 +1,3 @@
{ {
"parent": "betterend:block/%name%_bricks" "parent": "betterend:block/%name%_bricks"
} }

View file

@ -1,3 +1,3 @@
{ {
"parent": "betterend:block/%name%_button_inventory" "parent": "betterend:block/%name%_button_inventory"
} }

View file

@ -1,3 +1,3 @@
{ {
"parent": "betterend:block/%name%_pillar" "parent": "betterend:block/%name%_pillar"
} }

View file

@ -1,3 +1,3 @@
{ {
"parent": "betterend:block/%name%_pressure_plate_up" "parent": "betterend:block/%name%_pressure_plate_up"
} }

View file

@ -1,3 +1,3 @@
{ {
"parent": "betterend:block/%name%_half_slab" "parent": "betterend:block/%name%_half_slab"
} }

View file

@ -1,3 +1,3 @@
{ {
"parent": "betterend:block/%name%_small_tiles" "parent": "betterend:block/%name%_small_tiles"
} }

View file

@ -1,3 +1,3 @@
{ {
"parent": "betterend:block/%name%_stairs" "parent": "betterend:block/%name%_stairs"
} }

View file

@ -1,3 +1,3 @@
{ {
"parent": "betterend:block/%name%_tile" "parent": "betterend:block/%name%_tile"
} }

View file

@ -1,3 +1,3 @@
{ {
"parent": "betterend:block/%name%_wall_inventory" "parent": "betterend:block/%name%_wall_inventory"
} }

View file

@ -1,23 +1,23 @@
’®¬ ¢ ãáâனá⢥ D ¨¬¥¥â ¬¥âªã Data ’®¬ ¢ ãáâனá⢥ D ¨¬¥¥â ¬¥âªã Data
‘¥à¨©­ë© ­®¬¥à ⮬ : C7B5-F673 ‘¥à¨©­ë© ­®¬¥à ⮬ : C7B5-F673
‘®¤¥à¦¨¬®¥ ¯ ¯ª¨ D:\BetterEnd\Utilities\src\data\stone\item ‘®¤¥à¦¨¬®¥ ¯ ¯ª¨ D:\BetterEnd\Utilities\src\data\stone\item
11.10.2020 15:55 <DIR> . 11.10.2020 15:55 <DIR> .
11.10.2020 15:55 <DIR> .. 11.10.2020 15:55 <DIR> ..
11.10.2020 15:42 44 %name%.json 11.10.2020 15:42 44 %name%.json
11.10.2020 15:46 51 %name%_bricks.json 11.10.2020 15:46 51 %name%_bricks.json
11.10.2020 15:47 55 %name%_brick_slab.json 11.10.2020 15:47 55 %name%_brick_slab.json
11.10.2020 15:46 57 %name%_brick_stairs.json 11.10.2020 15:46 57 %name%_brick_stairs.json
11.10.2020 15:47 65 %name%_brick_wall.json 11.10.2020 15:47 65 %name%_brick_wall.json
11.10.2020 15:48 61 %name%_button.json 11.10.2020 15:48 61 %name%_button.json
11.10.2020 15:43 51 %name%_pillar.json 11.10.2020 15:43 51 %name%_pillar.json
26.09.2020 20:36 62 %name%_plate.json 26.09.2020 20:36 62 %name%_plate.json
11.10.2020 15:43 49 %name%_slab.json 11.10.2020 15:43 49 %name%_slab.json
11.10.2020 15:43 56 %name%_small_tiles.json 11.10.2020 15:43 56 %name%_small_tiles.json
11.10.2020 15:43 51 %name%_stairs.json 11.10.2020 15:43 51 %name%_stairs.json
11.10.2020 15:43 49 %name%_tile.json 11.10.2020 15:43 49 %name%_tile.json
11.10.2020 15:47 59 %name%_wall.json 11.10.2020 15:47 59 %name%_wall.json
11.10.2020 15:55 0 a.txt 11.10.2020 15:55 0 a.txt
14 ä ©«®¢ 710 ¡ ©â 14 ä ©«®¢ 710 ¡ ©â
2 ¯ ¯®ª 785ÿ301ÿ659ÿ648 ¡ ©â ᢮¡®¤­® 2 ¯ ¯®ª 785ÿ301ÿ659ÿ648 ¡ ©â ᢮¡®¤­®

View file

@ -1,10 +1,10 @@
pluginManagement { pluginManagement {
repositories { repositories {
jcenter() jcenter()
maven { maven {
name = 'Fabric' name = 'Fabric'
url = 'https://maven.fabricmc.net/' url = 'https://maven.fabricmc.net/'
} }
gradlePluginPortal() gradlePluginPortal()
} }
} }

View file

@ -1,64 +1,64 @@
package ru.betterend; package ru.betterend;
import net.fabricmc.api.ModInitializer; import net.fabricmc.api.ModInitializer;
import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import ru.betterend.api.BetterEndPlugin; import ru.betterend.api.BetterEndPlugin;
import ru.betterend.config.MainConfig; import ru.betterend.config.MainConfig;
import ru.betterend.effects.EndEnchantments; import ru.betterend.effects.EndEnchantments;
import ru.betterend.effects.EndPotions; import ru.betterend.effects.EndPotions;
import ru.betterend.recipe.AlloyingRecipes; import ru.betterend.recipe.AlloyingRecipes;
import ru.betterend.recipe.CraftingRecipes; import ru.betterend.recipe.CraftingRecipes;
import ru.betterend.recipe.FurnaceRecipes; import ru.betterend.recipe.FurnaceRecipes;
import ru.betterend.recipe.SmithingRecipes; import ru.betterend.recipe.SmithingRecipes;
import ru.betterend.registry.EndBiomes; import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndBlockEntities; import ru.betterend.registry.EndBlockEntities;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndEntities; import ru.betterend.registry.EndEntities;
import ru.betterend.registry.EndFeatures; import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndItems; import ru.betterend.registry.EndItems;
import ru.betterend.registry.EndSounds; import ru.betterend.registry.EndSounds;
import ru.betterend.registry.EndStructures; import ru.betterend.registry.EndStructures;
import ru.betterend.registry.EndTags; import ru.betterend.registry.EndTags;
import ru.betterend.util.Logger; import ru.betterend.util.Logger;
import ru.betterend.world.generator.BetterEndBiomeSource; import ru.betterend.world.generator.BetterEndBiomeSource;
public class BetterEnd implements ModInitializer { public class BetterEnd implements ModInitializer {
public static final String MOD_ID = "betterend"; public static final String MOD_ID = "betterend";
public static final Logger LOGGER = Logger.get(); public static final Logger LOGGER = Logger.get();
public static final MainConfig CONFIG = MainConfig.getInstance(); public static final MainConfig CONFIG = MainConfig.getInstance();
@Override @Override
public void onInitialize() { public void onInitialize() {
EndSounds.register(); EndSounds.register();
EndItems.register(); EndItems.register();
EndBlocks.register(); EndBlocks.register();
EndBlockEntities.register(); EndBlockEntities.register();
EndFeatures.register(); EndFeatures.register();
EndEntities.register(); EndEntities.register();
EndBiomes.register(); EndBiomes.register();
BetterEndBiomeSource.register(); BetterEndBiomeSource.register();
EndTags.register(); EndTags.register();
EndEnchantments.register(); EndEnchantments.register();
EndPotions.register(); EndPotions.register();
CraftingRecipes.register(); CraftingRecipes.register();
FurnaceRecipes.register(); FurnaceRecipes.register();
AlloyingRecipes.register(); AlloyingRecipes.register();
SmithingRecipes.register(); SmithingRecipes.register();
EndStructures.register(); EndStructures.register();
FabricLoader.getInstance().getEntrypoints("betterend", BetterEndPlugin.class).forEach(BetterEndPlugin::register); FabricLoader.getInstance().getEntrypoints("betterend", BetterEndPlugin.class).forEach(BetterEndPlugin::register);
} }
public static Identifier makeID(String path) { public static Identifier makeID(String path) {
return new Identifier(MOD_ID, path); return new Identifier(MOD_ID, path);
} }
public static String getStringId(String id) { public static String getStringId(String id) {
return String.format("%s:%s", MOD_ID, id); return String.format("%s:%s", MOD_ID, id);
} }
public static boolean isDevEnvironment() { public static boolean isDevEnvironment() {
return FabricLoader.getInstance().isDevelopmentEnvironment(); return FabricLoader.getInstance().isDevelopmentEnvironment();
} }
} }

View file

@ -1,34 +1,34 @@
package ru.betterend.api; package ru.betterend.api;
public interface BetterEndPlugin { public interface BetterEndPlugin {
/** /**
* Alloying recipes registration. * Alloying recipes registration.
* See AlloyingRecipe.Builder for details. * See AlloyingRecipe.Builder for details.
*/ */
default void registerAlloyingRecipes() {} default void registerAlloyingRecipes() {}
/** /**
* Smithing recipes registration. * Smithing recipes registration.
* See AnvilSmithingRecipe.Builder for details. * See AnvilSmithingRecipe.Builder for details.
*/ */
default void registerSmithingRecipes() {} default void registerSmithingRecipes() {}
/** /**
* Additional biomes registration. * Additional biomes registration.
* See BiomeRegistry.registerBiome for details. * See BiomeRegistry.registerBiome for details.
*/ */
default void registerEndBiomes() {} default void registerEndBiomes() {}
/** /**
* Register other mod stuff, for example, EndHammers. * Register other mod stuff, for example, EndHammers.
*/ */
default void registerOthers() {} default void registerOthers() {}
public static void register(BetterEndPlugin plugin) { public static void register(BetterEndPlugin plugin) {
plugin.registerAlloyingRecipes(); plugin.registerAlloyingRecipes();
plugin.registerSmithingRecipes(); plugin.registerSmithingRecipes();
plugin.registerEndBiomes(); plugin.registerEndBiomes();
plugin.registerOthers(); plugin.registerOthers();
} }
} }

View file

@ -1,28 +1,28 @@
package ru.betterend.blocks; package ru.betterend.blocks;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Material; import net.minecraft.block.Material;
import net.minecraft.block.MaterialColor; import net.minecraft.block.MaterialColor;
import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import ru.betterend.blocks.basis.BlockBase; import ru.betterend.blocks.basis.BlockBase;
public class AeterniumBlock extends BlockBase { public class AeterniumBlock extends BlockBase {
public AeterniumBlock() { public AeterniumBlock() {
super(FabricBlockSettings.of(Material.METAL, MaterialColor.GRAY) super(FabricBlockSettings.of(Material.METAL, MaterialColor.GRAY)
.hardness(65F) .hardness(65F)
.resistance(1200F) .resistance(1200F)
.requiresTool() .requiresTool()
.sounds(BlockSoundGroup.NETHERITE)); .sounds(BlockSoundGroup.NETHERITE));
} }
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public int getColor(BlockState state, BlockView world, BlockPos pos) { public int getColor(BlockState state, BlockView world, BlockPos pos) {
return 0xFF657A7A; return 0xFF657A7A;
} }
} }

View file

@ -1,14 +1,14 @@
package ru.betterend.blocks; package ru.betterend.blocks;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.MaterialColor; import net.minecraft.block.MaterialColor;
import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.BlockSoundGroup;
import ru.betterend.blocks.basis.BlockBase; import ru.betterend.blocks.basis.BlockBase;
public class BlockStone extends BlockBase { public class BlockStone extends BlockBase {
public BlockStone(MaterialColor color) { public BlockStone(MaterialColor color) {
super(FabricBlockSettings.copyOf(Blocks.END_STONE).materialColor(color).sounds(BlockSoundGroup.STONE)); super(FabricBlockSettings.copyOf(Blocks.END_STONE).materialColor(color).sounds(BlockSoundGroup.STONE));
} }
} }

View file

@ -1,119 +1,119 @@
package ru.betterend.blocks; package ru.betterend.blocks;
import java.util.Random; import java.util.Random;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.NetherPortalBlock; import net.minecraft.block.NetherPortalBlock;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents; import net.minecraft.sound.SoundEvents;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldAccess;
import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.dimension.DimensionType;
import ru.betterend.client.render.ERenderLayer; import ru.betterend.client.render.ERenderLayer;
import ru.betterend.interfaces.IRenderTypeable; import ru.betterend.interfaces.IRenderTypeable;
import ru.betterend.interfaces.TeleportingEntity; import ru.betterend.interfaces.TeleportingEntity;
import ru.betterend.registry.EndParticles; import ru.betterend.registry.EndParticles;
public class EndPortalBlock extends NetherPortalBlock implements IRenderTypeable { public class EndPortalBlock extends NetherPortalBlock implements IRenderTypeable {
public EndPortalBlock() { public EndPortalBlock() {
super(FabricBlockSettings.copyOf(Blocks.NETHER_PORTAL).resistance(Blocks.BEDROCK.getBlastResistance()).luminance(state -> { super(FabricBlockSettings.copyOf(Blocks.NETHER_PORTAL).resistance(Blocks.BEDROCK.getBlastResistance()).luminance(state -> {
return 12; return 12;
})); }));
} }
@Override @Override
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) {
if (random.nextInt(100) == 0) { if (random.nextInt(100) == 0) {
world.playSound(pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D, SoundEvents.BLOCK_PORTAL_AMBIENT, SoundCategory.BLOCKS, 0.5F, random.nextFloat() * 0.4F + 0.8F, false); world.playSound(pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D, SoundEvents.BLOCK_PORTAL_AMBIENT, SoundCategory.BLOCKS, 0.5F, random.nextFloat() * 0.4F + 0.8F, false);
} }
double x = pos.getX() + random.nextDouble(); double x = pos.getX() + random.nextDouble();
double y = pos.getY() + random.nextDouble(); double y = pos.getY() + random.nextDouble();
double z = pos.getZ() + random.nextDouble(); double z = pos.getZ() + random.nextDouble();
int k = random.nextInt(2) * 2 - 1; int k = random.nextInt(2) * 2 - 1;
if (!world.getBlockState(pos.west()).isOf(this) && !world.getBlockState(pos.east()).isOf(this)) { if (!world.getBlockState(pos.west()).isOf(this) && !world.getBlockState(pos.east()).isOf(this)) {
x = pos.getX() + 0.5D + 0.25D * k; x = pos.getX() + 0.5D + 0.25D * k;
} else { } else {
z = pos.getZ() + 0.5D + 0.25D * k; z = pos.getZ() + 0.5D + 0.25D * k;
} }
world.addParticle(EndParticles.PORTAL_SPHERE, x, y, z, 0, 0, 0); world.addParticle(EndParticles.PORTAL_SPHERE, x, y, z, 0, 0, 0);
} }
@Override @Override
public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {} public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {}
@Override @Override
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) { public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) {
return state; return state;
} }
@Override @Override
public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) { public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) {
if (world instanceof ServerWorld && !entity.hasVehicle() && !entity.hasPassengers() && entity.canUsePortals()) { if (world instanceof ServerWorld && !entity.hasVehicle() && !entity.hasPassengers() && entity.canUsePortals()) {
TeleportingEntity teleEntity = TeleportingEntity.class.cast(entity); TeleportingEntity teleEntity = TeleportingEntity.class.cast(entity);
if (teleEntity.hasCooldown()) return; if (teleEntity.hasCooldown()) return;
boolean isOverworld = world.getRegistryKey().equals(World.OVERWORLD); boolean isOverworld = world.getRegistryKey().equals(World.OVERWORLD);
ServerWorld destination = ((ServerWorld) world).getServer().getWorld(isOverworld ? World.END : World.OVERWORLD); ServerWorld destination = ((ServerWorld) world).getServer().getWorld(isOverworld ? World.END : World.OVERWORLD);
BlockPos exitPos = this.findExitPos(destination, pos, entity); BlockPos exitPos = this.findExitPos(destination, pos, entity);
if (exitPos == null) return; if (exitPos == null) return;
if (entity instanceof ServerPlayerEntity) { if (entity instanceof ServerPlayerEntity) {
ServerPlayerEntity player = (ServerPlayerEntity) entity; ServerPlayerEntity player = (ServerPlayerEntity) entity;
player.teleport(destination, exitPos.getX(), exitPos.getY(), exitPos.getZ(), entity.yaw, entity.pitch); player.teleport(destination, exitPos.getX(), exitPos.getY(), exitPos.getZ(), entity.yaw, entity.pitch);
teleEntity.beSetCooldown(player.isCreative() ? 50 : 300); teleEntity.beSetCooldown(player.isCreative() ? 50 : 300);
} else { } else {
teleEntity.beSetExitPos(exitPos); teleEntity.beSetExitPos(exitPos);
entity.moveToWorld(destination); entity.moveToWorld(destination);
teleEntity.beSetCooldown(300); teleEntity.beSetCooldown(300);
} }
} }
} }
@Override @Override
public ERenderLayer getRenderLayer() { public ERenderLayer getRenderLayer() {
return ERenderLayer.TRANSLUCENT; return ERenderLayer.TRANSLUCENT;
} }
private BlockPos findExitPos(ServerWorld world, BlockPos pos, Entity entity) { private BlockPos findExitPos(ServerWorld world, BlockPos pos, Entity entity) {
Registry<DimensionType> registry = world.getRegistryManager().getDimensionTypes(); Registry<DimensionType> registry = world.getRegistryManager().getDimensionTypes();
double mult = registry.get(DimensionType.THE_END_ID).getCoordinateScale(); double mult = registry.get(DimensionType.THE_END_ID).getCoordinateScale();
BlockPos.Mutable basePos; BlockPos.Mutable basePos;
if (world.getRegistryKey().equals(World.OVERWORLD)) { if (world.getRegistryKey().equals(World.OVERWORLD)) {
basePos = pos.mutableCopy().set(pos.getX() / mult, pos.getY(), pos.getZ() / mult); basePos = pos.mutableCopy().set(pos.getX() / mult, pos.getY(), pos.getZ() / mult);
} else { } else {
basePos = pos.mutableCopy().set(pos.getX() * mult, pos.getY(), pos.getZ() * mult); basePos = pos.mutableCopy().set(pos.getX() * mult, pos.getY(), pos.getZ() * mult);
} }
Direction direction = Direction.EAST; Direction direction = Direction.EAST;
BlockPos.Mutable checkPos = basePos.mutableCopy(); BlockPos.Mutable checkPos = basePos.mutableCopy();
for (int step = 1; step < 64; step++) { for (int step = 1; step < 64; step++) {
for (int i = 0; i < step; i++) { for (int i = 0; i < step; i++) {
checkPos.setY(5); checkPos.setY(5);
while(checkPos.getY() < world.getHeight()) { while(checkPos.getY() < world.getHeight()) {
BlockState state = world.getBlockState(checkPos); BlockState state = world.getBlockState(checkPos);
if(state.isOf(this)) { if(state.isOf(this)) {
if (state.get(AXIS).equals(Direction.Axis.X)) { if (state.get(AXIS).equals(Direction.Axis.X)) {
return checkPos.add(0, 0, 1); return checkPos.add(0, 0, 1);
} else { } else {
return checkPos.add(1, 0, 0); return checkPos.add(1, 0, 0);
} }
} }
checkPos.move(Direction.UP); checkPos.move(Direction.UP);
} }
checkPos.move(direction); checkPos.move(direction);
} }
direction = direction.rotateYClockwise(); direction = direction.rotateYClockwise();
} }
return null; return null;
} }
} }

View file

@ -1,140 +1,140 @@
package ru.betterend.blocks; package ru.betterend.blocks;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockRenderType; import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.HorizontalFacingBlock; import net.minecraft.block.HorizontalFacingBlock;
import net.minecraft.block.Material; import net.minecraft.block.Material;
import net.minecraft.block.MaterialColor; import net.minecraft.block.MaterialColor;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootContext; import net.minecraft.loot.context.LootContext;
import net.minecraft.particle.ParticleTypes; import net.minecraft.particle.ParticleTypes;
import net.minecraft.screen.NamedScreenHandlerFactory; import net.minecraft.screen.NamedScreenHandlerFactory;
import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.ScreenHandler;
import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents; import net.minecraft.sound.SoundEvents;
import net.minecraft.state.StateManager; import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.DirectionProperty; import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.property.Properties; import net.minecraft.state.property.Properties;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.BlockMirror; import net.minecraft.util.BlockMirror;
import net.minecraft.util.BlockRotation; import net.minecraft.util.BlockRotation;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import net.minecraft.world.World; import net.minecraft.world.World;
import ru.betterend.blocks.basis.BaseBlockWithEntity; import ru.betterend.blocks.basis.BaseBlockWithEntity;
import ru.betterend.blocks.entities.EndStoneSmelterBlockEntity; import ru.betterend.blocks.entities.EndStoneSmelterBlockEntity;
public class EndStoneSmelter extends BaseBlockWithEntity { public class EndStoneSmelter extends BaseBlockWithEntity {
public static final DirectionProperty FACING = HorizontalFacingBlock.FACING; public static final DirectionProperty FACING = HorizontalFacingBlock.FACING;
public static final BooleanProperty LIT = Properties.LIT; public static final BooleanProperty LIT = Properties.LIT;
public static final String ID = "end_stone_smelter"; public static final String ID = "end_stone_smelter";
public EndStoneSmelter() { public EndStoneSmelter() {
super(FabricBlockSettings.of(Material.STONE, MaterialColor.GRAY) super(FabricBlockSettings.of(Material.STONE, MaterialColor.GRAY)
.hardness(4F) .hardness(4F)
.resistance(100F) .resistance(100F)
.requiresTool() .requiresTool()
.sounds(BlockSoundGroup.STONE)); .sounds(BlockSoundGroup.STONE));
this.setDefaultState(this.stateManager.getDefaultState() this.setDefaultState(this.stateManager.getDefaultState()
.with(FACING, Direction.NORTH) .with(FACING, Direction.NORTH)
.with(LIT, false)); .with(LIT, false));
} }
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
if (world.isClient) { if (world.isClient) {
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
} else { } else {
this.openScreen(world, pos, player); this.openScreen(world, pos, player);
return ActionResult.CONSUME; return ActionResult.CONSUME;
} }
} }
private void openScreen(World world, BlockPos pos, PlayerEntity player) { private void openScreen(World world, BlockPos pos, PlayerEntity player) {
BlockEntity blockEntity = world.getBlockEntity(pos); BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity instanceof EndStoneSmelterBlockEntity) { if (blockEntity instanceof EndStoneSmelterBlockEntity) {
player.openHandledScreen((NamedScreenHandlerFactory) blockEntity); player.openHandledScreen((NamedScreenHandlerFactory) blockEntity);
} }
} }
@Override @Override
public BlockState getPlacementState(ItemPlacementContext ctx) { public BlockState getPlacementState(ItemPlacementContext ctx) {
return this.getDefaultState().with(FACING, ctx.getPlayerFacing().getOpposite()); return this.getDefaultState().with(FACING, ctx.getPlayerFacing().getOpposite());
} }
@Override @Override
public BlockEntity createBlockEntity(BlockView world) { public BlockEntity createBlockEntity(BlockView world) {
return new EndStoneSmelterBlockEntity(); return new EndStoneSmelterBlockEntity();
} }
@Override @Override
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) { public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
return Collections.singletonList(new ItemStack(this)); return Collections.singletonList(new ItemStack(this));
} }
@Override @Override
public boolean hasComparatorOutput(BlockState state) { public boolean hasComparatorOutput(BlockState state) {
return true; return true;
} }
@Override @Override
public int getComparatorOutput(BlockState state, World world, BlockPos pos) { public int getComparatorOutput(BlockState state, World world, BlockPos pos) {
//TODO //TODO
return ScreenHandler.calculateComparatorOutput(world.getBlockEntity(pos)); return ScreenHandler.calculateComparatorOutput(world.getBlockEntity(pos));
} }
@Override @Override
public BlockRenderType getRenderType(BlockState state) { public BlockRenderType getRenderType(BlockState state) {
return BlockRenderType.MODEL; return BlockRenderType.MODEL;
} }
@Override @Override
public BlockState rotate(BlockState state, BlockRotation rotation) { public BlockState rotate(BlockState state, BlockRotation rotation) {
return (BlockState)state.with(FACING, rotation.rotate((Direction)state.get(FACING))); return (BlockState)state.with(FACING, rotation.rotate((Direction)state.get(FACING)));
} }
@Override @Override
public BlockState mirror(BlockState state, BlockMirror mirror) { public BlockState mirror(BlockState state, BlockMirror mirror) {
return state.rotate(mirror.getRotation((Direction)state.get(FACING))); return state.rotate(mirror.getRotation((Direction)state.get(FACING)));
} }
@Override @Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) { protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(FACING, LIT); builder.add(FACING, LIT);
} }
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) {
if (state.get(LIT)) { if (state.get(LIT)) {
double x = pos.getX() + 0.5D; double x = pos.getX() + 0.5D;
double y = pos.getY(); double y = pos.getY();
double z = pos.getZ() + 0.5D; double z = pos.getZ() + 0.5D;
if (random.nextDouble() < 0.1D) { if (random.nextDouble() < 0.1D) {
world.playSound(x, y, z, SoundEvents.BLOCK_BLASTFURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false); world.playSound(x, y, z, SoundEvents.BLOCK_BLASTFURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
} }
Direction direction = (Direction)state.get(FACING); Direction direction = (Direction)state.get(FACING);
Direction.Axis axis = direction.getAxis(); Direction.Axis axis = direction.getAxis();
double defOffset = random.nextDouble() * 0.6D - 0.3D; double defOffset = random.nextDouble() * 0.6D - 0.3D;
double offX = axis == Direction.Axis.X ? direction.getOffsetX() * 0.52D : defOffset; double offX = axis == Direction.Axis.X ? direction.getOffsetX() * 0.52D : defOffset;
double offY = random.nextDouble() * 9.0D / 16.0D; double offY = random.nextDouble() * 9.0D / 16.0D;
double offZ = axis == Direction.Axis.Z ? direction.getOffsetZ() * 0.52D : defOffset; double offZ = axis == Direction.Axis.Z ? direction.getOffsetZ() * 0.52D : defOffset;
world.addParticle(ParticleTypes.SMOKE, x + offX, y + offY, z + offZ, 0.0D, 0.0D, 0.0D); world.addParticle(ParticleTypes.SMOKE, x + offX, y + offY, z + offZ, 0.0D, 0.0D, 0.0D);
} }
} }
} }

View file

@ -1,28 +1,28 @@
package ru.betterend.blocks; package ru.betterend.blocks;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Material; import net.minecraft.block.Material;
import net.minecraft.block.MaterialColor; import net.minecraft.block.MaterialColor;
import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import ru.betterend.blocks.basis.BlockBase; import ru.betterend.blocks.basis.BlockBase;
public class EnderBlock extends BlockBase { public class EnderBlock extends BlockBase {
public EnderBlock() { public EnderBlock() {
super(FabricBlockSettings.of(Material.STONE, MaterialColor.field_25708) super(FabricBlockSettings.of(Material.STONE, MaterialColor.field_25708)
.hardness(5F) .hardness(5F)
.resistance(6F) .resistance(6F)
.requiresTool() .requiresTool()
.sounds(BlockSoundGroup.STONE)); .sounds(BlockSoundGroup.STONE));
} }
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public int getColor(BlockState state, BlockView world, BlockPos pos) { public int getColor(BlockState state, BlockView world, BlockPos pos) {
return 0xFF005548; return 0xFF005548;
} }
} }

View file

@ -1,125 +1,125 @@
package ru.betterend.blocks; package ru.betterend.blocks;
import java.util.List; import java.util.List;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootContext; import net.minecraft.loot.context.LootContext;
import net.minecraft.loot.context.LootContextParameters; import net.minecraft.loot.context.LootContextParameters;
import net.minecraft.state.StateManager; import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.BooleanProperty;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldAccess;
import net.minecraft.world.explosion.Explosion; import net.minecraft.world.explosion.Explosion;
import ru.betterend.blocks.basis.BlockPedestal; import ru.betterend.blocks.basis.BlockPedestal;
import ru.betterend.blocks.entities.EternalPedestalEntity; import ru.betterend.blocks.entities.EternalPedestalEntity;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndItems; import ru.betterend.registry.EndItems;
import ru.betterend.rituals.EternalRitual; import ru.betterend.rituals.EternalRitual;
public class EternalPedestal extends BlockPedestal { public class EternalPedestal extends BlockPedestal {
public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVATED; public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVATED;
public EternalPedestal() { public EternalPedestal() {
super(EndBlocks.FLAVOLITE_RUNED_ETERNAL); super(EndBlocks.FLAVOLITE_RUNED_ETERNAL);
this.setDefaultState(this.getDefaultState().with(ACTIVATED, false)); this.setDefaultState(this.getDefaultState().with(ACTIVATED, false));
} }
@Override @Override
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
ActionResult result = super.onUse(state, world, pos, player, hand, hit); ActionResult result = super.onUse(state, world, pos, player, hand, hit);
if (result.equals(ActionResult.SUCCESS)) { if (result.equals(ActionResult.SUCCESS)) {
BlockEntity blockEntity = world.getBlockEntity(pos); BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity instanceof EternalPedestalEntity) { if (blockEntity instanceof EternalPedestalEntity) {
EternalPedestalEntity pedestal = (EternalPedestalEntity) blockEntity; EternalPedestalEntity pedestal = (EternalPedestalEntity) blockEntity;
BlockState updatedState = world.getBlockState(pos); BlockState updatedState = world.getBlockState(pos);
if (pedestal.isEmpty() && updatedState.get(ACTIVATED)) { if (pedestal.isEmpty() && updatedState.get(ACTIVATED)) {
if (pedestal.hasRitual()) { if (pedestal.hasRitual()) {
EternalRitual ritual = pedestal.getRitual(); EternalRitual ritual = pedestal.getRitual();
ritual.removePortal(); ritual.removePortal();
} }
world.setBlockState(pos, updatedState.with(ACTIVATED, false)); world.setBlockState(pos, updatedState.with(ACTIVATED, false));
} else { } else {
ItemStack itemStack = pedestal.getStack(0); ItemStack itemStack = pedestal.getStack(0);
if (itemStack.getItem() == EndItems.ETERNAL_CRYSTAL) { if (itemStack.getItem() == EndItems.ETERNAL_CRYSTAL) {
world.setBlockState(pos, updatedState.with(ACTIVATED, true)); world.setBlockState(pos, updatedState.with(ACTIVATED, true));
if (pedestal.hasRitual()) { if (pedestal.hasRitual()) {
pedestal.getRitual().checkStructure(); pedestal.getRitual().checkStructure();
} else { } else {
EternalRitual ritual = new EternalRitual(world, pos); EternalRitual ritual = new EternalRitual(world, pos);
ritual.checkStructure(); ritual.checkStructure();
} }
} }
} }
} }
} }
return result; return result;
} }
@Override @Override
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) { public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) {
BlockState updated = super.getStateForNeighborUpdate(state, direction, newState, world, pos, posFrom); BlockState updated = super.getStateForNeighborUpdate(state, direction, newState, world, pos, posFrom);
if (!updated.isOf(this)) return updated; if (!updated.isOf(this)) return updated;
if (!this.isPlaceable(updated)) { if (!this.isPlaceable(updated)) {
return updated.with(ACTIVATED, false); return updated.with(ACTIVATED, false);
} }
return updated; return updated;
} }
@Override @Override
public float calcBlockBreakingDelta(BlockState state, PlayerEntity player, BlockView world, BlockPos pos) { public float calcBlockBreakingDelta(BlockState state, PlayerEntity player, BlockView world, BlockPos pos) {
return 0.0F; return 0.0F;
} }
@Override @Override
public float getBlastResistance() { public float getBlastResistance() {
return Blocks.BEDROCK.getBlastResistance(); return Blocks.BEDROCK.getBlastResistance();
} }
@Override @Override
public boolean shouldDropItemsOnExplosion(Explosion explosion) { public boolean shouldDropItemsOnExplosion(Explosion explosion) {
return false; return false;
} }
@Override @Override
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) { public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
if (state.isOf(this)) { if (state.isOf(this)) {
BlockProperties.PedestalState currentState = state.get(BlockProperties.PEDESTAL_STATE); BlockProperties.PedestalState currentState = state.get(BlockProperties.PEDESTAL_STATE);
if (currentState.equals(BlockProperties.PedestalState.BOTTOM) || currentState.equals(BlockProperties.PedestalState.PILLAR)) { if (currentState.equals(BlockProperties.PedestalState.BOTTOM) || currentState.equals(BlockProperties.PedestalState.PILLAR)) {
return Lists.newArrayList(); return Lists.newArrayList();
} }
} }
List<ItemStack> drop = Lists.newArrayList(); List<ItemStack> drop = Lists.newArrayList();
BlockEntity blockEntity = builder.getNullable(LootContextParameters.BLOCK_ENTITY); BlockEntity blockEntity = builder.getNullable(LootContextParameters.BLOCK_ENTITY);
if (blockEntity != null && blockEntity instanceof EternalPedestalEntity) { if (blockEntity != null && blockEntity instanceof EternalPedestalEntity) {
EternalPedestalEntity pedestal = (EternalPedestalEntity) blockEntity; EternalPedestalEntity pedestal = (EternalPedestalEntity) blockEntity;
if (!pedestal.isEmpty()) { if (!pedestal.isEmpty()) {
drop.add(pedestal.getStack(0)); drop.add(pedestal.getStack(0));
} }
} }
return drop; return drop;
} }
@Override @Override
protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) { protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) {
super.appendProperties(stateManager); super.appendProperties(stateManager);
stateManager.add(ACTIVATED); stateManager.add(ACTIVATED);
} }
@Override @Override
public BlockEntity createBlockEntity(BlockView world) { public BlockEntity createBlockEntity(BlockView world) {
return new EternalPedestalEntity(); return new EternalPedestalEntity();
} }
} }

View file

@ -1,37 +1,37 @@
package ru.betterend.blocks; package ru.betterend.blocks;
import java.util.List; import java.util.List;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootContext; import net.minecraft.loot.context.LootContext;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import net.minecraft.world.explosion.Explosion; import net.minecraft.world.explosion.Explosion;
public class EternalRunedFlavolite extends RunedFlavolite { public class EternalRunedFlavolite extends RunedFlavolite {
@Override @Override
public float calcBlockBreakingDelta(BlockState state, PlayerEntity player, BlockView world, BlockPos pos) { public float calcBlockBreakingDelta(BlockState state, PlayerEntity player, BlockView world, BlockPos pos) {
return 0.0F; return 0.0F;
} }
@Override @Override
public float getBlastResistance() { public float getBlastResistance() {
return Blocks.BEDROCK.getBlastResistance(); return Blocks.BEDROCK.getBlastResistance();
} }
@Override @Override
public boolean shouldDropItemsOnExplosion(Explosion explosion) { public boolean shouldDropItemsOnExplosion(Explosion explosion) {
return false; return false;
} }
@Override @Override
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) { public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
return Lists.newArrayList(); return Lists.newArrayList();
} }
} }

View file

@ -1,71 +1,71 @@
package ru.betterend.blocks; package ru.betterend.blocks;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.ShapeContext; import net.minecraft.block.ShapeContext;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes; import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import net.minecraft.world.World; import net.minecraft.world.World;
import ru.betterend.blocks.basis.BlockPedestal; import ru.betterend.blocks.basis.BlockPedestal;
import ru.betterend.blocks.entities.InfusionPedestalEntity; import ru.betterend.blocks.entities.InfusionPedestalEntity;
public class InfusionPedestal extends BlockPedestal { public class InfusionPedestal extends BlockPedestal {
private static final VoxelShape SHAPE_DEFAULT; private static final VoxelShape SHAPE_DEFAULT;
private static final VoxelShape SHAPE_PEDESTAL_TOP; private static final VoxelShape SHAPE_PEDESTAL_TOP;
public InfusionPedestal() { public InfusionPedestal() {
super(Blocks.OBSIDIAN); super(Blocks.OBSIDIAN);
this.height = 1.08F; this.height = 1.08F;
} }
@Override @Override
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
ActionResult result = super.onUse(state, world, pos, player, hand, hit); ActionResult result = super.onUse(state, world, pos, player, hand, hit);
return result; return result;
} }
@Override @Override
public BlockEntity createBlockEntity(BlockView world) { public BlockEntity createBlockEntity(BlockView world) {
return new InfusionPedestalEntity(); return new InfusionPedestalEntity();
} }
@Override @Override
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
if (state.isOf(this)) { if (state.isOf(this)) {
switch(state.get(STATE)) { switch(state.get(STATE)) {
case PEDESTAL_TOP: { case PEDESTAL_TOP: {
return SHAPE_PEDESTAL_TOP; return SHAPE_PEDESTAL_TOP;
} }
case DEFAULT: { case DEFAULT: {
return SHAPE_DEFAULT; return SHAPE_DEFAULT;
} }
default: { default: {
return super.getOutlineShape(state, world, pos, context); return super.getOutlineShape(state, world, pos, context);
} }
} }
} }
return super.getOutlineShape(state, world, pos, context); return super.getOutlineShape(state, world, pos, context);
} }
static { static {
VoxelShape basinUp = Block.createCuboidShape(2, 3, 2, 14, 4, 14); VoxelShape basinUp = Block.createCuboidShape(2, 3, 2, 14, 4, 14);
VoxelShape basinDown = Block.createCuboidShape(0, 0, 0, 16, 3, 16); VoxelShape basinDown = Block.createCuboidShape(0, 0, 0, 16, 3, 16);
VoxelShape pedestalTop = Block.createCuboidShape(1, 9, 1, 15, 11, 15); VoxelShape pedestalTop = Block.createCuboidShape(1, 9, 1, 15, 11, 15);
VoxelShape pedestalDefault = Block.createCuboidShape(1, 13, 1, 15, 15, 15); VoxelShape pedestalDefault = Block.createCuboidShape(1, 13, 1, 15, 15, 15);
VoxelShape pillar = Block.createCuboidShape(3, 0, 3, 13, 9, 13); VoxelShape pillar = Block.createCuboidShape(3, 0, 3, 13, 9, 13);
VoxelShape pillarDefault = Block.createCuboidShape(3, 4, 3, 13, 13, 13); VoxelShape pillarDefault = Block.createCuboidShape(3, 4, 3, 13, 13, 13);
VoxelShape eyeDefault = Block.createCuboidShape(4, 15, 4, 12, 16, 12); VoxelShape eyeDefault = Block.createCuboidShape(4, 15, 4, 12, 16, 12);
VoxelShape eyeTop = Block.createCuboidShape(4, 11, 4, 12, 12, 12); VoxelShape eyeTop = Block.createCuboidShape(4, 11, 4, 12, 12, 12);
VoxelShape basin = VoxelShapes.union(basinDown, basinUp); VoxelShape basin = VoxelShapes.union(basinDown, basinUp);
SHAPE_DEFAULT = VoxelShapes.union(basin, pillarDefault, pedestalDefault, eyeDefault); SHAPE_DEFAULT = VoxelShapes.union(basin, pillarDefault, pedestalDefault, eyeDefault);
SHAPE_PEDESTAL_TOP = VoxelShapes.union(pillar, pedestalTop, eyeTop); SHAPE_PEDESTAL_TOP = VoxelShapes.union(pillar, pedestalTop, eyeTop);
} }
} }

View file

@ -1,26 +1,26 @@
package ru.betterend.blocks; package ru.betterend.blocks;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.state.StateManager; import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.BooleanProperty;
import ru.betterend.blocks.basis.BlockBase; import ru.betterend.blocks.basis.BlockBase;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
public class RunedFlavolite extends BlockBase { public class RunedFlavolite extends BlockBase {
public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVATED; public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVATED;
public RunedFlavolite() { public RunedFlavolite() {
super(FabricBlockSettings.copyOf(EndBlocks.FLAVOLITE.polished).resistance(Blocks.OBSIDIAN.getBlastResistance()).luminance(state -> { super(FabricBlockSettings.copyOf(EndBlocks.FLAVOLITE.polished).resistance(Blocks.OBSIDIAN.getBlastResistance()).luminance(state -> {
return state.get(ACTIVATED) ? 8 : 0; return state.get(ACTIVATED) ? 8 : 0;
})); }));
this.setDefaultState(stateManager.getDefaultState().with(ACTIVATED, false)); this.setDefaultState(stateManager.getDefaultState().with(ACTIVATED, false));
} }
@Override @Override
protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) { protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) {
stateManager.add(ACTIVATED); stateManager.add(ACTIVATED);
} }
} }

View file

@ -1,17 +1,17 @@
package ru.betterend.blocks; package ru.betterend.blocks;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Material; import net.minecraft.block.Material;
import net.minecraft.block.MaterialColor; import net.minecraft.block.MaterialColor;
import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.BlockSoundGroup;
import ru.betterend.blocks.basis.BlockBase; import ru.betterend.blocks.basis.BlockBase;
public class TerminiteBlock extends BlockBase { public class TerminiteBlock extends BlockBase {
public TerminiteBlock() { public TerminiteBlock() {
super(FabricBlockSettings.of(Material.METAL, MaterialColor.field_25708) super(FabricBlockSettings.of(Material.METAL, MaterialColor.field_25708)
.hardness(7F) .hardness(7F)
.resistance(9F) .resistance(9F)
.requiresTool() .requiresTool()
.sounds(BlockSoundGroup.METAL)); .sounds(BlockSoundGroup.METAL));
} }
} }

View file

@ -1,28 +1,28 @@
package ru.betterend.blocks.basis; package ru.betterend.blocks.basis;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.BlockWithEntity; import net.minecraft.block.BlockWithEntity;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootContext; import net.minecraft.loot.context.LootContext;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
public class BaseBlockWithEntity extends BlockWithEntity { public class BaseBlockWithEntity extends BlockWithEntity {
public BaseBlockWithEntity(Settings settings) { public BaseBlockWithEntity(Settings settings) {
super(settings); super(settings);
} }
@Override @Override
public BlockEntity createBlockEntity(BlockView world) { public BlockEntity createBlockEntity(BlockView world) {
return null; return null;
} }
@Override @Override
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) { public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
return Collections.singletonList(new ItemStack(this)); return Collections.singletonList(new ItemStack(this));
} }
} }

View file

@ -0,0 +1,146 @@
package ru.betterend.blocks.basis;
import java.io.Reader;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.ShapeContext;
import net.minecraft.block.Waterloggable;
import net.minecraft.client.color.block.BlockColorProvider;
import net.minecraft.client.color.item.ItemColorProvider;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3i;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import ru.betterend.blocks.AuroraCrystalBlock;
import ru.betterend.interfaces.IColorProvider;
import ru.betterend.interfaces.Patterned;
import ru.betterend.util.MHelper;
public class BlockStoneLantern extends BlockBaseNotFull implements IColorProvider, Waterloggable {
public static final BooleanProperty IS_FLOOR = BooleanProperty.of("is_floor");
public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED;
private static final VoxelShape SHAPE_CEIL = Block.createCuboidShape(3, 1, 3, 13, 16, 13);
private static final VoxelShape SHAPE_FLOOR = Block.createCuboidShape(3, 0, 3, 13, 15, 13);
private static final Vec3i[] COLORS = AuroraCrystalBlock.COLORS;
public BlockStoneLantern(Block source) {
super(FabricBlockSettings.copyOf(source).luminance(15));
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) {
stateManager.add(IS_FLOOR, WATERLOGGED);
}
@Override
public BlockState getPlacementState(ItemPlacementContext ctx) {
WorldView worldView = ctx.getWorld();
BlockPos blockPos = ctx.getBlockPos();
Direction dir = ctx.getSide();
if (dir == Direction.DOWN) {
if (sideCoversSmallSquare(worldView, blockPos.up(), Direction.DOWN)) {
boolean water = worldView.getFluidState(blockPos).getFluid() == Fluids.WATER;
return getDefaultState().with(IS_FLOOR, false).with(WATERLOGGED, water);
}
}
else {
if (sideCoversSmallSquare(worldView, blockPos.down(), Direction.UP)) {
boolean water = worldView.getFluidState(blockPos).getFluid() == Fluids.WATER;
return getDefaultState().with(IS_FLOOR, true).with(WATERLOGGED, water);
}
}
return null;
}
@Override
public BlockColorProvider getProvider() {
return (state, world, pos, tintIndex) -> {
long i = (long) pos.getX() + (long) pos.getY() + (long) pos.getZ();
double delta = i * 0.1;
int index = MHelper.floor(delta);
int index2 = (index + 1) & 3;
delta -= index;
index &= 3;
Vec3i color1 = COLORS[index];
Vec3i color2 = COLORS[index2];
int r = MHelper.floor(MathHelper.lerp(delta, color1.getX(), color2.getX()));
int g = MHelper.floor(MathHelper.lerp(delta, color1.getY(), color2.getY()));
int b = MHelper.floor(MathHelper.lerp(delta, color1.getZ(), color2.getZ()));
return MHelper.color(r, g, b);
};
}
@Override
public ItemColorProvider getItemProvider() {
return (stack, tintIndex) -> {
return MHelper.color(COLORS[3].getX(), COLORS[3].getY(), COLORS[3].getZ());
};
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ePos) {
return state.get(IS_FLOOR) ? SHAPE_FLOOR : SHAPE_CEIL;
}
@Override
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
if (state.get(IS_FLOOR)) {
return sideCoversSmallSquare(world, pos.down(), Direction.UP);
}
else {
return sideCoversSmallSquare(world, pos.up(), Direction.DOWN);
}
}
@Override
public BlockState getStateForNeighborUpdate(BlockState state, Direction facing, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) {
Boolean water = state.get(WATERLOGGED);
if (water) {
world.getFluidTickScheduler().schedule(pos, Fluids.WATER, Fluids.WATER.getTickRate(world));
}
if (!canPlaceAt(state, world, pos)) {
return water ? Blocks.WATER.getDefaultState() : Blocks.AIR.getDefaultState();
}
else {
return state;
}
}
@Override
public Identifier statePatternId() {
return Patterned.STATE_STONE_LANTERN;
}
@Override
public String getModelPattern(String block) {
Identifier blockId = Registry.BLOCK.getId(this);
if (block.contains("ceil")) {
return Patterned.createJson(Patterned.BLOCK_STONE_LANTERN_CEIL, blockId, blockId.getPath());
}
return Patterned.createJson(Patterned.BLOCK_STONE_LANTERN_FLOOR, blockId, blockId.getPath());
}
@Override
public String getStatesPattern(Reader data) {
Identifier blockId = Registry.BLOCK.getId(this);
return Patterned.createJson(data, blockId, blockId.getPath());
}
}

View file

@ -1,48 +1,48 @@
package ru.betterend.blocks.entities; package ru.betterend.blocks.entities;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import ru.betterend.rituals.EternalRitual; import ru.betterend.rituals.EternalRitual;
public class EternalPedestalEntity extends PedestalBlockEntity { public class EternalPedestalEntity extends PedestalBlockEntity {
private EternalRitual linkedRitual; private EternalRitual linkedRitual;
public boolean hasRitual() { public boolean hasRitual() {
return this.linkedRitual != null; return this.linkedRitual != null;
} }
public void linkRitual(EternalRitual ritual) { public void linkRitual(EternalRitual ritual) {
this.linkedRitual = ritual; this.linkedRitual = ritual;
} }
public EternalRitual getRitual() { public EternalRitual getRitual() {
return this.linkedRitual; return this.linkedRitual;
} }
@Override @Override
public void setLocation(World world, BlockPos pos) { public void setLocation(World world, BlockPos pos) {
super.setLocation(world, pos); super.setLocation(world, pos);
if (hasRitual()) { if (hasRitual()) {
this.linkedRitual.setWorld(world); this.linkedRitual.setWorld(world);
} }
} }
@Override @Override
public void fromTag(BlockState state, CompoundTag tag) { public void fromTag(BlockState state, CompoundTag tag) {
super.fromTag(state, tag); super.fromTag(state, tag);
if (tag.contains("ritual")) { if (tag.contains("ritual")) {
this.linkedRitual = new EternalRitual(world); this.linkedRitual = new EternalRitual(world);
this.linkedRitual.fromTag(tag.getCompound("ritual")); this.linkedRitual.fromTag(tag.getCompound("ritual"));
} }
} }
@Override @Override
public CompoundTag toTag(CompoundTag tag) { public CompoundTag toTag(CompoundTag tag) {
if (this.hasRitual()) { if (this.hasRitual()) {
tag.put("ritual", linkedRitual.toTag(new CompoundTag())); tag.put("ritual", linkedRitual.toTag(new CompoundTag()));
} }
return super.toTag(tag); return super.toTag(tag);
} }
} }

View file

@ -1,24 +1,24 @@
package ru.betterend.blocks.entities; package ru.betterend.blocks.entities;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import ru.betterend.rituals.InfusionRitual; import ru.betterend.rituals.InfusionRitual;
public class InfusionPedestalEntity extends PedestalBlockEntity { public class InfusionPedestalEntity extends PedestalBlockEntity {
private InfusionRitual activeRitual; private InfusionRitual activeRitual;
public boolean hasRitual() { public boolean hasRitual() {
return this.activeRitual != null; return this.activeRitual != null;
} }
@Override @Override
public void fromTag(BlockState state, CompoundTag tag) { public void fromTag(BlockState state, CompoundTag tag) {
super.fromTag(state, tag); super.fromTag(state, tag);
} }
@Override @Override
public CompoundTag toTag(CompoundTag tag) { public CompoundTag toTag(CompoundTag tag) {
return super.toTag(tag); return super.toTag(tag);
} }
} }

View file

@ -1,105 +1,105 @@
package ru.betterend.blocks.entities; package ru.betterend.blocks.entities;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.Inventory; import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
import net.minecraft.util.Tickable; import net.minecraft.util.Tickable;
import ru.betterend.registry.EndBlockEntities; import ru.betterend.registry.EndBlockEntities;
public class PedestalBlockEntity extends BlockEntity implements Inventory, Tickable { public class PedestalBlockEntity extends BlockEntity implements Inventory, Tickable {
private ItemStack activeItem = ItemStack.EMPTY; private ItemStack activeItem = ItemStack.EMPTY;
private final int maxAge = 314; private final int maxAge = 314;
private int age; private int age;
public PedestalBlockEntity() { public PedestalBlockEntity() {
super(EndBlockEntities.PEDESTAL); super(EndBlockEntities.PEDESTAL);
} }
public int getAge() { public int getAge() {
return this.age; return this.age;
} }
public int getMaxAge() { public int getMaxAge() {
return this.maxAge; return this.maxAge;
} }
@Override @Override
public void clear() { public void clear() {
this.activeItem = ItemStack.EMPTY; this.activeItem = ItemStack.EMPTY;
} }
@Override @Override
public int size() { public int size() {
return 1; return 1;
} }
@Override @Override
public boolean isEmpty() { public boolean isEmpty() {
return this.activeItem.isEmpty(); return this.activeItem.isEmpty();
} }
@Override @Override
public ItemStack getStack(int slot) { public ItemStack getStack(int slot) {
return this.activeItem; return this.activeItem;
} }
@Override @Override
public ItemStack removeStack(int slot, int amount) { public ItemStack removeStack(int slot, int amount) {
return this.removeStack(slot); return this.removeStack(slot);
} }
@Override @Override
public ItemStack removeStack(int slot) { public ItemStack removeStack(int slot) {
return this.activeItem = ItemStack.EMPTY; return this.activeItem = ItemStack.EMPTY;
} }
@Override @Override
public void setStack(int slot, ItemStack stack) { public void setStack(int slot, ItemStack stack) {
this.activeItem = stack; this.activeItem = stack;
} }
@Override @Override
public boolean canPlayerUse(PlayerEntity player) { public boolean canPlayerUse(PlayerEntity player) {
return true; return true;
} }
@Override @Override
public BlockEntityUpdateS2CPacket toUpdatePacket() { public BlockEntityUpdateS2CPacket toUpdatePacket() {
return new BlockEntityUpdateS2CPacket(pos, 32, this.toInitialChunkDataTag()); return new BlockEntityUpdateS2CPacket(pos, 32, this.toInitialChunkDataTag());
} }
@Override @Override
public CompoundTag toInitialChunkDataTag() { public CompoundTag toInitialChunkDataTag() {
return this.toTag(new CompoundTag()); return this.toTag(new CompoundTag());
} }
@Override @Override
public void fromTag(BlockState state, CompoundTag tag) { public void fromTag(BlockState state, CompoundTag tag) {
super.fromTag(state, tag); super.fromTag(state, tag);
if (tag.contains("active_item")) { if (tag.contains("active_item")) {
CompoundTag itemTag = tag.getCompound("active_item"); CompoundTag itemTag = tag.getCompound("active_item");
this.activeItem = ItemStack.fromTag(itemTag); this.activeItem = ItemStack.fromTag(itemTag);
} }
} }
@Override @Override
public CompoundTag toTag(CompoundTag tag) { public CompoundTag toTag(CompoundTag tag) {
tag.put("active_item", activeItem.toTag(new CompoundTag())); tag.put("active_item", activeItem.toTag(new CompoundTag()));
return super.toTag(tag); return super.toTag(tag);
} }
@Override @Override
public void tick() { public void tick() {
if (!isEmpty()) { if (!isEmpty()) {
this.age++; this.age++;
if (age > maxAge) { if (age > maxAge) {
this.age = 0; this.age = 0;
} }
} }
} }
} }

View file

@ -1,94 +1,94 @@
package ru.betterend.blocks.entities.render; package ru.betterend.blocks.entities.render;
import net.minecraft.client.model.ModelPart; import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.OverlayTexture; import net.minecraft.client.render.OverlayTexture;
import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f; import net.minecraft.client.util.math.Vector3f;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Matrix3f; import net.minecraft.util.math.Matrix3f;
import net.minecraft.util.math.Matrix4f; import net.minecraft.util.math.Matrix4f;
import net.minecraft.util.math.Quaternion; import net.minecraft.util.math.Quaternion;
public class EndCrystalRenderer { public class EndCrystalRenderer {
private static final Identifier CRYSTAL_TEXTURE = new Identifier("textures/entity/end_crystal/end_crystal.png"); private static final Identifier CRYSTAL_TEXTURE = new Identifier("textures/entity/end_crystal/end_crystal.png");
private static final Identifier CRYSTAL_BEAM_TEXTURE = new Identifier("textures/entity/end_crystal/end_crystal_beam.png"); private static final Identifier CRYSTAL_BEAM_TEXTURE = new Identifier("textures/entity/end_crystal/end_crystal_beam.png");
private static final RenderLayer CRYSTAL_BEAM_LAYER; private static final RenderLayer CRYSTAL_BEAM_LAYER;
private static final RenderLayer END_CRYSTAL; private static final RenderLayer END_CRYSTAL;
private static final ModelPart CORE; private static final ModelPart CORE;
private static final ModelPart FRAME; private static final ModelPart FRAME;
private static final int AGE_CYCLE = 240; private static final int AGE_CYCLE = 240;
private static final float SINE_45_DEGREES; private static final float SINE_45_DEGREES;
public static void render(int age, int maxAge, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumerProvider, int light) { public static void render(int age, int maxAge, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumerProvider, int light) {
float k = (float) AGE_CYCLE / maxAge; float k = (float) AGE_CYCLE / maxAge;
float rotation = (age * k + tickDelta) * 3.0F; float rotation = (age * k + tickDelta) * 3.0F;
VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(END_CRYSTAL); VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(END_CRYSTAL);
matrices.push(); matrices.push();
matrices.scale(0.8F, 0.8F, 0.8F); matrices.scale(0.8F, 0.8F, 0.8F);
matrices.translate(0.0D, -0.5D, 0.0D); matrices.translate(0.0D, -0.5D, 0.0D);
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(rotation)); matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(rotation));
matrices.translate(0.0D, 0.8F, 0.0D); matrices.translate(0.0D, 0.8F, 0.0D);
matrices.multiply(new Quaternion(new Vector3f(SINE_45_DEGREES, 0.0F, SINE_45_DEGREES), 60.0F, true)); matrices.multiply(new Quaternion(new Vector3f(SINE_45_DEGREES, 0.0F, SINE_45_DEGREES), 60.0F, true));
FRAME.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV); FRAME.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV);
matrices.scale(0.875F, 0.875F, 0.875F); matrices.scale(0.875F, 0.875F, 0.875F);
matrices.multiply(new Quaternion(new Vector3f(SINE_45_DEGREES, 0.0F, SINE_45_DEGREES), 60.0F, true)); matrices.multiply(new Quaternion(new Vector3f(SINE_45_DEGREES, 0.0F, SINE_45_DEGREES), 60.0F, true));
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(rotation)); matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(rotation));
FRAME.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV); FRAME.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV);
matrices.scale(0.875F, 0.875F, 0.875F); matrices.scale(0.875F, 0.875F, 0.875F);
matrices.multiply(new Quaternion(new Vector3f(SINE_45_DEGREES, 0.0F, SINE_45_DEGREES), 60.0F, true)); matrices.multiply(new Quaternion(new Vector3f(SINE_45_DEGREES, 0.0F, SINE_45_DEGREES), 60.0F, true));
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(rotation)); matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(rotation));
CORE.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV); CORE.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV);
matrices.pop(); matrices.pop();
} }
public static void renderBeam(BlockPos start, BlockPos end, float tickDelta, int age, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light) { public static void renderBeam(BlockPos start, BlockPos end, float tickDelta, int age, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light) {
float dx = start.getX() - end.getX() + 1.0F; float dx = start.getX() - end.getX() + 1.0F;
float dy = start.getY() - end.getY() + 1.0F; float dy = start.getY() - end.getY() + 1.0F;
float dz = start.getZ() - end.getZ() + 1.0F; float dz = start.getZ() - end.getZ() + 1.0F;
float f = MathHelper.sqrt(dx * dx + dz * dz); float f = MathHelper.sqrt(dx * dx + dz * dz);
float g = MathHelper.sqrt(dx * dx + dy * dy + dz * dz); float g = MathHelper.sqrt(dx * dx + dy * dy + dz * dz);
matrices.push(); matrices.push();
matrices.translate(0.0D, 2.0D, 0.0D); matrices.translate(0.0D, 2.0D, 0.0D);
matrices.multiply(Vector3f.POSITIVE_Y.getRadialQuaternion((float)(-Math.atan2((double)dz, (double)dx)) - 1.5707964F)); matrices.multiply(Vector3f.POSITIVE_Y.getRadialQuaternion((float)(-Math.atan2((double)dz, (double)dx)) - 1.5707964F));
matrices.multiply(Vector3f.POSITIVE_X.getRadialQuaternion((float)(-Math.atan2((double)f, (double)dy)) - 1.5707964F)); matrices.multiply(Vector3f.POSITIVE_X.getRadialQuaternion((float)(-Math.atan2((double)f, (double)dy)) - 1.5707964F));
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(CRYSTAL_BEAM_LAYER); VertexConsumer vertexConsumer = vertexConsumers.getBuffer(CRYSTAL_BEAM_LAYER);
float h = 0.0F - ((float)age + tickDelta) * 0.01F; float h = 0.0F - ((float)age + tickDelta) * 0.01F;
float i = MathHelper.sqrt(dx * dx + dy * dy + dz * dz) / 32.0F - ((float)age + tickDelta) * 0.01F; float i = MathHelper.sqrt(dx * dx + dy * dy + dz * dz) / 32.0F - ((float)age + tickDelta) * 0.01F;
float k = 0.0F; float k = 0.0F;
float l = 0.75F; float l = 0.75F;
float m = 0.0F; float m = 0.0F;
MatrixStack.Entry entry = matrices.peek(); MatrixStack.Entry entry = matrices.peek();
Matrix4f matrix4f = entry.getModel(); Matrix4f matrix4f = entry.getModel();
Matrix3f matrix3f = entry.getNormal(); Matrix3f matrix3f = entry.getNormal();
for(int n = 1; n <= 8; ++n) { for(int n = 1; n <= 8; ++n) {
float o = MathHelper.sin((float)n * 6.2831855F / 8.0F) * 0.75F; float o = MathHelper.sin((float)n * 6.2831855F / 8.0F) * 0.75F;
float p = MathHelper.cos((float)n * 6.2831855F / 8.0F) * 0.75F; float p = MathHelper.cos((float)n * 6.2831855F / 8.0F) * 0.75F;
float q = (float)n / 8.0F; float q = (float)n / 8.0F;
vertexConsumer.vertex(matrix4f, k * 0.2F, l * 0.2F, 0.0F).color(0, 0, 0, 255).texture(m, h).overlay(OverlayTexture.DEFAULT_UV).light(light).normal(matrix3f, 0.0F, -1.0F, 0.0F).next(); vertexConsumer.vertex(matrix4f, k * 0.2F, l * 0.2F, 0.0F).color(0, 0, 0, 255).texture(m, h).overlay(OverlayTexture.DEFAULT_UV).light(light).normal(matrix3f, 0.0F, -1.0F, 0.0F).next();
vertexConsumer.vertex(matrix4f, k, l, g).color(255, 255, 255, 255).texture(m, i).overlay(OverlayTexture.DEFAULT_UV).light(light).normal(matrix3f, 0.0F, -1.0F, 0.0F).next(); vertexConsumer.vertex(matrix4f, k, l, g).color(255, 255, 255, 255).texture(m, i).overlay(OverlayTexture.DEFAULT_UV).light(light).normal(matrix3f, 0.0F, -1.0F, 0.0F).next();
vertexConsumer.vertex(matrix4f, o, p, g).color(255, 255, 255, 255).texture(q, i).overlay(OverlayTexture.DEFAULT_UV).light(light).normal(matrix3f, 0.0F, -1.0F, 0.0F).next(); vertexConsumer.vertex(matrix4f, o, p, g).color(255, 255, 255, 255).texture(q, i).overlay(OverlayTexture.DEFAULT_UV).light(light).normal(matrix3f, 0.0F, -1.0F, 0.0F).next();
vertexConsumer.vertex(matrix4f, o * 0.2F, p * 0.2F, 0.0F).color(0, 0, 0, 255).texture(q, h).overlay(OverlayTexture.DEFAULT_UV).light(light).normal(matrix3f, 0.0F, -1.0F, 0.0F).next(); vertexConsumer.vertex(matrix4f, o * 0.2F, p * 0.2F, 0.0F).color(0, 0, 0, 255).texture(q, h).overlay(OverlayTexture.DEFAULT_UV).light(light).normal(matrix3f, 0.0F, -1.0F, 0.0F).next();
k = o; k = o;
l = p; l = p;
m = q; m = q;
} }
matrices.pop(); matrices.pop();
} }
static { static {
END_CRYSTAL = RenderLayer.getEntityCutoutNoCull(CRYSTAL_TEXTURE); END_CRYSTAL = RenderLayer.getEntityCutoutNoCull(CRYSTAL_TEXTURE);
CRYSTAL_BEAM_LAYER = RenderLayer.getEntitySmoothCutout(CRYSTAL_BEAM_TEXTURE); CRYSTAL_BEAM_LAYER = RenderLayer.getEntitySmoothCutout(CRYSTAL_BEAM_TEXTURE);
SINE_45_DEGREES = (float) Math.sin(0.7853981633974483D); SINE_45_DEGREES = (float) Math.sin(0.7853981633974483D);
FRAME = new ModelPart(64, 32, 0, 0); FRAME = new ModelPart(64, 32, 0, 0);
FRAME.addCuboid(-4.0F, -4.0F, -4.0F, 8.0F, 8.0F, 8.0F); FRAME.addCuboid(-4.0F, -4.0F, -4.0F, 8.0F, 8.0F, 8.0F);
CORE = new ModelPart(64, 32, 32, 0); CORE = new ModelPart(64, 32, 32, 0);
CORE.addCuboid(-4.0F, -4.0F, -4.0F, 8.0F, 8.0F, 8.0F); CORE.addCuboid(-4.0F, -4.0F, -4.0F, 8.0F, 8.0F, 8.0F);
} }
} }

View file

@ -1,75 +1,75 @@
package ru.betterend.blocks.entities.render; package ru.betterend.blocks.entities.render;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher; import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
import net.minecraft.client.render.block.entity.BlockEntityRenderer; import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.render.model.json.ModelTransformation; import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f; import net.minecraft.client.util.math.Vector3f;
import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.util.DyeColor; import net.minecraft.util.DyeColor;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import ru.betterend.blocks.EternalPedestal; import ru.betterend.blocks.EternalPedestal;
import ru.betterend.blocks.basis.BlockPedestal; import ru.betterend.blocks.basis.BlockPedestal;
import ru.betterend.blocks.entities.PedestalBlockEntity; import ru.betterend.blocks.entities.PedestalBlockEntity;
import ru.betterend.client.render.BeamRenderer; import ru.betterend.client.render.BeamRenderer;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public class PedestalItemRenderer extends BlockEntityRenderer<PedestalBlockEntity> { public class PedestalItemRenderer extends BlockEntityRenderer<PedestalBlockEntity> {
private static final Identifier BEAM_TEXTURE = new Identifier("textures/entity/end_gateway_beam.png"); private static final Identifier BEAM_TEXTURE = new Identifier("textures/entity/end_gateway_beam.png");
public PedestalItemRenderer(BlockEntityRenderDispatcher dispatcher) { public PedestalItemRenderer(BlockEntityRenderDispatcher dispatcher) {
super(dispatcher); super(dispatcher);
} }
@Override @Override
public void render(PedestalBlockEntity blockEntity, float tickDelta, MatrixStack matrices, public void render(PedestalBlockEntity blockEntity, float tickDelta, MatrixStack matrices,
VertexConsumerProvider vertexConsumers, int light, int overlay) { VertexConsumerProvider vertexConsumers, int light, int overlay) {
if (blockEntity.isEmpty()) return; if (blockEntity.isEmpty()) return;
BlockState state = blockEntity.getWorld().getBlockState(blockEntity.getPos()); BlockState state = blockEntity.getWorld().getBlockState(blockEntity.getPos());
ItemStack activeItem = blockEntity.getStack(0); ItemStack activeItem = blockEntity.getStack(0);
matrices.push(); matrices.push();
MinecraftClient minecraft = MinecraftClient.getInstance(); MinecraftClient minecraft = MinecraftClient.getInstance();
BakedModel model = minecraft.getItemRenderer().getHeldItemModel(activeItem, blockEntity.getWorld(), null); BakedModel model = minecraft.getItemRenderer().getHeldItemModel(activeItem, blockEntity.getWorld(), null);
Vector3f translate = model.getTransformation().ground.translation; Vector3f translate = model.getTransformation().ground.translation;
BlockPedestal pedestal = (BlockPedestal) state.getBlock(); BlockPedestal pedestal = (BlockPedestal) state.getBlock();
matrices.translate(translate.getX(), translate.getY(), translate.getZ()); matrices.translate(translate.getX(), translate.getY(), translate.getZ());
matrices.translate(0.5, pedestal.getHeight(state), 0.5); matrices.translate(0.5, pedestal.getHeight(state), 0.5);
if (activeItem.getItem() instanceof BlockItem) { if (activeItem.getItem() instanceof BlockItem) {
matrices.scale(1.5F, 1.5F, 1.5F); matrices.scale(1.5F, 1.5F, 1.5F);
} else { } else {
matrices.scale(1.25F, 1.25F, 1.25F); matrices.scale(1.25F, 1.25F, 1.25F);
} }
float rotation = (blockEntity.getAge() + tickDelta) / 25.0F + 6.0F; float rotation = (blockEntity.getAge() + tickDelta) / 25.0F + 6.0F;
matrices.multiply(Vector3f.POSITIVE_Y.getRadialQuaternion(rotation)); matrices.multiply(Vector3f.POSITIVE_Y.getRadialQuaternion(rotation));
if (state.isOf(EndBlocks.ETERNAL_PEDESTAL) && state.get(EternalPedestal.ACTIVATED)) { if (state.isOf(EndBlocks.ETERNAL_PEDESTAL) && state.get(EternalPedestal.ACTIVATED)) {
float altitude = MathHelper.sin((blockEntity.getAge() + tickDelta) / 10.0F) * 0.1F + 0.1F; float altitude = MathHelper.sin((blockEntity.getAge() + tickDelta) / 10.0F) * 0.1F + 0.1F;
matrices.translate(0.0D, altitude, 0.0D); matrices.translate(0.0D, altitude, 0.0D);
float[] colors = DyeColor.MAGENTA.getColorComponents(); float[] colors = DyeColor.MAGENTA.getColorComponents();
int y = blockEntity.getPos().getY(); int y = blockEntity.getPos().getY();
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getBeaconBeam(BEAM_TEXTURE, true)); VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getBeaconBeam(BEAM_TEXTURE, true));
BeamRenderer.renderLightBeam(matrices, vertexConsumer, tickDelta, -y, 1024 - y, colors, 0.25F, 0.15F, 0.2F); BeamRenderer.renderLightBeam(matrices, vertexConsumer, tickDelta, -y, 1024 - y, colors, 0.25F, 0.15F, 0.2F);
} }
if (activeItem.getItem() == Items.END_CRYSTAL) { if (activeItem.getItem() == Items.END_CRYSTAL) {
EndCrystalRenderer.render(blockEntity.getAge(), blockEntity.getMaxAge(), tickDelta, matrices, vertexConsumers, light); EndCrystalRenderer.render(blockEntity.getAge(), blockEntity.getMaxAge(), tickDelta, matrices, vertexConsumers, light);
} else { } else {
minecraft.getItemRenderer().renderItem(activeItem, ModelTransformation.Mode.GROUND, false, matrices, vertexConsumers, light, overlay, model); minecraft.getItemRenderer().renderItem(activeItem, ModelTransformation.Mode.GROUND, false, matrices, vertexConsumers, light, overlay, model);
} }
matrices.pop(); matrices.pop();
} }
} }

View file

@ -1,102 +1,102 @@
package ru.betterend.client.gui; package ru.betterend.client.gui;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.recipebook.BlastFurnaceRecipeBookScreen; import net.minecraft.client.gui.screen.recipebook.BlastFurnaceRecipeBookScreen;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.recipe.Ingredient; import net.minecraft.recipe.Ingredient;
import net.minecraft.recipe.Recipe; import net.minecraft.recipe.Recipe;
import net.minecraft.screen.slot.Slot; import net.minecraft.screen.slot.Slot;
import net.minecraft.util.collection.DefaultedList; import net.minecraft.util.collection.DefaultedList;
import ru.betterend.blocks.entities.EndStoneSmelterBlockEntity; import ru.betterend.blocks.entities.EndStoneSmelterBlockEntity;
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public class EndStoneSmelterRecipeBookScreen extends BlastFurnaceRecipeBookScreen { public class EndStoneSmelterRecipeBookScreen extends BlastFurnaceRecipeBookScreen {
private Iterator<Item> fuelIterator; private Iterator<Item> fuelIterator;
private Set<Item> fuels; private Set<Item> fuels;
private Slot fuelSlot; private Slot fuelSlot;
private Item currentItem; private Item currentItem;
private float frameTime; private float frameTime;
@Override @Override
protected Set<Item> getAllowedFuels() { protected Set<Item> getAllowedFuels() {
return EndStoneSmelterBlockEntity.availableFuels().keySet(); return EndStoneSmelterBlockEntity.availableFuels().keySet();
} }
@Override @Override
public void slotClicked(Slot slot) { public void slotClicked(Slot slot) {
super.slotClicked(slot); super.slotClicked(slot);
if (slot != null && slot.id < this.craftingScreenHandler.getCraftingSlotCount()) { if (slot != null && slot.id < this.craftingScreenHandler.getCraftingSlotCount()) {
this.fuelSlot = null; this.fuelSlot = null;
} }
} }
@Override @Override
public void showGhostRecipe(Recipe<?> recipe, List<Slot> slots) { public void showGhostRecipe(Recipe<?> recipe, List<Slot> slots) {
this.ghostSlots.reset(); this.ghostSlots.reset();
ItemStack result = recipe.getOutput(); ItemStack result = recipe.getOutput();
this.ghostSlots.setRecipe(recipe); this.ghostSlots.setRecipe(recipe);
this.ghostSlots.addSlot(Ingredient.ofStacks(result), (slots.get(3)).x, (slots.get(3)).y); this.ghostSlots.addSlot(Ingredient.ofStacks(result), (slots.get(3)).x, (slots.get(3)).y);
DefaultedList<Ingredient> inputs = recipe.getPreviewInputs(); DefaultedList<Ingredient> inputs = recipe.getPreviewInputs();
Iterator<Ingredient> iterator = inputs.iterator(); Iterator<Ingredient> iterator = inputs.iterator();
for(int i = 0; i < 2; i++) { for(int i = 0; i < 2; i++) {
if (!iterator.hasNext()) { if (!iterator.hasNext()) {
return; return;
} }
Ingredient ingredient = iterator.next(); Ingredient ingredient = iterator.next();
if (!ingredient.isEmpty()) { if (!ingredient.isEmpty()) {
Slot slot = slots.get(i); Slot slot = slots.get(i);
this.ghostSlots.addSlot(ingredient, slot.x, slot.y); this.ghostSlots.addSlot(ingredient, slot.x, slot.y);
} }
} }
this.fuelSlot = slots.get(2); this.fuelSlot = slots.get(2);
if (this.fuels == null) { if (this.fuels == null) {
this.fuels = this.getAllowedFuels(); this.fuels = this.getAllowedFuels();
} }
this.fuelIterator = this.fuels.iterator(); this.fuelIterator = this.fuels.iterator();
this.currentItem = null; this.currentItem = null;
} }
@Override @Override
public void drawGhostSlots(MatrixStack matrices, int x, int y, boolean bl, float f) { public void drawGhostSlots(MatrixStack matrices, int x, int y, boolean bl, float f) {
this.ghostSlots.draw(matrices, client, x, y, bl, f); this.ghostSlots.draw(matrices, client, x, y, bl, f);
if (fuelSlot != null) { if (fuelSlot != null) {
if (!Screen.hasControlDown()) { if (!Screen.hasControlDown()) {
this.frameTime += f; this.frameTime += f;
} }
int slotX = this.fuelSlot.x + x; int slotX = this.fuelSlot.x + x;
int slotY = this.fuelSlot.y + y; int slotY = this.fuelSlot.y + y;
DrawableHelper.fill(matrices, slotX, slotY, slotX + 16, slotY + 16, 822018048); DrawableHelper.fill(matrices, slotX, slotY, slotX + 16, slotY + 16, 822018048);
this.client.getItemRenderer().renderInGuiWithOverrides(client.player, this.getItem().getDefaultStack(), slotX, slotY); this.client.getItemRenderer().renderInGuiWithOverrides(client.player, this.getItem().getDefaultStack(), slotX, slotY);
RenderSystem.depthFunc(516); RenderSystem.depthFunc(516);
DrawableHelper.fill(matrices, slotX, slotY, slotX + 16, slotY + 16, 822083583); DrawableHelper.fill(matrices, slotX, slotY, slotX + 16, slotY + 16, 822083583);
RenderSystem.depthFunc(515); RenderSystem.depthFunc(515);
} }
} }
private Item getItem() { private Item getItem() {
if (this.currentItem == null || this.frameTime > 30.0F) { if (this.currentItem == null || this.frameTime > 30.0F) {
this.frameTime = 0.0F; this.frameTime = 0.0F;
if (this.fuelIterator == null || !this.fuelIterator.hasNext()) { if (this.fuelIterator == null || !this.fuelIterator.hasNext()) {
if (this.fuels == null) { if (this.fuels == null) {
this.fuels = this.getAllowedFuels(); this.fuels = this.getAllowedFuels();
} }
this.fuelIterator = this.fuels.iterator(); this.fuelIterator = this.fuels.iterator();
} }
this.currentItem = this.fuelIterator.next(); this.currentItem = this.fuelIterator.next();
} }
return this.currentItem; return this.currentItem;
} }
} }

View file

@ -1,130 +1,130 @@
package ru.betterend.client.gui; package ru.betterend.client.gui;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.gui.screen.recipebook.RecipeBookProvider; import net.minecraft.client.gui.screen.recipebook.RecipeBookProvider;
import net.minecraft.client.gui.screen.recipebook.RecipeBookWidget; import net.minecraft.client.gui.screen.recipebook.RecipeBookWidget;
import net.minecraft.client.gui.widget.TexturedButtonWidget; import net.minecraft.client.gui.widget.TexturedButtonWidget;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.screen.slot.Slot; import net.minecraft.screen.slot.Slot;
import net.minecraft.screen.slot.SlotActionType; import net.minecraft.screen.slot.SlotActionType;
import net.minecraft.text.StringVisitable; import net.minecraft.text.StringVisitable;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public class EndStoneSmelterScreen extends HandledScreen<EndStoneSmelterScreenHandler> implements RecipeBookProvider { public class EndStoneSmelterScreen extends HandledScreen<EndStoneSmelterScreenHandler> implements RecipeBookProvider {
private final static Identifier RECIPE_BUTTON_TEXTURE = new Identifier("textures/gui/recipe_button.png"); private final static Identifier RECIPE_BUTTON_TEXTURE = new Identifier("textures/gui/recipe_button.png");
private final static Identifier BACKGROUND_TEXTURE = BetterEnd.makeID("textures/gui/smelter_gui.png"); private final static Identifier BACKGROUND_TEXTURE = BetterEnd.makeID("textures/gui/smelter_gui.png");
public final EndStoneSmelterRecipeBookScreen recipeBook; public final EndStoneSmelterRecipeBookScreen recipeBook;
private boolean narrow; private boolean narrow;
public EndStoneSmelterScreen(EndStoneSmelterScreenHandler handler, PlayerInventory inventory, Text title) { public EndStoneSmelterScreen(EndStoneSmelterScreenHandler handler, PlayerInventory inventory, Text title) {
super(handler, inventory, title); super(handler, inventory, title);
this.recipeBook = new EndStoneSmelterRecipeBookScreen(); this.recipeBook = new EndStoneSmelterRecipeBookScreen();
} }
public void init() { public void init() {
super.init(); super.init();
this.narrow = this.width < 379; this.narrow = this.width < 379;
this.recipeBook.initialize(width, height, client, narrow, handler); this.recipeBook.initialize(width, height, client, narrow, handler);
this.x = this.recipeBook.findLeftEdge(narrow, width, backgroundWidth); this.x = this.recipeBook.findLeftEdge(narrow, width, backgroundWidth);
this.addButton(new TexturedButtonWidget(x + 20, height / 2 - 49, 20, 18, 0, 0, 19, RECIPE_BUTTON_TEXTURE, (buttonWidget) -> { this.addButton(new TexturedButtonWidget(x + 20, height / 2 - 49, 20, 18, 0, 0, 19, RECIPE_BUTTON_TEXTURE, (buttonWidget) -> {
this.recipeBook.reset(narrow); this.recipeBook.reset(narrow);
this.recipeBook.toggleOpen(); this.recipeBook.toggleOpen();
this.x = this.recipeBook.findLeftEdge(narrow, width, backgroundWidth); this.x = this.recipeBook.findLeftEdge(narrow, width, backgroundWidth);
((TexturedButtonWidget) buttonWidget).setPos(this.x + 20, height / 2 - 49); ((TexturedButtonWidget) buttonWidget).setPos(this.x + 20, height / 2 - 49);
})); }));
this.titleX = (this.backgroundWidth - this.textRenderer.getWidth((StringVisitable)this.title)) / 2; this.titleX = (this.backgroundWidth - this.textRenderer.getWidth((StringVisitable)this.title)) / 2;
} }
@Override @Override
public void tick() { public void tick() {
super.tick(); super.tick();
this.recipeBook.update(); this.recipeBook.update();
} }
@Override @Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
this.renderBackground(matrices); this.renderBackground(matrices);
if (this.recipeBook.isOpen() && this.narrow) { if (this.recipeBook.isOpen() && this.narrow) {
this.drawBackground(matrices, delta, mouseX, mouseY); this.drawBackground(matrices, delta, mouseX, mouseY);
this.recipeBook.render(matrices, mouseX, mouseY, delta); this.recipeBook.render(matrices, mouseX, mouseY, delta);
} else { } else {
this.recipeBook.render(matrices, mouseX, mouseY, delta); this.recipeBook.render(matrices, mouseX, mouseY, delta);
super.render(matrices, mouseX, mouseY, delta); super.render(matrices, mouseX, mouseY, delta);
this.recipeBook.drawGhostSlots(matrices, x, y, true, delta); this.recipeBook.drawGhostSlots(matrices, x, y, true, delta);
} }
this.drawMouseoverTooltip(matrices, mouseX, mouseY); this.drawMouseoverTooltip(matrices, mouseX, mouseY);
this.recipeBook.drawTooltip(matrices, x, y, mouseX, mouseY); this.recipeBook.drawTooltip(matrices, x, y, mouseX, mouseY);
} }
@Override @Override
public boolean mouseClicked(double mouseX, double mouseY, int button) { public boolean mouseClicked(double mouseX, double mouseY, int button) {
if (this.recipeBook.mouseClicked(mouseX, mouseY, button)) { if (this.recipeBook.mouseClicked(mouseX, mouseY, button)) {
return true; return true;
} else { } else {
return this.narrow && this.recipeBook.isOpen() ? true : super.mouseClicked(mouseX, mouseY, button); return this.narrow && this.recipeBook.isOpen() ? true : super.mouseClicked(mouseX, mouseY, button);
} }
} }
@Override @Override
protected void onMouseClick(Slot slot, int invSlot, int clickData, SlotActionType actionType) { protected void onMouseClick(Slot slot, int invSlot, int clickData, SlotActionType actionType) {
super.onMouseClick(slot, invSlot, clickData, actionType); super.onMouseClick(slot, invSlot, clickData, actionType);
this.recipeBook.slotClicked(slot); this.recipeBook.slotClicked(slot);
} }
@Override @Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) { public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
return this.recipeBook.keyPressed(keyCode, scanCode, modifiers) ? false : super.keyPressed(keyCode, scanCode, modifiers); return this.recipeBook.keyPressed(keyCode, scanCode, modifiers) ? false : super.keyPressed(keyCode, scanCode, modifiers);
} }
@Override @Override
protected boolean isClickOutsideBounds(double mouseX, double mouseY, int left, int top, int button) { protected boolean isClickOutsideBounds(double mouseX, double mouseY, int left, int top, int button) {
boolean isMouseOut = mouseX < left || mouseY < top || mouseX >= (left + backgroundWidth) || mouseY >= (top + backgroundHeight); boolean isMouseOut = mouseX < left || mouseY < top || mouseX >= (left + backgroundWidth) || mouseY >= (top + backgroundHeight);
return this.recipeBook.isClickOutsideBounds(mouseX, mouseY, x, y, backgroundWidth, backgroundHeight, button) && isMouseOut; return this.recipeBook.isClickOutsideBounds(mouseX, mouseY, x, y, backgroundWidth, backgroundHeight, button) && isMouseOut;
} }
@Override @Override
public boolean charTyped(char chr, int keyCode) { public boolean charTyped(char chr, int keyCode) {
return this.recipeBook.charTyped(chr, keyCode) ? true : super.charTyped(chr, keyCode); return this.recipeBook.charTyped(chr, keyCode) ? true : super.charTyped(chr, keyCode);
} }
@Override @Override
public void refreshRecipeBook() { public void refreshRecipeBook() {
this.recipeBook.refresh(); this.recipeBook.refresh();
} }
@Override @Override
public RecipeBookWidget getRecipeBookWidget() { public RecipeBookWidget getRecipeBookWidget() {
return this.recipeBook; return this.recipeBook;
} }
@Override @Override
protected void drawBackground(MatrixStack matrices, float delta, int mouseX, int mouseY) { protected void drawBackground(MatrixStack matrices, float delta, int mouseX, int mouseY) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.client.getTextureManager().bindTexture(BACKGROUND_TEXTURE); this.client.getTextureManager().bindTexture(BACKGROUND_TEXTURE);
this.drawTexture(matrices, x, y, 0, 0, backgroundWidth, backgroundHeight); this.drawTexture(matrices, x, y, 0, 0, backgroundWidth, backgroundHeight);
int p; int p;
if (handler.isBurning()) { if (handler.isBurning()) {
p = handler.getFuelProgress(); p = handler.getFuelProgress();
this.drawTexture(matrices, x + 56, y + 36 + 12 - p, 176, 12 - p, 14, p + 1); this.drawTexture(matrices, x + 56, y + 36 + 12 - p, 176, 12 - p, 14, p + 1);
} }
p = handler.getSmeltProgress(); p = handler.getSmeltProgress();
this.drawTexture(matrices, x + 92, y + 34, 176, 14, p + 1, 16); this.drawTexture(matrices, x + 92, y + 34, 176, 14, p + 1, 16);
} }
@Override @Override
public void removed() { public void removed() {
this.recipeBook.close(); this.recipeBook.close();
super.removed(); super.removed();
} }
} }

View file

@ -1,186 +1,186 @@
package ru.betterend.client.gui; package ru.betterend.client.gui;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry; import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Inventory; import net.minecraft.inventory.Inventory;
import net.minecraft.inventory.SimpleInventory; import net.minecraft.inventory.SimpleInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.recipe.Recipe; import net.minecraft.recipe.Recipe;
import net.minecraft.recipe.RecipeFinder; import net.minecraft.recipe.RecipeFinder;
import net.minecraft.recipe.RecipeInputProvider; import net.minecraft.recipe.RecipeInputProvider;
import net.minecraft.recipe.book.RecipeBookCategory; import net.minecraft.recipe.book.RecipeBookCategory;
import net.minecraft.screen.AbstractRecipeScreenHandler; import net.minecraft.screen.AbstractRecipeScreenHandler;
import net.minecraft.screen.ArrayPropertyDelegate; import net.minecraft.screen.ArrayPropertyDelegate;
import net.minecraft.screen.PropertyDelegate; import net.minecraft.screen.PropertyDelegate;
import net.minecraft.screen.ScreenHandlerType; import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.screen.slot.Slot; import net.minecraft.screen.slot.Slot;
import net.minecraft.world.World; import net.minecraft.world.World;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.blocks.EndStoneSmelter; import ru.betterend.blocks.EndStoneSmelter;
import ru.betterend.blocks.entities.EndStoneSmelterBlockEntity; import ru.betterend.blocks.entities.EndStoneSmelterBlockEntity;
import ru.betterend.client.gui.slot.SmelterFuelSlot; import ru.betterend.client.gui.slot.SmelterFuelSlot;
import ru.betterend.client.gui.slot.SmelterOutputSlot; import ru.betterend.client.gui.slot.SmelterOutputSlot;
import ru.betterend.recipe.builders.AlloyingRecipe; import ru.betterend.recipe.builders.AlloyingRecipe;
public class EndStoneSmelterScreenHandler extends AbstractRecipeScreenHandler<Inventory> { public class EndStoneSmelterScreenHandler extends AbstractRecipeScreenHandler<Inventory> {
public final static ScreenHandlerType<EndStoneSmelterScreenHandler> HANDLER_TYPE = ScreenHandlerRegistry.registerSimple( public final static ScreenHandlerType<EndStoneSmelterScreenHandler> HANDLER_TYPE = ScreenHandlerRegistry.registerSimple(
BetterEnd.makeID(EndStoneSmelter.ID), EndStoneSmelterScreenHandler::new); BetterEnd.makeID(EndStoneSmelter.ID), EndStoneSmelterScreenHandler::new);
private final Inventory inventory; private final Inventory inventory;
private final PropertyDelegate propertyDelegate; private final PropertyDelegate propertyDelegate;
protected final World world; protected final World world;
public EndStoneSmelterScreenHandler(int syncId, PlayerInventory playerInventory) { public EndStoneSmelterScreenHandler(int syncId, PlayerInventory playerInventory) {
this(syncId, playerInventory, new SimpleInventory(4), new ArrayPropertyDelegate(4)); this(syncId, playerInventory, new SimpleInventory(4), new ArrayPropertyDelegate(4));
} }
public EndStoneSmelterScreenHandler(int syncId, PlayerInventory playerInventory, Inventory inventory, PropertyDelegate propertyDelegate) { public EndStoneSmelterScreenHandler(int syncId, PlayerInventory playerInventory, Inventory inventory, PropertyDelegate propertyDelegate) {
super(HANDLER_TYPE, syncId); super(HANDLER_TYPE, syncId);
this.inventory = inventory; this.inventory = inventory;
this.propertyDelegate = propertyDelegate; this.propertyDelegate = propertyDelegate;
this.world = playerInventory.player.world; this.world = playerInventory.player.world;
this.addProperties(propertyDelegate); this.addProperties(propertyDelegate);
this.addSlot(new Slot(inventory, 0, 45, 17)); this.addSlot(new Slot(inventory, 0, 45, 17));
this.addSlot(new Slot(inventory, 1, 67, 17)); this.addSlot(new Slot(inventory, 1, 67, 17));
this.addSlot(new SmelterFuelSlot(this, inventory, 2, 56, 53)); this.addSlot(new SmelterFuelSlot(this, inventory, 2, 56, 53));
this.addSlot(new SmelterOutputSlot(playerInventory.player, inventory, 3, 129, 35)); this.addSlot(new SmelterOutputSlot(playerInventory.player, inventory, 3, 129, 35));
for(int i = 0; i < 3; ++i) { for(int i = 0; i < 3; ++i) {
for(int j = 0; j < 9; ++j) { for(int j = 0; j < 9; ++j) {
this.addSlot(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); this.addSlot(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
} }
} }
for(int i = 0; i < 9; ++i) { for(int i = 0; i < 9; ++i) {
this.addSlot(new Slot(playerInventory, i, 8 + i * 18, 142)); this.addSlot(new Slot(playerInventory, i, 8 + i * 18, 142));
} }
} }
@Override @Override
public void populateRecipeFinder(RecipeFinder finder) { public void populateRecipeFinder(RecipeFinder finder) {
if (inventory instanceof RecipeInputProvider) { if (inventory instanceof RecipeInputProvider) {
((RecipeInputProvider) inventory).provideRecipeInputs(finder); ((RecipeInputProvider) inventory).provideRecipeInputs(finder);
} }
} }
@Override @Override
public void clearCraftingSlots() { public void clearCraftingSlots() {
this.inventory.clear(); this.inventory.clear();
} }
@Override @Override
public boolean matches(Recipe<? super Inventory> recipe) { public boolean matches(Recipe<? super Inventory> recipe) {
return recipe.matches(this.inventory, this.world); return recipe.matches(this.inventory, this.world);
} }
@Override @Override
public int getCraftingResultSlotIndex() { public int getCraftingResultSlotIndex() {
return 3; return 3;
} }
@Override @Override
public int getCraftingWidth() { public int getCraftingWidth() {
return 2; return 2;
} }
@Override @Override
public int getCraftingHeight() { public int getCraftingHeight() {
return 1; return 1;
} }
@Override @Override
public int getCraftingSlotCount() { public int getCraftingSlotCount() {
return 4; return 4;
} }
@Override @Override
public RecipeBookCategory getCategory() { public RecipeBookCategory getCategory() {
return RecipeBookCategory.BLAST_FURNACE; return RecipeBookCategory.BLAST_FURNACE;
} }
@Override @Override
public boolean canUse(PlayerEntity player) { public boolean canUse(PlayerEntity player) {
return this.inventory.canPlayerUse(player); return this.inventory.canPlayerUse(player);
} }
protected boolean isSmeltable(ItemStack itemStack) { protected boolean isSmeltable(ItemStack itemStack) {
return this.world.getRecipeManager().getFirstMatch(AlloyingRecipe.TYPE, new SimpleInventory(new ItemStack[]{itemStack}), this.world).isPresent(); return this.world.getRecipeManager().getFirstMatch(AlloyingRecipe.TYPE, new SimpleInventory(new ItemStack[]{itemStack}), this.world).isPresent();
} }
public boolean isFuel(ItemStack itemStack) { public boolean isFuel(ItemStack itemStack) {
return EndStoneSmelterBlockEntity.canUseAsFuel(itemStack); return EndStoneSmelterBlockEntity.canUseAsFuel(itemStack);
} }
@Override @Override
public ItemStack transferSlot(PlayerEntity player, int index) { public ItemStack transferSlot(PlayerEntity player, int index) {
ItemStack itemStack = ItemStack.EMPTY; ItemStack itemStack = ItemStack.EMPTY;
Slot slot = this.slots.get(index); Slot slot = this.slots.get(index);
if (slot != null && slot.hasStack()) { if (slot != null && slot.hasStack()) {
ItemStack itemStack2 = slot.getStack(); ItemStack itemStack2 = slot.getStack();
itemStack = itemStack2.copy(); itemStack = itemStack2.copy();
if (index == 3) { if (index == 3) {
if (insertItem(itemStack2, 4, 40, true)) { if (insertItem(itemStack2, 4, 40, true)) {
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
slot.onStackChanged(itemStack2, itemStack); slot.onStackChanged(itemStack2, itemStack);
} else if (index != 2 && index != 1 && index != 0) { } else if (index != 2 && index != 1 && index != 0) {
if (isSmeltable(itemStack2)) { if (isSmeltable(itemStack2)) {
if (!insertItem(itemStack2, 0, 2, false)) { if (!insertItem(itemStack2, 0, 2, false)) {
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
} else if (isFuel(itemStack2)) { } else if (isFuel(itemStack2)) {
if (!this.insertItem(itemStack2, 2, 3, false)) { if (!this.insertItem(itemStack2, 2, 3, false)) {
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
} else if (index >= 4 && index < 31) { } else if (index >= 4 && index < 31) {
if (!insertItem(itemStack2, 31, 40, false)) { if (!insertItem(itemStack2, 31, 40, false)) {
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
} else if (index >= 31 && index < 40 && !insertItem(itemStack2, 4, 31, false)) { } else if (index >= 31 && index < 40 && !insertItem(itemStack2, 4, 31, false)) {
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
} else if (!insertItem(itemStack2, 4, 40, false)) { } else if (!insertItem(itemStack2, 4, 40, false)) {
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
if (itemStack2.isEmpty()) { if (itemStack2.isEmpty()) {
slot.setStack(ItemStack.EMPTY); slot.setStack(ItemStack.EMPTY);
} else { } else {
slot.markDirty(); slot.markDirty();
} }
if (itemStack2.getCount() == itemStack.getCount()) { if (itemStack2.getCount() == itemStack.getCount()) {
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
slot.onTakeItem(player, itemStack2); slot.onTakeItem(player, itemStack2);
} }
return itemStack; return itemStack;
} }
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public int getSmeltProgress() { public int getSmeltProgress() {
int time = this.propertyDelegate.get(2); int time = this.propertyDelegate.get(2);
int timeTotal = this.propertyDelegate.get(3); int timeTotal = this.propertyDelegate.get(3);
return timeTotal != 0 && time != 0 ? time * 24 / timeTotal : 0; return timeTotal != 0 && time != 0 ? time * 24 / timeTotal : 0;
} }
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public int getFuelProgress() { public int getFuelProgress() {
int fuelTime = this.propertyDelegate.get(1); int fuelTime = this.propertyDelegate.get(1);
if (fuelTime == 0) { if (fuelTime == 0) {
fuelTime = 200; fuelTime = 200;
} }
return this.propertyDelegate.get(0) * 13 / fuelTime; return this.propertyDelegate.get(0) * 13 / fuelTime;
} }
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public boolean isBurning() { public boolean isBurning() {
return this.propertyDelegate.get(0) > 0; return this.propertyDelegate.get(0) > 0;
} }
} }

View file

@ -1,25 +1,25 @@
package ru.betterend.client.gui.slot; package ru.betterend.client.gui.slot;
import net.minecraft.inventory.Inventory; import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.screen.slot.FurnaceFuelSlot; import net.minecraft.screen.slot.FurnaceFuelSlot;
import net.minecraft.screen.slot.Slot; import net.minecraft.screen.slot.Slot;
import ru.betterend.client.gui.EndStoneSmelterScreenHandler; import ru.betterend.client.gui.EndStoneSmelterScreenHandler;
public class SmelterFuelSlot extends Slot { public class SmelterFuelSlot extends Slot {
private final EndStoneSmelterScreenHandler handler; private final EndStoneSmelterScreenHandler handler;
public SmelterFuelSlot(EndStoneSmelterScreenHandler handler, Inventory inventory, int index, int x, int y) { public SmelterFuelSlot(EndStoneSmelterScreenHandler handler, Inventory inventory, int index, int x, int y) {
super(inventory, index, x, y); super(inventory, index, x, y);
this.handler = handler; this.handler = handler;
} }
public boolean canInsert(ItemStack stack) { public boolean canInsert(ItemStack stack) {
return this.handler.isFuel(stack) || FurnaceFuelSlot.isBucket(stack); return this.handler.isFuel(stack) || FurnaceFuelSlot.isBucket(stack);
} }
public int getMaxItemCount(ItemStack stack) { public int getMaxItemCount(ItemStack stack) {
return FurnaceFuelSlot.isBucket(stack) ? 1 : super.getMaxItemCount(stack); return FurnaceFuelSlot.isBucket(stack) ? 1 : super.getMaxItemCount(stack);
} }
} }

View file

@ -1,49 +1,49 @@
package ru.betterend.client.gui.slot; package ru.betterend.client.gui.slot;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.Inventory; import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.screen.slot.Slot; import net.minecraft.screen.slot.Slot;
import ru.betterend.blocks.entities.EndStoneSmelterBlockEntity; import ru.betterend.blocks.entities.EndStoneSmelterBlockEntity;
public class SmelterOutputSlot extends Slot { public class SmelterOutputSlot extends Slot {
private PlayerEntity player; private PlayerEntity player;
private int amount; private int amount;
public SmelterOutputSlot(PlayerEntity player, Inventory inventory, int index, int x, int y) { public SmelterOutputSlot(PlayerEntity player, Inventory inventory, int index, int x, int y) {
super(inventory, index, x, y); super(inventory, index, x, y);
this.player = player; this.player = player;
} }
public boolean canInsert(ItemStack stack) { public boolean canInsert(ItemStack stack) {
return false; return false;
} }
public ItemStack takeStack(int amount) { public ItemStack takeStack(int amount) {
if (this.hasStack()) { if (this.hasStack()) {
this.amount += Math.min(amount, this.getStack().getCount()); this.amount += Math.min(amount, this.getStack().getCount());
} }
return super.takeStack(amount); return super.takeStack(amount);
} }
public ItemStack onTakeItem(PlayerEntity player, ItemStack stack) { public ItemStack onTakeItem(PlayerEntity player, ItemStack stack) {
this.onCrafted(stack); this.onCrafted(stack);
super.onTakeItem(player, stack); super.onTakeItem(player, stack);
return stack; return stack;
} }
protected void onCrafted(ItemStack stack, int amount) { protected void onCrafted(ItemStack stack, int amount) {
this.amount += amount; this.amount += amount;
this.onCrafted(stack); this.onCrafted(stack);
} }
protected void onCrafted(ItemStack stack) { protected void onCrafted(ItemStack stack) {
stack.onCraft(this.player.world, this.player, this.amount); stack.onCraft(this.player.world, this.player, this.amount);
if (!this.player.world.isClient && this.inventory instanceof EndStoneSmelterBlockEntity) { if (!this.player.world.isClient && this.inventory instanceof EndStoneSmelterBlockEntity) {
((EndStoneSmelterBlockEntity) this.inventory).dropExperience(player); ((EndStoneSmelterBlockEntity) this.inventory).dropExperience(player);
} }
this.amount = 0; this.amount = 0;
} }
} }

View file

@ -1,62 +1,62 @@
package ru.betterend.client.render; package ru.betterend.client.render;
import net.minecraft.client.render.OverlayTexture; import net.minecraft.client.render.OverlayTexture;
import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f; import net.minecraft.client.util.math.Vector3f;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Matrix3f; import net.minecraft.util.math.Matrix3f;
import net.minecraft.util.math.Matrix4f; import net.minecraft.util.math.Matrix4f;
public class BeamRenderer { public class BeamRenderer {
public static void renderLightBeam(MatrixStack matrixStack, VertexConsumer vertexConsumer, float tick, int minY, int maxY, float[] colors, float alpha, float h, float k) { public static void renderLightBeam(MatrixStack matrixStack, VertexConsumer vertexConsumer, float tick, int minY, int maxY, float[] colors, float alpha, float h, float k) {
int m = minY + maxY; int m = minY + maxY;
float o = maxY < 0 ? tick : -tick; float o = maxY < 0 ? tick : -tick;
float p = MathHelper.fractionalPart(o * 0.2F - (float) MathHelper.floor(o * 0.1F)); float p = MathHelper.fractionalPart(o * 0.2F - (float) MathHelper.floor(o * 0.1F));
float red = colors[0]; float red = colors[0];
float green = colors[1]; float green = colors[1];
float blue = colors[2]; float blue = colors[2];
matrixStack.push(); matrixStack.push();
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(tick * 2.25F - 45.0F)); matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(tick * 2.25F - 45.0F));
float af = 0.0F; float af = 0.0F;
float ai = 0.0F; float ai = 0.0F;
float aj = -h; float aj = -h;
float aa = -h; float aa = -h;
float ap = -1.0F + p; float ap = -1.0F + p;
float aq = (float) maxY * (0.5F / h) + ap; float aq = (float) maxY * (0.5F / h) + ap;
renderBeam(matrixStack, vertexConsumer, red, green, blue, alpha, minY, m, 0.0F, h, h, 0.0F, aj, 0.0F, 0.0F, aa, 0.0F, 1.0F, aq, ap); renderBeam(matrixStack, vertexConsumer, red, green, blue, alpha, minY, m, 0.0F, h, h, 0.0F, aj, 0.0F, 0.0F, aa, 0.0F, 1.0F, aq, ap);
matrixStack.pop(); matrixStack.pop();
af = -k; af = -k;
float ag = -k; float ag = -k;
ai = -k; ai = -k;
aj = -k; aj = -k;
ap = -1.0F + p; ap = -1.0F + p;
aq = (float) maxY + ap; aq = (float) maxY + ap;
renderBeam(matrixStack, vertexConsumer, red, green, blue, alpha, minY, m, af, ag, k, ai, aj, k, k, k, 0.0F, 1.0F, aq, ap); renderBeam(matrixStack, vertexConsumer, red, green, blue, alpha, minY, m, af, ag, k, ai, aj, k, k, k, 0.0F, 1.0F, aq, ap);
} }
private static void renderBeam(MatrixStack matrixStack, VertexConsumer vertexConsumer, float red, float green, float blue, float alpha, int j, int k, float l, float m, float n, float o, float p, float q, float r, float s, float t, float u, float v, float w) { private static void renderBeam(MatrixStack matrixStack, VertexConsumer vertexConsumer, float red, float green, float blue, float alpha, int j, int k, float l, float m, float n, float o, float p, float q, float r, float s, float t, float u, float v, float w) {
MatrixStack.Entry entry = matrixStack.peek(); MatrixStack.Entry entry = matrixStack.peek();
Matrix4f matrix4f = entry.getModel(); Matrix4f matrix4f = entry.getModel();
Matrix3f matrix3f = entry.getNormal(); Matrix3f matrix3f = entry.getNormal();
renderBeam(matrix4f, matrix3f, vertexConsumer, red, green, blue, alpha, j, k, l, m, n, o, t, u, v, w); renderBeam(matrix4f, matrix3f, vertexConsumer, red, green, blue, alpha, j, k, l, m, n, o, t, u, v, w);
renderBeam(matrix4f, matrix3f, vertexConsumer, red, green, blue, alpha, j, k, r, s, p, q, t, u, v, w); renderBeam(matrix4f, matrix3f, vertexConsumer, red, green, blue, alpha, j, k, r, s, p, q, t, u, v, w);
renderBeam(matrix4f, matrix3f, vertexConsumer, red, green, blue, alpha, j, k, n, o, r, s, t, u, v, w); renderBeam(matrix4f, matrix3f, vertexConsumer, red, green, blue, alpha, j, k, n, o, r, s, t, u, v, w);
renderBeam(matrix4f, matrix3f, vertexConsumer, red, green, blue, alpha, j, k, p, q, l, m, t, u, v, w); renderBeam(matrix4f, matrix3f, vertexConsumer, red, green, blue, alpha, j, k, p, q, l, m, t, u, v, w);
} }
private static void renderBeam(Matrix4f matrix4f, Matrix3f matrix3f, VertexConsumer vertexConsumer, float red, float green, float blue, float alpha, int j, int k, float l, float m, float n, float o, float p, float q, float r, float s) { private static void renderBeam(Matrix4f matrix4f, Matrix3f matrix3f, VertexConsumer vertexConsumer, float red, float green, float blue, float alpha, int j, int k, float l, float m, float n, float o, float p, float q, float r, float s) {
addVertex(matrix4f, matrix3f, vertexConsumer, red, green, blue, alpha, k, l, m, q, r); addVertex(matrix4f, matrix3f, vertexConsumer, red, green, blue, alpha, k, l, m, q, r);
addVertex(matrix4f, matrix3f, vertexConsumer, red, green, blue, alpha, j, l, m, q, s); addVertex(matrix4f, matrix3f, vertexConsumer, red, green, blue, alpha, j, l, m, q, s);
addVertex(matrix4f, matrix3f, vertexConsumer, red, green, blue, alpha, j, n, o, p, s); addVertex(matrix4f, matrix3f, vertexConsumer, red, green, blue, alpha, j, n, o, p, s);
addVertex(matrix4f, matrix3f, vertexConsumer, red, green, blue, alpha, k, n, o, p, r); addVertex(matrix4f, matrix3f, vertexConsumer, red, green, blue, alpha, k, n, o, p, r);
} }
private static void addVertex(Matrix4f matrix4f, Matrix3f matrix3f, VertexConsumer vertexConsumer, float red, float green, float blue, float alpha, float y, float x, float l, float m, float n) { private static void addVertex(Matrix4f matrix4f, Matrix3f matrix3f, VertexConsumer vertexConsumer, float red, float green, float blue, float alpha, float y, float x, float l, float m, float n) {
vertexConsumer.vertex(matrix4f, x, y, l).color(red, green, blue, alpha).texture(m, n).overlay(OverlayTexture.DEFAULT_UV).light(15728880).normal(matrix3f, 0.0F, 1.0F, 0.0F).next(); vertexConsumer.vertex(matrix4f, x, y, l).color(red, green, blue, alpha).texture(m, n).overlay(OverlayTexture.DEFAULT_UV).light(15728880).normal(matrix3f, 0.0F, 1.0F, 0.0F).next();
} }
} }

View file

@ -1,6 +1,6 @@
package ru.betterend.client.render; package ru.betterend.client.render;
public enum ERenderLayer { public enum ERenderLayer {
CUTOUT, CUTOUT,
TRANSLUCENT; TRANSLUCENT;
} }

View file

@ -1,111 +1,111 @@
package ru.betterend.compat; package ru.betterend.compat;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import me.shedaniel.rei.api.EntryStack; import me.shedaniel.rei.api.EntryStack;
import me.shedaniel.rei.api.TransferRecipeDisplay; import me.shedaniel.rei.api.TransferRecipeDisplay;
import me.shedaniel.rei.server.ContainerInfo; import me.shedaniel.rei.server.ContainerInfo;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.recipe.BlastingRecipe; import net.minecraft.recipe.BlastingRecipe;
import net.minecraft.recipe.Recipe; import net.minecraft.recipe.Recipe;
import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.ScreenHandler;
import net.minecraft.text.TranslatableText; import net.minecraft.text.TranslatableText;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import ru.betterend.blocks.entities.EndStoneSmelterBlockEntity; import ru.betterend.blocks.entities.EndStoneSmelterBlockEntity;
import ru.betterend.recipe.builders.AlloyingRecipe; import ru.betterend.recipe.builders.AlloyingRecipe;
public class REIAlloyingDisplay implements TransferRecipeDisplay { public class REIAlloyingDisplay implements TransferRecipeDisplay {
private static List<EntryStack> fuel; private static List<EntryStack> fuel;
private Recipe<?> recipe; private Recipe<?> recipe;
private List<List<EntryStack>> input; private List<List<EntryStack>> input;
private List<EntryStack> output; private List<EntryStack> output;
private float xp; private float xp;
private double smeltTime; private double smeltTime;
public REIAlloyingDisplay(AlloyingRecipe recipe) { public REIAlloyingDisplay(AlloyingRecipe recipe) {
this.recipe = recipe; this.recipe = recipe;
this.input = EntryStack.ofIngredients(recipe.getPreviewInputs()); this.input = EntryStack.ofIngredients(recipe.getPreviewInputs());
this.output = Collections.singletonList(EntryStack.create(recipe.getOutput())); this.output = Collections.singletonList(EntryStack.create(recipe.getOutput()));
this.xp = recipe.getExperience(); this.xp = recipe.getExperience();
this.smeltTime = recipe.getSmeltTime(); this.smeltTime = recipe.getSmeltTime();
} }
public REIAlloyingDisplay(BlastingRecipe recipe) { public REIAlloyingDisplay(BlastingRecipe recipe) {
this.recipe = recipe; this.recipe = recipe;
this.input = EntryStack.ofIngredients(recipe.getPreviewInputs()); this.input = EntryStack.ofIngredients(recipe.getPreviewInputs());
this.output = Collections.singletonList(EntryStack.create(recipe.getOutput())); this.output = Collections.singletonList(EntryStack.create(recipe.getOutput()));
this.xp = recipe.getExperience(); this.xp = recipe.getExperience();
this.smeltTime = recipe.getCookTime(); this.smeltTime = recipe.getCookTime();
} }
public static List<EntryStack> getFuel() { public static List<EntryStack> getFuel() {
return fuel; return fuel;
} }
@Override @Override
public @NotNull Optional<Identifier> getRecipeLocation() { public @NotNull Optional<Identifier> getRecipeLocation() {
return Optional.ofNullable(recipe).map(Recipe::getId); return Optional.ofNullable(recipe).map(Recipe::getId);
} }
@Override @Override
public @NotNull List<List<EntryStack>> getInputEntries() { public @NotNull List<List<EntryStack>> getInputEntries() {
return this.input; return this.input;
} }
@Override @Override
public @NotNull List<List<EntryStack>> getResultingEntries() { public @NotNull List<List<EntryStack>> getResultingEntries() {
return Collections.singletonList(output); return Collections.singletonList(output);
} }
@Override @Override
public @NotNull Identifier getRecipeCategory() { public @NotNull Identifier getRecipeCategory() {
return AlloyingRecipe.ID; return AlloyingRecipe.ID;
} }
@Override @Override
public @NotNull List<List<EntryStack>> getRequiredEntries() { public @NotNull List<List<EntryStack>> getRequiredEntries() {
return this.input; return this.input;
} }
public float getXp() { public float getXp() {
return this.xp; return this.xp;
} }
public double getSmeltTime() { public double getSmeltTime() {
return this.smeltTime; return this.smeltTime;
} }
public Optional<Recipe<?>> getOptionalRecipe() { public Optional<Recipe<?>> getOptionalRecipe() {
return Optional.ofNullable(recipe); return Optional.ofNullable(recipe);
} }
@Override @Override
public int getWidth() { public int getWidth() {
return 2; return 2;
} }
@Override @Override
public int getHeight() { public int getHeight() {
return 1; return 1;
} }
@Override @Override
public List<List<EntryStack>> getOrganisedInputEntries(ContainerInfo<ScreenHandler> containerInfo, ScreenHandler container) { public List<List<EntryStack>> getOrganisedInputEntries(ContainerInfo<ScreenHandler> containerInfo, ScreenHandler container) {
return this.input; return this.input;
} }
static { static {
fuel = EndStoneSmelterBlockEntity.availableFuels().keySet().stream() fuel = EndStoneSmelterBlockEntity.availableFuels().keySet().stream()
.map(Item::getDefaultStack).map(EntryStack::create) .map(Item::getDefaultStack).map(EntryStack::create)
.map(e -> e.setting(EntryStack.Settings.TOOLTIP_APPEND_EXTRA, stack -> Collections.singletonList(new TranslatableText("category.rei.smelting.fuel") .map(e -> e.setting(EntryStack.Settings.TOOLTIP_APPEND_EXTRA, stack -> Collections.singletonList(new TranslatableText("category.rei.smelting.fuel")
.formatted(Formatting.YELLOW)))).collect(Collectors.toList()); .formatted(Formatting.YELLOW)))).collect(Collectors.toList());
} }
} }

View file

@ -1,84 +1,84 @@
package ru.betterend.compat; package ru.betterend.compat;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntList;
import me.shedaniel.math.Point; import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle; import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.EntryStack; import me.shedaniel.rei.api.EntryStack;
import me.shedaniel.rei.api.TransferRecipeCategory; import me.shedaniel.rei.api.TransferRecipeCategory;
import me.shedaniel.rei.api.widgets.Widgets; import me.shedaniel.rei.api.widgets.Widgets;
import me.shedaniel.rei.gui.entries.RecipeEntry; import me.shedaniel.rei.gui.entries.RecipeEntry;
import me.shedaniel.rei.gui.entries.SimpleRecipeEntry; import me.shedaniel.rei.gui.entries.SimpleRecipeEntry;
import me.shedaniel.rei.gui.widget.Widget; import me.shedaniel.rei.gui.widget.Widget;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.TranslatableText; import net.minecraft.text.TranslatableText;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import ru.betterend.util.LangUtil; import ru.betterend.util.LangUtil;
public class REIAnvilCategory implements TransferRecipeCategory<REIAnvilDisplay> { public class REIAnvilCategory implements TransferRecipeCategory<REIAnvilDisplay> {
@Override @Override
public @NotNull Identifier getIdentifier() { public @NotNull Identifier getIdentifier() {
return REIPlugin.SMITHING; return REIPlugin.SMITHING;
} }
@Override @Override
public @NotNull String getCategoryName() { public @NotNull String getCategoryName() {
return LangUtil.translate(Blocks.ANVIL.getTranslationKey()); return LangUtil.translate(Blocks.ANVIL.getTranslationKey());
} }
@Override @Override
public @NotNull EntryStack getLogo() { public @NotNull EntryStack getLogo() {
return REIPlugin.ANVIL; return REIPlugin.ANVIL;
} }
@Override @Override
public @NotNull List<Widget> setupDisplay(REIAnvilDisplay display, Rectangle bounds) { public @NotNull List<Widget> setupDisplay(REIAnvilDisplay display, Rectangle bounds) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10); Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10);
List<Widget> widgets = Lists.newArrayList(); List<Widget> widgets = Lists.newArrayList();
widgets.add(Widgets.createRecipeBase(bounds)); widgets.add(Widgets.createRecipeBase(bounds));
int x = startPoint.x + 10; int x = startPoint.x + 10;
int y = startPoint.y; int y = startPoint.y;
widgets.add(Widgets.createResultSlotBackground(new Point(x + 61, y + 4))); widgets.add(Widgets.createResultSlotBackground(new Point(x + 61, y + 4)));
List<List<EntryStack>> inputEntries = display.getInputEntries(); List<List<EntryStack>> inputEntries = display.getInputEntries();
widgets.add(Widgets.createArrow(new Point(x + 24, y + 3))); widgets.add(Widgets.createArrow(new Point(x + 24, y + 3)));
widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width - 5, bounds.y + bounds.height - 12), widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width - 5, bounds.y + bounds.height - 12),
new TranslatableText("category.rei.damage.amount&dmg", display.getDamage())).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB)); new TranslatableText("category.rei.damage.amount&dmg", display.getDamage())).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
widgets.add(Widgets.createSlot(new Point(x - 20, y + 3)).entries(inputEntries.get(0)).markInput()); widgets.add(Widgets.createSlot(new Point(x - 20, y + 3)).entries(inputEntries.get(0)).markInput());
widgets.add(Widgets.createSlot(new Point(x + 1, y + 3)).entries(inputEntries.get(1)).markInput()); widgets.add(Widgets.createSlot(new Point(x + 1, y + 3)).entries(inputEntries.get(1)).markInput());
widgets.add(Widgets.createSlot(new Point(x + 61, y + 4)).entries(display.getResultingEntries().get(0)).disableBackground().markOutput()); widgets.add(Widgets.createSlot(new Point(x + 61, y + 4)).entries(display.getResultingEntries().get(0)).disableBackground().markOutput());
return widgets; return widgets;
} }
@Override @Override
public void renderRedSlots(MatrixStack matrices, List<Widget> widgets, Rectangle bounds, REIAnvilDisplay display, public void renderRedSlots(MatrixStack matrices, List<Widget> widgets, Rectangle bounds, REIAnvilDisplay display,
IntList redSlots) { IntList redSlots) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 27); Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 27);
matrices.push(); matrices.push();
matrices.translate(0, 0, 400); matrices.translate(0, 0, 400);
if (redSlots.contains(0)) { if (redSlots.contains(0)) {
DrawableHelper.fill(matrices, startPoint.x - 20, startPoint.y + 3, startPoint.x - 20 + 16, startPoint.y + 3 + 16, 1090453504); DrawableHelper.fill(matrices, startPoint.x - 20, startPoint.y + 3, startPoint.x - 20 + 16, startPoint.y + 3 + 16, 1090453504);
DrawableHelper.fill(matrices, startPoint.x + 1, startPoint.y + 3, startPoint.x + 1 + 16, startPoint.y + 3 + 16, 1090453504); DrawableHelper.fill(matrices, startPoint.x + 1, startPoint.y + 3, startPoint.x + 1 + 16, startPoint.y + 3 + 16, 1090453504);
} }
matrices.pop(); matrices.pop();
} }
@Override @Override
public @NotNull RecipeEntry getSimpleRenderer(REIAnvilDisplay recipe) { public @NotNull RecipeEntry getSimpleRenderer(REIAnvilDisplay recipe) {
return SimpleRecipeEntry.from(Collections.singletonList(recipe.getInputEntries().get(0)), recipe.getResultingEntries()); return SimpleRecipeEntry.from(Collections.singletonList(recipe.getInputEntries().get(0)), recipe.getResultingEntries());
} }
@Override @Override
public int getDisplayHeight() { public int getDisplayHeight() {
return 49; return 49;
} }
} }

View file

@ -1,73 +1,73 @@
package ru.betterend.compat; package ru.betterend.compat;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import me.shedaniel.rei.api.EntryStack; import me.shedaniel.rei.api.EntryStack;
import me.shedaniel.rei.api.TransferRecipeDisplay; import me.shedaniel.rei.api.TransferRecipeDisplay;
import me.shedaniel.rei.server.ContainerInfo; import me.shedaniel.rei.server.ContainerInfo;
import net.minecraft.recipe.Recipe; import net.minecraft.recipe.Recipe;
import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.ScreenHandler;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import ru.betterend.recipe.builders.AnvilSmithingRecipe; import ru.betterend.recipe.builders.AnvilSmithingRecipe;
public class REIAnvilDisplay implements TransferRecipeDisplay { public class REIAnvilDisplay implements TransferRecipeDisplay {
private AnvilSmithingRecipe recipe; private AnvilSmithingRecipe recipe;
private List<List<EntryStack>> input; private List<List<EntryStack>> input;
private List<EntryStack> output; private List<EntryStack> output;
public REIAnvilDisplay(AnvilSmithingRecipe recipe) { public REIAnvilDisplay(AnvilSmithingRecipe recipe) {
this.recipe = recipe; this.recipe = recipe;
this.input = EntryStack.ofIngredients(recipe.getPreviewInputs()); this.input = EntryStack.ofIngredients(recipe.getPreviewInputs());
this.output = Collections.singletonList(EntryStack.create(recipe.getOutput())); this.output = Collections.singletonList(EntryStack.create(recipe.getOutput()));
} }
public int getDamage() { public int getDamage() {
return this.recipe.getDamage(); return this.recipe.getDamage();
} }
@Override @Override
public @NotNull Optional<Identifier> getRecipeLocation() { public @NotNull Optional<Identifier> getRecipeLocation() {
return Optional.ofNullable(recipe).map(Recipe::getId); return Optional.ofNullable(recipe).map(Recipe::getId);
} }
@Override @Override
public @NotNull List<List<EntryStack>> getInputEntries() { public @NotNull List<List<EntryStack>> getInputEntries() {
return this.input; return this.input;
} }
@Override @Override
public @NotNull List<List<EntryStack>> getResultingEntries() { public @NotNull List<List<EntryStack>> getResultingEntries() {
return Collections.singletonList(output); return Collections.singletonList(output);
} }
@Override @Override
public @NotNull Identifier getRecipeCategory() { public @NotNull Identifier getRecipeCategory() {
return REIPlugin.SMITHING; return REIPlugin.SMITHING;
} }
@Override @Override
public @NotNull List<List<EntryStack>> getRequiredEntries() { public @NotNull List<List<EntryStack>> getRequiredEntries() {
return this.input; return this.input;
} }
@Override @Override
public int getWidth() { public int getWidth() {
return 2; return 2;
} }
@Override @Override
public int getHeight() { public int getHeight() {
return 1; return 1;
} }
@Override @Override
public List<List<EntryStack>> getOrganisedInputEntries(ContainerInfo<ScreenHandler> containerInfo, public List<List<EntryStack>> getOrganisedInputEntries(ContainerInfo<ScreenHandler> containerInfo,
ScreenHandler container) { ScreenHandler container) {
return this.input; return this.input;
} }
} }

View file

@ -1,14 +1,14 @@
package ru.betterend.compat; package ru.betterend.compat;
import me.shedaniel.rei.plugin.containers.CraftingContainerInfoWrapper; import me.shedaniel.rei.plugin.containers.CraftingContainerInfoWrapper;
import me.shedaniel.rei.server.ContainerInfoHandler; import me.shedaniel.rei.server.ContainerInfoHandler;
import ru.betterend.client.gui.EndStoneSmelterScreenHandler; import ru.betterend.client.gui.EndStoneSmelterScreenHandler;
import ru.betterend.recipe.builders.AlloyingRecipe; import ru.betterend.recipe.builders.AlloyingRecipe;
public class REIContainer implements Runnable { public class REIContainer implements Runnable {
@Override @Override
public void run() { public void run() {
ContainerInfoHandler.registerContainerInfo(AlloyingRecipe.ID, CraftingContainerInfoWrapper.create(EndStoneSmelterScreenHandler.class)); ContainerInfoHandler.registerContainerInfo(AlloyingRecipe.ID, CraftingContainerInfoWrapper.create(EndStoneSmelterScreenHandler.class));
} }
} }

View file

@ -1,115 +1,115 @@
package ru.betterend.config; package ru.betterend.config;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.config.ConfigKeeper.BooleanEntry; import ru.betterend.config.ConfigKeeper.BooleanEntry;
import ru.betterend.config.ConfigKeeper.Entry; import ru.betterend.config.ConfigKeeper.Entry;
import ru.betterend.config.ConfigKeeper.FloatEntry; import ru.betterend.config.ConfigKeeper.FloatEntry;
import ru.betterend.config.ConfigKeeper.IntegerEntry; import ru.betterend.config.ConfigKeeper.IntegerEntry;
import ru.betterend.config.ConfigKeeper.RangeEntry; import ru.betterend.config.ConfigKeeper.RangeEntry;
import ru.betterend.config.ConfigKeeper.StringEntry; import ru.betterend.config.ConfigKeeper.StringEntry;
public abstract class Config { public abstract class Config {
protected final ConfigKeeper configKeeper = new ConfigKeeper(); protected final ConfigKeeper configKeeper = new ConfigKeeper();
public abstract void saveChanges(); public abstract void saveChanges();
public <E extends Entry<?>> E getEntry(String key) { public <E extends Entry<?>> E getEntry(String key) {
return this.configKeeper.getEntry(key); return this.configKeeper.getEntry(key);
} }
public <T> T getDefault(String key) { public <T> T getDefault(String key) {
Entry<T> entry = configKeeper.getEntry(key); Entry<T> entry = configKeeper.getEntry(key);
return entry != null ? entry.getDefault() : null; return entry != null ? entry.getDefault() : null;
} }
public String getString(String key) { public String getString(String key) {
String str = configKeeper.getValue(key); String str = configKeeper.getValue(key);
return str != null ? str : ""; return str != null ? str : "";
} }
public boolean setString(String key, String value) { public boolean setString(String key, String value) {
try { try {
StringEntry entry = configKeeper.getEntry(key); StringEntry entry = configKeeper.getEntry(key);
entry.setValue(value); entry.setValue(value);
this.configKeeper.set(key, entry); this.configKeeper.set(key, entry);
return true; return true;
} catch (NullPointerException ex) { } catch (NullPointerException ex) {
BetterEnd.LOGGER.catching(ex); BetterEnd.LOGGER.catching(ex);
} }
return false; return false;
} }
public int getInt(String key) { public int getInt(String key) {
Integer val = configKeeper.getValue(key); Integer val = configKeeper.getValue(key);
return val != null ? val : 0; return val != null ? val : 0;
} }
public boolean setInt(String key, int value) { public boolean setInt(String key, int value) {
try { try {
IntegerEntry entry = configKeeper.getEntry(key); IntegerEntry entry = configKeeper.getEntry(key);
entry.setValue(value); entry.setValue(value);
this.configKeeper.set(key, entry); this.configKeeper.set(key, entry);
return true; return true;
} catch (NullPointerException ex) { } catch (NullPointerException ex) {
BetterEnd.LOGGER.catching(ex); BetterEnd.LOGGER.catching(ex);
} }
return false; return false;
} }
public <T extends Comparable<T>> boolean setRanged(String key, T value) { public <T extends Comparable<T>> boolean setRanged(String key, T value) {
try { try {
RangeEntry<T> entry = configKeeper.getEntry(key); RangeEntry<T> entry = configKeeper.getEntry(key);
entry.setValue(value); entry.setValue(value);
this.configKeeper.set(key, entry); this.configKeeper.set(key, entry);
return true; return true;
} catch (NullPointerException | ClassCastException ex) { } catch (NullPointerException | ClassCastException ex) {
BetterEnd.LOGGER.catching(ex); BetterEnd.LOGGER.catching(ex);
} }
return false; return false;
} }
public float getFloat(String key) { public float getFloat(String key) {
Float val = configKeeper.getValue(key); Float val = configKeeper.getValue(key);
return val != null ? val : 0.0F; return val != null ? val : 0.0F;
} }
public boolean setFloat(String key, float value) { public boolean setFloat(String key, float value) {
try { try {
FloatEntry entry = configKeeper.getEntry(key); FloatEntry entry = configKeeper.getEntry(key);
entry.setValue(value); entry.setValue(value);
this.configKeeper.set(key, entry); this.configKeeper.set(key, entry);
return true; return true;
} catch (NullPointerException ex) { } catch (NullPointerException ex) {
BetterEnd.LOGGER.catching(ex); BetterEnd.LOGGER.catching(ex);
} }
return false; return false;
} }
public boolean getBoolean(String key) { public boolean getBoolean(String key) {
Boolean val = configKeeper.getValue(key); Boolean val = configKeeper.getValue(key);
return val != null ? val : false; return val != null ? val : false;
} }
public boolean setBoolean(String key, boolean value) { public boolean setBoolean(String key, boolean value) {
try { try {
BooleanEntry entry = configKeeper.getEntry(key); BooleanEntry entry = configKeeper.getEntry(key);
entry.setValue(value); entry.setValue(value);
this.configKeeper.set(key, entry); this.configKeeper.set(key, entry);
return true; return true;
} catch (NullPointerException ex) { } catch (NullPointerException ex) {
BetterEnd.LOGGER.catching(ex); BetterEnd.LOGGER.catching(ex);
} }
return false; return false;
} }
} }

View file

@ -1,342 +1,342 @@
package ru.betterend.config; package ru.betterend.config;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.Supplier; import java.util.function.Supplier;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import net.minecraft.util.JsonHelper; import net.minecraft.util.JsonHelper;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
public final class ConfigKeeper { public final class ConfigKeeper {
private Map<String, Entry<?>> configEntries = new HashMap<>(); private Map<String, Entry<?>> configEntries = new HashMap<>();
public JsonElement toJson(JsonObject jsonObject) { public JsonElement toJson(JsonObject jsonObject) {
for (String param : configEntries.keySet()) { for (String param : configEntries.keySet()) {
jsonObject.addProperty(param, configEntries.get(param).asString()); jsonObject.addProperty(param, configEntries.get(param).asString());
} }
return jsonObject; return jsonObject;
} }
public void fromJson(JsonObject jsonObject) { public void fromJson(JsonObject jsonObject) {
for (String param : configEntries.keySet()) { for (String param : configEntries.keySet()) {
if (jsonObject.has(param)) { if (jsonObject.has(param)) {
Entry<?> entry = configEntries.get(param); Entry<?> entry = configEntries.get(param);
entry.fromString(JsonHelper.getString(jsonObject, param)); entry.fromString(JsonHelper.getString(jsonObject, param));
} }
} }
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <E extends Entry<?>> E getEntry(String key) { public <E extends Entry<?>> E getEntry(String key) {
Entry<?> entry = this.configEntries.get(key); Entry<?> entry = this.configEntries.get(key);
if (entry == null) { if (entry == null) {
BetterEnd.LOGGER.warning(String.format("Entry '%s' doesn't exists.", key)); BetterEnd.LOGGER.warning(String.format("Entry '%s' doesn't exists.", key));
return null; return null;
} }
return (E) entry; return (E) entry;
} }
public <T> T getValue(String key) { public <T> T getValue(String key) {
Entry<T> entry = this.getEntry(key); Entry<T> entry = this.getEntry(key);
if (entry == null) { if (entry == null) {
BetterEnd.LOGGER.warning("Empty value will be returned."); BetterEnd.LOGGER.warning("Empty value will be returned.");
return null; return null;
} }
return entry.getValue(); return entry.getValue();
} }
public void set(String key, Entry<?> entry) { public void set(String key, Entry<?> entry) {
configEntries.put(key, entry); configEntries.put(key, entry);
} }
public <T extends Entry<?>> void registerEntry(String key, T entry) { public <T extends Entry<?>> void registerEntry(String key, T entry) {
configEntries.put(key, entry); configEntries.put(key, entry);
} }
public static class BooleanEntry extends Entry<Boolean> { public static class BooleanEntry extends Entry<Boolean> {
public BooleanEntry(Boolean defaultValue, Consumer<Boolean> consumer, Supplier<Boolean> supplier) { public BooleanEntry(Boolean defaultValue, Consumer<Boolean> consumer, Supplier<Boolean> supplier) {
super(defaultValue, consumer, supplier); super(defaultValue, consumer, supplier);
} }
@Override @Override
public Boolean getValue() { public Boolean getValue() {
return this.getter.get(); return this.getter.get();
} }
@Override @Override
public void setValue(Boolean value) { public void setValue(Boolean value) {
this.setter.accept(value); this.setter.accept(value);
} }
@Override @Override
public Boolean getDefault() { public Boolean getDefault() {
return this.defaultValue; return this.defaultValue;
} }
@Override @Override
public String asString() { public String asString() {
return this.getValue() ? "true" : "false"; return this.getValue() ? "true" : "false";
} }
@Override @Override
public void fromString(String value) { public void fromString(String value) {
this.setValue(value.equals("true") ? true : false); this.setValue(value.equals("true") ? true : false);
} }
} }
public static class FloatEntry extends Entry<Float> { public static class FloatEntry extends Entry<Float> {
public FloatEntry(Float defaultValue, Consumer<Float> consumer, Supplier<Float> supplier) { public FloatEntry(Float defaultValue, Consumer<Float> consumer, Supplier<Float> supplier) {
super(defaultValue, consumer, supplier); super(defaultValue, consumer, supplier);
} }
@Override @Override
public Float getValue() { public Float getValue() {
return this.getter.get(); return this.getter.get();
} }
@Override @Override
public void setValue(Float value) { public void setValue(Float value) {
this.setter.accept(value); this.setter.accept(value);
} }
@Override @Override
public Float getDefault() { public Float getDefault() {
return this.defaultValue; return this.defaultValue;
} }
@Override @Override
public String asString() { public String asString() {
return Float.toString(getValue()); return Float.toString(getValue());
} }
@Override @Override
public void fromString(String value) { public void fromString(String value) {
this.setValue(Float.valueOf(value)); this.setValue(Float.valueOf(value));
} }
} }
public static class FloatRange extends RangeEntry<Float> { public static class FloatRange extends RangeEntry<Float> {
public FloatRange(Float defaultValue, Consumer<Float> consumer, Supplier<Float> supplier, Float minVal, Float maxVal) { public FloatRange(Float defaultValue, Consumer<Float> consumer, Supplier<Float> supplier, Float minVal, Float maxVal) {
super(defaultValue, consumer, supplier, minVal, maxVal); super(defaultValue, consumer, supplier, minVal, maxVal);
} }
@Override @Override
public Float getValue() { public Float getValue() {
return this.getter.get(); return this.getter.get();
} }
@Override @Override
public Float getDefault() { public Float getDefault() {
return this.defaultValue; return this.defaultValue;
} }
@Override @Override
public void fromString(String value) { public void fromString(String value) {
this.setValue(Float.valueOf(value)); this.setValue(Float.valueOf(value));
} }
@Override @Override
public String asString() { public String asString() {
return Float.toString(getValue()); return Float.toString(getValue());
} }
} }
public static class IntegerEntry extends Entry<Integer> { public static class IntegerEntry extends Entry<Integer> {
public IntegerEntry(Integer defaultValue, Consumer<Integer> consumer, Supplier<Integer> supplier) { public IntegerEntry(Integer defaultValue, Consumer<Integer> consumer, Supplier<Integer> supplier) {
super(defaultValue, consumer, supplier); super(defaultValue, consumer, supplier);
} }
@Override @Override
public Integer getValue() { public Integer getValue() {
return this.getter.get(); return this.getter.get();
} }
@Override @Override
public void setValue(Integer value) { public void setValue(Integer value) {
this.setter.accept(value); this.setter.accept(value);
} }
@Override @Override
public Integer getDefault() { public Integer getDefault() {
return this.defaultValue; return this.defaultValue;
} }
@Override @Override
public String asString() { public String asString() {
return Integer.toString(getValue()); return Integer.toString(getValue());
} }
@Override @Override
public void fromString(String value) { public void fromString(String value) {
this.setValue(Integer.valueOf(value)); this.setValue(Integer.valueOf(value));
} }
} }
public static class IntegerRange extends RangeEntry<Integer> { public static class IntegerRange extends RangeEntry<Integer> {
public IntegerRange(Integer defaultValue, Consumer<Integer> consumer, Supplier<Integer> supplier, Integer minVal, Integer maxVal) { public IntegerRange(Integer defaultValue, Consumer<Integer> consumer, Supplier<Integer> supplier, Integer minVal, Integer maxVal) {
super(defaultValue, consumer, supplier, minVal, maxVal); super(defaultValue, consumer, supplier, minVal, maxVal);
} }
@Override @Override
public Integer getValue() { public Integer getValue() {
return this.getter.get(); return this.getter.get();
} }
@Override @Override
public Integer getDefault() { public Integer getDefault() {
return this.defaultValue; return this.defaultValue;
} }
@Override @Override
public void fromString(String value) { public void fromString(String value) {
this.setValue(Integer.valueOf(value)); this.setValue(Integer.valueOf(value));
} }
@Override @Override
public String asString() { public String asString() {
return Integer.toString(getValue()); return Integer.toString(getValue());
} }
} }
public static class StringEntry extends Entry<String> { public static class StringEntry extends Entry<String> {
public StringEntry(String defaultValue, Consumer<String> consumer, Supplier<String> supplier) { public StringEntry(String defaultValue, Consumer<String> consumer, Supplier<String> supplier) {
super(defaultValue, consumer, supplier); super(defaultValue, consumer, supplier);
} }
@Override @Override
public String getValue() { public String getValue() {
return this.getter.get(); return this.getter.get();
} }
@Override @Override
public void setValue(String value) { public void setValue(String value) {
this.setter.accept(value); this.setter.accept(value);
} }
@Override @Override
public String getDefault() { public String getDefault() {
return this.defaultValue; return this.defaultValue;
} }
@Override @Override
public String asString() { public String asString() {
return getValue(); return getValue();
} }
@Override @Override
public void fromString(String value) { public void fromString(String value) {
this.setValue(value); this.setValue(value);
} }
} }
public static class EnumEntry<T extends Enum<T>> extends Entry<T> { public static class EnumEntry<T extends Enum<T>> extends Entry<T> {
public EnumEntry(T defaultValue, Consumer<T> consumer, Supplier<T> supplier) { public EnumEntry(T defaultValue, Consumer<T> consumer, Supplier<T> supplier) {
super(defaultValue, consumer, supplier); super(defaultValue, consumer, supplier);
} }
@Override @Override
public T getValue() { public T getValue() {
return this.getter.get(); return this.getter.get();
} }
@Override @Override
public void setValue(T value) { public void setValue(T value) {
this.setter.accept(value); this.setter.accept(value);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public boolean setValue(String name) { public boolean setValue(String name) {
try { try {
this.setter.accept((T) Enum.valueOf(this.defaultValue.getClass(), name)); this.setter.accept((T) Enum.valueOf(this.defaultValue.getClass(), name));
return true; return true;
} catch(IllegalArgumentException ex) { } catch(IllegalArgumentException ex) {
BetterEnd.LOGGER.catching(ex); BetterEnd.LOGGER.catching(ex);
} }
return false; return false;
} }
@Override @Override
public T getDefault() { public T getDefault() {
return this.defaultValue; return this.defaultValue;
} }
@Override @Override
public String asString() { public String asString() {
return getValue().name(); return getValue().name();
} }
@Override @Override
public void fromString(String value) { public void fromString(String value) {
this.setValue(value); this.setValue(value);
} }
} }
public static abstract class RangeEntry<T extends Comparable<T>> extends Entry<T> { public static abstract class RangeEntry<T extends Comparable<T>> extends Entry<T> {
private final T min, max; private final T min, max;
public RangeEntry(T defaultValue, Consumer<T> consumer, Supplier<T> supplier, T minVal, T maxVal) { public RangeEntry(T defaultValue, Consumer<T> consumer, Supplier<T> supplier, T minVal, T maxVal) {
super(defaultValue, consumer, supplier); super(defaultValue, consumer, supplier);
this.min = minVal; this.min = minVal;
this.max = maxVal; this.max = maxVal;
} }
@Override @Override
public void setValue(T value) { public void setValue(T value) {
this.setter.accept(value.compareTo(min) < 0 ? min : value.compareTo(max) > 0 ? max : value); this.setter.accept(value.compareTo(min) < 0 ? min : value.compareTo(max) > 0 ? max : value);
} }
public T minValue() { public T minValue() {
return this.min; return this.min;
} }
public T maxValue() { public T maxValue() {
return this.max; return this.max;
} }
} }
public static abstract class Entry<T> { public static abstract class Entry<T> {
protected final T defaultValue; protected final T defaultValue;
protected final Consumer<T> setter; protected final Consumer<T> setter;
protected final Supplier<T> getter; protected final Supplier<T> getter;
public Entry (T defaultValue, Consumer<T> consumer, Supplier<T> supplier) { public Entry (T defaultValue, Consumer<T> consumer, Supplier<T> supplier) {
this.defaultValue = defaultValue; this.defaultValue = defaultValue;
this.setter = consumer; this.setter = consumer;
this.getter = supplier; this.getter = supplier;
} }
public abstract T getValue(); public abstract T getValue();
public abstract void setValue(T value); public abstract void setValue(T value);
public abstract T getDefault(); public abstract T getDefault();
public abstract void fromString(String value); public abstract void fromString(String value);
public abstract String asString(); public abstract String asString();
public void setDefault() { public void setDefault() {
this.setter.accept(defaultValue); this.setter.accept(defaultValue);
} }
} }
} }

View file

@ -1,79 +1,79 @@
package ru.betterend.config; package ru.betterend.config;
import java.io.File; import java.io.File;
import java.nio.file.Path; import java.nio.file.Path;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.FabricLoader;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.util.JsonFactory; import ru.betterend.util.JsonFactory;
public class ConfigWriter { public class ConfigWriter {
private final static Path GAME_CONFIG_DIR = FabricLoader.getInstance().getConfigDir(); private final static Path GAME_CONFIG_DIR = FabricLoader.getInstance().getConfigDir();
public final static File MOD_CONFIG_DIR = new File(GAME_CONFIG_DIR.toFile(), BetterEnd.MOD_ID); public final static File MOD_CONFIG_DIR = new File(GAME_CONFIG_DIR.toFile(), BetterEnd.MOD_ID);
private final static File MAIN_CONFIG_FILE = new File(MOD_CONFIG_DIR, "settings.json"); private final static File MAIN_CONFIG_FILE = new File(MOD_CONFIG_DIR, "settings.json");
private static JsonObject mainConfig; private static JsonObject mainConfig;
private JsonObject configObject; private JsonObject configObject;
private File configFile; private File configFile;
public JsonObject getConfig() { public JsonObject getConfig() {
return configObject; return configObject;
} }
public JsonObject loadConfig(File configFile) { public JsonObject loadConfig(File configFile) {
this.configFile = configFile; this.configFile = configFile;
if (configObject == null) { if (configObject == null) {
configObject = load(configFile); configObject = load(configFile);
} }
return configObject; return configObject;
} }
public void saveConfig() { public void saveConfig() {
if (configFile == null || configObject == null) { if (configFile == null || configObject == null) {
return; return;
} }
save(configFile, configObject); save(configFile, configObject);
} }
public static JsonObject load() { public static JsonObject load() {
if (mainConfig == null) { if (mainConfig == null) {
mainConfig = load(MAIN_CONFIG_FILE); mainConfig = load(MAIN_CONFIG_FILE);
} }
return mainConfig; return mainConfig;
} }
public static JsonObject load(File configFile) { public static JsonObject load(File configFile) {
return JsonFactory.getJsonObject(configFile); return JsonFactory.getJsonObject(configFile);
} }
public static void save() { public static void save() {
save(MAIN_CONFIG_FILE, mainConfig); save(MAIN_CONFIG_FILE, mainConfig);
} }
public static void save(JsonElement config) { public static void save(JsonElement config) {
save(MAIN_CONFIG_FILE, config); save(MAIN_CONFIG_FILE, config);
} }
public static void save(File configFile, JsonElement config) { public static void save(File configFile, JsonElement config) {
JsonFactory.storeJson(configFile, config); JsonFactory.storeJson(configFile, config);
} }
public static String scrubFileName(String input) { public static String scrubFileName(String input) {
input = input.replaceAll("[/\\ ]+", "_"); input = input.replaceAll("[/\\ ]+", "_");
input = input.replaceAll("[,:&\"\\|\\<\\>\\?\\*]", "_"); input = input.replaceAll("[,:&\"\\|\\<\\>\\?\\*]", "_");
return input; return input;
} }
static { static {
if (!MOD_CONFIG_DIR.exists()) { if (!MOD_CONFIG_DIR.exists()) {
MOD_CONFIG_DIR.mkdirs(); MOD_CONFIG_DIR.mkdirs();
} }
} }
} }

View file

@ -1,34 +1,34 @@
package ru.betterend.config; package ru.betterend.config;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
public class MainConfig extends Config { public class MainConfig extends Config {
private static MainConfig instance; private static MainConfig instance;
public static MainConfig getInstance() { public static MainConfig getInstance() {
if (instance == null) { if (instance == null) {
instance = new MainConfig(); instance = new MainConfig();
} }
return instance; return instance;
} }
private MainConfig() { private MainConfig() {
//TODO: Need to register config params in the Keeper //TODO: Need to register config params in the Keeper
JsonObject config = ConfigWriter.load(); JsonObject config = ConfigWriter.load();
if (config.size() > 0) { if (config.size() > 0) {
this.configKeeper.fromJson(config); this.configKeeper.fromJson(config);
} else { } else {
this.configKeeper.toJson(config); this.configKeeper.toJson(config);
ConfigWriter.save(); ConfigWriter.save();
} }
} }
@Override @Override
public void saveChanges() { public void saveChanges() {
this.configKeeper.toJson(ConfigWriter.load()); this.configKeeper.toJson(ConfigWriter.load());
ConfigWriter.save(); ConfigWriter.save();
} }
} }

View file

@ -1,16 +1,16 @@
package ru.betterend.effects; package ru.betterend.effects;
import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.Enchantment;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.effects.enchantment.EndVeilEnchantment; import ru.betterend.effects.enchantment.EndVeilEnchantment;
public class EndEnchantments { public class EndEnchantments {
public final static Enchantment END_VEIL = registerEnchantment("end_veil", new EndVeilEnchantment()); public final static Enchantment END_VEIL = registerEnchantment("end_veil", new EndVeilEnchantment());
public static Enchantment registerEnchantment(String name, Enchantment enchantment) { public static Enchantment registerEnchantment(String name, Enchantment enchantment) {
return Registry.register(Registry.ENCHANTMENT, BetterEnd.makeID(name), enchantment); return Registry.register(Registry.ENCHANTMENT, BetterEnd.makeID(name), enchantment);
} }
public static void register() {} public static void register() {}
} }

View file

@ -1,15 +1,15 @@
package ru.betterend.effects; package ru.betterend.effects;
import net.minecraft.entity.effect.StatusEffect; import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.effects.status.EndVeilEffect; import ru.betterend.effects.status.EndVeilEffect;
public class EndStatusEffects { public class EndStatusEffects {
public final static StatusEffect END_VEIL = registerEffect("end_veil", new EndVeilEffect()); public final static StatusEffect END_VEIL = registerEffect("end_veil", new EndVeilEffect());
public static <E extends StatusEffect> StatusEffect registerEffect(String name, E effect) { public static <E extends StatusEffect> StatusEffect registerEffect(String name, E effect) {
return Registry.register(Registry.STATUS_EFFECT, BetterEnd.makeID(name), effect); return Registry.register(Registry.STATUS_EFFECT, BetterEnd.makeID(name), effect);
} }
} }

View file

@ -1,17 +1,17 @@
package ru.betterend.effects.enchantment; package ru.betterend.effects.enchantment;
import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentTarget; import net.minecraft.enchantment.EnchantmentTarget;
import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.EquipmentSlot;
public class EndVeilEnchantment extends Enchantment { public class EndVeilEnchantment extends Enchantment {
public EndVeilEnchantment() { public EndVeilEnchantment() {
super(Enchantment.Rarity.VERY_RARE, EnchantmentTarget.ARMOR_HEAD, new EquipmentSlot[] { EquipmentSlot.HEAD }); super(Enchantment.Rarity.VERY_RARE, EnchantmentTarget.ARMOR_HEAD, new EquipmentSlot[] { EquipmentSlot.HEAD });
} }
@Override @Override
public boolean isAvailableForRandomSelection() { public boolean isAvailableForRandomSelection() {
return false; return false;
} }
} }

View file

@ -1,16 +1,16 @@
package ru.betterend.effects.status; package ru.betterend.effects.status;
import net.minecraft.entity.effect.StatusEffect; import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectType; import net.minecraft.entity.effect.StatusEffectType;
public class EndVeilEffect extends StatusEffect { public class EndVeilEffect extends StatusEffect {
public EndVeilEffect() { public EndVeilEffect() {
super(StatusEffectType.BENEFICIAL, 0x0D554A); super(StatusEffectType.BENEFICIAL, 0x0D554A);
} }
@Override @Override
public boolean canApplyUpdateEffect(int duration, int amplifier) { public boolean canApplyUpdateEffect(int duration, int amplifier) {
return false; return false;
} }
} }

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