9 Commits

Author SHA1 Message Date
Motschen
89bddc548a Decorative 420 - Update to 1.18.2, Fix Bugs 2022-04-10 15:19:48 +02:00
Motschen
59ca504771 Initial 1.18.1 port 2022-02-03 21:54:06 +01:00
Motschen
50e700e919 Merge pull request #11 from stop-x13/patch-1
Fix the recipe to make it work
2022-02-03 21:05:17 +01:00
stop-x13
aafdebd209 Fix the recipe to make it work 2021-09-03 15:24:07 +10:00
Motschen
370a802886 Decorative 4.1.1 - Bugfixes
Fixed #9
Fixed bath tires having wrong colors
Update MidnightLib
2021-06-09 19:48:32 +02:00
Motschen
57c92dbcba Decorative 4.1.0 - 1.17 and code cleanup
Update to 1.17-pre1 and Java 16
Use MidnightLib for configuration, makes the config gui cleaner and accessable without modmenu
2021-05-30 13:13:22 +02:00
Motschen
bfc6fc4d16 Decorative 4.0.0 - Clock Update 2021-02-04 15:06:50 +01:00
Motschen
bc27d95a6a Merge pull request #6 from Miros77/patch-2
Update ru_ru.json
2020-11-15 11:31:03 +01:00
Miroslav Bondarev
7b6057ef8c Update ru_ru.json 2020-10-12 17:10:17 +03:00
960 changed files with 3930 additions and 2027 deletions

3
.gitignore vendored Normal file → Executable file
View File

@@ -1,6 +1,7 @@
# gradle # gradle
.gradle/ .gradle/
build/
out/ out/
classes/ classes/
@@ -21,4 +22,4 @@ bin/
# fabric # fabric
run/ run/

0
LICENSE Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

72
build.gradle Normal file → Executable file
View File

@@ -1,10 +1,10 @@
plugins { plugins {
id 'fabric-loom' version '0.4-SNAPSHOT' id 'fabric-loom' version '0.10-SNAPSHOT'
id 'maven-publish' id 'maven-publish'
} }
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_17
archivesBaseName = project.archives_base_name archivesBaseName = project.archives_base_name
version = project.mod_version version = project.mod_version
@@ -16,55 +16,63 @@ minecraft {
repositories { repositories {
maven { url "https://jitpack.io" } maven { url "https://jitpack.io" }
maven { url "https://maven.blamejared.com" } maven { url "https://maven.blamejared.com" }
maven { url "https://maven.terraformersmc.com/releases" }
maven {
url = "https://api.modrinth.com/maven"
}
} }
dependencies { dependencies {
//to change the versions see the gradle.properties file //to change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}" minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modCompile "net.fabricmc:fabric-loader:${project.loader_version}" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
// Fabric API. This is technically optional, but you probably want it anyway. // Fabric API. This is technically optional, but you probably want it anyway.
modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modCompile("vazkii.patchouli:Patchouli:${project.patchouli_version}") modImplementation("vazkii.patchouli:Patchouli:${project.patchouli_version}"){
// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs. exclude module: "fabric-api"
// You may need to force-disable transitiveness on them. }
modImplementation "eu.midnightdust:midnight-hats:${midnighthats_version}" modImplementation ("com.terraformersmc:modmenu:${project.mod_menu_version}"){
include "eu.midnightdust:midnight-hats:${midnighthats_version}" exclude module: "fabric-api"
}
modImplementation "maven.modrinth:midnightlib:${midnightlib_version}"
include "maven.modrinth:midnightlib:${midnightlib_version}"
} }
processResources { processResources {
inputs.property "version", project.version inputs.property "version", project.version
from(sourceSets.main.resources.srcDirs) { filesMatching("fabric.mod.json") {
include "fabric.mod.json"
expand "version": project.version 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 tasks.withType(JavaCompile).configureEach {
// this fixes some edge cases with special characters not displaying correctly // ensure that the encoding is set to UTF-8, no matter what the system default is
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html // this fixes some edge cases with special characters not displaying correctly
tasks.withType(JavaCompile) { // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
options.encoding = "UTF-8" // If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"
// Minecraft 1.17 (21w19a) upwards uses Java 16.
it.options.release = 17
} }
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task java {
// if it is present. // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// If you remove this task, sources will not be generated. // if it is present.
task sourcesJar(type: Jar, dependsOn: classes) { // If you remove this line, sources will not be generated.
classifier = "sources" withSourcesJar()
from sourceSets.main.allSource
} }
jar { jar {
from "LICENSE" from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
} }
// configure the maven publication // configure the maven publication
@@ -81,9 +89,11 @@ publishing {
} }
} }
// select the repositories you want to publish to // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories { repositories {
// uncomment to publish to the local maven // Add repositories to publish to here.
// mavenLocal() // Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
} }
} }

17
gradle.properties Normal file → Executable file
View File

@@ -1,19 +1,20 @@
# Done to increase the memory available to gradle. # Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G org.gradle.jvmargs=-Xmx2G
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/use # check these on https://fabricmc.net/use
minecraft_version=1.16.2 minecraft_version=1.18.2
yarn_mappings=1.16.2+build.6 yarn_mappings=1.18.2+build.2
loader_version=0.9.1+build.205 loader_version=0.13.3
# Mod Properties # Mod Properties
mod_version = 3.0.0 mod_version = 4.2.0
maven_group = eu.midnightdust.motschen maven_group = eu.midnightdust.motschen
archives_base_name = decorative archives_base_name = decorative
# Dependencies # Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.17.2+build.396-1.16 fabric_version=0.48.0+1.18.2
patchouli_version=1.16-40-FABRIC mod_menu_version = 2.0.0-beta.7
midnighthats_version=1.0.2 midnightlib_version=0.4.0
patchouli_version=1.18.2-67-FABRIC

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file → Executable file

Binary file not shown.

2
gradle/wrapper/gradle-wrapper.properties vendored Normal file → Executable file
View File

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

270
gradlew vendored Normal file → Executable file
View File

@@ -1,7 +1,7 @@
#!/usr/bin/env sh #!/bin/sh
# #
# Copyright 2015 the original author or authors. # Copyright © 2015-2021 the original authors.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@@ -17,78 +17,113 @@
# #
############################################################################## ##############################################################################
## #
## Gradle start up script for UN*X # Gradle start up script for POSIX generated by Gradle.
## #
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
############################################################################## ##############################################################################
# Attempt to set APP_HOME # Attempt to set APP_HOME
# Resolve links: $0 may be a link # Resolve links: $0 may be a link
PRG="$0" app_path=$0
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do # Need this for daisy-chained symlinks.
ls=`ls -ld "$PRG"` while
link=`expr "$ls" : '.*-> \(.*\)$'` APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
if expr "$link" : '/.*' > /dev/null; then [ -h "$app_path" ]
PRG="$link" do
else ls=$( ls -ld "$app_path" )
PRG=`dirname "$PRG"`"/$link" link=${ls#*' -> '}
fi case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle" APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"` APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum" MAX_FD=maximum
warn () { warn () {
echo "$*" echo "$*"
} } >&2
die () { die () {
echo echo
echo "$*" echo "$*"
echo echo
exit 1 exit 1
} } >&2
# OS specific support (must be 'true' or 'false'). # OS specific support (must be 'true' or 'false').
cygwin=false cygwin=false
msys=false msys=false
darwin=false darwin=false
nonstop=false nonstop=false
case "`uname`" in case "$( uname )" in #(
CYGWIN* ) CYGWIN* ) cygwin=true ;; #(
cygwin=true Darwin* ) darwin=true ;; #(
;; MSYS* | MINGW* ) msys=true ;; #(
Darwin* ) NONSTOP* ) nonstop=true ;;
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM. # Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables # IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java" JAVACMD=$JAVA_HOME/jre/sh/java
else else
JAVACMD="$JAVA_HOME/bin/java" JAVACMD=$JAVA_HOME/bin/java
fi fi
if [ ! -x "$JAVACMD" ] ; then if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -97,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi fi
else else
JAVACMD="java" JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the Please set the JAVA_HOME variable in your environment to match the
@@ -105,84 +140,95 @@ location of your Java installation."
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
MAX_FD_LIMIT=`ulimit -H -n` case $MAX_FD in #(
if [ $? -eq 0 ] ; then max*)
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then MAX_FD=$( ulimit -H -n ) ||
MAX_FD="$MAX_FD_LIMIT" warn "Could not query maximum file descriptor limit"
fi esac
ulimit -n $MAX_FD case $MAX_FD in #(
if [ $? -ne 0 ] ; then '' | soft) :;; #(
warn "Could not set maximum file descriptor limit: $MAX_FD" *)
fi ulimit -n "$MAX_FD" ||
else warn "Could not set maximum file descriptor limit to $MAX_FD"
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac esac
fi fi
# Escape application args # Collect all arguments for the java command, stacking in reverse order:
save () { # * args from the command line
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done # * the main class name
echo " " # * -classpath
} # * -D...appname settings
APP_ARGS=$(save "$@") # * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# Collect all arguments for the java command, following the shell quoting and substitution rules # For Cygwin or MSYS, switch paths to Windows format before running java
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong JAVACMD=$( cygpath --unix "$JAVACMD" )
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")" # Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@" exec "$JAVACMD" "$@"

25
gradlew.bat vendored Normal file → Executable file
View File

@@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init if "%ERRORLEVEL%" == "0" goto execute
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -51,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=% set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init if exist "%JAVA_EXE%" goto execute
echo. echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -61,28 +64,14 @@ echo location of your Java installation.
goto fail 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 :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell

0
settings.gradle Normal file → Executable file
View File

View File

@@ -1,6 +1,11 @@
package eu.midnightdust.motschen.decorative; package eu.midnightdust.motschen.decorative;
import eu.midnightdust.motschen.decorative.block.render.*; import eu.midnightdust.motschen.decorative.block.render.*;
import eu.midnightdust.motschen.decorative.block.render.model.CeilingFanBladesModel;
import eu.midnightdust.motschen.decorative.block.render.model.WallClockHandsModel;
import eu.midnightdust.motschen.decorative.entity.client.model.BathTireModel;
import eu.midnightdust.motschen.decorative.entity.client.model.BeachBallModel;
import eu.midnightdust.motschen.decorative.entity.client.model.DuckBathTireModel;
import eu.midnightdust.motschen.decorative.entity.client.renderer.*; import eu.midnightdust.motschen.decorative.entity.client.renderer.*;
import eu.midnightdust.motschen.decorative.init.BathTires; import eu.midnightdust.motschen.decorative.init.BathTires;
import eu.midnightdust.motschen.decorative.init.BlockEntities; import eu.midnightdust.motschen.decorative.init.BlockEntities;
@@ -8,39 +13,47 @@ import eu.midnightdust.motschen.decorative.init.Pool;
import eu.midnightdust.motschen.decorative.init.Signs; import eu.midnightdust.motschen.decorative.init.Signs;
import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.rendereregistry.v1.BlockEntityRendererRegistry; import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry;
import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityRendererRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry; import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.client.color.block.BlockColorProvider; import net.minecraft.client.color.block.BlockColorProvider;
import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.RenderLayer;
import net.minecraft.util.DyeColor;
public class DecorativeClient implements ClientModInitializer { public class DecorativeClient implements ClientModInitializer {
@Override @Override
public void onInitializeClient() { public void onInitializeClient() {
EntityModelLayerRegistry.registerModelLayer(BathTireModel.BATH_TIRE_MODEL_LAYER, BathTireModel::getTexturedModelData);
EntityModelLayerRegistry.registerModelLayer(DuckBathTireModel.DUCK_BATH_TIRE_MODEL_LAYER, DuckBathTireModel::getTexturedModelData);
EntityModelLayerRegistry.registerModelLayer(BeachBallModel.BEACH_BALL_MODEL_LAYER, BeachBallModel::getTexturedModelData);
EntityRendererRegistry.INSTANCE.register(Pool.BEACH_BALL, (dispatcher, context) -> new BeachBallRenderer(dispatcher)); EntityModelLayerRegistry.registerModelLayer(CeilingFanBladesModel.CEILING_FAN_MODEL_LAYER, CeilingFanBladesModel::getTexturedModelData);
EntityModelLayerRegistry.registerModelLayer(WallClockHandsModel.CLOCK_HANDS_MODEL_LAYER, WallClockHandsModel::getTexturedModelData);
EntityRendererRegistry.INSTANCE.register(BathTires.WHITE_BATH_TIRE, (dispatcher, context) -> new WhiteBathTireRenderer(dispatcher)); EntityRendererRegistry.register(Pool.BEACH_BALL, BeachBallRenderer::new);
EntityRendererRegistry.INSTANCE.register(BathTires.ORANGE_BATH_TIRE, (dispatcher, context) -> new OrangeBathTireRenderer(dispatcher));
EntityRendererRegistry.INSTANCE.register(BathTires.MAGENTA_BATH_TIRE, (dispatcher, context) -> new MagentaBathTireRenderer(dispatcher));
EntityRendererRegistry.INSTANCE.register(BathTires.LIGHT_BLUE_BATH_TIRE, (dispatcher, context) -> new LightBlueBathTireRenderer(dispatcher));
EntityRendererRegistry.INSTANCE.register(BathTires.YELLOW_BATH_TIRE, (dispatcher, context) -> new YellowBathTireRenderer(dispatcher));
EntityRendererRegistry.INSTANCE.register(BathTires.LIME_BATH_TIRE, (dispatcher, context) -> new LimeBathTireRenderer(dispatcher));
EntityRendererRegistry.INSTANCE.register(BathTires.PINK_BATH_TIRE, (dispatcher, context) -> new PinkBathTireRenderer(dispatcher));
EntityRendererRegistry.INSTANCE.register(BathTires.GRAY_BATH_TIRE, (dispatcher, context) -> new GrayBathTireRenderer(dispatcher));
EntityRendererRegistry.INSTANCE.register(BathTires.LIGHT_GRAY_BATH_TIRE, (dispatcher, context) -> new LightGrayBathTireRenderer(dispatcher));
EntityRendererRegistry.INSTANCE.register(BathTires.CYAN_BATH_TIRE, (dispatcher, context) -> new CyanBathTireRenderer(dispatcher));
EntityRendererRegistry.INSTANCE.register(BathTires.PURPLE_BATH_TIRE, (dispatcher, context) -> new PurpleBathTireRenderer(dispatcher));
EntityRendererRegistry.INSTANCE.register(BathTires.BLUE_BATH_TIRE, (dispatcher, context) -> new BlueBathTireRenderer(dispatcher));
EntityRendererRegistry.INSTANCE.register(BathTires.BROWN_BATH_TIRE, (dispatcher, context) -> new BrownBathTireRenderer(dispatcher));
EntityRendererRegistry.INSTANCE.register(BathTires.GREEN_BATH_TIRE, (dispatcher, context) -> new GreenBathTireRenderer(dispatcher));
EntityRendererRegistry.INSTANCE.register(BathTires.RED_BATH_TIRE, (dispatcher, context) -> new RedBathTireRenderer(dispatcher));
EntityRendererRegistry.INSTANCE.register(BathTires.BLACK_BATH_TIRE, (dispatcher, context) -> new BlackBathTireRenderer(dispatcher));
EntityRendererRegistry.INSTANCE.register(BathTires.DUCK_BATH_TIRE, (dispatcher, context) -> new DuckBathTireRenderer(dispatcher)); EntityRendererRegistry.register(BathTires.WHITE_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.WHITE));
EntityRendererRegistry.register(BathTires.ORANGE_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.ORANGE));
EntityRendererRegistry.register(BathTires.MAGENTA_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.MAGENTA));
EntityRendererRegistry.register(BathTires.LIGHT_BLUE_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.LIGHT_BLUE));
EntityRendererRegistry.register(BathTires.YELLOW_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.YELLOW));
EntityRendererRegistry.register(BathTires.LIME_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.LIME));
EntityRendererRegistry.register(BathTires.PINK_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.PINK));
EntityRendererRegistry.register(BathTires.GRAY_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.GRAY));
EntityRendererRegistry.register(BathTires.LIGHT_GRAY_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.LIGHT_GRAY));
EntityRendererRegistry.register(BathTires.CYAN_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.CYAN));
EntityRendererRegistry.register(BathTires.PURPLE_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.PURPLE));
EntityRendererRegistry.register(BathTires.BLUE_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.BLUE));
EntityRendererRegistry.register(BathTires.BROWN_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.BROWN));
EntityRendererRegistry.register(BathTires.GREEN_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.GREEN));
EntityRendererRegistry.register(BathTires.RED_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.RED));
EntityRendererRegistry.register(BathTires.BLACK_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.BLACK));
EntityRendererRegistry.register(BathTires.DUCK_BATH_TIRE, DuckBathTireRenderer::new);
registerBlockColor(DecorativeMain.BirdBath, Blocks.WATER); registerBlockColor(DecorativeMain.BirdBath, Blocks.WATER);
@@ -64,17 +77,15 @@ public class DecorativeClient implements ClientModInitializer {
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(),DecorativeMain.ChristmasTree); BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(),DecorativeMain.ChristmasTree);
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(),DecorativeMain.CeilingFan); BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(),DecorativeMain.CeilingFan);
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(),DecorativeMain.SlidingDoor); BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(),DecorativeMain.SlidingDoor);
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(),DecorativeMain.WallClock);
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getTranslucent(),DecorativeMain.BirdBath); BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getTranslucent(),DecorativeMain.BirdBath);
BlockEntityRendererRegistry.INSTANCE.register(BlockEntities.CeilingFanBlockEntity, CeilingFanRenderer::new); BlockEntityRendererRegistry.register(BlockEntities.CeilingFanBlockEntity, CeilingFanRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(BlockEntities.OakChoppingLogBlockEntity, OakChoppingLogBlockEntityRenderer::new); BlockEntityRendererRegistry.register(BlockEntities.ChoppingLogBlockEntity, ChoppingLogBlockEntityRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(BlockEntities.SpruceChoppingLogBlockEntity, SpruceChoppingLogBlockEntityRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(BlockEntities.BirchChoppingLogBlockEntity, BirchChoppingLogBlockEntityRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(BlockEntities.AcaciaChoppingLogBlockEntity, AcaciaChoppingLogBlockEntityRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(BlockEntities.JungleChoppingLogBlockEntity, JungleChoppingLogBlockEntityRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(BlockEntities.DarkOakChoppingLogBlockEntity, DarkOakChoppingLogBlockEntityRenderer::new);
BlockEntityRendererRegistry.register(BlockEntities.WallClockBlockEntity, WallClockRenderer::new);
BlockEntityRendererRegistry.register(BlockEntities.DigitalClockBlockEntity, DigitalClockRenderer::new);
} }
public void registerBlockColor(Block block, Block templateBlock) { public void registerBlockColor(Block block, Block templateBlock) {
ColorProviderRegistry.BLOCK.register((type, pos, world, layer) -> { ColorProviderRegistry.BLOCK.register((type, pos, world, layer) -> {
@@ -82,5 +93,4 @@ public class DecorativeClient implements ClientModInitializer {
return provider == null ? -1 : provider.getColor(type, pos, world, layer); return provider == null ? -1 : provider.getColor(type, pos, world, layer);
}, block); }, block);
} }
} }

View File

@@ -1,12 +1,14 @@
package eu.midnightdust.motschen.decorative; package eu.midnightdust.motschen.decorative;
import eu.midnightdust.lib.config.MidnightConfig;
import eu.midnightdust.motschen.decorative.block.*; import eu.midnightdust.motschen.decorative.block.*;
import eu.midnightdust.motschen.decorative.blockstates.CeilingFanStage; import eu.midnightdust.motschen.decorative.blockstates.CeilingFanStage;
import eu.midnightdust.motschen.decorative.blockstates.Part; import eu.midnightdust.motschen.decorative.blockstates.Part;
import eu.midnightdust.motschen.decorative.blockstates.PoolShape; import eu.midnightdust.motschen.decorative.blockstates.PoolShape;
import eu.midnightdust.motschen.decorative.blockstates.Program; import eu.midnightdust.motschen.decorative.blockstates.Program;
import eu.midnightdust.motschen.decorative.config.DecorativeConfig;
import eu.midnightdust.motschen.decorative.init.*; import eu.midnightdust.motschen.decorative.init.*;
import eu.midnightdust.motschen.decorative.world.OreFeatureInjector; import eu.midnightdust.motschen.decorative.sound.DecorativeSoundEvents;
import eu.midnightdust.motschen.decorative.world.OreFeatures; import eu.midnightdust.motschen.decorative.world.OreFeatures;
import net.fabricmc.api.ModInitializer; import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder; import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
@@ -18,6 +20,7 @@ import net.minecraft.state.property.EnumProperty;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
public class DecorativeMain implements ModInitializer { public class DecorativeMain implements ModInitializer {
public static final String MOD_ID = "decorative"; public static final String MOD_ID = "decorative";
@@ -47,10 +50,15 @@ public class DecorativeMain implements ModInitializer {
public static Block ChristmasTree = new ChristmasTree(); public static Block ChristmasTree = new ChristmasTree();
public static Block ChristmasLights = new ChristmasLights(); public static Block ChristmasLights = new ChristmasLights();
public static Block ShowerHead = new ShowerHead(); public static Block ShowerHead = new ShowerHead();
public static Block WallClock = new WallClock();
public static Block StonePath = new StonePath();
@Override @Override
public void onInitialize() { public void onInitialize() {
MidnightConfig.init("decorative", DecorativeConfig.class);
BlockEntities.init(); BlockEntities.init();
// Traffic // // Traffic //
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"rocky_asphalt"), RockyAsphalt); Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"rocky_asphalt"), RockyAsphalt);
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"rocky_asphalt"), new BlockItem(RockyAsphalt, new Item.Settings().group(DecorativeMain.TrafficGroup))); Registry.register(Registry.ITEM, new Identifier(MOD_ID,"rocky_asphalt"), new BlockItem(RockyAsphalt, new Item.Settings().group(DecorativeMain.TrafficGroup)));
@@ -71,6 +79,8 @@ public class DecorativeMain implements ModInitializer {
Signs.init(); Signs.init();
//Garden// //Garden//
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"stone_path"), StonePath);
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"stone_path"), new BlockItem(StonePath, new Item.Settings().group(DecorativeMain.GardenGroup)));
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"bird_bath"), BirdBath); Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"bird_bath"), BirdBath);
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"bird_bath"), new BlockItem(BirdBath, new Item.Settings().group(DecorativeMain.GardenGroup))); Registry.register(Registry.ITEM, new Identifier(MOD_ID,"bird_bath"), new BlockItem(BirdBath, new Item.Settings().group(DecorativeMain.GardenGroup)));
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"water_pump"), WaterPump); Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"water_pump"), WaterPump);
@@ -81,6 +91,8 @@ public class DecorativeMain implements ModInitializer {
//Furniture// //Furniture//
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"kitchen_tiles"), KitchenTiles); Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"kitchen_tiles"), KitchenTiles);
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"kitchen_tiles"), new BlockItem(KitchenTiles, new Item.Settings().group(DecorativeMain.IndoorGroup))); Registry.register(Registry.ITEM, new Identifier(MOD_ID,"kitchen_tiles"), new BlockItem(KitchenTiles, new Item.Settings().group(DecorativeMain.IndoorGroup)));
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"wall_clock"), WallClock);
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"wall_clock"), new BlockItem(WallClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"television"), Television); Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"television"), Television);
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"television"), new BlockItem(Television, new Item.Settings().group(DecorativeMain.IndoorGroup))); Registry.register(Registry.ITEM, new Identifier(MOD_ID,"television"), new BlockItem(Television, new Item.Settings().group(DecorativeMain.IndoorGroup)));
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"old_television"), OldTelevision); Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"old_television"), OldTelevision);
@@ -98,7 +110,8 @@ public class DecorativeMain implements ModInitializer {
Lamps.init(); Lamps.init();
DoubleLamps.init(); DoubleLamps.init();
Clocks.init();
OreFeatures.init(); OreFeatures.init();
OreFeatureInjector.init(); new DecorativeSoundEvents();
} }
} }

View File

@@ -1,42 +0,0 @@
package eu.midnightdust.motschen.decorative.block;
import eu.midnightdust.motschen.decorative.block.blockentity.AcaciaChoppingLogBlockEntity;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.state.StateManager;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.WorldView;
public class AcaciaChoppingLog extends HorizontalFacingBlock implements BlockEntityProvider {
public AcaciaChoppingLog() {
super(FabricBlockSettings.copy(Blocks.OAK_PLANKS).nonOpaque().sounds(BlockSoundGroup.WOOD));
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH));
}
@Override
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
return super.getPlacementState(itemPlacementContext)
.with(FACING, itemPlacementContext.getPlayerFacing().getOpposite());
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(FACING);
}
public boolean canPlaceAt(BlockState state, WorldView worldView, BlockPos pos) {
return !worldView.isAir(pos.down());
}
@Override
public BlockEntity createBlockEntity(BlockView view) {
return new AcaciaChoppingLogBlockEntity();
}
}

View File

@@ -1,42 +0,0 @@
package eu.midnightdust.motschen.decorative.block;
import eu.midnightdust.motschen.decorative.block.blockentity.BirchChoppingLogBlockEntity;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.state.StateManager;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.WorldView;
public class BirchChoppingLog extends HorizontalFacingBlock implements BlockEntityProvider {
public BirchChoppingLog() {
super(FabricBlockSettings.copy(Blocks.OAK_PLANKS).nonOpaque().sounds(BlockSoundGroup.WOOD));
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH));
}
@Override
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
return super.getPlacementState(itemPlacementContext)
.with(FACING, itemPlacementContext.getPlayerFacing().getOpposite());
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(FACING);
}
public boolean canPlaceAt(BlockState state, WorldView worldView, BlockPos pos) {
return !worldView.isAir(pos.down());
}
@Override
public BlockEntity createBlockEntity(BlockView view) {
return new BirchChoppingLogBlockEntity();
}
}

View File

@@ -2,34 +2,109 @@ package eu.midnightdust.motschen.decorative.block;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.*; import net.minecraft.block.*;
import net.minecraft.block.cauldron.CauldronBehavior;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.potion.PotionUtil;
import net.minecraft.potion.Potions;
import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.state.StateManager; import net.minecraft.state.StateManager;
import net.minecraft.state.property.IntProperty;
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.BlockPos;
import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;
public class BirdBath extends CauldronBlock { import java.util.Objects;
public class BirdBath extends AbstractCauldronBlock {
private static final VoxelShape SHAPE; private static final VoxelShape SHAPE;
public static final IntProperty LEVEL = IntProperty.of("level",0,3);
public BirdBath() { public BirdBath() {
super(FabricBlockSettings.copy(Blocks.CAULDRON).nonOpaque().sounds(BlockSoundGroup.STONE)); super(FabricBlockSettings.copy(Blocks.WATER_CAULDRON).nonOpaque().sounds(BlockSoundGroup.STONE), CauldronBehavior.WATER_CAULDRON_BEHAVIOR);
}
@Override
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
ItemStack itemStack = player.getStackInHand(hand);
if (itemStack.getItem().equals(Items.WATER_BUCKET) || (itemStack.getItem().equals(Items.POTION) && PotionUtil.getPotion(itemStack).equals(Potions.WATER))) {
if (itemStack.getItem().equals(Items.WATER_BUCKET)) {
world.setBlockState(pos, state.with(LEVEL, 3));
if (!player.isCreative()) player.setStackInHand(hand, new ItemStack(Items.BUCKET));
return ActionResult.SUCCESS;
}
else if (!state.get(LEVEL).equals(3)) {
world.setBlockState(pos, state.with(LEVEL, state.get(LEVEL) + 1));
if (!player.isCreative()) player.setStackInHand(hand, new ItemStack(Items.GLASS_BOTTLE));
return ActionResult.SUCCESS;
}
}
if (itemStack.getItem().equals(Items.BUCKET) || (itemStack.getItem().equals(Items.GLASS_BOTTLE))) {
if (itemStack.getItem().equals(Items.BUCKET) && state.get(LEVEL).equals(3)) {
world.setBlockState(pos, state.with(LEVEL, 0));
if (!player.isCreative()) player.setStackInHand(hand, new ItemStack(Items.WATER_BUCKET));
return ActionResult.SUCCESS;
}
else if (!itemStack.getItem().equals(Items.BUCKET) && !state.get(LEVEL).equals(0)) {
world.setBlockState(pos, state.with(LEVEL, state.get(LEVEL) - 1));
if (!player.isCreative()) player.setStackInHand(hand, PotionUtil.setPotion(new ItemStack(Items.POTION), Potions.WATER));
return ActionResult.SUCCESS;
}
}
return ActionResult.FAIL;
}
@Override
public boolean isFull(BlockState state) {
return state.get(LEVEL) == 3;
}
@Override
protected boolean canBeFilledByDripstone(Fluid fluid) {
return fluid == Fluids.WATER;
}
@Override
protected double getFluidHeight(BlockState state) {
return (6.0D + (double)state.get(LEVEL) * 3.0D) / 16.0D;
}
@Override
public int getComparatorOutput(BlockState state, World world, BlockPos pos) {
return state.get(LEVEL);
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(LEVEL);
}
@Override
protected void fillFromDripstone(BlockState state, World world, BlockPos pos, Fluid fluid) {
if (!this.isFull(state)) {
world.setBlockState(pos, state.with(LEVEL, state.get(LEVEL) + 1));
world.syncWorldEvent(1047, pos, 0);
}
} }
@Override @Override
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) { public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
return super.getPlacementState(itemPlacementContext) return Objects.requireNonNull(super.getPlacementState(itemPlacementContext))
.with(LEVEL, 0); .with(LEVEL, 0);
} }
@Override @Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) { public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {
return SHAPE; return SHAPE;
} }
static { static {
VoxelShape shape = createCuboidShape(4, 0, 4, 12, 9, 12); SHAPE = createCuboidShape(4, 0, 4, 12, 9, 12);
SHAPE = shape;
} }
public boolean canPlaceAt(BlockState state, WorldView worldView, BlockPos pos) { public boolean canPlaceAt(BlockState state, WorldView worldView, BlockPos pos) {

View File

@@ -3,9 +3,13 @@ package eu.midnightdust.motschen.decorative.block;
import eu.midnightdust.motschen.decorative.blockstates.CeilingFanStage; import eu.midnightdust.motschen.decorative.blockstates.CeilingFanStage;
import eu.midnightdust.motschen.decorative.DecorativeMain; import eu.midnightdust.motschen.decorative.DecorativeMain;
import eu.midnightdust.motschen.decorative.block.blockentity.CeilingFanBlockEntity; import eu.midnightdust.motschen.decorative.block.blockentity.CeilingFanBlockEntity;
import eu.midnightdust.motschen.decorative.init.BlockEntities;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.*; import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityTicker;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.block.entity.BrewingStandBlockEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.BlockSoundGroup;
@@ -21,8 +25,9 @@ import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;
import org.jetbrains.annotations.Nullable;
public class CeilingFan extends Block implements BlockEntityProvider { public class CeilingFan extends BlockWithEntity implements BlockEntityProvider {
private static final VoxelShape SHAPE; private static final VoxelShape SHAPE;
private static final EnumProperty<CeilingFanStage> STAGE = DecorativeMain.STAGE; private static final EnumProperty<CeilingFanStage> STAGE = DecorativeMain.STAGE;
@@ -32,8 +37,17 @@ public class CeilingFan extends Block implements BlockEntityProvider {
} }
@Override @Override
public BlockEntity createBlockEntity(BlockView view) { public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
return new CeilingFanBlockEntity(); return new CeilingFanBlockEntity(pos, state);
}
@Nullable
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) {
return checkType(type, BlockEntities.CeilingFanBlockEntity, CeilingFanBlockEntity::tick);
}
@Override
public BlockRenderType getRenderType(BlockState state) {
return BlockRenderType.MODEL;
} }
@Override @Override

View File

@@ -0,0 +1,59 @@
package eu.midnightdust.motschen.decorative.block;
import eu.midnightdust.motschen.decorative.block.blockentity.ChoppingLogBlockEntity;
import eu.midnightdust.motschen.decorative.init.BlockEntities;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityTicker;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import net.minecraft.world.WorldView;
import org.jetbrains.annotations.Nullable;
import java.util.Objects;
public class ChoppingLog extends BlockWithEntity implements BlockEntityProvider {
private static final DirectionProperty FACING = HorizontalFacingBlock.FACING;
public ChoppingLog() {
super(FabricBlockSettings.copy(Blocks.OAK_PLANKS).nonOpaque().sounds(BlockSoundGroup.WOOD));
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH));
}
@Override
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
return Objects.requireNonNull(super.getPlacementState(itemPlacementContext))
.with(FACING, itemPlacementContext.getPlayerFacing().getOpposite());
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(FACING);
}
public boolean canPlaceAt(BlockState state, WorldView worldView, BlockPos pos) {
return !worldView.isAir(pos.down());
}
@Override
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
return new ChoppingLogBlockEntity(pos, state);
}
@Nullable
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) {
return checkType(type, BlockEntities.ChoppingLogBlockEntity, ChoppingLogBlockEntity::tick);
}
@Override
public BlockRenderType getRenderType(BlockState state) {
return BlockRenderType.MODEL;
}
}

View File

@@ -1,42 +0,0 @@
package eu.midnightdust.motschen.decorative.block;
import eu.midnightdust.motschen.decorative.block.blockentity.DarkOakChoppingLogBlockEntity;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.state.StateManager;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.WorldView;
public class DarkOakChoppingLog extends HorizontalFacingBlock implements BlockEntityProvider {
public DarkOakChoppingLog() {
super(FabricBlockSettings.copy(Blocks.OAK_PLANKS).nonOpaque().sounds(BlockSoundGroup.WOOD));
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH));
}
@Override
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
return super.getPlacementState(itemPlacementContext)
.with(FACING, itemPlacementContext.getPlayerFacing().getOpposite());
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(FACING);
}
public boolean canPlaceAt(BlockState state, WorldView worldView, BlockPos pos) {
return !worldView.isAir(pos.down());
}
@Override
public BlockEntity createBlockEntity(BlockView view) {
return new DarkOakChoppingLogBlockEntity();
}
}

View File

@@ -0,0 +1,89 @@
package eu.midnightdust.motschen.decorative.block;
import eu.midnightdust.motschen.decorative.block.blockentity.DigitalClockBlockEntity;
import eu.midnightdust.motschen.decorative.init.BlockEntities;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityTicker;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
public class DigitalClock extends BlockWithEntity implements BlockEntityProvider {
private static final DirectionProperty FACING = HorizontalFacingBlock.FACING;
private static final VoxelShape NORTH_SHAPE;
private static final VoxelShape EAST_SHAPE;
private static final VoxelShape SOUTH_SHAPE;
private static final VoxelShape WEST_SHAPE;
public DigitalClock() {
super(FabricBlockSettings.copy(Blocks.SMOOTH_QUARTZ).nonOpaque().sounds(BlockSoundGroup.STONE));
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH));
}
@Override
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
return new DigitalClockBlockEntity(pos, state);
}
@Nullable
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) {
return checkType(type, BlockEntities.DigitalClockBlockEntity, DigitalClockBlockEntity::tick);
}
@Override
public BlockRenderType getRenderType(BlockState state) {
return BlockRenderType.MODEL;
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(FACING);
}
@Override
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
return super.getPlacementState(itemPlacementContext)
.with(FACING, itemPlacementContext.getPlayerFacing().getOpposite());
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {
switch (state.get(FACING)) {
case NORTH: return NORTH_SHAPE;
case EAST: return EAST_SHAPE;
case SOUTH: return SOUTH_SHAPE;
case WEST: return WEST_SHAPE;
default: return super.getOutlineShape(state, view, pos, context);
}
}
static {
VoxelShape shape = createCuboidShape(1, 0, 5, 15, 8, 13);
NORTH_SHAPE = shape;
WEST_SHAPE = rotate(Direction.EAST, Direction.NORTH, shape);
EAST_SHAPE = rotate(Direction.EAST, Direction.SOUTH, shape);
SOUTH_SHAPE = rotate(Direction.EAST, Direction.WEST, shape);
}
private static VoxelShape rotate(Direction from, Direction to, VoxelShape shape) {
VoxelShape[] buffer = new VoxelShape[]{ shape, VoxelShapes.empty() };
int times = (to.getHorizontal() - from.getHorizontal() + 4) % 4;
for (int i = 0; i < times; i++) {
buffer[0].forEachBox((minX, minY, minZ, maxX, maxY, maxZ) -> buffer[1] = VoxelShapes.union(buffer[1], VoxelShapes.cuboid(1-maxZ, minY, minX, 1-minZ, maxY, maxX)));
buffer[0] = buffer[1];
buffer[1] = VoxelShapes.empty();
}
return buffer[0];
}
}

View File

@@ -5,6 +5,7 @@ import net.minecraft.block.*;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsage;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundCategory;
@@ -36,14 +37,7 @@ public class FireHydrant extends HorizontalFacingBlock {
if (!itemStack.isEmpty() && hand==Hand.MAIN_HAND) { if (!itemStack.isEmpty() && hand==Hand.MAIN_HAND) {
if (itemStack.getItem() == Items.BUCKET) { if (itemStack.getItem() == Items.BUCKET) {
if (!world.isClient) { if (!world.isClient) {
if (!player.abilities.creativeMode) { ItemUsage.exchangeStack(itemStack, player, new ItemStack(Items.BUCKET));
itemStack.decrement(1);
if (itemStack.isEmpty()) {
player.setStackInHand(hand, new ItemStack(Items.WATER_BUCKET));
} else if (!player.inventory.insertStack(new ItemStack(Items.WATER_BUCKET))) {
player.dropItem(new ItemStack(Items.WATER_BUCKET), false);
}
}
world.playSound(null, pos, SoundEvents.ITEM_BUCKET_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F); world.playSound(null, pos, SoundEvents.ITEM_BUCKET_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F);
} }
return ActionResult.SUCCESS; return ActionResult.SUCCESS;

View File

View File

@@ -1,42 +0,0 @@
package eu.midnightdust.motschen.decorative.block;
import eu.midnightdust.motschen.decorative.block.blockentity.JungleChoppingLogBlockEntity;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.state.StateManager;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.WorldView;
public class JungleChoppingLog extends HorizontalFacingBlock implements BlockEntityProvider {
public JungleChoppingLog() {
super(FabricBlockSettings.copy(Blocks.OAK_PLANKS).nonOpaque().sounds(BlockSoundGroup.WOOD));
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH));
}
@Override
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
return super.getPlacementState(itemPlacementContext)
.with(FACING, itemPlacementContext.getPlayerFacing().getOpposite());
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(FACING);
}
public boolean canPlaceAt(BlockState state, WorldView worldView, BlockPos pos) {
return !worldView.isAir(pos.down());
}
@Override
public BlockEntity createBlockEntity(BlockView view) {
return new JungleChoppingLogBlockEntity();
}
}

View File

View File

@@ -1,42 +0,0 @@
package eu.midnightdust.motschen.decorative.block;
import eu.midnightdust.motschen.decorative.block.blockentity.OakChoppingLogBlockEntity;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.state.StateManager;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.WorldView;
public class OakChoppingLog extends HorizontalFacingBlock implements BlockEntityProvider {
public OakChoppingLog() {
super(FabricBlockSettings.copy(Blocks.OAK_PLANKS).nonOpaque().sounds(BlockSoundGroup.WOOD));
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH));
}
@Override
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
return super.getPlacementState(itemPlacementContext)
.with(FACING, itemPlacementContext.getPlayerFacing().getOpposite());
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(FACING);
}
public boolean canPlaceAt(BlockState state, WorldView worldView, BlockPos pos) {
return !worldView.isAir(pos.down());
}
@Override
public BlockEntity createBlockEntity(BlockView view) {
return new OakChoppingLogBlockEntity();
}
}

View File

@@ -33,7 +33,7 @@ public class OldTelevision extends HorizontalFacingBlock {
private static final EnumProperty<Program> PROGRAM = DecorativeMain.PROGRAM; private static final EnumProperty<Program> PROGRAM = DecorativeMain.PROGRAM;
public OldTelevision() { public OldTelevision() {
super(FabricBlockSettings.copy(Blocks.BLACK_CONCRETE).nonOpaque().sounds(BlockSoundGroup.STONE).lightLevel(createLightLevelFromBlockState(15))); super(FabricBlockSettings.copy(Blocks.BLACK_CONCRETE).nonOpaque().sounds(BlockSoundGroup.STONE).luminance(createLightLevelFromBlockState()));
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH).with(PROGRAM, Program.OFF)); this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH).with(PROGRAM, Program.OFF));
} }
@@ -45,10 +45,10 @@ public class OldTelevision extends HorizontalFacingBlock {
case NYANCAT: world.setBlockState(pos, state.with(PROGRAM, Program.CREEPER)); case NYANCAT: world.setBlockState(pos, state.with(PROGRAM, Program.CREEPER));
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 1.5f); world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 1.5f);
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
case CREEPER: world.setBlockState(pos, state.with(PROGRAM, Program.WOODYS)); case CREEPER: world.setBlockState(pos, state.with(PROGRAM, Program.CRABRAVE));
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 1.5f); world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 1.5f);
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
case WOODYS: world.setBlockState(pos, state.with(PROGRAM, Program.TATER)); case CRABRAVE: world.setBlockState(pos, state.with(PROGRAM, Program.TATER));
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 1.5f); world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 1.5f);
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
case TATER: world.setBlockState(pos, state.with(PROGRAM, Program.OFF)); case TATER: world.setBlockState(pos, state.with(PROGRAM, Program.OFF));
@@ -104,7 +104,7 @@ public class OldTelevision extends HorizontalFacingBlock {
return !worldView.isAir(pos.down()); return !worldView.isAir(pos.down());
} }
private static ToIntFunction<BlockState> createLightLevelFromBlockState(int litLevel) { private static ToIntFunction<BlockState> createLightLevelFromBlockState() {
return (blockState) -> { return (blockState) -> {
if (blockState.get(PROGRAM) == Program.OFF) { if (blockState.get(PROGRAM) == Program.OFF) {
return 0; return 0;

View File

@@ -1,9 +1,12 @@
package eu.midnightdust.motschen.decorative.block; package eu.midnightdust.motschen.decorative.block;
import eu.midnightdust.motschen.decorative.block.blockentity.PoolSprinklerBlockEntity; import eu.midnightdust.motschen.decorative.block.blockentity.PoolSprinklerBlockEntity;
import eu.midnightdust.motschen.decorative.init.BlockEntities;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.*; import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityTicker;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.BlockSoundGroup;
@@ -11,6 +14,7 @@ import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents; import net.minecraft.sound.SoundEvents;
import net.minecraft.state.StateManager; import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.BlockHitResult;
@@ -21,14 +25,18 @@ import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;
import org.jetbrains.annotations.Nullable;
public class PoolSprinkler extends HorizontalFacingBlock implements BlockEntityProvider { import java.util.Objects;
public class PoolSprinkler extends BlockWithEntity implements BlockEntityProvider {
public static final DirectionProperty FACING = HorizontalFacingBlock.FACING;
public static final BooleanProperty POWERED = DoorBlock.POWERED;
private static final VoxelShape NORTH_SHAPE; private static final VoxelShape NORTH_SHAPE;
private static final VoxelShape EAST_SHAPE; private static final VoxelShape EAST_SHAPE;
private static final VoxelShape SOUTH_SHAPE; private static final VoxelShape SOUTH_SHAPE;
private static final VoxelShape WEST_SHAPE; private static final VoxelShape WEST_SHAPE;
public static final BooleanProperty POWERED = DoorBlock.POWERED;
public PoolSprinkler() { public PoolSprinkler() {
super(FabricBlockSettings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE)); super(FabricBlockSettings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE));
@@ -36,14 +44,14 @@ public class PoolSprinkler extends HorizontalFacingBlock implements BlockEntityP
} }
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
world.setBlockState(pos, state.with(POWERED, Boolean.valueOf(!state.get(POWERED)))); world.setBlockState(pos, state.with(POWERED, !state.get(POWERED)));
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 0.5f); world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 0.5f);
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
} }
@Override @Override
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) { public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
return super.getPlacementState(itemPlacementContext) return Objects.requireNonNull(super.getPlacementState(itemPlacementContext))
.with(FACING, itemPlacementContext.getPlayerFacing().getOpposite()) .with(FACING, itemPlacementContext.getPlayerFacing().getOpposite())
.with(POWERED, Boolean.FALSE); .with(POWERED, Boolean.FALSE);
} }
@@ -89,8 +97,17 @@ public class PoolSprinkler extends HorizontalFacingBlock implements BlockEntityP
return !worldView.isAir(pos.down()); return !worldView.isAir(pos.down());
} }
@Override @Override
public BlockEntity createBlockEntity(BlockView world) { public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
return new PoolSprinklerBlockEntity(); return new PoolSprinklerBlockEntity(pos, state);
}
@Nullable
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) {
return checkType(type, BlockEntities.PoolSprinklerBlockEntity, PoolSprinklerBlockEntity::tick);
}
@Override
public BlockRenderType getRenderType(BlockState state) {
return BlockRenderType.MODEL;
} }
} }

View File

View File

@@ -1,9 +1,12 @@
package eu.midnightdust.motschen.decorative.block; package eu.midnightdust.motschen.decorative.block;
import eu.midnightdust.motschen.decorative.block.blockentity.ShowerHeadBlockEntity; import eu.midnightdust.motschen.decorative.block.blockentity.ShowerHeadBlockEntity;
import eu.midnightdust.motschen.decorative.init.BlockEntities;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.*; import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityTicker;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.BlockSoundGroup;
@@ -11,6 +14,7 @@ import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents; import net.minecraft.sound.SoundEvents;
import net.minecraft.state.StateManager; import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.BlockHitResult;
@@ -21,14 +25,16 @@ import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;
import org.jetbrains.annotations.Nullable;
public class ShowerHead extends HorizontalFacingBlock implements BlockEntityProvider { public class ShowerHead extends BlockWithEntity implements BlockEntityProvider {
private static final DirectionProperty FACING = HorizontalFacingBlock.FACING;
public static final BooleanProperty POWERED = DoorBlock.POWERED;
private static final VoxelShape NORTH_SHAPE; private static final VoxelShape NORTH_SHAPE;
private static final VoxelShape EAST_SHAPE; private static final VoxelShape EAST_SHAPE;
private static final VoxelShape SOUTH_SHAPE; private static final VoxelShape SOUTH_SHAPE;
private static final VoxelShape WEST_SHAPE; private static final VoxelShape WEST_SHAPE;
public static final BooleanProperty POWERED = DoorBlock.POWERED;
public ShowerHead() { public ShowerHead() {
super(FabricBlockSettings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE)); super(FabricBlockSettings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE));
@@ -36,7 +42,7 @@ public class ShowerHead extends HorizontalFacingBlock implements BlockEntityProv
} }
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
world.setBlockState(pos, state.with(POWERED, Boolean.valueOf(!state.get(POWERED)))); world.setBlockState(pos, state.with(POWERED, !state.get(POWERED)));
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 0.5f); world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 0.5f);
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
} }
@@ -91,8 +97,17 @@ public class ShowerHead extends HorizontalFacingBlock implements BlockEntityProv
return !worldView.isAir(pos.north()) | !worldView.isAir(pos.east()) | !worldView.isAir(pos.south()) | !worldView.isAir(pos.west()); return !worldView.isAir(pos.north()) | !worldView.isAir(pos.east()) | !worldView.isAir(pos.south()) | !worldView.isAir(pos.west());
} }
@Override @Override
public BlockEntity createBlockEntity(BlockView world) { public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
return new ShowerHeadBlockEntity(); return new ShowerHeadBlockEntity(pos, state);
}
@Nullable
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) {
return checkType(type, BlockEntities.ShowerHeadBlockEntity, ShowerHeadBlockEntity::tick);
}
@Override
public BlockRenderType getRenderType(BlockState state) {
return BlockRenderType.MODEL;
} }
} }

View File

@@ -35,13 +35,13 @@ public class Sign extends HorizontalFacingBlock {
} }
@Override @Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) { public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {
switch (state.get(FACING)) { return switch (state.get(FACING)) {
case NORTH: return NORTH_SHAPE; case NORTH -> NORTH_SHAPE;
case EAST: return EAST_SHAPE; case EAST -> EAST_SHAPE;
case SOUTH: return SOUTH_SHAPE; case SOUTH -> SOUTH_SHAPE;
case WEST: return WEST_SHAPE; case WEST -> WEST_SHAPE;
default: return super.getOutlineShape(state, view, pos, context); default -> super.getOutlineShape(state, view, pos, context);
} };
} }
static { static {
VoxelShape shape = createCuboidShape(0, 0, 6.9, 16, 16, 9); VoxelShape shape = createCuboidShape(0, 0, 6.9, 16, 16, 9);

View File

@@ -23,9 +23,7 @@ public class SignPost extends Block {
return SHAPE; return SHAPE;
} }
static { static {
VoxelShape shape = createCuboidShape(7, 0, 7, 9, 16, 9); SHAPE = createCuboidShape(7, 0, 7, 9, 16, 9);
SHAPE = shape;
} }
public boolean canPlaceAt(BlockState state, WorldView worldView, BlockPos pos) { public boolean canPlaceAt(BlockState state, WorldView worldView, BlockPos pos) {

View File

@@ -43,16 +43,12 @@ public class SlidingDoor extends DoorBlock {
state.get(FACING); state.get(FACING);
boolean bl = !state.get(OPEN); boolean bl = !state.get(OPEN);
boolean bl2 = state.get(HINGE) == DoorHinge.RIGHT; boolean bl2 = state.get(HINGE) == DoorHinge.RIGHT;
switch(state.get(FACING)) { return switch (state.get(FACING)) {
default: default -> bl ? WEST_SHAPE : (bl2 ? EAST_SHAPE_OPEN : WEST_SHAPE_OPEN);
return bl ? WEST_SHAPE : (bl2 ? EAST_SHAPE_OPEN : WEST_SHAPE_OPEN); case NORTH -> bl ? NORTH_SHAPE : (bl2 ? SOUTH_SHAPE_OPEN : NORTH_SHAPE_OPEN);
case NORTH: case EAST -> bl ? EAST_SHAPE : (bl2 ? WEST_SHAPE_OPEN : EAST_SHAPE_OPEN);
return bl ? NORTH_SHAPE : (bl2 ? SOUTH_SHAPE_OPEN : NORTH_SHAPE_OPEN); case SOUTH -> bl ? SOUTH_SHAPE : (bl2 ? NORTH_SHAPE_OPEN : SOUTH_SHAPE_OPEN);
case EAST: };
return bl ? EAST_SHAPE : (bl2 ? WEST_SHAPE_OPEN : EAST_SHAPE_OPEN);
case SOUTH:
return bl ? SOUTH_SHAPE : (bl2 ? NORTH_SHAPE_OPEN : SOUTH_SHAPE_OPEN);
}
} }
static { static {
VoxelShape shape = createCuboidShape(0, 0, 7, 16, 16, 9); VoxelShape shape = createCuboidShape(0, 0, 7, 16, 16, 9);

View File

@@ -24,6 +24,8 @@ import net.minecraft.world.BlockView;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;
import java.util.Objects;
public class Springboard extends HorizontalFacingBlock { public class Springboard extends HorizontalFacingBlock {
private static final VoxelShape NORTH_SHAPE_FRONT; private static final VoxelShape NORTH_SHAPE_FRONT;
private static final VoxelShape EAST_SHAPE_FRONT; private static final VoxelShape EAST_SHAPE_FRONT;
@@ -43,68 +45,56 @@ public class Springboard extends HorizontalFacingBlock {
ItemStack itemStack = player.getStackInHand(hand); ItemStack itemStack = player.getStackInHand(hand);
if (!world.isClient) { if (!world.isClient) {
if (itemStack.isEmpty() && hand==Hand.MAIN_HAND) { if (itemStack.isEmpty() && hand==Hand.MAIN_HAND) {
switch (state.get(PART)) { if (state.get(PART) == Part.FRONT) {
case FRONT: if (player.getY() >= pos.getY() + 0.1 && player.squaredDistanceTo(pos.getX(), pos.getY(), pos.getZ()) <= 1.0) {
if (player.getY() >= pos.getY()+0.1 && player.squaredDistanceTo(pos.getX(), pos.getY(), pos.getZ()) <= 1.0) { player.addStatusEffect(new StatusEffectInstance(StatusEffects.LEVITATION, 10, 10));
player.addStatusEffect(new StatusEffectInstance(StatusEffects.LEVITATION, 10, 10)); return ActionResult.SUCCESS;
return ActionResult.SUCCESS; }
}
else return ActionResult.FAIL;
default:
return ActionResult.FAIL;
} }
} }
else return ActionResult.FAIL;
} }
else return ActionResult.FAIL; return ActionResult.FAIL;
} }
@Override @Override
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) { public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
return super.getPlacementState(itemPlacementContext) return Objects.requireNonNull(super.getPlacementState(itemPlacementContext))
.with(FACING, itemPlacementContext.getPlayerFacing()) .with(FACING, itemPlacementContext.getPlayerFacing())
.with(PART, Part.BACK); .with(PART, Part.BACK);
} }
@Override @Override
public void onPlaced(World arg, BlockPos pos, BlockState state, LivingEntity arg4, ItemStack arg5) { public void onPlaced(World arg, BlockPos pos, BlockState state, LivingEntity arg4, ItemStack arg5) {
switch (state.get(PART)) { if (state.get(PART) == Part.BACK) {
case BACK: switch (state.get(FACING)) { switch (state.get(FACING)) {
case NORTH: case NORTH:
if (!arg.getBlockState(pos.north()).isAir()) { if (!arg.getBlockState(pos.north()).isAir()) {
arg.breakBlock(pos, true); arg.breakBlock(pos, true);
} else {
arg.setBlockState(pos.north(), state.with(PART, Part.FRONT).with(FACING, Direction.NORTH));
} }
else { break;
arg.setBlockState(pos.north(), state.with(PART, Part.FRONT).with(FACING, Direction.NORTH));
}
return;
case EAST: case EAST:
if (!arg.getBlockState(pos.east()).isAir()) { if (!arg.getBlockState(pos.east()).isAir()) {
arg.breakBlock(pos, true); arg.breakBlock(pos, true);
} else {
arg.setBlockState(pos.east(), state.with(PART, Part.FRONT).with(FACING, Direction.EAST));
} }
else { break;
arg.setBlockState(pos.east(), state.with(PART, Part.FRONT).with(FACING, Direction.EAST));
}
return;
case SOUTH: case SOUTH:
if (!arg.getBlockState(pos.south()).isAir()) { if (!arg.getBlockState(pos.south()).isAir()) {
arg.breakBlock(pos, true); arg.breakBlock(pos, true);
} else {
arg.setBlockState(pos.south(), state.with(PART, Part.FRONT).with(FACING, Direction.SOUTH));
} }
else { break;
arg.setBlockState(pos.south(), state.with(PART, Part.FRONT).with(FACING, Direction.SOUTH));
}
return;
case WEST: case WEST:
if (!arg.getBlockState(pos.west()).isAir()) { if (!arg.getBlockState(pos.west()).isAir()) {
arg.breakBlock(pos, true); arg.breakBlock(pos, true);
} else {
arg.setBlockState(pos.west(), state.with(PART, Part.FRONT).with(FACING, Direction.WEST));
} }
else { break;
arg.setBlockState(pos.west(), state.with(PART, Part.FRONT).with(FACING, Direction.WEST));
}
return;
default:
return;
} }
default: return;
} }
} }
@Override @Override
@@ -112,38 +102,48 @@ public class Springboard extends HorizontalFacingBlock {
switch (state.get(PART)) { switch (state.get(PART)) {
case BACK: switch (state.get(FACING)) { case BACK: switch (state.get(FACING)) {
case NORTH: case NORTH:
if (world.getBlockState(pos.north()).contains(PART)) { world.breakBlock(pos.north(), true);} if (world.getBlockState(pos.north()).contains(PART)) {
return; world.breakBlock(pos.north(), true);
break;
}
case EAST: case EAST:
if (world.getBlockState(pos.east()).contains(PART)) { world.breakBlock(pos.east(), true);} if (world.getBlockState(pos.east()).contains(PART)) {
return; world.breakBlock(pos.east(), true);
break;
}
case SOUTH: case SOUTH:
if (world.getBlockState(pos.south()).contains(PART)) { world.breakBlock(pos.south(), true);} if (world.getBlockState(pos.south()).contains(PART)) {
world.breakBlock(pos.south(), true);
return; break;
}
case WEST: case WEST:
if (world.getBlockState(pos.west()).contains(PART)) { world.breakBlock(pos.west(), true);} if (world.getBlockState(pos.west()).contains(PART)) {
return; world.breakBlock(pos.west(), true);
default: break;
return; }
} }
case FRONT: switch (state.get(FACING)) { case FRONT: switch (state.get(FACING)) {
case NORTH: case NORTH:
if (world.getBlockState(pos.south()).contains(PART)) { world.breakBlock(pos.south(), true); } if (world.getBlockState(pos.south()).contains(PART)) {
return; world.breakBlock(pos.south(), true);
break;
}
case EAST: case EAST:
if (world.getBlockState(pos.west()).contains(PART)) { world.breakBlock(pos.south(), true); } if (world.getBlockState(pos.west()).contains(PART)) {
return; world.breakBlock(pos.west(), true);
break;
}
case SOUTH: case SOUTH:
if (world.getBlockState(pos.north()).contains(PART)) { world.breakBlock(pos.south(), true); } if (world.getBlockState(pos.north()).contains(PART)) {
return; world.breakBlock(pos.north(), true);
break;
}
case WEST: case WEST:
if (world.getBlockState(pos.east()).contains(PART)) { world.breakBlock(pos.south(), true); } if (world.getBlockState(pos.east()).contains(PART)) {
return; world.breakBlock(pos.east(), true);
default: break;
return; }
} }
default: return;
} }
} }
@@ -154,13 +154,25 @@ public class Springboard extends HorizontalFacingBlock {
} }
@Override @Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) { public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {
switch (state.get(FACING)) { return switch (state.get(FACING)) {
case NORTH: switch (state.get(PART)) { case FRONT: return NORTH_SHAPE_FRONT; case BACK: return NORTH_SHAPE_BACK;} case NORTH -> switch (state.get(PART)) {
case EAST: switch (state.get(PART)) { case FRONT: return EAST_SHAPE_FRONT; case BACK: return EAST_SHAPE_BACK;} case FRONT -> NORTH_SHAPE_FRONT;
case SOUTH: switch (state.get(PART)) { case FRONT: return SOUTH_SHAPE_FRONT; case BACK: return SOUTH_SHAPE_BACK;} case BACK -> NORTH_SHAPE_BACK;
case WEST: switch (state.get(PART)) { case FRONT: return WEST_SHAPE_FRONT; case BACK: return WEST_SHAPE_BACK;} };
default: return super.getOutlineShape(state, view, pos, context); case EAST -> switch (state.get(PART)) {
} case FRONT -> EAST_SHAPE_FRONT;
case BACK -> EAST_SHAPE_BACK;
};
case SOUTH -> switch (state.get(PART)) {
case FRONT -> SOUTH_SHAPE_FRONT;
case BACK -> SOUTH_SHAPE_BACK;
};
case WEST -> switch (state.get(PART)) {
case FRONT -> WEST_SHAPE_FRONT;
case BACK -> WEST_SHAPE_BACK;
};
default -> super.getOutlineShape(state, view, pos, context);
};
} }
static { static {
//long_plank //long_plank
@@ -229,7 +241,7 @@ public class Springboard extends HorizontalFacingBlock {
} }
public boolean canPlaceAt(BlockState state, WorldView worldView, BlockPos pos) { public boolean canPlaceAt(BlockState state, WorldView worldView, BlockPos pos) {
return !worldView.isAir(pos.down()); return !worldView.isAir(pos.down()) && worldView.getBlockState(pos.offset(state.get(FACING))) == Blocks.AIR.getDefaultState();
} }
} }

View File

@@ -1,42 +0,0 @@
package eu.midnightdust.motschen.decorative.block;
import eu.midnightdust.motschen.decorative.block.blockentity.SpruceChoppingLogBlockEntity;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.state.StateManager;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.WorldView;
public class SpruceChoppingLog extends HorizontalFacingBlock implements BlockEntityProvider {
public SpruceChoppingLog() {
super(FabricBlockSettings.copy(Blocks.OAK_PLANKS).nonOpaque().sounds(BlockSoundGroup.WOOD));
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH));
}
@Override
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
return super.getPlacementState(itemPlacementContext)
.with(FACING, itemPlacementContext.getPlayerFacing().getOpposite());
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(FACING);
}
public boolean canPlaceAt(BlockState state, WorldView worldView, BlockPos pos) {
return !worldView.isAir(pos.down());
}
@Override
public BlockEntity createBlockEntity(BlockView view) {
return new SpruceChoppingLogBlockEntity();
}
}

View File

@@ -0,0 +1,34 @@
package eu.midnightdust.motschen.decorative.block;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.*;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.state.StateManager;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.WorldView;
public class StonePath extends Block {
private static final VoxelShape SHAPE;
public StonePath() {
super(FabricBlockSettings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE));
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {
return SHAPE;
}
static {
SHAPE = createCuboidShape(0, 0, 0, 16, 1, 16);
}
public boolean canPlaceAt(BlockState state, WorldView worldView, BlockPos pos) {
return worldView.getBlockState(pos.down()).isSideSolidFullSquare(worldView,pos,Direction.UP);
}
}

View File

@@ -23,6 +23,7 @@ import net.minecraft.world.BlockView;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;
import java.util.Objects;
import java.util.function.ToIntFunction; import java.util.function.ToIntFunction;
public class Television extends HorizontalFacingBlock { public class Television extends HorizontalFacingBlock {
@@ -34,34 +35,44 @@ public class Television extends HorizontalFacingBlock {
private static final EnumProperty<Program> PROGRAM = DecorativeMain.PROGRAM; private static final EnumProperty<Program> PROGRAM = DecorativeMain.PROGRAM;
public Television() { public Television() {
super(FabricBlockSettings.copy(Blocks.BLACK_CONCRETE).nonOpaque().sounds(BlockSoundGroup.STONE).lightLevel(createLightLevelFromBlockState(15))); super(FabricBlockSettings.copy(Blocks.BLACK_CONCRETE).nonOpaque().sounds(BlockSoundGroup.STONE).luminance(createLightLevelFromBlockState()));
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH).with(PROGRAM, Program.OFF)); this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH).with(PROGRAM, Program.OFF));
} }
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
switch (state.get(PROGRAM)) { switch (state.get(PROGRAM)) {
case OFF: world.setBlockState(pos, state.with(PROGRAM, Program.NYANCAT)); case OFF -> {
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 1.5f); world.setBlockState(pos, state.with(PROGRAM, Program.NYANCAT));
return ActionResult.SUCCESS; world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 1.5f);
case NYANCAT: world.setBlockState(pos, state.with(PROGRAM, Program.CREEPER)); return ActionResult.SUCCESS;
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 1.5f);
return ActionResult.SUCCESS;
case CREEPER: world.setBlockState(pos, state.with(PROGRAM, Program.WOODYS));
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 1.5f);
return ActionResult.SUCCESS;
case WOODYS: world.setBlockState(pos, state.with(PROGRAM, Program.TATER));
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 1.5f);
return ActionResult.SUCCESS;
case TATER: world.setBlockState(pos, state.with(PROGRAM, Program.OFF));
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 1.5f);
return ActionResult.SUCCESS;
} }
case NYANCAT -> {
world.setBlockState(pos, state.with(PROGRAM, Program.CREEPER));
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 1.5f);
return ActionResult.SUCCESS;
}
case CREEPER -> {
world.setBlockState(pos, state.with(PROGRAM, Program.CRABRAVE));
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 1.5f);
return ActionResult.SUCCESS;
}
case CRABRAVE -> {
world.setBlockState(pos, state.with(PROGRAM, Program.TATER));
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 1.5f);
return ActionResult.SUCCESS;
}
case TATER -> {
world.setBlockState(pos, state.with(PROGRAM, Program.OFF));
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 1.5f);
return ActionResult.SUCCESS;
}
}
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
} }
@Override @Override
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) { public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
return super.getPlacementState(itemPlacementContext) return Objects.requireNonNull(super.getPlacementState(itemPlacementContext))
.with(FACING, itemPlacementContext.getPlayerFacing().getOpposite()) .with(FACING, itemPlacementContext.getPlayerFacing().getOpposite())
.with(PROGRAM, Program.OFF); .with(PROGRAM, Program.OFF);
} }
@@ -73,13 +84,13 @@ public class Television extends HorizontalFacingBlock {
} }
@Override @Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) { public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {
switch (state.get(FACING)) { return switch (state.get(FACING)) {
case NORTH: return NORTH_SHAPE; case NORTH -> NORTH_SHAPE;
case EAST: return EAST_SHAPE; case EAST -> EAST_SHAPE;
case SOUTH: return SOUTH_SHAPE; case SOUTH -> SOUTH_SHAPE;
case WEST: return WEST_SHAPE; case WEST -> WEST_SHAPE;
default: return super.getOutlineShape(state, view, pos, context); default -> super.getOutlineShape(state, view, pos, context);
} };
} }
static { static {
VoxelShape shape = createCuboidShape(-7, 4, 7, 22, 22, 9); VoxelShape shape = createCuboidShape(-7, 4, 7, 22, 22, 9);
@@ -105,7 +116,7 @@ public class Television extends HorizontalFacingBlock {
return !worldView.isAir(pos.down()); return !worldView.isAir(pos.down());
} }
private static ToIntFunction<BlockState> createLightLevelFromBlockState(int litLevel) { private static ToIntFunction<BlockState> createLightLevelFromBlockState() {
return (blockState) -> { return (blockState) -> {
if (blockState.get(PROGRAM) == Program.OFF) { if (blockState.get(PROGRAM) == Program.OFF) {
return 0; return 0;

View File

@@ -20,9 +20,7 @@ public class TrafficCone extends Block {
return SHAPE; return SHAPE;
} }
static { static {
VoxelShape shape = createCuboidShape(4, 0, 4, 12, 11.5, 12); SHAPE = createCuboidShape(4, 0, 4, 12, 11.5, 12);
SHAPE = shape;
} }
public boolean canPlaceAt(BlockState state, WorldView worldView, BlockPos pos) { public boolean canPlaceAt(BlockState state, WorldView worldView, BlockPos pos) {

View File

@@ -0,0 +1,91 @@
package eu.midnightdust.motschen.decorative.block;
import eu.midnightdust.motschen.decorative.block.blockentity.WallClockBlockEntity;
import eu.midnightdust.motschen.decorative.init.BlockEntities;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityTicker;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
import java.util.Objects;
public class WallClock extends BlockWithEntity implements BlockEntityProvider {
private static final DirectionProperty FACING = HorizontalFacingBlock.FACING;
private static final VoxelShape NORTH_SHAPE;
private static final VoxelShape EAST_SHAPE;
private static final VoxelShape SOUTH_SHAPE;
private static final VoxelShape WEST_SHAPE;
public WallClock() {
super(FabricBlockSettings.copy(Blocks.SMOOTH_QUARTZ).nonOpaque().sounds(BlockSoundGroup.STONE));
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH));
}
@Override
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
return new WallClockBlockEntity(pos, state);
}
@Nullable
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) {
return checkType(type, BlockEntities.WallClockBlockEntity, WallClockBlockEntity::tick);
}
@Override
public BlockRenderType getRenderType(BlockState state) {
return BlockRenderType.MODEL;
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(FACING);
}
@Override
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
return Objects.requireNonNull(super.getPlacementState(itemPlacementContext))
.with(FACING, itemPlacementContext.getPlayerFacing().getOpposite());
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {
return switch (state.get(FACING)) {
case NORTH -> NORTH_SHAPE;
case EAST -> EAST_SHAPE;
case SOUTH -> SOUTH_SHAPE;
case WEST -> WEST_SHAPE;
default -> super.getOutlineShape(state, view, pos, context);
};
}
static {
VoxelShape shape = createCuboidShape(0, 0, 15, 16, 16, 16);
NORTH_SHAPE = shape;
WEST_SHAPE = rotate(Direction.NORTH, Direction.WEST, shape);
EAST_SHAPE = rotate(Direction.NORTH, Direction.EAST, shape);
SOUTH_SHAPE = rotate(Direction.NORTH, Direction.SOUTH, shape);
}
private static VoxelShape rotate(Direction from, Direction to, VoxelShape shape) {
VoxelShape[] buffer = new VoxelShape[]{ shape, VoxelShapes.empty() };
int times = (to.getHorizontal() - from.getHorizontal() + 4) % 4;
for (int i = 0; i < times; i++) {
buffer[0].forEachBox((minX, minY, minZ, maxX, maxY, maxZ) -> buffer[1] = VoxelShapes.union(buffer[1], VoxelShapes.cuboid(1-maxZ, minY, minX, 1-minZ, maxY, maxX)));
buffer[0] = buffer[1];
buffer[1] = VoxelShapes.empty();
}
return buffer[0];
}
}

View File

@@ -19,6 +19,8 @@ import net.minecraft.world.BlockView;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;
import java.util.Objects;
public class WaterPump extends HorizontalFacingBlock { public class WaterPump extends HorizontalFacingBlock {
private static final VoxelShape NORTH_SHAPE; private static final VoxelShape NORTH_SHAPE;
private static final VoxelShape EAST_SHAPE; private static final VoxelShape EAST_SHAPE;
@@ -34,30 +36,19 @@ public class WaterPump extends HorizontalFacingBlock {
if (!itemStack.isEmpty() && hand==Hand.MAIN_HAND) { if (!itemStack.isEmpty() && hand==Hand.MAIN_HAND) {
if (itemStack.getItem() == Items.BUCKET) { if (itemStack.getItem() == Items.BUCKET) {
if (!world.isClient) { if (!world.isClient) {
if (!player.abilities.creativeMode) { ItemUsage.exchangeStack(itemStack, player, new ItemStack(Items.BUCKET));
itemStack.decrement(1);
if (itemStack.isEmpty()) {
player.setStackInHand(hand, new ItemStack(Items.WATER_BUCKET));
} else if (!player.inventory.insertStack(new ItemStack(Items.WATER_BUCKET))) {
player.dropItem(new ItemStack(Items.WATER_BUCKET), false);
}
}
world.playSound(null, pos, SoundEvents.ITEM_BUCKET_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F); world.playSound(null, pos, SoundEvents.ITEM_BUCKET_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F);
} }
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
} }
else {
return ActionResult.PASS;
}
}
if (itemStack.isEmpty()) {
return ActionResult.PASS; return ActionResult.PASS;
} return ActionResult.PASS; }
return ActionResult.PASS;
} }
@Override @Override
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) { public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
return super.getPlacementState(itemPlacementContext) return Objects.requireNonNull(super.getPlacementState(itemPlacementContext))
.with(FACING, itemPlacementContext.getPlayerFacing().getOpposite()); .with(FACING, itemPlacementContext.getPlayerFacing().getOpposite());
} }
@@ -67,13 +58,13 @@ public class WaterPump extends HorizontalFacingBlock {
} }
@Override @Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) { public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {
switch (state.get(FACING)) { return switch (state.get(FACING)) {
case NORTH: return NORTH_SHAPE; case NORTH -> NORTH_SHAPE;
case EAST: return EAST_SHAPE; case EAST -> EAST_SHAPE;
case SOUTH: return SOUTH_SHAPE; case SOUTH -> SOUTH_SHAPE;
case WEST: return WEST_SHAPE; case WEST -> WEST_SHAPE;
default: return super.getOutlineShape(state, view, pos, context); default -> super.getOutlineShape(state, view, pos, context);
} };
} }
static { static {
VoxelShape shape = createCuboidShape(4.25, 0, 0, 11.75, 24, 14); VoxelShape shape = createCuboidShape(4.25, 0, 0, 11.75, 24, 14);

View File

@@ -1,61 +0,0 @@
package eu.midnightdust.motschen.decorative.block.blockentity;
import eu.midnightdust.motschen.decorative.init.BlockEntities;
import net.minecraft.block.BlockState;
import net.minecraft.block.HorizontalFacingBlock;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.Tickable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
public class AcaciaChoppingLogBlockEntity extends BlockEntity implements Tickable {
private int facing;
private double axe_x;
private double axe_z;
public AcaciaChoppingLogBlockEntity() {
super(BlockEntities.AcaciaChoppingLogBlockEntity);
}
@Override
public void tick() {
BlockPos pos = this.pos;
BlockState state = this.world.getBlockState(pos);
if (world != null && state.get(HorizontalFacingBlock.FACING) == Direction.EAST) {
facing = 180;
axe_x = 0.2D;
axe_z = 0.5D;
return;
}
if (world != null && state.get(HorizontalFacingBlock.FACING) == Direction.SOUTH) {
facing = 90;
axe_x = 0.5D;
axe_z = 0.2D;
return;
}
if (world != null && state.get(HorizontalFacingBlock.FACING) == Direction.WEST) {
facing = 0;
axe_x = 0.8D;
axe_z = 0.5D;
return;
}
else {
facing = 270;
axe_x = 0.5D;
axe_z = 0.8D;
return;
}
}
public int getFacing() {
return facing;
}
public double getAxeX() {
return axe_x;
}
public double getAxeZ() {
return axe_z;
}
}

View File

@@ -1,61 +0,0 @@
package eu.midnightdust.motschen.decorative.block.blockentity;
import eu.midnightdust.motschen.decorative.init.BlockEntities;
import net.minecraft.block.BlockState;
import net.minecraft.block.HorizontalFacingBlock;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.Tickable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
public class BirchChoppingLogBlockEntity extends BlockEntity implements Tickable {
private int facing;
private double axe_x;
private double axe_z;
public BirchChoppingLogBlockEntity() {
super(BlockEntities.BirchChoppingLogBlockEntity);
}
@Override
public void tick() {
BlockPos pos = this.pos;
BlockState state = this.world.getBlockState(pos);
if (world != null && state.get(HorizontalFacingBlock.FACING) == Direction.EAST) {
facing = 180;
axe_x = 0.2D;
axe_z = 0.5D;
return;
}
if (world != null && state.get(HorizontalFacingBlock.FACING) == Direction.SOUTH) {
facing = 90;
axe_x = 0.5D;
axe_z = 0.2D;
return;
}
if (world != null && state.get(HorizontalFacingBlock.FACING) == Direction.WEST) {
facing = 0;
axe_x = 0.8D;
axe_z = 0.5D;
return;
}
else {
facing = 270;
axe_x = 0.5D;
axe_z = 0.8D;
return;
}
}
public int getFacing() {
return facing;
}
public double getAxeX() {
return axe_x;
}
public double getAxeZ() {
return axe_z;
}
}

View File

@@ -5,43 +5,45 @@ import eu.midnightdust.motschen.decorative.DecorativeMain;
import eu.midnightdust.motschen.decorative.init.BlockEntities; import eu.midnightdust.motschen.decorative.init.BlockEntities;
import eu.midnightdust.motschen.decorative.sound.DecorativeSoundEvents; import eu.midnightdust.motschen.decorative.sound.DecorativeSoundEvents;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.BrewingStandBlock;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BrewingStandBlockEntity;
import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundCategory;
import net.minecraft.util.Tickable;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class CeilingFanBlockEntity extends BlockEntity implements Tickable { import java.time.LocalTime;
public class CeilingFanBlockEntity extends BlockEntity {
private int rot; private int rot;
private int second;
public CeilingFanBlockEntity() { public CeilingFanBlockEntity(BlockPos pos, BlockState state) {
super(BlockEntities.CeilingFanBlockEntity); super(BlockEntities.CeilingFanBlockEntity, pos, state);
} }
public static void tick(World world, BlockPos pos, BlockState state, CeilingFanBlockEntity blockEntity) {
if (state.get(DecorativeMain.STAGE) == CeilingFanStage.LEVEL_1) {
@Override if (LocalTime.now().getSecond() != blockEntity.second) {
public void tick() { blockEntity.second = LocalTime.now().getSecond();
world.playSound(null,pos, DecorativeSoundEvents.CEILINGFAN_AMBIENT, SoundCategory.BLOCKS, 0.1f, 1.0f);
BlockPos pos = this.pos; }
BlockState state = this.world.getBlockState(pos); blockEntity.rot = blockEntity.rot + 6;
if (world != null && state.get(DecorativeMain.STAGE) == CeilingFanStage.LEVEL_1) {
world.playSound(null,pos, DecorativeSoundEvents.CEILINGFAN_AMBIENT, SoundCategory.BLOCKS, 0.1f, 1.0f);
rot = rot + 6;
return;
} }
if (world != null && state.get(DecorativeMain.STAGE) == CeilingFanStage.LEVEL_2) { else if (state.get(DecorativeMain.STAGE) == CeilingFanStage.LEVEL_2) {
world.playSound(null,pos, DecorativeSoundEvents.CEILINGFAN_AMBIENT, SoundCategory.BLOCKS, 0.2f, 1.0f); if (LocalTime.now().getSecond() != blockEntity.second) {
rot = rot + 10; blockEntity.second = LocalTime.now().getSecond();
return; world.playSound(null,pos, DecorativeSoundEvents.CEILINGFAN_AMBIENT, SoundCategory.BLOCKS, 0.2f, 1.0f);
}
blockEntity.rot = blockEntity.rot + 10;
} }
if (world != null && state.get(DecorativeMain.STAGE) == CeilingFanStage.LEVEL_3) { else if (state.get(DecorativeMain.STAGE) == CeilingFanStage.LEVEL_3) {
world.playSound(null,pos, DecorativeSoundEvents.CEILINGFAN_AMBIENT, SoundCategory.BLOCKS, 0.3f, 1.0f); if (LocalTime.now().getSecond() != blockEntity.second) {
rot = rot + 14; blockEntity.second = LocalTime.now().getSecond();
return; world.playSound(null,pos, DecorativeSoundEvents.CEILINGFAN_AMBIENT, SoundCategory.BLOCKS, 0.3f, 1.0f);
} }
else {
rot = rot; blockEntity.rot = blockEntity.rot + 14;
return;
} }
} }
public int getRot() { public int getRot() {

View File

@@ -0,0 +1,53 @@
package eu.midnightdust.motschen.decorative.block.blockentity;
import eu.midnightdust.motschen.decorative.init.BlockEntities;
import net.minecraft.block.BlockState;
import net.minecraft.block.HorizontalFacingBlock;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.JukeboxBlockEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
public class ChoppingLogBlockEntity extends BlockEntity {
private int facing;
private double axe_x;
private double axe_z;
public ChoppingLogBlockEntity(BlockPos pos, BlockState state) {
super(BlockEntities.ChoppingLogBlockEntity, pos, state);
}
public static void tick(World world, BlockPos pos, BlockState state, ChoppingLogBlockEntity blockEntity) {
if (state.get(HorizontalFacingBlock.FACING) == Direction.EAST) {
blockEntity.facing = 180;
blockEntity.axe_x = 0.2D;
blockEntity.axe_z = 0.5D;
}
else if (state.get(HorizontalFacingBlock.FACING) == Direction.SOUTH) {
blockEntity.facing = 90;
blockEntity.axe_x = 0.5D;
blockEntity.axe_z = 0.2D;
}
else if (state.get(HorizontalFacingBlock.FACING) == Direction.WEST) {
blockEntity.facing = 0;
blockEntity.axe_x = 0.8D;
blockEntity.axe_z = 0.5D;
}
else {
blockEntity.facing = 270;
blockEntity.axe_x = 0.5D;
blockEntity.axe_z = 0.8D;
}
}
public int getFacing() {
return facing;
}
public double getAxeX() {
return axe_x;
}
public double getAxeZ() {
return axe_z;
}
}

View File

@@ -1,61 +0,0 @@
package eu.midnightdust.motschen.decorative.block.blockentity;
import eu.midnightdust.motschen.decorative.init.BlockEntities;
import net.minecraft.block.BlockState;
import net.minecraft.block.HorizontalFacingBlock;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.Tickable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
public class DarkOakChoppingLogBlockEntity extends BlockEntity implements Tickable {
private int facing;
private double axe_x;
private double axe_z;
public DarkOakChoppingLogBlockEntity() {
super(BlockEntities.DarkOakChoppingLogBlockEntity);
}
@Override
public void tick() {
BlockPos pos = this.pos;
BlockState state = this.world.getBlockState(pos);
if (world != null && state.get(HorizontalFacingBlock.FACING) == Direction.EAST) {
facing = 180;
axe_x = 0.2D;
axe_z = 0.5D;
return;
}
if (world != null && state.get(HorizontalFacingBlock.FACING) == Direction.SOUTH) {
facing = 90;
axe_x = 0.5D;
axe_z = 0.2D;
return;
}
if (world != null && state.get(HorizontalFacingBlock.FACING) == Direction.WEST) {
facing = 0;
axe_x = 0.8D;
axe_z = 0.5D;
return;
}
else {
facing = 270;
axe_x = 0.5D;
axe_z = 0.8D;
return;
}
}
public int getFacing() {
return facing;
}
public double getAxeX() {
return axe_x;
}
public double getAxeZ() {
return axe_z;
}
}

View File

@@ -0,0 +1,63 @@
package eu.midnightdust.motschen.decorative.block.blockentity;
import eu.midnightdust.motschen.decorative.init.BlockEntities;
import net.minecraft.block.BlockState;
import net.minecraft.block.HorizontalFacingBlock;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import java.time.LocalTime;
public class DigitalClockBlockEntity extends BlockEntity {
private int facing;
private double x;
private double z;
private int second;
public DigitalClockBlockEntity(BlockPos pos, BlockState state) {
super(BlockEntities.DigitalClockBlockEntity, pos, state);
}
public static void tick(World world, BlockPos pos, BlockState state, DigitalClockBlockEntity blockEntity) {
if (LocalTime.now().getSecond() != blockEntity.second) {
blockEntity.second = LocalTime.now().getSecond();
}
switch (state.get(HorizontalFacingBlock.FACING)) {
case NORTH: {
blockEntity.facing = 0;
blockEntity.x = 0.825;
blockEntity.z = 0.374;
break;
}
case EAST:{
blockEntity.facing = 270;
blockEntity.x = 0.626;
blockEntity.z = 0.825;
break;
}
case SOUTH:{
blockEntity.facing = 180;
blockEntity.x = 0.175;
blockEntity.z = 0.626;
break;
}
case WEST:{
blockEntity.facing = 90;
blockEntity.x = 0.374;
blockEntity.z = 0.175;
break;
}
default: break;
}
}
public int getFacing() {
return facing;
}
public double getX() {
return x;
}
public double getZ() {
return z;
}
}

View File

@@ -1,61 +0,0 @@
package eu.midnightdust.motschen.decorative.block.blockentity;
import eu.midnightdust.motschen.decorative.init.BlockEntities;
import net.minecraft.block.BlockState;
import net.minecraft.block.HorizontalFacingBlock;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.Tickable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
public class JungleChoppingLogBlockEntity extends BlockEntity implements Tickable {
private int facing;
private double axe_x;
private double axe_z;
public JungleChoppingLogBlockEntity() {
super(BlockEntities.JungleChoppingLogBlockEntity);
}
@Override
public void tick() {
BlockPos pos = this.pos;
BlockState state = this.world.getBlockState(pos);
if (world != null && state.get(HorizontalFacingBlock.FACING) == Direction.EAST) {
facing = 180;
axe_x = 0.2D;
axe_z = 0.5D;
return;
}
if (world != null && state.get(HorizontalFacingBlock.FACING) == Direction.SOUTH) {
facing = 90;
axe_x = 0.5D;
axe_z = 0.2D;
return;
}
if (world != null && state.get(HorizontalFacingBlock.FACING) == Direction.WEST) {
facing = 0;
axe_x = 0.8D;
axe_z = 0.5D;
return;
}
else {
facing = 270;
axe_x = 0.5D;
axe_z = 0.8D;
return;
}
}
public int getFacing() {
return facing;
}
public double getAxeX() {
return axe_x;
}
public double getAxeZ() {
return axe_z;
}
}

View File

@@ -1,61 +0,0 @@
package eu.midnightdust.motschen.decorative.block.blockentity;
import eu.midnightdust.motschen.decorative.init.BlockEntities;
import net.minecraft.block.BlockState;
import net.minecraft.block.HorizontalFacingBlock;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.Tickable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
public class OakChoppingLogBlockEntity extends BlockEntity implements Tickable {
private int facing;
private double axe_x;
private double axe_z;
public OakChoppingLogBlockEntity() {
super(BlockEntities.OakChoppingLogBlockEntity);
}
@Override
public void tick() {
BlockPos pos = this.pos;
BlockState state = this.world.getBlockState(pos);
if (world != null && state.get(HorizontalFacingBlock.FACING) == Direction.EAST) {
facing = 180;
axe_x = 0.2D;
axe_z = 0.5D;
return;
}
if (world != null && state.get(HorizontalFacingBlock.FACING) == Direction.SOUTH) {
facing = 90;
axe_x = 0.5D;
axe_z = 0.2D;
return;
}
if (world != null && state.get(HorizontalFacingBlock.FACING) == Direction.WEST) {
facing = 0;
axe_x = 0.8D;
axe_z = 0.5D;
return;
}
else {
facing = 270;
axe_x = 0.5D;
axe_z = 0.8D;
return;
}
}
public int getFacing() {
return facing;
}
public double getAxeX() {
return axe_x;
}
public double getAxeZ() {
return axe_z;
}
}

View File

@@ -2,30 +2,26 @@ package eu.midnightdust.motschen.decorative.block.blockentity;
import eu.midnightdust.motschen.decorative.block.PoolSprinkler; import eu.midnightdust.motschen.decorative.block.PoolSprinkler;
import eu.midnightdust.motschen.decorative.init.BlockEntities; import eu.midnightdust.motschen.decorative.init.BlockEntities;
import eu.midnightdust.motschen.decorative.init.Pool;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.particle.ParticleTypes; import net.minecraft.particle.ParticleTypes;
import net.minecraft.util.Tickable;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class PoolSprinklerBlockEntity extends BlockEntity implements Tickable { public class PoolSprinklerBlockEntity extends BlockEntity {
public PoolSprinklerBlockEntity() { public PoolSprinklerBlockEntity(BlockPos pos, BlockState state) {
super(BlockEntities.PoolSprinklerBlockEntity); super(BlockEntities.PoolSprinklerBlockEntity, pos, state);
} }
@Override public static void tick(World world, BlockPos pos, BlockState state, PoolSprinklerBlockEntity blockEntity) {
public void tick() { if (state.get(PoolSprinkler.POWERED)) {
BlockPos pos = this.pos;
BlockState state = this.world.getBlockState(pos);
if (world != null && state.get(PoolSprinkler.POWERED) == true) {
switch (state.get(PoolSprinkler.FACING)) { switch (state.get(PoolSprinkler.FACING)) {
case NORTH: world.addParticle(ParticleTypes.DRIPPING_WATER,pos.getX()+0.5,pos.getY()+0.5,pos.getZ()-0.34,1,1,1); return; case NORTH: world.addParticle(ParticleTypes.DRIPPING_WATER, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() - 0.34, 1, 1, 1); break;
case EAST: world.addParticle(ParticleTypes.DRIPPING_WATER,pos.getX()+1.34,pos.getY()+0.5,pos.getZ()+0.5,1,1,1); return; case EAST: world.addParticle(ParticleTypes.DRIPPING_WATER, pos.getX() + 1.34, pos.getY() + 0.5, pos.getZ() + 0.5, 1, 1, 1); break;
case SOUTH: world.addParticle(ParticleTypes.DRIPPING_WATER,pos.getX()+0.5,pos.getY()+0.5,pos.getZ()+1.34,1,1,1); return; case SOUTH: world.addParticle(ParticleTypes.DRIPPING_WATER, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 1.34, 1, 1, 1); break;
case WEST: world.addParticle(ParticleTypes.DRIPPING_WATER,pos.getX()-0.34,pos.getY()+0.5,pos.getZ()+0.5,1,1,1); return; case WEST: world.addParticle(ParticleTypes.DRIPPING_WATER, pos.getX() - 0.34, pos.getY() + 0.5, pos.getZ() + 0.5, 1, 1, 1); break;
default: return; default: break;
} }
} }
} }

View File

@@ -2,31 +2,28 @@ package eu.midnightdust.motschen.decorative.block.blockentity;
import eu.midnightdust.motschen.decorative.block.PoolSprinkler; import eu.midnightdust.motschen.decorative.block.PoolSprinkler;
import eu.midnightdust.motschen.decorative.init.BlockEntities; import eu.midnightdust.motschen.decorative.init.BlockEntities;
import eu.midnightdust.motschen.decorative.init.Pool;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.particle.ParticleTypes; import net.minecraft.particle.ParticleTypes;
import net.minecraft.util.Tickable;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class ShowerHeadBlockEntity extends BlockEntity implements Tickable { public class ShowerHeadBlockEntity extends BlockEntity {
public ShowerHeadBlockEntity() { public ShowerHeadBlockEntity(BlockPos pos, BlockState state) {
super(BlockEntities.ShowerHeadBlockEntity); super(BlockEntities.ShowerHeadBlockEntity, pos, state);
} }
@Override public static void tick(World world, BlockPos pos, BlockState state, ShowerHeadBlockEntity blockEntity) {
public void tick() { if (state.get(PoolSprinkler.POWERED)) {
BlockPos pos = this.pos;
BlockState state = this.world.getBlockState(pos);
if (world != null && state.get(PoolSprinkler.POWERED) == true) {
switch (state.get(PoolSprinkler.FACING)) { switch (state.get(PoolSprinkler.FACING)) {
case NORTH: world.addParticle(ParticleTypes.DRIPPING_WATER,pos.getX()+0.5,pos.getY()+0.5,pos.getZ()+0.625,1,1,1); return; case NORTH: world.addParticle(ParticleTypes.DRIPPING_WATER, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.625, 1, 1, 1); break;
case EAST: world.addParticle(ParticleTypes.DRIPPING_WATER,pos.getX()+0.375,pos.getY()+0.5,pos.getZ()+0.5,1,1,1); return; case EAST: world.addParticle(ParticleTypes.DRIPPING_WATER, pos.getX() + 0.375, pos.getY() + 0.5, pos.getZ() + 0.5, 1, 1, 1); break;
case SOUTH: world.addParticle(ParticleTypes.DRIPPING_WATER,pos.getX()+0.5,pos.getY()+0.5,pos.getZ()+0.375,1,1,1); return; case SOUTH: world.addParticle(ParticleTypes.DRIPPING_WATER, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.375, 1, 1, 1); break;
case WEST: world.addParticle(ParticleTypes.DRIPPING_WATER,pos.getX()+0.625,pos.getY()+0.5,pos.getZ()+0.5,1,1,1); return; case WEST: world.addParticle(ParticleTypes.DRIPPING_WATER, pos.getX() + 0.625, pos.getY() + 0.5, pos.getZ() + 0.5, 1, 1, 1); break;
default: return; default: break;
} }
} }
} }
} }

View File

@@ -1,61 +0,0 @@
package eu.midnightdust.motschen.decorative.block.blockentity;
import eu.midnightdust.motschen.decorative.init.BlockEntities;
import net.minecraft.block.BlockState;
import net.minecraft.block.HorizontalFacingBlock;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.Tickable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
public class SpruceChoppingLogBlockEntity extends BlockEntity implements Tickable {
private int facing;
private double axe_x;
private double axe_z;
public SpruceChoppingLogBlockEntity() {
super(BlockEntities.SpruceChoppingLogBlockEntity);
}
@Override
public void tick() {
BlockPos pos = this.pos;
BlockState state = this.world.getBlockState(pos);
if (world != null && state.get(HorizontalFacingBlock.FACING) == Direction.EAST) {
facing = 180;
axe_x = 0.2D;
axe_z = 0.5D;
return;
}
if (world != null && state.get(HorizontalFacingBlock.FACING) == Direction.SOUTH) {
facing = 90;
axe_x = 0.5D;
axe_z = 0.2D;
return;
}
if (world != null && state.get(HorizontalFacingBlock.FACING) == Direction.WEST) {
facing = 0;
axe_x = 0.8D;
axe_z = 0.5D;
return;
}
else {
facing = 270;
axe_x = 0.5D;
axe_z = 0.8D;
return;
}
}
public int getFacing() {
return facing;
}
public double getAxeX() {
return axe_x;
}
public double getAxeZ() {
return axe_z;
}
}

View File

@@ -0,0 +1,59 @@
package eu.midnightdust.motschen.decorative.block.blockentity;
import eu.midnightdust.motschen.decorative.init.BlockEntities;
import net.minecraft.block.BlockState;
import net.minecraft.block.HorizontalFacingBlock;
import net.minecraft.block.entity.BlockEntity;
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.world.World;
import java.time.LocalTime;
public class WallClockBlockEntity extends BlockEntity {
public int facing;
public double x;
public double z;
public int second;
public WallClockBlockEntity(BlockPos pos, BlockState state) {
super(BlockEntities.WallClockBlockEntity, pos, state);
}
public static void tick(World world, BlockPos pos, BlockState state, WallClockBlockEntity blockEntity) {
if (LocalTime.now().getSecond() != blockEntity.second) {
blockEntity.second = LocalTime.now().getSecond();
world.playSound(null, pos, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.04f, 1f);
}
switch (state.get(HorizontalFacingBlock.FACING)) {
case NORTH: {
blockEntity.facing = 0;
blockEntity.x = 0.5;
blockEntity.z = 0.95;
break;
}
case EAST: {
blockEntity.facing = 270;
blockEntity.x = 0.05;
blockEntity.z = 0.5;
break;
}
case SOUTH: {
blockEntity.facing = 180;
blockEntity.x = 0.5;
blockEntity.z = 0.05;
break;
}
case WEST: {
blockEntity.facing = 90;
blockEntity.x = 0.95;
blockEntity.z = 0.5;
break;
}
default: break;
}
}
}

View File

@@ -1,52 +0,0 @@
package eu.midnightdust.motschen.decorative.block.render;
import eu.midnightdust.motschen.decorative.block.blockentity.AcaciaChoppingLogBlockEntity;
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.VertexConsumerProvider;
import net.minecraft.client.render.WorldRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
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.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.math.BlockPos;
@Environment(EnvType.CLIENT)
public class AcaciaChoppingLogBlockEntityRenderer extends BlockEntityRenderer<AcaciaChoppingLogBlockEntity> {
public AcaciaChoppingLogBlockEntityRenderer(BlockEntityRenderDispatcher blockEntityRenderDispatcher) {
super(blockEntityRenderDispatcher);
}
@Override
public boolean rendersOutsideBoundingBox(AcaciaChoppingLogBlockEntity blockEntity) {
return true;
}
@Override
public void render(AcaciaChoppingLogBlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
BlockPos pos = blockEntity.getPos();
BlockState state = blockEntity.getWorld().getBlockState(pos);
matrices.push();
int lightAbove = WorldRenderer.getLightmapCoordinates(blockEntity.getWorld(), blockEntity.getPos().up());
matrices.translate(blockEntity.getAxeX(), 1.5D, blockEntity.getAxeZ());
matrices.scale(2.5f,2.5f,2.5f);
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(blockEntity.getFacing()));
matrices.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(160));
MinecraftClient.getInstance().getItemRenderer().renderItem(new ItemStack(Items.IRON_AXE),
ModelTransformation.Mode.GROUND, lightAbove, overlay, matrices, vertexConsumers);
matrices.pop();
}
}

View File

@@ -1,52 +0,0 @@
package eu.midnightdust.motschen.decorative.block.render;
import eu.midnightdust.motschen.decorative.block.blockentity.BirchChoppingLogBlockEntity;
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.VertexConsumerProvider;
import net.minecraft.client.render.WorldRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
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.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.math.BlockPos;
@Environment(EnvType.CLIENT)
public class BirchChoppingLogBlockEntityRenderer extends BlockEntityRenderer<BirchChoppingLogBlockEntity> {
public BirchChoppingLogBlockEntityRenderer(BlockEntityRenderDispatcher blockEntityRenderDispatcher) {
super(blockEntityRenderDispatcher);
}
@Override
public boolean rendersOutsideBoundingBox(BirchChoppingLogBlockEntity blockEntity) {
return true;
}
@Override
public void render(BirchChoppingLogBlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
BlockPos pos = blockEntity.getPos();
BlockState state = blockEntity.getWorld().getBlockState(pos);
matrices.push();
int lightAbove = WorldRenderer.getLightmapCoordinates(blockEntity.getWorld(), blockEntity.getPos().up());
matrices.translate(blockEntity.getAxeX(), 1.5D, blockEntity.getAxeZ());
matrices.scale(2.5f,2.5f,2.5f);
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(blockEntity.getFacing()));
matrices.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(160));
MinecraftClient.getInstance().getItemRenderer().renderItem(new ItemStack(Items.IRON_AXE),
ModelTransformation.Mode.GROUND, lightAbove, overlay, matrices, vertexConsumers);
matrices.pop();
}
}

View File

@@ -1,58 +1,40 @@
package eu.midnightdust.motschen.decorative.block.render; package eu.midnightdust.motschen.decorative.block.render;
import eu.midnightdust.motschen.decorative.block.blockentity.CeilingFanBlockEntity; import eu.midnightdust.motschen.decorative.block.blockentity.CeilingFanBlockEntity;
import net.fabricmc.api.EnvType; import eu.midnightdust.motschen.decorative.block.render.model.CeilingFanBladesModel;
import net.fabricmc.api.Environment; import net.fabricmc.api.EnvType;
import net.minecraft.block.DoorBlock; import net.fabricmc.api.Environment;
import net.minecraft.client.model.ModelPart; import net.minecraft.client.render.OverlayTexture;
import net.minecraft.client.render.OverlayTexture; import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.WorldRenderer; import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.render.block.entity.BlockEntityRenderer; import net.minecraft.util.Identifier;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.math.Vec3f;
import net.minecraft.client.util.math.Vector3f;
import net.minecraft.util.Identifier; @Environment(EnvType.CLIENT)
public class CeilingFanRenderer implements BlockEntityRenderer<CeilingFanBlockEntity> {
@Environment(EnvType.CLIENT) private final CeilingFanBladesModel blades;
public class CeilingFanRenderer extends BlockEntityRenderer<CeilingFanBlockEntity> {
private static int rot; public CeilingFanRenderer(BlockEntityRendererFactory.Context ctx) {
private final ModelPart blades; blades = new CeilingFanBladesModel(ctx.getLayerModelPart(CeilingFanBladesModel.CEILING_FAN_MODEL_LAYER));
private final ModelPart point; }
public CeilingFanRenderer(BlockEntityRenderDispatcher blockEntityRenderDispatcher) { @Override
super(blockEntityRenderDispatcher); public boolean rendersOutsideBoundingBox(CeilingFanBlockEntity blockEntity) {
blades = new ModelPart(64, 64, 0, 0); return true;
blades.setPivot(0.0F, 0.0F, 0.0F); }
blades.addCuboid(-1.0F, 0.0F, 1.0F, 2.0F, 1.0F, 10.0F, 0.0F);
blades.addCuboid(-1.0F, 0.0F, -11.0F, 2.0F, 1.0F, 10.0F, 0.0F);
blades.addCuboid(1.0F, 0.0F, -1.0F, 10.0F, 1.0F, 2.0F, 0.0F); @Override
blades.addCuboid(-11.0F, 0.0F, -1.0F, 10.0F, 1.0F, 2.0F, 0.0F); public void render(CeilingFanBlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
point = new ModelPart(32, 32, 16, 0); matrices.push();
point.addCuboid(-1.0F, -1.0F, -1.0F, 2.0F, 2.0F, 2.0F, 0.0F); VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getEntityCutoutNoCull(new Identifier("decorative:textures/block/ceilingfan.png")));
blades.addChild(point); matrices.translate(0.5,0.31,0.5);
} matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(blockEntity.getRot()));
blades.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV, 1.0F, 1.0F, 1.0F, 1.0F);
@Override matrices.pop();
public boolean rendersOutsideBoundingBox(CeilingFanBlockEntity blockEntity) { }
return true; }
}
@Override
public void render(CeilingFanBlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
matrices.push();
int lightAtBlock = WorldRenderer.getLightmapCoordinates(blockEntity.getWorld(), blockEntity.getPos());
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getEntityCutoutNoCull(new Identifier("decorative:textures/block/ceilingfan.png")));
matrices.translate(0.5,0.31,0.5);
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(blockEntity.getRot()));
blades.render(matrices, vertexConsumer, lightAtBlock, OverlayTexture.DEFAULT_UV, 1.0F, 1.0F, 1.0F, 1.0F);
matrices.pop();
}
}

View File

@@ -0,0 +1,40 @@
package eu.midnightdust.motschen.decorative.block.render;
import eu.midnightdust.motschen.decorative.block.blockentity.ChoppingLogBlockEntity;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.*;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.math.Vec3f;
import java.util.Objects;
@Environment(EnvType.CLIENT)
public class ChoppingLogBlockEntityRenderer implements BlockEntityRenderer<ChoppingLogBlockEntity> {
public ChoppingLogBlockEntityRenderer(BlockEntityRendererFactory.Context ctx) {
}
@Override
public boolean rendersOutsideBoundingBox(ChoppingLogBlockEntity blockEntity) {
return true;
}
@Override
public void render(ChoppingLogBlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
matrices.push();
int lightAbove = WorldRenderer.getLightmapCoordinates(Objects.requireNonNull(blockEntity.getWorld()), blockEntity.getPos().up());
matrices.translate(blockEntity.getAxeX(), 1.5D, blockEntity.getAxeZ());
matrices.scale(2.5f,2.5f,2.5f);
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(blockEntity.getFacing()));
matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(160));
MinecraftClient.getInstance().getItemRenderer().renderItem(new ItemStack(Items.IRON_AXE), ModelTransformation.Mode.GROUND, lightAbove, overlay, matrices, vertexConsumers, 0);
matrices.pop();
}
}

View File

@@ -1,52 +0,0 @@
package eu.midnightdust.motschen.decorative.block.render;
import eu.midnightdust.motschen.decorative.block.blockentity.DarkOakChoppingLogBlockEntity;
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.VertexConsumerProvider;
import net.minecraft.client.render.WorldRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
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.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.math.BlockPos;
@Environment(EnvType.CLIENT)
public class DarkOakChoppingLogBlockEntityRenderer extends BlockEntityRenderer<DarkOakChoppingLogBlockEntity> {
public DarkOakChoppingLogBlockEntityRenderer(BlockEntityRenderDispatcher blockEntityRenderDispatcher) {
super(blockEntityRenderDispatcher);
}
@Override
public boolean rendersOutsideBoundingBox(DarkOakChoppingLogBlockEntity blockEntity) {
return true;
}
@Override
public void render(DarkOakChoppingLogBlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
BlockPos pos = blockEntity.getPos();
BlockState state = blockEntity.getWorld().getBlockState(pos);
matrices.push();
int lightAbove = WorldRenderer.getLightmapCoordinates(blockEntity.getWorld(), blockEntity.getPos().up());
matrices.translate(blockEntity.getAxeX(), 1.5D, blockEntity.getAxeZ());
matrices.scale(2.5f,2.5f,2.5f);
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(blockEntity.getFacing()));
matrices.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(160));
MinecraftClient.getInstance().getItemRenderer().renderItem(new ItemStack(Items.IRON_AXE),
ModelTransformation.Mode.GROUND, lightAbove, overlay, matrices, vertexConsumers);
matrices.pop();
}
}

View File

@@ -0,0 +1,77 @@
package eu.midnightdust.motschen.decorative.block.render;
import eu.midnightdust.motschen.decorative.DecorativeMain;
import eu.midnightdust.motschen.decorative.block.blockentity.DigitalClockBlockEntity;
import eu.midnightdust.motschen.decorative.config.DecorativeConfig;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.render.*;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.Vec3f;
import java.time.LocalTime;
@Environment(EnvType.CLIENT)
public class DigitalClockRenderer implements BlockEntityRenderer<DigitalClockBlockEntity> {
private final TextRenderer textRenderer;
public DigitalClockRenderer(BlockEntityRendererFactory.Context ctx) {
textRenderer = ctx.getTextRenderer();
}
private int getHour12hFormat() {
int hour;
hour = LocalTime.now().getHour();
if (hour > 12) {
hour = hour - 12;
}
return hour;
}
private String getTime() {
String hour;
String minute;
// Hour
if (DecorativeConfig.timeFormat.equals(DecorativeConfig.TimeFormat.h12)) {
if (getHour12hFormat() <= 9) {
hour = "0" + getHour12hFormat();
} else {
hour = "" + getHour12hFormat();
}
}
else {
if (LocalTime.now().getHour() <= 9) {
hour = "0" + LocalTime.now().getHour();
} else {
hour = "" + LocalTime.now().getHour();
}
}
// Minute
if (LocalTime.now().getMinute() <= 9) {
minute = "0" + LocalTime.now().getMinute();
}
else {
minute = "" + LocalTime.now().getMinute();
}
return hour +":"+ minute;
}
@Override
public void render(DigitalClockBlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
matrices.push();
matrices.translate(blockEntity.getX(),0.35,blockEntity.getZ());
matrices.scale(0.025f, 0.025f, 0.025f);
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(blockEntity.getFacing()));
matrices.translate(0,0,-0.1);
matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(180));
textRenderer.draw(getTime(), 0, 0, 16382457, false, matrices.peek().getPositionMatrix(), vertexConsumers, false, 0, light);
matrices.pop();
}
}

View File

@@ -1,52 +0,0 @@
package eu.midnightdust.motschen.decorative.block.render;
import eu.midnightdust.motschen.decorative.block.blockentity.JungleChoppingLogBlockEntity;
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.VertexConsumerProvider;
import net.minecraft.client.render.WorldRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
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.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.math.BlockPos;
@Environment(EnvType.CLIENT)
public class JungleChoppingLogBlockEntityRenderer extends BlockEntityRenderer<JungleChoppingLogBlockEntity> {
public JungleChoppingLogBlockEntityRenderer(BlockEntityRenderDispatcher blockEntityRenderDispatcher) {
super(blockEntityRenderDispatcher);
}
@Override
public boolean rendersOutsideBoundingBox(JungleChoppingLogBlockEntity blockEntity) {
return true;
}
@Override
public void render(JungleChoppingLogBlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
BlockPos pos = blockEntity.getPos();
BlockState state = blockEntity.getWorld().getBlockState(pos);
matrices.push();
int lightAbove = WorldRenderer.getLightmapCoordinates(blockEntity.getWorld(), blockEntity.getPos().up());
matrices.translate(blockEntity.getAxeX(), 1.5D, blockEntity.getAxeZ());
matrices.scale(2.5f,2.5f,2.5f);
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(blockEntity.getFacing()));
matrices.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(160));
MinecraftClient.getInstance().getItemRenderer().renderItem(new ItemStack(Items.IRON_AXE),
ModelTransformation.Mode.GROUND, lightAbove, overlay, matrices, vertexConsumers);
matrices.pop();
}
}

View File

@@ -1,51 +0,0 @@
package eu.midnightdust.motschen.decorative.block.render;
import eu.midnightdust.motschen.decorative.block.blockentity.OakChoppingLogBlockEntity;
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.*;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
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.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.math.BlockPos;
@Environment(EnvType.CLIENT)
public class OakChoppingLogBlockEntityRenderer extends BlockEntityRenderer<OakChoppingLogBlockEntity> {
public OakChoppingLogBlockEntityRenderer(BlockEntityRenderDispatcher blockEntityRenderDispatcher) {
super(blockEntityRenderDispatcher);
}
@Override
public boolean rendersOutsideBoundingBox(OakChoppingLogBlockEntity blockEntity) {
return true;
}
@Override
public void render(OakChoppingLogBlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
BlockPos pos = blockEntity.getPos();
BlockState state = blockEntity.getWorld().getBlockState(pos);
matrices.push();
int lightAbove = WorldRenderer.getLightmapCoordinates(blockEntity.getWorld(), blockEntity.getPos().up());
matrices.translate(blockEntity.getAxeX(), 1.5D, blockEntity.getAxeZ());
matrices.scale(2.5f,2.5f,2.5f);
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(blockEntity.getFacing()));
matrices.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(160));
MinecraftClient.getInstance().getItemRenderer().renderItem(new ItemStack(Items.IRON_AXE),
ModelTransformation.Mode.GROUND, lightAbove, overlay, matrices, vertexConsumers);
matrices.pop();
}
}

View File

@@ -1,52 +0,0 @@
package eu.midnightdust.motschen.decorative.block.render;
import eu.midnightdust.motschen.decorative.block.blockentity.SpruceChoppingLogBlockEntity;
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.VertexConsumerProvider;
import net.minecraft.client.render.WorldRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
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.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.math.BlockPos;
@Environment(EnvType.CLIENT)
public class SpruceChoppingLogBlockEntityRenderer extends BlockEntityRenderer<SpruceChoppingLogBlockEntity> {
public SpruceChoppingLogBlockEntityRenderer(BlockEntityRenderDispatcher blockEntityRenderDispatcher) {
super(blockEntityRenderDispatcher);
}
@Override
public boolean rendersOutsideBoundingBox(SpruceChoppingLogBlockEntity blockEntity) {
return true;
}
@Override
public void render(SpruceChoppingLogBlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
BlockPos pos = blockEntity.getPos();
BlockState state = blockEntity.getWorld().getBlockState(pos);
matrices.push();
int lightAbove = WorldRenderer.getLightmapCoordinates(blockEntity.getWorld(), blockEntity.getPos().up());
matrices.translate(blockEntity.getAxeX(), 1.5D, blockEntity.getAxeZ());
matrices.scale(2.5f,2.5f,2.5f);
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(blockEntity.getFacing()));
matrices.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(160));
MinecraftClient.getInstance().getItemRenderer().renderItem(new ItemStack(Items.IRON_AXE),
ModelTransformation.Mode.GROUND, lightAbove, overlay, matrices, vertexConsumers);
matrices.pop();
}
}

View File

@@ -0,0 +1,58 @@
package eu.midnightdust.motschen.decorative.block.render;
import eu.midnightdust.motschen.decorative.block.blockentity.WallClockBlockEntity;
import eu.midnightdust.motschen.decorative.block.render.model.WallClockHandsModel;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.*;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.Vec3f;
import java.time.LocalTime;
@Environment(EnvType.CLIENT)
public class WallClockRenderer implements BlockEntityRenderer<WallClockBlockEntity> {
private final WallClockHandsModel handsModel;
public WallClockRenderer(BlockEntityRendererFactory.Context ctx) {
handsModel = new WallClockHandsModel(ctx.getLayerModelPart(WallClockHandsModel.CLOCK_HANDS_MODEL_LAYER));
}
private int getHour12hFormat() {
int hour;
hour = LocalTime.now().getHour();
if (hour >= 12) {
hour = hour - 12;
}
return hour;
}
@Override
public void render(WallClockBlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
VertexConsumer vertex = vertexConsumers.getBuffer(RenderLayer.getEntityCutoutNoCull(new Identifier("textures/block/red_concrete.png")));
matrices.push();
matrices.translate(blockEntity.x,0.5,blockEntity.z);
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(blockEntity.facing));
matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(LocalTime.now().getSecond() * 6));
handsModel.seconds.render(matrices, vertex, light, OverlayTexture.DEFAULT_UV, 1.0F, 1.0F, 1.0F, 1.0F);
matrices.pop();
matrices.push();
matrices.translate(blockEntity.x,0.5,blockEntity.z);
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(blockEntity.facing));
matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(LocalTime.now().getMinute() * 6));
handsModel.minutes.render(matrices, vertex, light, OverlayTexture.DEFAULT_UV, 0.0F, 0.0F, 0.0F, 1.0F);
matrices.pop();
matrices.push();
matrices.translate(blockEntity.x,0.5,blockEntity.z);
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(blockEntity.facing));
matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(getHour12hFormat() * 30));
handsModel.hours.render(matrices, vertex, light, OverlayTexture.DEFAULT_UV, 0.0F, 0.0F, 0.0F, 1.0F);
matrices.pop();
}
}

View File

@@ -0,0 +1,42 @@
package eu.midnightdust.motschen.decorative.block.render.model;
import net.minecraft.client.model.*;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.entity.model.EntityModelLayer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.Identifier;
public class CeilingFanBladesModel extends Model {
private final ModelPart blades;
public static final EntityModelLayer CEILING_FAN_MODEL_LAYER = new EntityModelLayer(new Identifier("decorative", "ceiling_fan"), "main");
public CeilingFanBladesModel(ModelPart root) {
super(RenderLayer::getEntitySolid);
blades = root;
blades.setPivot(0.0F, 0.0F, 0.0F);
}
public ModelPart getPart() {
return blades;
}
public static TexturedModelData getTexturedModelData() {
return TexturedModelData.of(getModelData(), 64, 64);
}
public static ModelData getModelData() {
ModelData modelData = new ModelData();
ModelPartData modelPartData = modelData.getRoot();
modelPartData.addChild("blade1", ModelPartBuilder.create().cuboid(-1.0F, 0.0F, 1.0F, 2.0F, 1.0F, 10.0F), ModelTransform.NONE);
modelPartData.addChild("blade2", ModelPartBuilder.create().cuboid(-1.0F, 0.0F, -11.0F, 2.0F, 1.0F, 10.0F), ModelTransform.NONE);
modelPartData.addChild("blade3", ModelPartBuilder.create().cuboid(1.0F, 0.0F, -1.0F, 10.0F, 1.0F, 2.0F), ModelTransform.NONE);
modelPartData.addChild("blade4", ModelPartBuilder.create().cuboid(-11.0F, 0.0F, -1.0F, 10.0F, 1.0F, 2.0F), ModelTransform.NONE);
modelPartData.addChild("point", ModelPartBuilder.create().uv(32,0).cuboid(-1.0F, -1.0F, -1.0F, 2.0F, 2.0F, 2.0F), ModelTransform.NONE);
return modelData;
}
@Override
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) {
blades.render(matrices, vertices, light, overlay, red, green, blue, alpha);
}
}

View File

@@ -0,0 +1,47 @@
package eu.midnightdust.motschen.decorative.block.render.model;
import net.minecraft.client.model.*;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.entity.model.EntityModelLayer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.Identifier;
public class WallClockHandsModel extends Model {
private final ModelPart hands;
public final ModelPart seconds;
public final ModelPart minutes;
public final ModelPart hours;
public static final EntityModelLayer CLOCK_HANDS_MODEL_LAYER = new EntityModelLayer(new Identifier("decorative", "clock_hands"), "main");
public WallClockHandsModel(ModelPart root) {
super(RenderLayer::getEntitySolid);
hands = root;
hands.setPivot(0.0F, 0.0F, 0.0F);
seconds = hands.getChild("seconds");//new ModelPart(16, 16, 8, 0);
minutes = hands.getChild("minutes");//new ModelPart(16, 16, 0, 0);
hours = hands.getChild("hours");//new ModelPart(16, 16, 0, 0);
}
public ModelPart getPart() {
return hands;
}
public static TexturedModelData getTexturedModelData() {
return TexturedModelData.of(getModelData(), 16, 16);
}
public static ModelData getModelData(){
ModelData modelData = new ModelData();
ModelPartData modelPartData = modelData.getRoot();
modelPartData.addChild("seconds", ModelPartBuilder.create().uv(0, 0).cuboid(-0.175F, 0.0F, 0.01F, 0.25F, 7.0F, 0.2F), ModelTransform.NONE);
modelPartData.addChild("minutes", ModelPartBuilder.create().uv(0, 0).cuboid(-0.25F, 0.0F, 0.0F, 0.5F, 6.0F, 0.2F), ModelTransform.NONE);
modelPartData.addChild("hours", ModelPartBuilder.create().uv(0, 0).cuboid(-0.25F, 0.0F, 0.0F, 0.5F, 4.0F, 0.2F), ModelTransform.NONE);
return modelData;
}
@Override
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) {
hands.render(matrices, vertices, light, overlay, red, green, blue, alpha);
}
}

View File

@@ -6,7 +6,7 @@ public enum Program implements StringIdentifiable {
OFF("off"), OFF("off"),
NYANCAT("nyancat"), NYANCAT("nyancat"),
CREEPER("creeper"), CREEPER("creeper"),
WOODYS("woodys"), CRABRAVE("crabrave"),
TATER("tater"); TATER("tater");
private final String name; private final String name;

View File

@@ -0,0 +1,13 @@
package eu.midnightdust.motschen.decorative.config;
import eu.midnightdust.lib.config.MidnightConfig;
import java.util.TimeZone;
public class DecorativeConfig extends MidnightConfig {
@Entry public static TimeFormat timeFormat = TimeZone.getDefault().useDaylightTime() ? TimeFormat.h12 : TimeFormat.h24;
public enum TimeFormat {
h12, h24
}
}

View File

@@ -0,0 +1,16 @@
package eu.midnightdust.motschen.decorative.config;
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
import eu.midnightdust.lib.config.MidnightConfig;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@Environment(EnvType.CLIENT)
public class ModMenuIntegration implements ModMenuApi {
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return parent -> MidnightConfig.getScreen(parent,"decorative");
}
}

View File

@@ -7,13 +7,16 @@ import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.passive.PigEntity; import net.minecraft.entity.passive.PigEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.FluidState;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.sound.SoundEvent; import net.minecraft.sound.SoundEvent;
import net.minecraft.tag.Tag; import net.minecraft.tag.TagKey;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BathTireEntity extends PigEntity { public class BathTireEntity extends PigEntity {
@@ -21,11 +24,6 @@ public class BathTireEntity extends PigEntity {
super(entityType, world); super(entityType, world);
} }
@Override
protected int getCurrentExperience(PlayerEntity player) {
return 0;
}
@Override @Override
protected SoundEvent getAmbientSound() { protected SoundEvent getAmbientSound() {
return null; return null;
@@ -50,7 +48,7 @@ public class BathTireEntity extends PigEntity {
} }
@Override @Override
protected void swimUpward(Tag<Fluid> fluid) { protected void swimUpward(TagKey<Fluid> fluid) {
if (this.getNavigation().canSwim()) { if (this.getNavigation().canSwim()) {
super.swimUpward(fluid); super.swimUpward(fluid);
} else { } else {
@@ -65,7 +63,7 @@ public class BathTireEntity extends PigEntity {
} }
@Override @Override
public boolean canWalkOnFluid(Fluid fluid) { public boolean canWalkOnFluid(FluidState fluid) {
return true; return true;
} }
@@ -109,7 +107,14 @@ public class BathTireEntity extends PigEntity {
@Override @Override
public ActionResult interactAt(PlayerEntity player, Vec3d hitPos, Hand hand) { public ActionResult interactAt(PlayerEntity player, Vec3d hitPos, Hand hand) {
if(!player.getEntityWorld().isClient && player.getStackInHand(hand)== ItemStack.EMPTY && hand==Hand.MAIN_HAND) if (!player.getEntityWorld().isClient && player.getStackInHand(hand)== ItemStack.EMPTY && hand==Hand.MAIN_HAND && player.isSneaking())
{
this.remove(RemovalReason.DISCARDED);
System.out.println(Identifier.tryParse(this.getType().getUntranslatedName()));
player.setStackInHand(hand, new ItemStack(Registry.ITEM.get(Identifier.tryParse("decorative:"+this.getType().getUntranslatedName()))));
return ActionResult.SUCCESS;
}
else if (!player.getEntityWorld().isClient && player.getStackInHand(hand)== ItemStack.EMPTY && hand==Hand.MAIN_HAND && !player.isSneaking())
{ {
player.startRiding(this,true); player.startRiding(this,true);
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
@@ -125,5 +130,8 @@ public class BathTireEntity extends PigEntity {
} }
} }
@Override
protected int getXpToDrop(PlayerEntity player) {
return 0;
}
} }

View File

@@ -8,9 +8,10 @@ import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.passive.PigEntity; import net.minecraft.entity.passive.PigEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.FluidState;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.sound.SoundEvent; import net.minecraft.sound.SoundEvent;
import net.minecraft.tag.Tag; import net.minecraft.tag.TagKey;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@@ -22,11 +23,6 @@ public class BeachBallEntity extends PigEntity {
super(entityType, world); super(entityType, world);
} }
@Override
protected int getCurrentExperience(PlayerEntity player) {
return 0;
}
@Override @Override
protected SoundEvent getAmbientSound() { protected SoundEvent getAmbientSound() {
return null; return null;
@@ -51,7 +47,7 @@ public class BeachBallEntity extends PigEntity {
} }
@Override @Override
protected void swimUpward(Tag<Fluid> fluid) { protected void swimUpward(TagKey<Fluid> fluid) {
this.setVelocity(this.getVelocity().add(0.0D, 1.0D, 0.0D)); this.setVelocity(this.getVelocity().add(0.0D, 1.0D, 0.0D));
} }
@@ -61,7 +57,7 @@ public class BeachBallEntity extends PigEntity {
} }
@Override @Override
public boolean canWalkOnFluid(Fluid fluid) { public boolean canWalkOnFluid(FluidState fluid) {
return true; return true;
} }
@@ -107,7 +103,7 @@ public class BeachBallEntity extends PigEntity {
public ActionResult interactAt(PlayerEntity player, Vec3d hitPos, Hand hand) { public ActionResult interactAt(PlayerEntity player, Vec3d hitPos, Hand hand) {
if(!player.getEntityWorld().isClient && player.getStackInHand(hand)== ItemStack.EMPTY && hand==Hand.MAIN_HAND && player.isSneaking()) if(!player.getEntityWorld().isClient && player.getStackInHand(hand)== ItemStack.EMPTY && hand==Hand.MAIN_HAND && player.isSneaking())
{ {
remove(); this.remove(RemovalReason.DISCARDED);
player.setStackInHand(hand, new ItemStack(Pool.BEACH_BALL_ITEM)); player.setStackInHand(hand, new ItemStack(Pool.BEACH_BALL_ITEM));
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
} }

View File

@@ -1,39 +1,44 @@
package eu.midnightdust.motschen.decorative.entity.client.model; package eu.midnightdust.motschen.decorative.entity.client.model;
import eu.midnightdust.motschen.decorative.entity.BathTireEntity; import eu.midnightdust.motschen.decorative.entity.BathTireEntity;
import net.minecraft.client.model.ModelPart; import net.minecraft.client.model.*;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.entity.model.EntityModel; import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.client.render.entity.model.EntityModelLayer;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.Identifier;
public class BathTireModel extends EntityModel<BathTireEntity> { public class BathTireModel extends EntityModel<BathTireEntity> {
private final ModelPart body; private final ModelPart body;
public static final EntityModelLayer BATH_TIRE_MODEL_LAYER = new EntityModelLayer(new Identifier("decorative", "bath_tire"), "main");
public BathTireModel() { public BathTireModel(ModelPart root) {
textureWidth = 16; super(RenderLayer::getEntitySolid);
textureHeight = 16; body = root;
body = new ModelPart(this);
body.setPivot(0.0F, 24.0F, 0.0F); body.setPivot(0.0F, 24.0F, 0.0F);
body.setTextureOffset(0, 0).addCuboid(6.0F, -9.0F, -11.0F, 4.0F, 4.0F, 16.0F, 0.0F, false); }
body.setTextureOffset(0, 0).addCuboid(-10.0F, -9.0F, -11.0F, 4.0F, 4.0F, 16.0F, 0.0F, false);
body.setTextureOffset(0, 0).addCuboid(-8.0F, -8.99F, -13.0F, 16.0F, 4.0F, 4.0F, 0.0F, false); public static TexturedModelData getTexturedModelData() {
body.setTextureOffset(0, 0).addCuboid(-8.0F, -8.99F, 3.0F, 16.0F, 4.0F, 4.0F, 0.0F, false); return TexturedModelData.of(getModelData(), 16, 16);
}
public static ModelData getModelData(){
ModelData modelData = new ModelData();
ModelPartData modelPartData = modelData.getRoot();
modelPartData.addChild("cube1", ModelPartBuilder.create().cuboid(6.0F, -9.0F, -11.0F, 4.0F, 4.0F, 16.0F), ModelTransform.NONE);
modelPartData.addChild("cube2", ModelPartBuilder.create().cuboid(-10.0F, -9.0F, -11.0F, 4.0F, 4.0F, 16.0F), ModelTransform.NONE);
modelPartData.addChild("cube3", ModelPartBuilder.create().cuboid(-8.0F, -8.99F, -13.0F, 16.0F, 4.0F, 4.0F), ModelTransform.NONE);
modelPartData.addChild("cube4", ModelPartBuilder.create().cuboid(-8.0F, -8.99F, 3.0F, 16.0F, 4.0F, 4.0F), ModelTransform.NONE);
return modelData;
} }
@Override @Override
public void setAngles(BathTireEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch){ public void setAngles(BathTireEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch){
//previously the render function, render code was moved to a method below
} }
@Override @Override
public void render(MatrixStack matrixStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){ public void render(MatrixStack matrixStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){
body.render(matrixStack, buffer, packedLight, packedOverlay); body.render(matrixStack, buffer, packedLight, packedOverlay);
} }
public void setRotationAngle(ModelPart modelRenderer, float x, float y, float z) {
modelRenderer.pivotX = x;
modelRenderer.pivotY = y;
modelRenderer.pivotZ = z;
}
} }

View File

@@ -1,27 +1,39 @@
package eu.midnightdust.motschen.decorative.entity.client.model; package eu.midnightdust.motschen.decorative.entity.client.model;
import eu.midnightdust.motschen.decorative.entity.BeachBallEntity; import eu.midnightdust.motschen.decorative.entity.BeachBallEntity;
import net.minecraft.client.model.ModelPart; import net.minecraft.client.model.*;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.entity.model.EntityModel; import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.client.render.entity.model.EntityModelLayer;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.Identifier;
public class BeachBallModel extends EntityModel<BeachBallEntity> { public class BeachBallModel extends EntityModel<BeachBallEntity> {
private final ModelPart body; private final ModelPart body;
public static final EntityModelLayer BEACH_BALL_MODEL_LAYER = new EntityModelLayer(new Identifier("decorative", "beach_ball"), "main");
public BeachBallModel() { public BeachBallModel(ModelPart root) {
textureWidth = 64; super(RenderLayer::getEntitySolid);
textureHeight = 64; body = root;
body.setPivot(0.0F, 20.0F, 0.0F);
}
body = new ModelPart(this); public static TexturedModelData getTexturedModelData() {
body.setPivot(0.0F, 24.0F, 0.0F); return TexturedModelData.of(getModelData(), 64, 64);
body.setTextureOffset(0, 22).addCuboid(-4.0F, -1.0F, -4.0F, 8.0F, 1.0F, 8.0F, 0.0F, false); }
body.setTextureOffset(0, 22).addCuboid(-4.0F, -12.0F, -4.0F, 8.0F, 1.0F, 8.0F, 0.0F, false);
body.setTextureOffset(0, 48).addCuboid(-6.0F, -10.0F, -4.0F, 1.0F, 8.0F, 8.0F, 0.0F, false); public static ModelData getModelData(){
body.setTextureOffset(20, 48).addCuboid(5.0F, -10.0F, -4.0F, 1.0F, 8.0F, 8.0F, 0.0F, false); ModelData modelData = new ModelData();
body.setTextureOffset(0, 33).addCuboid(-4.0F, -10.0F, -6.0F, 8.0F, 8.0F, 1.0F, 0.0F, false); ModelPartData modelPartData = modelData.getRoot();
body.setTextureOffset(20, 33).addCuboid(-4.0F, -10.0F, 5.0F, 8.0F, 8.0F, 1.0F, 0.0F, false); modelPartData.addChild("cube1", ModelPartBuilder.create().uv(0, 22).cuboid(-4.0F, -1.0F, -4.0F, 8.0F, 1.0F, 8.0F), ModelTransform.NONE);
body.setTextureOffset(0, 0).addCuboid(-5.0F, -11.0F, -5.0F, 10.0F, 10.0F, 10.0F, 0.0F, false); modelPartData.addChild("cube2", ModelPartBuilder.create().uv(0, 22).cuboid(-4.0F, -12.0F, -4.0F, 8.0F, 1.0F, 8.0F), ModelTransform.NONE);
modelPartData.addChild("cube3", ModelPartBuilder.create().uv(0, 48).cuboid(-6.0F, -10.0F, -4.0F, 1.0F, 8.0F, 8.0F), ModelTransform.NONE);
modelPartData.addChild("cube4", ModelPartBuilder.create().uv(20, 48).cuboid(5.0F, -10.0F, -4.0F, 1.0F, 8.0F, 8.0F), ModelTransform.NONE);
modelPartData.addChild("cube5", ModelPartBuilder.create().uv(0, 33).cuboid(-4.0F, -10.0F, -6.0F, 8.0F, 8.0F, 1.0F), ModelTransform.NONE);
modelPartData.addChild("cube6", ModelPartBuilder.create().uv(20, 33).cuboid(-4.0F, -10.0F, 5.0F, 8.0F, 8.0F, 1.0F), ModelTransform.NONE);
modelPartData.addChild("cube7", ModelPartBuilder.create().uv(0,0).cuboid(-5.0F, -11.0F, -5.0F, 10.0F, 10.0F, 10.0F), ModelTransform.NONE);
return modelData;
} }
@Override @Override
@@ -33,10 +45,4 @@ public class BeachBallModel extends EntityModel<BeachBallEntity> {
public void render(MatrixStack matrixStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){ public void render(MatrixStack matrixStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){
body.render(matrixStack, buffer, packedLight, packedOverlay); body.render(matrixStack, buffer, packedLight, packedOverlay);
} }
public void setRotationAngle(ModelPart modelRenderer, float x, float y, float z) {
modelRenderer.pivotX = x;
modelRenderer.pivotY = y;
modelRenderer.pivotZ = z;
}
} }

View File

@@ -1,47 +1,53 @@
package eu.midnightdust.motschen.decorative.entity.client.model; package eu.midnightdust.motschen.decorative.entity.client.model;
import eu.midnightdust.motschen.decorative.entity.BathTireEntity; import eu.midnightdust.motschen.decorative.entity.BathTireEntity;
import net.minecraft.client.model.ModelPart; import net.minecraft.client.model.*;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.entity.model.EntityModel; import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.client.render.entity.model.EntityModelLayer;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.Identifier;
public class DuckBathTireModel extends EntityModel<BathTireEntity> { public class DuckBathTireModel extends EntityModel<BathTireEntity> {
private final ModelPart body; private final ModelPart body;
public static final EntityModelLayer DUCK_BATH_TIRE_MODEL_LAYER = new EntityModelLayer(new Identifier("decorative", "duck_bath_tire"), "main");
public DuckBathTireModel() { public DuckBathTireModel(ModelPart root) {
textureWidth = 64; super(RenderLayer::getEntitySolid);
textureHeight = 64; body = root;
body.setPivot(0.0F, 20.0F, 0.0F);
}
body = new ModelPart(this); public static TexturedModelData getTexturedModelData() {
body.setPivot(0.0F, 19.0F, 0.0F); return TexturedModelData.of(getModelData(), 64, 64);
body.setTextureOffset(0, 9).addCuboid(6.0F, -3.0F, -8.0F, 4.0F, 3.0F, 16.0F, 0.0F, false); }
body.setTextureOffset(0, 37).addCuboid(-10.0F, -3.0F, -8.0F, 4.0F, 3.0F, 16.0F, 0.0F, false);
body.setTextureOffset(0, 57).addCuboid(-8.0F, -2.99F, -10.0F, 16.0F, 3.0F, 4.0F, 0.0F, false); public static ModelData getModelData(){
body.setTextureOffset(0, 29).addCuboid(-8.0F, -2.99F, 6.0F, 16.0F, 3.0F, 4.0F, 0.0F, false); ModelData modelData = new ModelData();
body.setTextureOffset(50, 0).addCuboid(-2.0F, -8.0F, -10.0F, 4.0F, 5.0F, 3.0F, 0.0F, false); ModelPartData modelPartData = modelData.getRoot();
body.setTextureOffset(46, 11).addCuboid(-2.999F, -10.0F, -12.0F, 6.0F, 5.0F, 3.0F, 0.0F, false); modelPartData.addChild("cube1", ModelPartBuilder.create().uv(0, 9).cuboid(6.0F, -3.0F, -8.0F, 4.0F, 3.0F, 16.0F), ModelTransform.NONE);
body.setTextureOffset(15, 31).addCuboid(-2.499F, -10.5F, -12.001F, 5.0F, 1.0F, 3.0F, 0.0F, false); modelPartData.addChild("cube2", ModelPartBuilder.create().uv(0, 37).cuboid(-10.0F, -3.0F, -8.0F, 4.0F, 3.0F, 16.0F), ModelTransform.NONE);
body.setTextureOffset(58, 20).addCuboid(-0.999F, -8.0F, -13.0F, 2.0F, 2.0F, 1.0F, 0.0F, false); modelPartData.addChild("cube3", ModelPartBuilder.create().uv(0, 57).cuboid(-8.0F, -2.99F, -10.0F, 16.0F, 3.0F, 4.0F), ModelTransform.NONE);
body.setTextureOffset(58, 20).addCuboid(-1.999F, -7.0F, -13.0F, 1.0F, 1.0F, 1.0F, 0.0F, false); modelPartData.addChild("cube4", ModelPartBuilder.create().uv(0, 29).cuboid(-8.0F, -2.99F, 6.0F, 16.0F, 3.0F, 4.0F), ModelTransform.NONE);
body.setTextureOffset(53, 21).addCuboid(-1.999F, -10.0F, -12.5F, 1.0F, 1.0F, 1.0F, 0.0F, false); modelPartData.addChild("cube5", ModelPartBuilder.create().uv(50, 0).cuboid(-2.0F, -8.0F, -10.0F, 4.0F, 5.0F, 3.0F), ModelTransform.NONE);
body.setTextureOffset(53, 21).addCuboid(1.001F, -10.0F, -12.5F, 1.0F, 1.0F, 1.0F, 0.0F, false); modelPartData.addChild("cube6", ModelPartBuilder.create().uv(46, 11).cuboid(-2.999F, -10.0F, -12.0F, 6.0F, 5.0F, 3.0F), ModelTransform.NONE);
body.setTextureOffset(58, 20).addCuboid(1.001F, -7.0F, -13.0F, 1.0F, 1.0F, 1.0F, 0.0F, false); modelPartData.addChild("cube7", ModelPartBuilder.create().uv(15, 31).cuboid(-2.499F, -10.5F, -12.001F, 5.0F, 1.0F, 3.0F), ModelTransform.NONE);
modelPartData.addChild("cube8", ModelPartBuilder.create().uv(58, 20).cuboid(-0.999F, -8.0F, -13.0F, 2.0F, 2.0F, 1.0F), ModelTransform.NONE);
modelPartData.addChild("cube9", ModelPartBuilder.create().uv(58, 20).cuboid(-1.999F, -7.0F, -13.0F, 1.0F, 1.0F, 1.0F), ModelTransform.NONE);
modelPartData.addChild("cube10", ModelPartBuilder.create().uv(53, 21).cuboid(-1.999F, -10.0F, -12.5F, 1.0F, 1.0F, 1.0F), ModelTransform.NONE);
modelPartData.addChild("cube11", ModelPartBuilder.create().uv(53, 21).cuboid(1.001F, -10.0F, -12.5F, 1.0F, 1.0F, 1.0F), ModelTransform.NONE);
modelPartData.addChild("cube12", ModelPartBuilder.create().uv(58, 20).cuboid(1.001F, -7.0F, -13.0F, 1.0F, 1.0F, 1.0F), ModelTransform.NONE);
return modelData;
} }
@Override @Override
public void setAngles(BathTireEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch){ public void setAngles(BathTireEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
//previously the render function, render code was moved to a method below //previously the render function, render code was moved to a method below
} }
@Override @Override
public void render(MatrixStack matrixStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){ public void render(MatrixStack matrixStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
body.render(matrixStack, buffer, packedLight, packedOverlay); body.render(matrixStack, buffer, packedLight, packedOverlay);
} }
public void setRotationAngle(ModelPart modelRenderer, float x, float y, float z) {
modelRenderer.pivotX = x;
modelRenderer.pivotY = y;
modelRenderer.pivotZ = z;
}
} }

View File

@@ -0,0 +1,24 @@
package eu.midnightdust.motschen.decorative.entity.client.renderer;
import eu.midnightdust.motschen.decorative.entity.BathTireEntity;
import eu.midnightdust.motschen.decorative.entity.client.model.BathTireModel;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.entity.EntityRendererFactory;
import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.util.DyeColor;
import net.minecraft.util.Identifier;
@Environment(EnvType.CLIENT)
public class BathTireRenderer extends MobEntityRenderer<BathTireEntity, BathTireModel> {
private final Identifier TEXTURE;
public BathTireRenderer(EntityRendererFactory.Context context, DyeColor color) {
super(context, new BathTireModel(context.getPart(BathTireModel.BATH_TIRE_MODEL_LAYER)), 0.5F);
TEXTURE = Identifier.tryParse("textures/block/"+color.getName()+"_concrete.png");
}
@Override
public Identifier getTexture(BathTireEntity entity) {
return TEXTURE;
}
}

View File

@@ -5,15 +5,17 @@ import eu.midnightdust.motschen.decorative.entity.BeachBallEntity;
import eu.midnightdust.motschen.decorative.entity.client.model.BeachBallModel; import eu.midnightdust.motschen.decorative.entity.client.model.BeachBallModel;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.render.entity.*;
import net.minecraft.client.render.entity.MobEntityRenderer; import net.minecraft.client.render.entity.feature.ArmorFeatureRenderer;
import net.minecraft.client.render.entity.feature.SlimeOverlayFeatureRenderer;
import net.minecraft.client.render.entity.model.*;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public class BeachBallRenderer extends MobEntityRenderer<BeachBallEntity, BeachBallModel> { public class BeachBallRenderer extends MobEntityRenderer<BeachBallEntity, BeachBallModel> {
public BeachBallRenderer(EntityRenderDispatcher dispatcher) { public BeachBallRenderer(EntityRendererFactory.Context context) {
super(dispatcher, new BeachBallModel(), 0.5F); super(context, new BeachBallModel(context.getPart(BeachBallModel.BEACH_BALL_MODEL_LAYER)), 0.5F);
} }
@Override @Override

View File

@@ -1,22 +0,0 @@
package eu.midnightdust.motschen.decorative.entity.client.renderer;
import eu.midnightdust.motschen.decorative.entity.BathTireEntity;
import eu.midnightdust.motschen.decorative.entity.client.model.BathTireModel;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.util.Identifier;
@Environment(EnvType.CLIENT)
public class BlackBathTireRenderer extends MobEntityRenderer<BathTireEntity, BathTireModel> {
public BlackBathTireRenderer(EntityRenderDispatcher dispatcher) {
super(dispatcher, new BathTireModel(), 0.5F);
}
@Override
public Identifier getTexture(BathTireEntity entity) {
return new Identifier("minecraft", "textures/block/black_concrete.png");
}
}

View File

@@ -1,22 +0,0 @@
package eu.midnightdust.motschen.decorative.entity.client.renderer;
import eu.midnightdust.motschen.decorative.entity.BathTireEntity;
import eu.midnightdust.motschen.decorative.entity.client.model.BathTireModel;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.util.Identifier;
@Environment(EnvType.CLIENT)
public class BlueBathTireRenderer extends MobEntityRenderer<BathTireEntity, BathTireModel> {
public BlueBathTireRenderer(EntityRenderDispatcher dispatcher) {
super(dispatcher, new BathTireModel(), 0.5F);
}
@Override
public Identifier getTexture(BathTireEntity entity) {
return new Identifier("minecraft", "textures/block/blue_concrete.png");
}
}

View File

@@ -1,22 +0,0 @@
package eu.midnightdust.motschen.decorative.entity.client.renderer;
import eu.midnightdust.motschen.decorative.entity.BathTireEntity;
import eu.midnightdust.motschen.decorative.entity.client.model.BathTireModel;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.util.Identifier;
@Environment(EnvType.CLIENT)
public class BrownBathTireRenderer extends MobEntityRenderer<BathTireEntity, BathTireModel> {
public BrownBathTireRenderer(EntityRenderDispatcher dispatcher) {
super(dispatcher, new BathTireModel(), 0.5F);
}
@Override
public Identifier getTexture(BathTireEntity entity) {
return new Identifier("minecraft", "textures/block/brown_concrete.png");
}
}

View File

@@ -1,22 +0,0 @@
package eu.midnightdust.motschen.decorative.entity.client.renderer;
import eu.midnightdust.motschen.decorative.entity.BathTireEntity;
import eu.midnightdust.motschen.decorative.entity.client.model.BathTireModel;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.util.Identifier;
@Environment(EnvType.CLIENT)
public class CyanBathTireRenderer extends MobEntityRenderer<BathTireEntity, BathTireModel> {
public CyanBathTireRenderer(EntityRenderDispatcher dispatcher) {
super(dispatcher, new BathTireModel(), 0.5F);
}
@Override
public Identifier getTexture(BathTireEntity entity) {
return new Identifier("minecraft", "textures/block/cyan_concrete.png");
}
}

View File

@@ -8,13 +8,15 @@ import eu.midnightdust.motschen.decorative.entity.client.model.DuckBathTireModel
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.EntityRendererFactory;
import net.minecraft.client.render.entity.MobEntityRenderer; import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public class DuckBathTireRenderer extends MobEntityRenderer<BathTireEntity, DuckBathTireModel> { public class DuckBathTireRenderer extends MobEntityRenderer<BathTireEntity, DuckBathTireModel> {
public DuckBathTireRenderer(EntityRendererFactory.Context context) {
public DuckBathTireRenderer(EntityRenderDispatcher dispatcher) { super(dispatcher, new DuckBathTireModel(), 0.5F); } super(context, new DuckBathTireModel(context.getPart(DuckBathTireModel.DUCK_BATH_TIRE_MODEL_LAYER)), 0.5F);
}
@Override @Override
public Identifier getTexture(BathTireEntity entity) { public Identifier getTexture(BathTireEntity entity) {

View File

@@ -1,22 +0,0 @@
package eu.midnightdust.motschen.decorative.entity.client.renderer;
import eu.midnightdust.motschen.decorative.entity.BathTireEntity;
import eu.midnightdust.motschen.decorative.entity.client.model.BathTireModel;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.util.Identifier;
@Environment(EnvType.CLIENT)
public class GrayBathTireRenderer extends MobEntityRenderer<BathTireEntity, BathTireModel> {
public GrayBathTireRenderer(EntityRenderDispatcher dispatcher) {
super(dispatcher, new BathTireModel(), 0.5F);
}
@Override
public Identifier getTexture(BathTireEntity entity) {
return new Identifier("minecraft", "textures/block/gray_concrete.png");
}
}

View File

@@ -1,22 +0,0 @@
package eu.midnightdust.motschen.decorative.entity.client.renderer;
import eu.midnightdust.motschen.decorative.entity.BathTireEntity;
import eu.midnightdust.motschen.decorative.entity.client.model.BathTireModel;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.util.Identifier;
@Environment(EnvType.CLIENT)
public class GreenBathTireRenderer extends MobEntityRenderer<BathTireEntity, BathTireModel> {
public GreenBathTireRenderer(EntityRenderDispatcher dispatcher) {
super(dispatcher, new BathTireModel(), 0.5F);
}
@Override
public Identifier getTexture(BathTireEntity entity) {
return new Identifier("minecraft", "textures/block/green_concrete.png");
}
}

View File

@@ -1,22 +0,0 @@
package eu.midnightdust.motschen.decorative.entity.client.renderer;
import eu.midnightdust.motschen.decorative.entity.BathTireEntity;
import eu.midnightdust.motschen.decorative.entity.client.model.BathTireModel;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.util.Identifier;
@Environment(EnvType.CLIENT)
public class LightBlueBathTireRenderer extends MobEntityRenderer<BathTireEntity, BathTireModel> {
public LightBlueBathTireRenderer(EntityRenderDispatcher dispatcher) {
super(dispatcher, new BathTireModel(), 0.5F);
}
@Override
public Identifier getTexture(BathTireEntity entity) {
return new Identifier("minecraft", "textures/block/light_blue_concrete.png");
}
}

View File

@@ -1,22 +0,0 @@
package eu.midnightdust.motschen.decorative.entity.client.renderer;
import eu.midnightdust.motschen.decorative.entity.BathTireEntity;
import eu.midnightdust.motschen.decorative.entity.client.model.BathTireModel;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.util.Identifier;
@Environment(EnvType.CLIENT)
public class LightGrayBathTireRenderer extends MobEntityRenderer<BathTireEntity, BathTireModel> {
public LightGrayBathTireRenderer(EntityRenderDispatcher dispatcher) {
super(dispatcher, new BathTireModel(), 0.5F);
}
@Override
public Identifier getTexture(BathTireEntity entity) {
return new Identifier("minecraft", "textures/block/light_gray_concrete.png");
}
}

View File

@@ -1,22 +0,0 @@
package eu.midnightdust.motschen.decorative.entity.client.renderer;
import eu.midnightdust.motschen.decorative.entity.BathTireEntity;
import eu.midnightdust.motschen.decorative.entity.client.model.BathTireModel;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.util.Identifier;
@Environment(EnvType.CLIENT)
public class LimeBathTireRenderer extends MobEntityRenderer<BathTireEntity, BathTireModel> {
public LimeBathTireRenderer(EntityRenderDispatcher dispatcher) {
super(dispatcher, new BathTireModel(), 0.5F);
}
@Override
public Identifier getTexture(BathTireEntity entity) {
return new Identifier("minecraft", "textures/block/lime_concrete.png");
}
}

View File

@@ -1,22 +0,0 @@
package eu.midnightdust.motschen.decorative.entity.client.renderer;
import eu.midnightdust.motschen.decorative.entity.BathTireEntity;
import eu.midnightdust.motschen.decorative.entity.client.model.BathTireModel;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.util.Identifier;
@Environment(EnvType.CLIENT)
public class MagentaBathTireRenderer extends MobEntityRenderer<BathTireEntity, BathTireModel> {
public MagentaBathTireRenderer(EntityRenderDispatcher dispatcher) {
super(dispatcher, new BathTireModel(), 0.5F);
}
@Override
public Identifier getTexture(BathTireEntity entity) {
return new Identifier("minecraft", "textures/block/magenta_concrete.png");
}
}

View File

@@ -1,22 +0,0 @@
package eu.midnightdust.motschen.decorative.entity.client.renderer;
import eu.midnightdust.motschen.decorative.entity.BathTireEntity;
import eu.midnightdust.motschen.decorative.entity.client.model.BathTireModel;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.util.Identifier;
@Environment(EnvType.CLIENT)
public class OrangeBathTireRenderer extends MobEntityRenderer<BathTireEntity, BathTireModel> {
public OrangeBathTireRenderer(EntityRenderDispatcher dispatcher) {
super(dispatcher, new BathTireModel(), 0.5F);
}
@Override
public Identifier getTexture(BathTireEntity entity) {
return new Identifier("minecraft", "textures/block/orange_concrete.png");
}
}

View File

@@ -1,22 +0,0 @@
package eu.midnightdust.motschen.decorative.entity.client.renderer;
import eu.midnightdust.motschen.decorative.entity.BathTireEntity;
import eu.midnightdust.motschen.decorative.entity.client.model.BathTireModel;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.util.Identifier;
@Environment(EnvType.CLIENT)
public class PinkBathTireRenderer extends MobEntityRenderer<BathTireEntity, BathTireModel> {
public PinkBathTireRenderer(EntityRenderDispatcher dispatcher) {
super(dispatcher, new BathTireModel(), 0.5F);
}
@Override
public Identifier getTexture(BathTireEntity entity) {
return new Identifier("minecraft", "textures/block/pink_concrete.png");
}
}

View File

@@ -1,22 +0,0 @@
package eu.midnightdust.motschen.decorative.entity.client.renderer;
import eu.midnightdust.motschen.decorative.entity.BathTireEntity;
import eu.midnightdust.motschen.decorative.entity.client.model.BathTireModel;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.util.Identifier;
@Environment(EnvType.CLIENT)
public class PurpleBathTireRenderer extends MobEntityRenderer<BathTireEntity, BathTireModel> {
public PurpleBathTireRenderer(EntityRenderDispatcher dispatcher) {
super(dispatcher, new BathTireModel(), 0.5F);
}
@Override
public Identifier getTexture(BathTireEntity entity) {
return new Identifier("minecraft", "textures/block/purple_concrete.png");
}
}

View File

@@ -1,22 +0,0 @@
package eu.midnightdust.motschen.decorative.entity.client.renderer;
import eu.midnightdust.motschen.decorative.entity.BathTireEntity;
import eu.midnightdust.motschen.decorative.entity.client.model.BathTireModel;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.util.Identifier;
@Environment(EnvType.CLIENT)
public class RedBathTireRenderer extends MobEntityRenderer<BathTireEntity, BathTireModel> {
public RedBathTireRenderer(EntityRenderDispatcher dispatcher) {
super(dispatcher, new BathTireModel(), 0.5F);
}
@Override
public Identifier getTexture(BathTireEntity entity) {
return new Identifier("minecraft", "textures/block/red_concrete.png");
}
}

View File

@@ -1,23 +0,0 @@
package eu.midnightdust.motschen.decorative.entity.client.renderer;
import eu.midnightdust.motschen.decorative.DecorativeMain;
import eu.midnightdust.motschen.decorative.entity.BathTireEntity;
import eu.midnightdust.motschen.decorative.entity.client.model.BathTireModel;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.util.Identifier;
@Environment(EnvType.CLIENT)
public class WhiteBathTireRenderer extends MobEntityRenderer<BathTireEntity, BathTireModel> {
public WhiteBathTireRenderer(EntityRenderDispatcher dispatcher) {
super(dispatcher, new BathTireModel(), 0.5F);
}
@Override
public Identifier getTexture(BathTireEntity entity) {
return new Identifier("minecraft", "textures/block/white_concrete.png");
}
}

View File

@@ -1,22 +0,0 @@
package eu.midnightdust.motschen.decorative.entity.client.renderer;
import eu.midnightdust.motschen.decorative.entity.BathTireEntity;
import eu.midnightdust.motschen.decorative.entity.client.model.BathTireModel;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.util.Identifier;
@Environment(EnvType.CLIENT)
public class YellowBathTireRenderer extends MobEntityRenderer<BathTireEntity, BathTireModel> {
public YellowBathTireRenderer(EntityRenderDispatcher dispatcher) {
super(dispatcher, new BathTireModel(), 0.5F);
}
@Override
public Identifier getTexture(BathTireEntity entity) {
return new Identifier("minecraft", "textures/block/yellow_concrete.png");
}
}

View File

View File

@@ -2,6 +2,8 @@ package eu.midnightdust.motschen.decorative.init;
import eu.midnightdust.motschen.decorative.DecorativeMain; import eu.midnightdust.motschen.decorative.DecorativeMain;
import eu.midnightdust.motschen.decorative.block.blockentity.*; import eu.midnightdust.motschen.decorative.block.blockentity.*;
import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder;
import net.minecraft.block.Blocks;
import net.minecraft.block.entity.BlockEntityType; import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
@@ -11,22 +13,16 @@ public class BlockEntities {
public static BlockEntityType<PoolSprinklerBlockEntity> PoolSprinklerBlockEntity; public static BlockEntityType<PoolSprinklerBlockEntity> PoolSprinklerBlockEntity;
public static BlockEntityType<ShowerHeadBlockEntity> ShowerHeadBlockEntity; public static BlockEntityType<ShowerHeadBlockEntity> ShowerHeadBlockEntity;
public static BlockEntityType<CeilingFanBlockEntity> CeilingFanBlockEntity; public static BlockEntityType<CeilingFanBlockEntity> CeilingFanBlockEntity;
public static BlockEntityType<OakChoppingLogBlockEntity> OakChoppingLogBlockEntity; public static BlockEntityType<ChoppingLogBlockEntity> ChoppingLogBlockEntity;
public static BlockEntityType<SpruceChoppingLogBlockEntity> SpruceChoppingLogBlockEntity; public static BlockEntityType<WallClockBlockEntity> WallClockBlockEntity;
public static BlockEntityType<BirchChoppingLogBlockEntity> BirchChoppingLogBlockEntity; public static BlockEntityType<DigitalClockBlockEntity> DigitalClockBlockEntity;
public static BlockEntityType<AcaciaChoppingLogBlockEntity> AcaciaChoppingLogBlockEntity;
public static BlockEntityType<JungleChoppingLogBlockEntity> JungleChoppingLogBlockEntity;
public static BlockEntityType<DarkOakChoppingLogBlockEntity> DarkOakChoppingLogBlockEntity;
public static void init() { public static void init() {
PoolSprinklerBlockEntity = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(DecorativeMain.MOD_ID,"pool_sprinkler_blockentity"), BlockEntityType.Builder.create(PoolSprinklerBlockEntity::new, Pool.PoolSprinkler).build(null)); PoolSprinklerBlockEntity = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(DecorativeMain.MOD_ID,"pool_sprinkler_blockentity"), FabricBlockEntityTypeBuilder.create(PoolSprinklerBlockEntity::new, Pool.PoolSprinkler).build(null));
ShowerHeadBlockEntity = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(DecorativeMain.MOD_ID,"shower_head_blockentity"), BlockEntityType.Builder.create(ShowerHeadBlockEntity::new, DecorativeMain.ShowerHead).build(null)); ShowerHeadBlockEntity = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(DecorativeMain.MOD_ID,"shower_head_blockentity"), FabricBlockEntityTypeBuilder.create(ShowerHeadBlockEntity::new, DecorativeMain.ShowerHead).build(null));
CeilingFanBlockEntity = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(DecorativeMain.MOD_ID,"ceiling_fan_blockentity"), BlockEntityType.Builder.create(CeilingFanBlockEntity::new, DecorativeMain.CeilingFan).build(null)); CeilingFanBlockEntity = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(DecorativeMain.MOD_ID,"ceiling_fan_blockentity"), FabricBlockEntityTypeBuilder.create(CeilingFanBlockEntity::new, DecorativeMain.CeilingFan).build(null));
OakChoppingLogBlockEntity = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(DecorativeMain.MOD_ID,"oak_chopping_log_blockentity"), BlockEntityType.Builder.create(OakChoppingLogBlockEntity::new, LogsWithAxes.OakChoppingLog).build(null)); ChoppingLogBlockEntity = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(DecorativeMain.MOD_ID,"chopping_log_blockentity"), FabricBlockEntityTypeBuilder.create(ChoppingLogBlockEntity::new, LogsWithAxes.OakChoppingLog, LogsWithAxes.BirchChoppingLog, LogsWithAxes.AcaciaChoppingLog, LogsWithAxes.DarkOakChoppingLog, LogsWithAxes.JungleChoppingLog, LogsWithAxes.SpruceChoppingLog).build(null));
SpruceChoppingLogBlockEntity = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(DecorativeMain.MOD_ID,"spruce_chopping_log_blockentity"), BlockEntityType.Builder.create(SpruceChoppingLogBlockEntity::new, LogsWithAxes.SpruceChoppingLog).build(null)); WallClockBlockEntity = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(DecorativeMain.MOD_ID,"wall_clock_blockentity"), FabricBlockEntityTypeBuilder.create(WallClockBlockEntity::new, DecorativeMain.WallClock).build(null));
BirchChoppingLogBlockEntity = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(DecorativeMain.MOD_ID,"birch_chopping_log_blockentity"), BlockEntityType.Builder.create(BirchChoppingLogBlockEntity::new, LogsWithAxes.BirchChoppingLog).build(null)); DigitalClockBlockEntity = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(DecorativeMain.MOD_ID,"digital_clock_blockentity"), FabricBlockEntityTypeBuilder.create(DigitalClockBlockEntity::new, Clocks.RedDigitalClock, Clocks.BlackDigitalClock, Clocks.BlueDigitalClock, Clocks.BrownDigitalClock, Clocks.CyanDigitalClock, Clocks.GrayDigitalClock, Clocks.GreenDigitalClock, Clocks.LightBlueDigitalClock, Clocks.LightGrayDigitalClock, Clocks.LimeDigitalClock, Clocks.MagentaDigitalClock, Clocks.OrangeDigitalClock, Clocks.PinkDigitalClock, Clocks.PurpleDigitalClock, Clocks.WhiteDigitalClock, Clocks.YellowDigitalClock).build(null));
AcaciaChoppingLogBlockEntity = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(DecorativeMain.MOD_ID,"acacia_chopping_log_blockentity"), BlockEntityType.Builder.create(AcaciaChoppingLogBlockEntity::new, LogsWithAxes.AcaciaChoppingLog).build(null));
JungleChoppingLogBlockEntity = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(DecorativeMain.MOD_ID,"jungle_chopping_log_blockentity"), BlockEntityType.Builder.create(JungleChoppingLogBlockEntity::new, LogsWithAxes.JungleChoppingLog).build(null));
DarkOakChoppingLogBlockEntity = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(DecorativeMain.MOD_ID,"dark_oak_chopping_log_blockentity"), BlockEntityType.Builder.create(DarkOakChoppingLogBlockEntity::new, LogsWithAxes.DarkOakChoppingLog).build(null));
} }
} }

View File

@@ -0,0 +1,63 @@
package eu.midnightdust.motschen.decorative.init;
import eu.midnightdust.motschen.decorative.DecorativeMain;
import eu.midnightdust.motschen.decorative.block.DigitalClock;
import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
public class Clocks {
public static Block WhiteDigitalClock = new DigitalClock();
public static Block OrangeDigitalClock = new DigitalClock();
public static Block MagentaDigitalClock = new DigitalClock();
public static Block LightBlueDigitalClock = new DigitalClock();
public static Block YellowDigitalClock = new DigitalClock();
public static Block LimeDigitalClock = new DigitalClock();
public static Block PinkDigitalClock = new DigitalClock();
public static Block GrayDigitalClock = new DigitalClock();
public static Block LightGrayDigitalClock = new DigitalClock();
public static Block CyanDigitalClock = new DigitalClock();
public static Block PurpleDigitalClock = new DigitalClock();
public static Block BlueDigitalClock = new DigitalClock();
public static Block BrownDigitalClock = new DigitalClock();
public static Block GreenDigitalClock = new DigitalClock();
public static Block RedDigitalClock = new DigitalClock();
public static Block BlackDigitalClock = new DigitalClock();
public static void init() {
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"white_digital_clock"), WhiteDigitalClock);
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"white_digital_clock"), new BlockItem(WhiteDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"orange_digital_clock"), OrangeDigitalClock);
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"orange_digital_clock"), new BlockItem(OrangeDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"magenta_digital_clock"), MagentaDigitalClock);
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"magenta_digital_clock"), new BlockItem(MagentaDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"light_blue_digital_clock"), LightBlueDigitalClock);
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"light_blue_digital_clock"), new BlockItem(LightBlueDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"yellow_digital_clock"), YellowDigitalClock);
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"yellow_digital_clock"), new BlockItem(YellowDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"lime_digital_clock"), LimeDigitalClock);
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"lime_digital_clock"), new BlockItem(LimeDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"pink_digital_clock"), PinkDigitalClock);
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"pink_digital_clock"), new BlockItem(PinkDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"gray_digital_clock"), GrayDigitalClock);
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"gray_digital_clock"), new BlockItem(GrayDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"light_gray_digital_clock"), LightGrayDigitalClock);
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"light_gray_digital_clock"), new BlockItem(LightGrayDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"cyan_digital_clock"), CyanDigitalClock);
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"cyan_digital_clock"), new BlockItem(CyanDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"purple_digital_clock"), PurpleDigitalClock);
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"purple_digital_clock"), new BlockItem(PurpleDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"blue_digital_clock"), BlueDigitalClock);
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"blue_digital_clock"), new BlockItem(BlueDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"brown_digital_clock"), BrownDigitalClock);
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"brown_digital_clock"), new BlockItem(BrownDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"green_digital_clock"), GreenDigitalClock);
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"green_digital_clock"), new BlockItem(GreenDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"red_digital_clock"), RedDigitalClock);
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"red_digital_clock"), new BlockItem(RedDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"black_digital_clock"), BlackDigitalClock);
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"black_digital_clock"), new BlockItem(BlackDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
}
}

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