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/
build/
out/
classes/
# eclipse
*.launch
# idea
.idea/
*.iml
*.ipr
*.iws
# vscode
.settings/
.vscode/
bin/
.classpath
.project
# fabric
run/
output/
*.log
# gradle
.gradle/
build/
out/
classes/
# eclipse
*.launch
# idea
.idea/
*.iml
*.ipr
*.iws
# vscode
.settings/
.vscode/
bin/
.classpath
.project
# fabric
run/
output/
*.log

View file

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

View file

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

View file

@ -1,21 +1,21 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx2G
# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version = 1.16.4
yarn_mappings = 1
loader_version = 0.10.6+build.214
# Mod Properties
mod_version = 0.6.0-beta
maven_group = ru.betterend
archives_base_name = better-end
# Dependencies
# 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
cloth_config_version = 4.8.2
cloth_events_version = 1.4.8
canvas_version = 1.0.+
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx2G
# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version = 1.16.4
yarn_mappings = 1
loader_version = 0.10.6+build.214
# Mod Properties
mod_version = 0.6.0-beta
maven_group = ru.betterend
archives_base_name = better-end
# Dependencies
# 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
cloth_config_version = 4.8.2
cloth_events_version = 1.4.8
canvas_version = 1.0.+
rei_version = 5.6.2

View file

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

366
gradlew vendored
View file

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

206
gradlew.bat vendored
View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,23 +1,23 @@
’®¬ ¢ ãáâனá⢥ D ¨¬¥¥â ¬¥âªã Data
‘¥à¨©­ë© ­®¬¥à ⮬ : C7B5-F673
‘®¤¥à¦¨¬®¥ ¯ ¯ª¨ D:\BetterEnd\Utilities\src\data\stone\blockstates
11.10.2020 15:54 <DIR> .
11.10.2020 15:54 <DIR> ..
11.10.2020 15:50 103 %name%.json
11.10.2020 15:51 110 %name%_bricks.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:52 1ÿ635 %name%_brick_wall.json
26.09.2020 20:35 4ÿ006 %name%_button.json
11.10.2020 15:50 253 %name%_pillar.json
26.09.2020 20:35 241 %name%_plate.json
26.09.2020 20:35 364 %name%_slab.json
11.10.2020 15:50 115 %name%_small_tiles.json
26.09.2020 20:35 7ÿ300 %name%_stairs.json
11.10.2020 15:50 108 %name%_tile.json
11.10.2020 15:52 1ÿ581 %name%_wall.json
11.10.2020 15:58 0 a.txt
14 ä ©«®¢ 23ÿ738 ¡ ©â
2 ¯ ¯®ª 785ÿ301ÿ614ÿ592 ¡ ©â ᢮¡®¤­®
’®¬ ¢ ãáâனá⢥ D ¨¬¥¥â ¬¥âªã Data
‘¥à¨©­ë© ­®¬¥à ⮬ : C7B5-F673
‘®¤¥à¦¨¬®¥ ¯ ¯ª¨ D:\BetterEnd\Utilities\src\data\stone\blockstates
11.10.2020 15:54 <DIR> .
11.10.2020 15:54 <DIR> ..
11.10.2020 15:50 103 %name%.json
11.10.2020 15:51 110 %name%_bricks.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:52 1ÿ635 %name%_brick_wall.json
26.09.2020 20:35 4ÿ006 %name%_button.json
11.10.2020 15:50 253 %name%_pillar.json
26.09.2020 20:35 241 %name%_plate.json
26.09.2020 20:35 364 %name%_slab.json
11.10.2020 15:50 115 %name%_small_tiles.json
26.09.2020 20:35 7ÿ300 %name%_stairs.json
11.10.2020 15:50 108 %name%_tile.json
11.10.2020 15:52 1ÿ581 %name%_wall.json
11.10.2020 15:58 0 a.txt
14 ä ©«®¢ 23ÿ738 ¡ ©â
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
‘¥à¨©­ë© ­®¬¥à ⮬ : C7B5-F673
‘®¤¥à¦¨¬®¥ ¯ ¯ª¨ D:\BetterEnd\Utilities\src\data\stone\item
11.10.2020 15:55 <DIR> .
11.10.2020 15:55 <DIR> ..
11.10.2020 15:42 44 %name%.json
11.10.2020 15:46 51 %name%_bricks.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:47 65 %name%_brick_wall.json
11.10.2020 15:48 61 %name%_button.json
11.10.2020 15:43 51 %name%_pillar.json
26.09.2020 20:36 62 %name%_plate.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 51 %name%_stairs.json
11.10.2020 15:43 49 %name%_tile.json
11.10.2020 15:47 59 %name%_wall.json
11.10.2020 15:55 0 a.txt
14 ä ©«®¢ 710 ¡ ©â
2 ¯ ¯®ª 785ÿ301ÿ659ÿ648 ¡ ©â ᢮¡®¤­®
’®¬ ¢ ãáâனá⢥ D ¨¬¥¥â ¬¥âªã Data
‘¥à¨©­ë© ­®¬¥à ⮬ : C7B5-F673
‘®¤¥à¦¨¬®¥ ¯ ¯ª¨ D:\BetterEnd\Utilities\src\data\stone\item
11.10.2020 15:55 <DIR> .
11.10.2020 15:55 <DIR> ..
11.10.2020 15:42 44 %name%.json
11.10.2020 15:46 51 %name%_bricks.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:47 65 %name%_brick_wall.json
11.10.2020 15:48 61 %name%_button.json
11.10.2020 15:43 51 %name%_pillar.json
26.09.2020 20:36 62 %name%_plate.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 51 %name%_stairs.json
11.10.2020 15:43 49 %name%_tile.json
11.10.2020 15:47 59 %name%_wall.json
11.10.2020 15:55 0 a.txt
14 ä ©«®¢ 710 ¡ ©â
2 ¯ ¯®ª 785ÿ301ÿ659ÿ648 ¡ ©â ᢮¡®¤­®

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,28 +1,28 @@
package ru.betterend.blocks.basis;
import java.util.Collections;
import java.util.List;
import net.minecraft.block.BlockState;
import net.minecraft.block.BlockWithEntity;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootContext;
import net.minecraft.world.BlockView;
public class BaseBlockWithEntity extends BlockWithEntity {
public BaseBlockWithEntity(Settings settings) {
super(settings);
}
@Override
public BlockEntity createBlockEntity(BlockView world) {
return null;
}
@Override
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
return Collections.singletonList(new ItemStack(this));
}
}
package ru.betterend.blocks.basis;
import java.util.Collections;
import java.util.List;
import net.minecraft.block.BlockState;
import net.minecraft.block.BlockWithEntity;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootContext;
import net.minecraft.world.BlockView;
public class BaseBlockWithEntity extends BlockWithEntity {
public BaseBlockWithEntity(Settings settings) {
super(settings);
}
@Override
public BlockEntity createBlockEntity(BlockView world) {
return null;
}
@Override
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
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;
import net.minecraft.block.BlockState;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import ru.betterend.rituals.EternalRitual;
public class EternalPedestalEntity extends PedestalBlockEntity {
private EternalRitual linkedRitual;
public boolean hasRitual() {
return this.linkedRitual != null;
}
public void linkRitual(EternalRitual ritual) {
this.linkedRitual = ritual;
}
public EternalRitual getRitual() {
return this.linkedRitual;
}
@Override
public void setLocation(World world, BlockPos pos) {
super.setLocation(world, pos);
if (hasRitual()) {
this.linkedRitual.setWorld(world);
}
}
@Override
public void fromTag(BlockState state, CompoundTag tag) {
super.fromTag(state, tag);
if (tag.contains("ritual")) {
this.linkedRitual = new EternalRitual(world);
this.linkedRitual.fromTag(tag.getCompound("ritual"));
}
}
@Override
public CompoundTag toTag(CompoundTag tag) {
if (this.hasRitual()) {
tag.put("ritual", linkedRitual.toTag(new CompoundTag()));
}
return super.toTag(tag);
}
}
package ru.betterend.blocks.entities;
import net.minecraft.block.BlockState;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import ru.betterend.rituals.EternalRitual;
public class EternalPedestalEntity extends PedestalBlockEntity {
private EternalRitual linkedRitual;
public boolean hasRitual() {
return this.linkedRitual != null;
}
public void linkRitual(EternalRitual ritual) {
this.linkedRitual = ritual;
}
public EternalRitual getRitual() {
return this.linkedRitual;
}
@Override
public void setLocation(World world, BlockPos pos) {
super.setLocation(world, pos);
if (hasRitual()) {
this.linkedRitual.setWorld(world);
}
}
@Override
public void fromTag(BlockState state, CompoundTag tag) {
super.fromTag(state, tag);
if (tag.contains("ritual")) {
this.linkedRitual = new EternalRitual(world);
this.linkedRitual.fromTag(tag.getCompound("ritual"));
}
}
@Override
public CompoundTag toTag(CompoundTag tag) {
if (this.hasRitual()) {
tag.put("ritual", linkedRitual.toTag(new CompoundTag()));
}
return super.toTag(tag);
}
}

View file

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

View file

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

View file

@ -1,94 +1,94 @@
package ru.betterend.blocks.entities.render;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.OverlayTexture;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Matrix3f;
import net.minecraft.util.math.Matrix4f;
import net.minecraft.util.math.Quaternion;
public class EndCrystalRenderer {
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 RenderLayer CRYSTAL_BEAM_LAYER;
private static final RenderLayer END_CRYSTAL;
private static final ModelPart CORE;
private static final ModelPart FRAME;
private static final int AGE_CYCLE = 240;
private static final float SINE_45_DEGREES;
public static void render(int age, int maxAge, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumerProvider, int light) {
float k = (float) AGE_CYCLE / maxAge;
float rotation = (age * k + tickDelta) * 3.0F;
VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(END_CRYSTAL);
matrices.push();
matrices.scale(0.8F, 0.8F, 0.8F);
matrices.translate(0.0D, -0.5D, 0.0D);
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(rotation));
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));
FRAME.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV);
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(Vector3f.POSITIVE_Y.getDegreesQuaternion(rotation));
FRAME.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV);
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(Vector3f.POSITIVE_Y.getDegreesQuaternion(rotation));
CORE.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV);
matrices.pop();
}
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 dy = start.getY() - end.getY() + 1.0F;
float dz = start.getZ() - end.getZ() + 1.0F;
float f = MathHelper.sqrt(dx * dx + dz * dz);
float g = MathHelper.sqrt(dx * dx + dy * dy + dz * dz);
matrices.push();
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_X.getRadialQuaternion((float)(-Math.atan2((double)f, (double)dy)) - 1.5707964F));
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(CRYSTAL_BEAM_LAYER);
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 k = 0.0F;
float l = 0.75F;
float m = 0.0F;
MatrixStack.Entry entry = matrices.peek();
Matrix4f matrix4f = entry.getModel();
Matrix3f matrix3f = entry.getNormal();
for(int n = 1; n <= 8; ++n) {
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 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, 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 * 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;
l = p;
m = q;
}
matrices.pop();
}
static {
END_CRYSTAL = RenderLayer.getEntityCutoutNoCull(CRYSTAL_TEXTURE);
CRYSTAL_BEAM_LAYER = RenderLayer.getEntitySmoothCutout(CRYSTAL_BEAM_TEXTURE);
SINE_45_DEGREES = (float) Math.sin(0.7853981633974483D);
FRAME = new ModelPart(64, 32, 0, 0);
FRAME.addCuboid(-4.0F, -4.0F, -4.0F, 8.0F, 8.0F, 8.0F);
CORE = new ModelPart(64, 32, 32, 0);
CORE.addCuboid(-4.0F, -4.0F, -4.0F, 8.0F, 8.0F, 8.0F);
}
}
package ru.betterend.blocks.entities.render;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.OverlayTexture;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Matrix3f;
import net.minecraft.util.math.Matrix4f;
import net.minecraft.util.math.Quaternion;
public class EndCrystalRenderer {
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 RenderLayer CRYSTAL_BEAM_LAYER;
private static final RenderLayer END_CRYSTAL;
private static final ModelPart CORE;
private static final ModelPart FRAME;
private static final int AGE_CYCLE = 240;
private static final float SINE_45_DEGREES;
public static void render(int age, int maxAge, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumerProvider, int light) {
float k = (float) AGE_CYCLE / maxAge;
float rotation = (age * k + tickDelta) * 3.0F;
VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(END_CRYSTAL);
matrices.push();
matrices.scale(0.8F, 0.8F, 0.8F);
matrices.translate(0.0D, -0.5D, 0.0D);
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(rotation));
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));
FRAME.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV);
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(Vector3f.POSITIVE_Y.getDegreesQuaternion(rotation));
FRAME.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV);
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(Vector3f.POSITIVE_Y.getDegreesQuaternion(rotation));
CORE.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV);
matrices.pop();
}
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 dy = start.getY() - end.getY() + 1.0F;
float dz = start.getZ() - end.getZ() + 1.0F;
float f = MathHelper.sqrt(dx * dx + dz * dz);
float g = MathHelper.sqrt(dx * dx + dy * dy + dz * dz);
matrices.push();
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_X.getRadialQuaternion((float)(-Math.atan2((double)f, (double)dy)) - 1.5707964F));
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(CRYSTAL_BEAM_LAYER);
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 k = 0.0F;
float l = 0.75F;
float m = 0.0F;
MatrixStack.Entry entry = matrices.peek();
Matrix4f matrix4f = entry.getModel();
Matrix3f matrix3f = entry.getNormal();
for(int n = 1; n <= 8; ++n) {
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 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, 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 * 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;
l = p;
m = q;
}
matrices.pop();
}
static {
END_CRYSTAL = RenderLayer.getEntityCutoutNoCull(CRYSTAL_TEXTURE);
CRYSTAL_BEAM_LAYER = RenderLayer.getEntitySmoothCutout(CRYSTAL_BEAM_TEXTURE);
SINE_45_DEGREES = (float) Math.sin(0.7853981633974483D);
FRAME = new ModelPart(64, 32, 0, 0);
FRAME.addCuboid(-4.0F, -4.0F, -4.0F, 8.0F, 8.0F, 8.0F);
CORE = new ModelPart(64, 32, 32, 0);
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;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.BlockState;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.DyeColor;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
import ru.betterend.blocks.EternalPedestal;
import ru.betterend.blocks.basis.BlockPedestal;
import ru.betterend.blocks.entities.PedestalBlockEntity;
import ru.betterend.client.render.BeamRenderer;
import ru.betterend.registry.EndBlocks;
@Environment(EnvType.CLIENT)
public class PedestalItemRenderer extends BlockEntityRenderer<PedestalBlockEntity> {
private static final Identifier BEAM_TEXTURE = new Identifier("textures/entity/end_gateway_beam.png");
public PedestalItemRenderer(BlockEntityRenderDispatcher dispatcher) {
super(dispatcher);
}
@Override
public void render(PedestalBlockEntity blockEntity, float tickDelta, MatrixStack matrices,
VertexConsumerProvider vertexConsumers, int light, int overlay) {
if (blockEntity.isEmpty()) return;
BlockState state = blockEntity.getWorld().getBlockState(blockEntity.getPos());
ItemStack activeItem = blockEntity.getStack(0);
matrices.push();
MinecraftClient minecraft = MinecraftClient.getInstance();
BakedModel model = minecraft.getItemRenderer().getHeldItemModel(activeItem, blockEntity.getWorld(), null);
Vector3f translate = model.getTransformation().ground.translation;
BlockPedestal pedestal = (BlockPedestal) state.getBlock();
matrices.translate(translate.getX(), translate.getY(), translate.getZ());
matrices.translate(0.5, pedestal.getHeight(state), 0.5);
if (activeItem.getItem() instanceof BlockItem) {
matrices.scale(1.5F, 1.5F, 1.5F);
} else {
matrices.scale(1.25F, 1.25F, 1.25F);
}
float rotation = (blockEntity.getAge() + tickDelta) / 25.0F + 6.0F;
matrices.multiply(Vector3f.POSITIVE_Y.getRadialQuaternion(rotation));
if (state.isOf(EndBlocks.ETERNAL_PEDESTAL) && state.get(EternalPedestal.ACTIVATED)) {
float altitude = MathHelper.sin((blockEntity.getAge() + tickDelta) / 10.0F) * 0.1F + 0.1F;
matrices.translate(0.0D, altitude, 0.0D);
float[] colors = DyeColor.MAGENTA.getColorComponents();
int y = blockEntity.getPos().getY();
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getBeaconBeam(BEAM_TEXTURE, true));
BeamRenderer.renderLightBeam(matrices, vertexConsumer, tickDelta, -y, 1024 - y, colors, 0.25F, 0.15F, 0.2F);
}
if (activeItem.getItem() == Items.END_CRYSTAL) {
EndCrystalRenderer.render(blockEntity.getAge(), blockEntity.getMaxAge(), tickDelta, matrices, vertexConsumers, light);
} else {
minecraft.getItemRenderer().renderItem(activeItem, ModelTransformation.Mode.GROUND, false, matrices, vertexConsumers, light, overlay, model);
}
matrices.pop();
}
}
package ru.betterend.blocks.entities.render;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.BlockState;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.DyeColor;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
import ru.betterend.blocks.EternalPedestal;
import ru.betterend.blocks.basis.BlockPedestal;
import ru.betterend.blocks.entities.PedestalBlockEntity;
import ru.betterend.client.render.BeamRenderer;
import ru.betterend.registry.EndBlocks;
@Environment(EnvType.CLIENT)
public class PedestalItemRenderer extends BlockEntityRenderer<PedestalBlockEntity> {
private static final Identifier BEAM_TEXTURE = new Identifier("textures/entity/end_gateway_beam.png");
public PedestalItemRenderer(BlockEntityRenderDispatcher dispatcher) {
super(dispatcher);
}
@Override
public void render(PedestalBlockEntity blockEntity, float tickDelta, MatrixStack matrices,
VertexConsumerProvider vertexConsumers, int light, int overlay) {
if (blockEntity.isEmpty()) return;
BlockState state = blockEntity.getWorld().getBlockState(blockEntity.getPos());
ItemStack activeItem = blockEntity.getStack(0);
matrices.push();
MinecraftClient minecraft = MinecraftClient.getInstance();
BakedModel model = minecraft.getItemRenderer().getHeldItemModel(activeItem, blockEntity.getWorld(), null);
Vector3f translate = model.getTransformation().ground.translation;
BlockPedestal pedestal = (BlockPedestal) state.getBlock();
matrices.translate(translate.getX(), translate.getY(), translate.getZ());
matrices.translate(0.5, pedestal.getHeight(state), 0.5);
if (activeItem.getItem() instanceof BlockItem) {
matrices.scale(1.5F, 1.5F, 1.5F);
} else {
matrices.scale(1.25F, 1.25F, 1.25F);
}
float rotation = (blockEntity.getAge() + tickDelta) / 25.0F + 6.0F;
matrices.multiply(Vector3f.POSITIVE_Y.getRadialQuaternion(rotation));
if (state.isOf(EndBlocks.ETERNAL_PEDESTAL) && state.get(EternalPedestal.ACTIVATED)) {
float altitude = MathHelper.sin((blockEntity.getAge() + tickDelta) / 10.0F) * 0.1F + 0.1F;
matrices.translate(0.0D, altitude, 0.0D);
float[] colors = DyeColor.MAGENTA.getColorComponents();
int y = blockEntity.getPos().getY();
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getBeaconBeam(BEAM_TEXTURE, true));
BeamRenderer.renderLightBeam(matrices, vertexConsumer, tickDelta, -y, 1024 - y, colors, 0.25F, 0.15F, 0.2F);
}
if (activeItem.getItem() == Items.END_CRYSTAL) {
EndCrystalRenderer.render(blockEntity.getAge(), blockEntity.getMaxAge(), tickDelta, matrices, vertexConsumers, light);
} else {
minecraft.getItemRenderer().renderItem(activeItem, ModelTransformation.Mode.GROUND, false, matrices, vertexConsumers, light, overlay, model);
}
matrices.pop();
}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,62 +1,62 @@
package ru.betterend.client.render;
import net.minecraft.client.render.OverlayTexture;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Matrix3f;
import net.minecraft.util.math.Matrix4f;
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) {
int m = minY + maxY;
float o = maxY < 0 ? tick : -tick;
float p = MathHelper.fractionalPart(o * 0.2F - (float) MathHelper.floor(o * 0.1F));
float red = colors[0];
float green = colors[1];
float blue = colors[2];
matrixStack.push();
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(tick * 2.25F - 45.0F));
float af = 0.0F;
float ai = 0.0F;
float aj = -h;
float aa = -h;
float ap = -1.0F + p;
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);
matrixStack.pop();
af = -k;
float ag = -k;
ai = -k;
aj = -k;
ap = -1.0F + p;
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);
}
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();
Matrix4f matrix4f = entry.getModel();
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, 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, 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) {
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, n, o, p, s);
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) {
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();
}
}
package ru.betterend.client.render;
import net.minecraft.client.render.OverlayTexture;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Matrix3f;
import net.minecraft.util.math.Matrix4f;
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) {
int m = minY + maxY;
float o = maxY < 0 ? tick : -tick;
float p = MathHelper.fractionalPart(o * 0.2F - (float) MathHelper.floor(o * 0.1F));
float red = colors[0];
float green = colors[1];
float blue = colors[2];
matrixStack.push();
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(tick * 2.25F - 45.0F));
float af = 0.0F;
float ai = 0.0F;
float aj = -h;
float aa = -h;
float ap = -1.0F + p;
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);
matrixStack.pop();
af = -k;
float ag = -k;
ai = -k;
aj = -k;
ap = -1.0F + p;
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);
}
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();
Matrix4f matrix4f = entry.getModel();
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, 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, 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) {
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, n, o, p, s);
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) {
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;
public enum ERenderLayer {
CUTOUT,
TRANSLUCENT;
}
package ru.betterend.client.render;
public enum ERenderLayer {
CUTOUT,
TRANSLUCENT;
}

View file

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

View file

@ -1,84 +1,84 @@
package ru.betterend.compat;
import java.util.Collections;
import java.util.List;
import org.jetbrains.annotations.NotNull;
import com.google.common.collect.Lists;
import it.unimi.dsi.fastutil.ints.IntList;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.EntryStack;
import me.shedaniel.rei.api.TransferRecipeCategory;
import me.shedaniel.rei.api.widgets.Widgets;
import me.shedaniel.rei.gui.entries.RecipeEntry;
import me.shedaniel.rei.gui.entries.SimpleRecipeEntry;
import me.shedaniel.rei.gui.widget.Widget;
import net.minecraft.block.Blocks;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Identifier;
import ru.betterend.util.LangUtil;
public class REIAnvilCategory implements TransferRecipeCategory<REIAnvilDisplay> {
@Override
public @NotNull Identifier getIdentifier() {
return REIPlugin.SMITHING;
}
@Override
public @NotNull String getCategoryName() {
return LangUtil.translate(Blocks.ANVIL.getTranslationKey());
}
@Override
public @NotNull EntryStack getLogo() {
return REIPlugin.ANVIL;
}
@Override
public @NotNull List<Widget> setupDisplay(REIAnvilDisplay display, Rectangle bounds) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10);
List<Widget> widgets = Lists.newArrayList();
widgets.add(Widgets.createRecipeBase(bounds));
int x = startPoint.x + 10;
int y = startPoint.y;
widgets.add(Widgets.createResultSlotBackground(new Point(x + 61, y + 4)));
List<List<EntryStack>> inputEntries = display.getInputEntries();
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),
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 + 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());
return widgets;
}
@Override
public void renderRedSlots(MatrixStack matrices, List<Widget> widgets, Rectangle bounds, REIAnvilDisplay display,
IntList redSlots) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 27);
matrices.push();
matrices.translate(0, 0, 400);
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 + 1, startPoint.y + 3, startPoint.x + 1 + 16, startPoint.y + 3 + 16, 1090453504);
}
matrices.pop();
}
@Override
public @NotNull RecipeEntry getSimpleRenderer(REIAnvilDisplay recipe) {
return SimpleRecipeEntry.from(Collections.singletonList(recipe.getInputEntries().get(0)), recipe.getResultingEntries());
}
@Override
public int getDisplayHeight() {
return 49;
}
}
package ru.betterend.compat;
import java.util.Collections;
import java.util.List;
import org.jetbrains.annotations.NotNull;
import com.google.common.collect.Lists;
import it.unimi.dsi.fastutil.ints.IntList;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.EntryStack;
import me.shedaniel.rei.api.TransferRecipeCategory;
import me.shedaniel.rei.api.widgets.Widgets;
import me.shedaniel.rei.gui.entries.RecipeEntry;
import me.shedaniel.rei.gui.entries.SimpleRecipeEntry;
import me.shedaniel.rei.gui.widget.Widget;
import net.minecraft.block.Blocks;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Identifier;
import ru.betterend.util.LangUtil;
public class REIAnvilCategory implements TransferRecipeCategory<REIAnvilDisplay> {
@Override
public @NotNull Identifier getIdentifier() {
return REIPlugin.SMITHING;
}
@Override
public @NotNull String getCategoryName() {
return LangUtil.translate(Blocks.ANVIL.getTranslationKey());
}
@Override
public @NotNull EntryStack getLogo() {
return REIPlugin.ANVIL;
}
@Override
public @NotNull List<Widget> setupDisplay(REIAnvilDisplay display, Rectangle bounds) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10);
List<Widget> widgets = Lists.newArrayList();
widgets.add(Widgets.createRecipeBase(bounds));
int x = startPoint.x + 10;
int y = startPoint.y;
widgets.add(Widgets.createResultSlotBackground(new Point(x + 61, y + 4)));
List<List<EntryStack>> inputEntries = display.getInputEntries();
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),
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 + 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());
return widgets;
}
@Override
public void renderRedSlots(MatrixStack matrices, List<Widget> widgets, Rectangle bounds, REIAnvilDisplay display,
IntList redSlots) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 27);
matrices.push();
matrices.translate(0, 0, 400);
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 + 1, startPoint.y + 3, startPoint.x + 1 + 16, startPoint.y + 3 + 16, 1090453504);
}
matrices.pop();
}
@Override
public @NotNull RecipeEntry getSimpleRenderer(REIAnvilDisplay recipe) {
return SimpleRecipeEntry.from(Collections.singletonList(recipe.getInputEntries().get(0)), recipe.getResultingEntries());
}
@Override
public int getDisplayHeight() {
return 49;
}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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