mirror of
https://github.com/TeamMidnightDust/VisualOverhaul.git
synced 2025-12-15 13:45:09 +01:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01f894a184 | ||
|
|
775d3bd6b2 | ||
|
|
042c68d81e | ||
|
|
eb778de237 | ||
|
|
2fb840a19d | ||
|
|
316caf8a95 | ||
|
|
1bcba33aaa | ||
|
|
88e5c38337 | ||
|
|
98dee343e1 | ||
|
|
8f51167982 | ||
|
|
afac024e9e | ||
|
|
f802e803b9 | ||
|
|
0d008e40d9 |
0
.gitignore
vendored
Normal file → Executable file
0
.gitignore
vendored
Normal file → Executable file
2
README.md
Normal file → Executable file
2
README.md
Normal file → Executable file
@@ -1,2 +1,4 @@
|
||||
# VisualOverhaul
|
||||
https://www.curseforge.com/minecraft/mc-mods/visual-overhaul
|
||||
|
||||
Revamps the visual aspect of certain vanilla blocks.
|
||||
|
||||
62
build.gradle
Normal file → Executable file
62
build.gradle
Normal file → Executable file
@@ -1,10 +1,10 @@
|
||||
plugins {
|
||||
id 'fabric-loom' version '0.5-SNAPSHOT'
|
||||
id 'fabric-loom' version '0.10-SNAPSHOT'
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
|
||||
archivesBaseName = project.archives_base_name
|
||||
version = project.mod_version
|
||||
@@ -15,51 +15,51 @@ minecraft {
|
||||
|
||||
repositories {
|
||||
maven { url "https://jitpack.io" }
|
||||
maven { url "https://api.modrinth.com/maven" }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
//to change the versions see the gradle.properties file
|
||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||
modCompile "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||
|
||||
modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||
|
||||
modImplementation ("io.github.prospector:modmenu:${project.mod_menu_version}") {
|
||||
exclude group: "net.fabricmc.fabric-api"
|
||||
}
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||
|
||||
modImplementation "maven.modrinth:midnightlib:${project.midnightlib_version}"
|
||||
include "maven.modrinth:midnightlib:${project.midnightlib_version}"
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include "fabric.mod.json"
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand "version": project.version
|
||||
}
|
||||
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude "fabric.mod.json"
|
||||
}
|
||||
}
|
||||
|
||||
// ensure that the encoding is set to UTF-8, no matter what the system default is
|
||||
// this fixes some edge cases with special characters not displaying correctly
|
||||
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = "UTF-8"
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
// ensure that the encoding is set to UTF-8, no matter what the system default is
|
||||
// this fixes some edge cases with special characters not displaying correctly
|
||||
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
|
||||
// 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 = 16
|
||||
}
|
||||
|
||||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
||||
// if it is present.
|
||||
// If you remove this task, sources will not be generated.
|
||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||
classifier = "sources"
|
||||
from sourceSets.main.allSource
|
||||
java {
|
||||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
||||
// if it is present.
|
||||
// If you remove this line, sources will not be generated.
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
jar {
|
||||
from "LICENSE"
|
||||
from("LICENSE") {
|
||||
rename { "${it}_${project.archivesBaseName}"}
|
||||
}
|
||||
}
|
||||
|
||||
// configure the maven publication
|
||||
@@ -76,9 +76,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 {
|
||||
// uncomment to publish to the local maven
|
||||
// mavenLocal()
|
||||
// Add repositories to publish to here.
|
||||
// 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.
|
||||
}
|
||||
}
|
||||
|
||||
16
gradle.properties
Normal file → Executable file
16
gradle.properties
Normal file → Executable file
@@ -1,19 +1,19 @@
|
||||
# Done to increase the memory available to gradle.
|
||||
org.gradle.jvmargs=-Xmx1G
|
||||
org.gradle.jvmargs=-Xmx2G
|
||||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/use
|
||||
minecraft_version=1.16.5
|
||||
yarn_mappings=1.16.5+build.3
|
||||
loader_version=0.11.1
|
||||
minecraft_version=1.18.1
|
||||
yarn_mappings=1.18.1+build.5
|
||||
loader_version=0.12.12
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 3.0.0
|
||||
mod_version = 4.0.0
|
||||
maven_group = eu.midnightdust
|
||||
archives_base_name = visualoverhaul
|
||||
|
||||
# Dependencies
|
||||
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
||||
fabric_version=0.29.4+1.16
|
||||
|
||||
mod_menu_version = 1.14.6+build.31
|
||||
fabric_version=0.44.0+1.18
|
||||
mod_menu_version = 2.0.0-beta.5
|
||||
midnightlib_version=0.3.1
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file → Executable file
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
2
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file → Executable file
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
270
gradlew
vendored
Normal file → Executable file
270
gradlew
vendored
Normal file → Executable file
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env sh
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -17,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
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
@@ -97,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
@@ -105,84 +140,95 @@ location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
||||
25
gradlew.bat
vendored
Normal file → Executable file
25
gradlew.bat
vendored
Normal file → Executable file
@@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
@@ -51,7 +54,7 @@ goto fail
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
@@ -61,28 +64,14 @@ echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
|
||||
0
settings.gradle
Normal file → Executable file
0
settings.gradle
Normal file → Executable file
30
src/main/java/eu/midnightdust/visualoverhaul/VisualOverhaul.java
Normal file → Executable file
30
src/main/java/eu/midnightdust/visualoverhaul/VisualOverhaul.java
Normal file → Executable file
@@ -1,33 +1,11 @@
|
||||
package eu.midnightdust.visualoverhaul;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.block.PuddleBlock;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.gamerule.v1.GameRuleFactory;
|
||||
import net.fabricmc.fabric.api.gamerule.v1.GameRuleRegistry;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.GameRules;
|
||||
|
||||
public class VisualOverhaul implements ModInitializer {
|
||||
public class VisualOverhaul {
|
||||
public static final String MOD_ID = "visualoverhaul";
|
||||
public static final Block Puddle = new PuddleBlock(Fluids.WATER, FabricBlockSettings.of(Material.WATER));
|
||||
public static GameRules.Key<GameRules.IntRule> PUDDLE_SPAWN_RATE;
|
||||
public static GameRules.Key<GameRules.IntRule> SNOW_STACK_CHANCE;
|
||||
|
||||
public static final Identifier UPDATE_POTION_BOTTLES = new Identifier("visualoverhaul", "brewingstand");
|
||||
public static final Identifier UPDATE_RECORD = new Identifier("visualoverhaul", "record");
|
||||
public static final Identifier UPDATE_FURNACE_ITEMS = new Identifier("visualoverhaul", "furnace");
|
||||
|
||||
public void onInitialize() {
|
||||
PUDDLE_SPAWN_RATE = GameRuleRegistry.register("puddleSpawnRate", GameRules.Category.SPAWNING, GameRuleFactory.createIntRule(1));
|
||||
SNOW_STACK_CHANCE = GameRuleRegistry.register("snowStackChance", GameRules.Category.SPAWNING, GameRuleFactory.createIntRule(1));
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"puddle"), Puddle);
|
||||
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"puddle"), new BlockItem(Puddle, new Item.Settings()));
|
||||
}
|
||||
public static final Identifier UPDATE_POTION_BOTTLES = new Identifier(MOD_ID, "brewingstand");
|
||||
public static final Identifier UPDATE_RECORD = new Identifier(MOD_ID, "record");
|
||||
public static final Identifier UPDATE_FURNACE_ITEMS = new Identifier(MOD_ID, "furnace");
|
||||
}
|
||||
|
||||
105
src/main/java/eu/midnightdust/visualoverhaul/VisualOverhaulClient.java
Normal file → Executable file
105
src/main/java/eu/midnightdust/visualoverhaul/VisualOverhaulClient.java
Normal file → Executable file
@@ -1,28 +1,30 @@
|
||||
package eu.midnightdust.visualoverhaul;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.block.JukeboxTop;
|
||||
import eu.midnightdust.visualoverhaul.block.model.FurnaceWoodenPlanksModel;
|
||||
import eu.midnightdust.visualoverhaul.block.renderer.BrewingStandBlockEntityRenderer;
|
||||
import eu.midnightdust.visualoverhaul.block.renderer.FurnaceBlockEntityRenderer;
|
||||
import eu.midnightdust.visualoverhaul.block.renderer.JukeboxBlockEntityRenderer;
|
||||
import eu.midnightdust.visualoverhaul.config.VOConfig;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.fabricmc.fabric.api.client.rendereregistry.v1.BlockEntityRendererRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry;
|
||||
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.client.model.FabricModelPredicateProviderRegistry;
|
||||
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
|
||||
import net.fabricmc.fabric.api.resource.ResourcePackActivationType;
|
||||
import net.fabricmc.fabric.impl.blockrenderlayer.BlockRenderLayerMapImpl;
|
||||
import net.fabricmc.fabric.impl.client.rendering.ColorProviderRegistryImpl;
|
||||
import net.fabricmc.fabric.impl.client.rendering.BlockEntityRendererRegistryImpl;
|
||||
import net.fabricmc.fabric.impl.networking.ClientSidePacketRegistryImpl;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.block.entity.BrewingStandBlockEntity;
|
||||
import net.minecraft.block.entity.FurnaceBlockEntity;
|
||||
import net.minecraft.block.entity.JukeboxBlockEntity;
|
||||
import net.minecraft.block.entity.*;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.color.world.BiomeColors;
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.MusicDiscItem;
|
||||
@@ -32,17 +34,16 @@ import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.collection.DefaultedList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.BuiltinBiomes;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.logging.LogManager;
|
||||
|
||||
import static eu.midnightdust.visualoverhaul.VisualOverhaul.*;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class VisualOverhaulClient implements ClientModInitializer {
|
||||
|
||||
public static Block JukeBoxTop = new JukeboxTop();
|
||||
public static Item RoundDiscDummy = new Item(new FabricItemSettings());
|
||||
private final MinecraftClient client = MinecraftClient.getInstance();
|
||||
|
||||
@Override
|
||||
@@ -51,18 +52,31 @@ public class VisualOverhaulClient implements ClientModInitializer {
|
||||
|
||||
// Block only registered on client, because it's just used for the renderer //
|
||||
Registry.register(Registry.BLOCK, new Identifier("visualoverhaul","jukebox_top"), JukeBoxTop);
|
||||
Registry.register(Registry.ITEM, new Identifier("visualoverhaul","round_disc"), RoundDiscDummy);
|
||||
EntityModelLayerRegistry.registerModelLayer(FurnaceWoodenPlanksModel.WOODEN_PLANKS_MODEL_LAYER, FurnaceWoodenPlanksModel::getTexturedModelData);
|
||||
|
||||
|
||||
BlockRenderLayerMapImpl.INSTANCE.putBlock(Blocks.JUKEBOX, RenderLayer.getCutout());
|
||||
BlockRenderLayerMapImpl.INSTANCE.putBlock(JukeBoxTop, RenderLayer.getCutout());
|
||||
BlockRenderLayerMapImpl.INSTANCE.putBlock(Blocks.FURNACE, RenderLayer.getCutout());
|
||||
BlockRenderLayerMapImpl.INSTANCE.putBlock(Blocks.SMOKER, RenderLayer.getCutout());
|
||||
BlockRenderLayerMapImpl.INSTANCE.putBlock(Blocks.BLAST_FURNACE, RenderLayer.getCutout());
|
||||
|
||||
BlockEntityRendererRegistry.INSTANCE.register(BlockEntityType.BREWING_STAND, BrewingStandBlockEntityRenderer::new);
|
||||
BlockEntityRendererRegistry.INSTANCE.register(BlockEntityType.JUKEBOX, JukeboxBlockEntityRenderer::new);
|
||||
BlockEntityRendererRegistry.INSTANCE.register(BlockEntityType.FURNACE, FurnaceBlockEntityRenderer::new);
|
||||
BlockEntityRendererRegistryImpl.register(BlockEntityType.BREWING_STAND, BrewingStandBlockEntityRenderer::new);
|
||||
BlockEntityRendererRegistryImpl.register(BlockEntityType.JUKEBOX, JukeboxBlockEntityRenderer::new);
|
||||
BlockEntityRendererRegistryImpl.register(BlockEntityType.FURNACE, FurnaceBlockEntityRenderer::new);
|
||||
BlockEntityRendererRegistryImpl.register(BlockEntityType.SMOKER, FurnaceBlockEntityRenderer::new);
|
||||
BlockEntityRendererRegistryImpl.register(BlockEntityType.BLAST_FURNACE, FurnaceBlockEntityRenderer::new);
|
||||
|
||||
// // Phonos Compat //
|
||||
// if (FabricLoader.getInstance().isModLoaded("phonos")) {
|
||||
// PhonosCompatInit.init();
|
||||
// BlockEntityRendererRegistry.INSTANCE.register(PhonosBlocks.RADIO_JUKEBOX_ENTITY, RadioJukeboxBlockEntityRenderer::new);
|
||||
// }
|
||||
|
||||
Registry.ITEM.forEach((item) -> {
|
||||
if(item instanceof MusicDiscItem) {
|
||||
FabricModelPredicateProviderRegistry.register(item, new Identifier("round"), (stack, world, entity) -> stack.getCount() == 2 ? 1.0F : 0.0F);
|
||||
if(item instanceof MusicDiscItem || item.getName().getString().toLowerCase().contains("music_disc") || item.getName().getString().toLowerCase().contains("dynamic_disc")) {
|
||||
FabricModelPredicateProviderRegistry.register(item, new Identifier("round"), (stack, world, entity, seed) -> stack.getCount() == 2 ? 1.0F : 0.0F);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -74,8 +88,7 @@ public class VisualOverhaulClient implements ClientModInitializer {
|
||||
inv.set(i, attachedData.readItemStack());
|
||||
}
|
||||
packetContext.getTaskQueue().execute(() -> {
|
||||
if (client.world != null && client.world.getBlockEntity(pos) != null && client.world.getBlockEntity(pos) instanceof BrewingStandBlockEntity) {
|
||||
BrewingStandBlockEntity blockEntity = (BrewingStandBlockEntity) client.world.getBlockEntity(pos);
|
||||
if (client.world != null && client.world.getBlockEntity(pos) != null && client.world.getBlockEntity(pos) instanceof BrewingStandBlockEntity blockEntity) {
|
||||
blockEntity.setStack(0, inv.get(0));
|
||||
blockEntity.setStack(1, inv.get(1));
|
||||
blockEntity.setStack(2, inv.get(2));
|
||||
@@ -89,8 +102,7 @@ public class VisualOverhaulClient implements ClientModInitializer {
|
||||
BlockPos pos = attachedData.readBlockPos();
|
||||
ItemStack record = attachedData.readItemStack();
|
||||
packetContext.getTaskQueue().execute(() -> {
|
||||
if (client.world != null && client.world.getBlockEntity(pos) != null && client.world.getBlockEntity(pos) instanceof JukeboxBlockEntity) {
|
||||
JukeboxBlockEntity blockEntity = (JukeboxBlockEntity) client.world.getBlockEntity(pos);
|
||||
if (client.world != null && client.world.getBlockEntity(pos) != null && client.world.getBlockEntity(pos) instanceof JukeboxBlockEntity blockEntity) {
|
||||
blockEntity.setRecord(record);
|
||||
}
|
||||
});
|
||||
@@ -103,8 +115,7 @@ public class VisualOverhaulClient implements ClientModInitializer {
|
||||
inv.set(i, attachedData.readItemStack());
|
||||
}
|
||||
packetContext.getTaskQueue().execute(() -> {
|
||||
if (client.world != null && client.world.getBlockEntity(pos) != null && client.world.getBlockEntity(pos) instanceof FurnaceBlockEntity) {
|
||||
FurnaceBlockEntity blockEntity = (FurnaceBlockEntity) client.world.getBlockEntity(pos);
|
||||
if (client.world != null && client.world.getBlockEntity(pos) != null && client.world.getBlockEntity(pos) instanceof AbstractFurnaceBlockEntity blockEntity) {
|
||||
blockEntity.setStack(0, inv.get(0));
|
||||
blockEntity.setStack(1, inv.get(1));
|
||||
blockEntity.setStack(2, inv.get(2));
|
||||
@@ -114,43 +125,57 @@ public class VisualOverhaulClient implements ClientModInitializer {
|
||||
|
||||
// Register builtin resourcepacks
|
||||
FabricLoader.getInstance().getModContainer("visualoverhaul").ifPresent(modContainer -> {
|
||||
ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("visualoverhaul:nobottles"), "resourcepacks/nobrewingbottles", modContainer, true);
|
||||
ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("visualoverhaul:fancyfurnace"), "resourcepacks/fancyfurnace", modContainer, true);
|
||||
ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("visualoverhaul:coloredwaterbucket"), "resourcepacks/coloredwaterbucket", modContainer, true);
|
||||
ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("visualoverhaul","nobrewingbottles"), modContainer, ResourcePackActivationType.DEFAULT_ENABLED);
|
||||
ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("visualoverhaul","fancyfurnace"), modContainer, ResourcePackActivationType.DEFAULT_ENABLED);
|
||||
ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("visualoverhaul","coloredwaterbucket"), modContainer, ResourcePackActivationType.DEFAULT_ENABLED);
|
||||
});
|
||||
|
||||
// Context Colored Items
|
||||
|
||||
// Biome-colored Items
|
||||
if (VOConfig.coloredItems) {
|
||||
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||
int waterColor;
|
||||
int foliageColor;
|
||||
if (client.world != null) {
|
||||
Biome biome = client.world.getBiome(client.player.getBlockPos());
|
||||
waterColor = biome.getWaterColor();
|
||||
foliageColor = biome.getFoliageColor();
|
||||
} else {
|
||||
waterColor = BuiltinBiomes.PLAINS.getWaterColor();
|
||||
foliageColor = BuiltinBiomes.PLAINS.getFoliageColor();
|
||||
int grassColor;
|
||||
if (client.world != null && client.player != null) {
|
||||
waterColor = BiomeColors.getWaterColor(client.world, client.player.getBlockPos());
|
||||
foliageColor = BiomeColors.getFoliageColor(client.world, client.player.getBlockPos());
|
||||
grassColor = BiomeColors.getGrassColor(client.world, client.player.getBlockPos());
|
||||
}
|
||||
else {
|
||||
waterColor = 4159204;
|
||||
foliageColor = -8934609;
|
||||
grassColor = -8934609;
|
||||
}
|
||||
ColorProviderRegistry.ITEM.register((stack, tintIndex) -> waterColor, VisualOverhaul.Puddle);
|
||||
ColorProviderRegistry.ITEM.register((stack, tintIndex) -> tintIndex == 0 ? -1 : waterColor, Items.WATER_BUCKET);
|
||||
ColorProviderRegistry.ITEM.register((stack, tintIndex) -> foliageColor, Items.GRASS_BLOCK);
|
||||
ColorProviderRegistry.ITEM.register((stack, tintIndex) -> grassColor, Items.GRASS_BLOCK);
|
||||
ColorProviderRegistry.ITEM.register((stack, tintIndex) -> grassColor, Items.GRASS);
|
||||
ColorProviderRegistry.ITEM.register((stack, tintIndex) -> grassColor, Items.TALL_GRASS);
|
||||
ColorProviderRegistry.ITEM.register((stack, tintIndex) -> grassColor, Items.FERN);
|
||||
ColorProviderRegistry.ITEM.register((stack, tintIndex) -> grassColor, Items.LARGE_FERN);
|
||||
ColorProviderRegistry.ITEM.register((stack, tintIndex) -> foliageColor, Items.ACACIA_LEAVES);
|
||||
ColorProviderRegistry.ITEM.register((stack, tintIndex) -> foliageColor, Items.DARK_OAK_LEAVES);
|
||||
ColorProviderRegistry.ITEM.register((stack, tintIndex) -> foliageColor, Items.JUNGLE_LEAVES);
|
||||
ColorProviderRegistry.ITEM.register((stack, tintIndex) -> foliageColor, Items.OAK_LEAVES);
|
||||
ColorProviderRegistry.ITEM.register((stack, tintIndex) -> {
|
||||
if (PotionUtil.getPotion(stack) == Potions.WATER && tintIndex == 0) {
|
||||
if ((PotionUtil.getPotion(stack) == Potions.WATER || PotionUtil.getPotion(stack) == Potions.MUNDANE || PotionUtil.getPotion(stack) == Potions.THICK || PotionUtil.getPotion(stack) == Potions.AWKWARD) && tintIndex == 0) {
|
||||
return waterColor;
|
||||
}
|
||||
return tintIndex > 0 ? -1 : PotionUtil.getColor(stack);
|
||||
}, Items.POTION);
|
||||
ColorProviderRegistry.ITEM.register((stack, tintIndex) -> {
|
||||
if ((PotionUtil.getPotion(stack) == Potions.WATER || PotionUtil.getPotion(stack) == Potions.MUNDANE || PotionUtil.getPotion(stack) == Potions.THICK || PotionUtil.getPotion(stack) == Potions.AWKWARD) && tintIndex == 0) {
|
||||
return waterColor;
|
||||
}
|
||||
return tintIndex > 0 ? -1 : PotionUtil.getColor(stack);
|
||||
}, Items.SPLASH_POTION);
|
||||
ColorProviderRegistry.ITEM.register((stack, tintIndex) -> {
|
||||
if ((PotionUtil.getPotion(stack) == Potions.WATER || PotionUtil.getPotion(stack) == Potions.MUNDANE || PotionUtil.getPotion(stack) == Potions.THICK || PotionUtil.getPotion(stack) == Potions.AWKWARD) && tintIndex == 0) {
|
||||
return waterColor;
|
||||
}
|
||||
return tintIndex > 0 ? -1 : PotionUtil.getColor(stack);
|
||||
}, Items.LINGERING_POTION);
|
||||
});
|
||||
}
|
||||
// Else just register a static color for our puddle item
|
||||
else {
|
||||
ColorProviderRegistry.ITEM.register((stack, tintIndex) -> BuiltinBiomes.PLAINS.getWaterColor(), Puddle);
|
||||
}
|
||||
ColorProviderRegistry.BLOCK.register((state, view, pos, tintIndex) -> Objects.requireNonNull(ColorProviderRegistryImpl.BLOCK.get(Blocks.WATER)).getColor(state, view, pos, tintIndex), Puddle);
|
||||
}
|
||||
}
|
||||
|
||||
19
src/main/java/eu/midnightdust/visualoverhaul/block/JukeboxTop.java
Normal file → Executable file
19
src/main/java/eu/midnightdust/visualoverhaul/block/JukeboxTop.java
Normal file → Executable file
@@ -9,15 +9,14 @@ import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.property.Properties;
|
||||
|
||||
public class JukeboxTop extends Block {
|
||||
private static final BooleanProperty HAS_RECORD = Properties.HAS_RECORD;
|
||||
|
||||
private static final BooleanProperty HAS_RECORD = Properties.HAS_RECORD;
|
||||
|
||||
public JukeboxTop() {
|
||||
super(FabricBlockSettings.copy(Blocks.JUKEBOX));
|
||||
this.setDefaultState(this.stateManager.getDefaultState().with(HAS_RECORD,false));
|
||||
}
|
||||
@Override
|
||||
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
|
||||
builder.add(HAS_RECORD);
|
||||
}
|
||||
public JukeboxTop() {
|
||||
super(FabricBlockSettings.copy(Blocks.JUKEBOX));
|
||||
this.setDefaultState(this.stateManager.getDefaultState().with(HAS_RECORD,false));
|
||||
}
|
||||
@Override
|
||||
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
|
||||
builder.add(HAS_RECORD);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
package eu.midnightdust.visualoverhaul.block;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.entity.ai.pathing.NavigationType;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.fluid.*;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.loot.context.LootContext;
|
||||
import net.minecraft.potion.PotionUtil;
|
||||
import net.minecraft.potion.Potions;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.stat.Stats;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import net.minecraft.world.WorldView;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class PuddleBlock extends Block {
|
||||
|
||||
protected final FlowableFluid fluid;
|
||||
public static final VoxelShape COLLISION_SHAPE;
|
||||
|
||||
public PuddleBlock(FlowableFluid fluid, AbstractBlock.Settings settings) {
|
||||
super(settings);
|
||||
this.fluid = fluid;
|
||||
}
|
||||
@Override
|
||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
|
||||
ItemStack itemStack = player.getStackInHand(hand);
|
||||
if (itemStack.isEmpty()) {
|
||||
return ActionResult.PASS;
|
||||
} else {
|
||||
Item item = itemStack.getItem();
|
||||
ItemStack waterBottleStack;
|
||||
if (item == Items.GLASS_BOTTLE) {
|
||||
if (!world.isClient) {
|
||||
if (!player.abilities.creativeMode) {
|
||||
waterBottleStack = PotionUtil.setPotion(new ItemStack(Items.POTION), Potions.WATER);
|
||||
player.incrementStat(Stats.USE_CAULDRON);
|
||||
itemStack.decrement(1);
|
||||
if (itemStack.isEmpty()) {
|
||||
player.setStackInHand(hand, waterBottleStack);
|
||||
} else if (!player.inventory.insertStack(waterBottleStack)) {
|
||||
player.dropItem(waterBottleStack, false);
|
||||
} else if (player instanceof ServerPlayerEntity) {
|
||||
((ServerPlayerEntity)player).refreshScreenHandler(player.playerScreenHandler);
|
||||
}
|
||||
}
|
||||
|
||||
world.playSound(null, pos, SoundEvents.ITEM_BOTTLE_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||
}
|
||||
return ActionResult.success(world.isClient);
|
||||
}
|
||||
else return ActionResult.FAIL;
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public boolean hasRandomTicks(BlockState state) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
|
||||
if (!world.isRaining() && random.nextInt(2000) == 0) {
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||
}
|
||||
|
||||
this.scheduledTick(state, world, pos, random);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
||||
return context.isAbove(COLLISION_SHAPE, pos, true) ? COLLISION_SHAPE : VoxelShapes.empty();
|
||||
}
|
||||
@Override
|
||||
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
||||
return COLLISION_SHAPE;
|
||||
}
|
||||
@Override
|
||||
public VoxelShape getCullingShape(BlockState state, BlockView world, BlockPos pos) {
|
||||
return VoxelShapes.empty();
|
||||
}
|
||||
|
||||
public boolean canPathfindThrough(BlockState state, BlockView world, BlockPos pos, NavigationType type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public FluidState getFluidState(BlockState state) {
|
||||
return fluid.getFlowing(1,false);
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public boolean isSideInvisible(BlockState state, BlockState stateFrom, Direction direction) {
|
||||
return stateFrom.getFluidState().getFluid().matchesType(this.fluid);
|
||||
}
|
||||
|
||||
public BlockRenderType getRenderType(BlockState state) {
|
||||
return BlockRenderType.INVISIBLE;
|
||||
}
|
||||
|
||||
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
|
||||
return world.getBlockState(pos.down()).isSideSolidFullSquare(world,pos,Direction.UP);
|
||||
}
|
||||
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) {
|
||||
return !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, direction, newState, world, pos, posFrom);
|
||||
}
|
||||
|
||||
static {
|
||||
COLLISION_SHAPE = net.minecraft.block.Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 0.5D, 16.0D);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package eu.midnightdust.visualoverhaul.block.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 FurnaceWoodenPlanksModel extends Model {
|
||||
private static ModelPart bb_main;
|
||||
public static final EntityModelLayer WOODEN_PLANKS_MODEL_LAYER = new EntityModelLayer(new Identifier("visualoverhaul", "wooden_planks"), "main");
|
||||
|
||||
public FurnaceWoodenPlanksModel(ModelPart root) {
|
||||
super(RenderLayer::getEntitySolid);
|
||||
bb_main = root;
|
||||
bb_main.setPivot(0.0F, 24.0F, 0.0F);
|
||||
}
|
||||
public ModelPart getPart() {
|
||||
return bb_main;
|
||||
}
|
||||
|
||||
public static TexturedModelData getTexturedModelData() {
|
||||
return TexturedModelData.of(getModelData(), 16, 16);
|
||||
}
|
||||
|
||||
public static ModelData getModelData(){
|
||||
ModelData modelData = new ModelData();
|
||||
ModelPartData modelPartData = modelData.getRoot();
|
||||
modelPartData.addChild("cube_r1", ModelPartBuilder.create().uv(0, 0).cuboid(-10.0F, -3.0F, 0.0F, 10.0F, 1.0F, 1.0F), ModelTransform.of(6.0F, 1.0F, -2.0F,0.0F, -0.5672F, 0.0F));
|
||||
modelPartData.addChild("cube_r2", ModelPartBuilder.create().uv(0, 0).cuboid(-10.0F, -2.5F, 0.0F, 10.0F, 2.0F, 2.0F), ModelTransform.of(5.0F, 0.0F, -5.0F,0.0F, -0.1309F, 0.0F));
|
||||
modelPartData.addChild("cube_r3", ModelPartBuilder.create().uv(0, 0).cuboid(-10.0F, -2.0F, 0.0F, 10.0F, 2.0F, 2.0F), ModelTransform.of(5.0F, -1.0F, -7.0F,0.0F, 0.2618F, 0.0F));
|
||||
return modelData;
|
||||
}
|
||||
|
||||
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) {
|
||||
bb_main.render(matrices, vertices, light, overlay, red, green, blue, alpha);
|
||||
}
|
||||
}
|
||||
55
src/main/java/eu/midnightdust/visualoverhaul/block/renderer/BrewingStandBlockEntityRenderer.java
Normal file → Executable file
55
src/main/java/eu/midnightdust/visualoverhaul/block/renderer/BrewingStandBlockEntityRenderer.java
Normal file → Executable file
@@ -7,18 +7,19 @@ import net.minecraft.block.entity.BrewingStandBlockEntity;
|
||||
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.block.entity.BlockEntityRendererFactory;
|
||||
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.util.math.Vec3f;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class BrewingStandBlockEntityRenderer extends BlockEntityRenderer<BrewingStandBlockEntity> {
|
||||
public class BrewingStandBlockEntityRenderer implements BlockEntityRenderer<BrewingStandBlockEntity> {
|
||||
|
||||
public BrewingStandBlockEntityRenderer(BlockEntityRenderDispatcher blockEntityRenderDispatcher) {
|
||||
super(blockEntityRenderDispatcher);
|
||||
public BrewingStandBlockEntityRenderer(BlockEntityRendererFactory.Context ctx) {
|
||||
}
|
||||
|
||||
|
||||
@@ -26,35 +27,41 @@ public class BrewingStandBlockEntityRenderer extends BlockEntityRenderer<Brewing
|
||||
public void render(BrewingStandBlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
|
||||
|
||||
if (VOConfig.brewingstand) {
|
||||
int lightAtBlock = WorldRenderer.getLightmapCoordinates(blockEntity.getWorld(), blockEntity.getPos());
|
||||
int lightAtBlock = WorldRenderer.getLightmapCoordinates(Objects.requireNonNull(blockEntity.getWorld()), blockEntity.getPos());
|
||||
ItemStack item1 = blockEntity.getStack(0);
|
||||
ItemStack item2 = blockEntity.getStack(1);
|
||||
ItemStack item3 = blockEntity.getStack(2);
|
||||
|
||||
matrices.push();
|
||||
if (!item1.isEmpty()) {
|
||||
matrices.push();
|
||||
|
||||
matrices.translate(0.86f, 0.23f, 0.5f);
|
||||
matrices.scale(1.15f, 1.15f, 1.15f);
|
||||
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(180));
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(item1, ModelTransformation.Mode.GROUND, lightAtBlock, overlay, matrices, vertexConsumers);
|
||||
matrices.translate(0.86f, 0.23f, 0.5f);
|
||||
matrices.scale(1.15f, 1.15f, 1.15f);
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(180));
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(item1, ModelTransformation.Mode.GROUND, lightAtBlock, overlay, matrices, vertexConsumers, 0);
|
||||
|
||||
matrices.pop();
|
||||
matrices.push();
|
||||
matrices.pop();
|
||||
}
|
||||
if (!item2.isEmpty()) {
|
||||
matrices.push();
|
||||
|
||||
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(315));
|
||||
matrices.translate(0.32f, 0.23f, 0f);
|
||||
matrices.scale(1.15f, 1.15f, 1.15f);
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(item2, ModelTransformation.Mode.GROUND, lightAtBlock, overlay, matrices, vertexConsumers);
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(315));
|
||||
matrices.translate(0.32f, 0.23f, 0f);
|
||||
matrices.scale(1.15f, 1.15f, 1.15f);
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(item2, ModelTransformation.Mode.GROUND, lightAtBlock, overlay, matrices, vertexConsumers, 0);
|
||||
|
||||
matrices.pop();
|
||||
matrices.push();
|
||||
matrices.pop();
|
||||
}
|
||||
if (!item3.isEmpty()) {
|
||||
matrices.push();
|
||||
|
||||
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(45));
|
||||
matrices.translate(-0.39f, 0.23f, 0.705f);
|
||||
matrices.scale(1.15f, 1.15f, 1.15f);
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(item3, ModelTransformation.Mode.GROUND, lightAtBlock, overlay, matrices, vertexConsumers);
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(45));
|
||||
matrices.translate(-0.39f, 0.23f, 0.705f);
|
||||
matrices.scale(1.15f, 1.15f, 1.15f);
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(item3, ModelTransformation.Mode.GROUND, lightAtBlock, overlay, matrices, vertexConsumers, 0);
|
||||
|
||||
matrices.pop();
|
||||
matrices.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
104
src/main/java/eu/midnightdust/visualoverhaul/block/renderer/FurnaceBlockEntityRenderer.java
Normal file → Executable file
104
src/main/java/eu/midnightdust/visualoverhaul/block/renderer/FurnaceBlockEntityRenderer.java
Normal file → Executable file
@@ -1,109 +1,87 @@
|
||||
package eu.midnightdust.visualoverhaul.block.renderer;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.block.model.FurnaceWoodenPlanksModel;
|
||||
import eu.midnightdust.visualoverhaul.config.VOConfig;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.entity.FurnaceBlockEntity;
|
||||
import net.minecraft.block.entity.AbstractFurnaceBlockEntity;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.model.ModelPart;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
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.block.entity.BlockEntityRendererFactory;
|
||||
import net.minecraft.client.render.model.json.ModelTransformation;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tag.ItemTags;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class FurnaceBlockEntityRenderer extends BlockEntityRenderer<FurnaceBlockEntity> {
|
||||
private static final ModelPart bb_main;
|
||||
private static final ModelPart cube_r1;
|
||||
private static final ModelPart cube_r2;
|
||||
private static final ModelPart cube_r3;
|
||||
public class FurnaceBlockEntityRenderer<E extends AbstractFurnaceBlockEntity> implements BlockEntityRenderer<E> {
|
||||
private final FurnaceWoodenPlanksModel planks;
|
||||
|
||||
static {
|
||||
bb_main = new ModelPart(16, 16, 0, 0);
|
||||
bb_main.setPivot(0.0F, 24.0F, 0.0F);
|
||||
|
||||
cube_r1 = new ModelPart(16, 16, 0, 0);
|
||||
cube_r1.setPivot(6.0F, 1.0F, -2.0F);
|
||||
bb_main.addChild(cube_r1);
|
||||
setRotationAngle(cube_r1, 0.0F, -0.5672F, 0.0F);
|
||||
cube_r1.setTextureOffset(0, 0).addCuboid(-10.0F, -3.0F, 0.0F, 10.0F, 1.0F, 1.0F, 0.0F, false);
|
||||
|
||||
cube_r2 = new ModelPart(16, 16, 0, 0);
|
||||
cube_r2.setPivot(5.0F, 0.0F, -5.0F);
|
||||
bb_main.addChild(cube_r2);
|
||||
setRotationAngle(cube_r2, 0.0F, -0.1309F, 0.0F);
|
||||
cube_r2.setTextureOffset(0, 0).addCuboid(-10.0F, -2.5F, 0.0F, 10.0F, 2.0F, 2.0F, 0.0F, false);
|
||||
|
||||
cube_r3 = new ModelPart(16, 16, 0, 0);
|
||||
cube_r3.setPivot(5.0F, -1.0F, -7.0F);
|
||||
bb_main.addChild(cube_r3);
|
||||
setRotationAngle(cube_r3, 0.0F, 0.2618F, 0.0F);
|
||||
cube_r3.setTextureOffset(0, 0).addCuboid(-10.0F, -2.0F, 0.0F, 10.0F, 2.0F, 2.0F, 0.0F, false);
|
||||
}
|
||||
public static void setRotationAngle(ModelPart bone, float x, float y, float z) {
|
||||
bone.pitch = x;
|
||||
bone.yaw = y;
|
||||
bone.roll = z;
|
||||
public FurnaceBlockEntityRenderer(BlockEntityRendererFactory.Context ctx) {
|
||||
this.planks = new FurnaceWoodenPlanksModel(ctx.getLayerModelPart(FurnaceWoodenPlanksModel.WOODEN_PLANKS_MODEL_LAYER));
|
||||
}
|
||||
|
||||
public FurnaceBlockEntityRenderer(BlockEntityRenderDispatcher blockEntityRenderDispatcher) {
|
||||
super(blockEntityRenderDispatcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(FurnaceBlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
|
||||
if (VOConfig.furnace && blockEntity.getCachedState().getBlock().is(Blocks.FURNACE)) {
|
||||
public void render(E blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
|
||||
if (VOConfig.furnace && blockEntity != null) {
|
||||
BlockState blockState = blockEntity.getCachedState();
|
||||
int lightAtBlock = WorldRenderer.getLightmapCoordinates(blockEntity.getWorld(), blockEntity.getPos().offset(blockState.get(AbstractFurnaceBlock.FACING)));
|
||||
int lightAtBlock = WorldRenderer.getLightmapCoordinates(Objects.requireNonNull(blockEntity.getWorld()), blockEntity.getPos().offset(blockState.get(AbstractFurnaceBlock.FACING)));
|
||||
ItemStack item1 = blockEntity.getStack(0);
|
||||
ItemStack item2 = blockEntity.getStack(1);
|
||||
float angle = (blockState.get(AbstractFurnaceBlock.FACING)).asRotation();
|
||||
|
||||
matrices.push();
|
||||
|
||||
matrices.translate(0.5f, 0.58f, 0.5f);
|
||||
matrices.scale(1f, 1f, 1f);
|
||||
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(angle * 3 + 180));
|
||||
matrices.translate(0.0f, 0.0f, -0.4f);
|
||||
matrices.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(90));
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(item1, ModelTransformation.Mode.GROUND, lightAtBlock, overlay, matrices, vertexConsumers);
|
||||
|
||||
|
||||
matrices.pop();
|
||||
if (!item2.getItem().isIn(ItemTags.LOGS_THAT_BURN) && !item2.getItem().isIn(ItemTags.PLANKS)) {
|
||||
if(!item1.isEmpty()) {
|
||||
matrices.push();
|
||||
|
||||
matrices.translate(0.5f, 0.08f, 0.5f);
|
||||
matrices.translate(0.5f, 0.58f, 0.5f);
|
||||
if (blockEntity.getCachedState().getBlock().equals(Blocks.SMOKER)) matrices.translate(0f, -0.06f, 0f);
|
||||
if (blockEntity.getCachedState().getBlock().equals(Blocks.BLAST_FURNACE)) matrices.translate(0f, -0.25f, 0f);
|
||||
matrices.scale(1f, 1f, 1f);
|
||||
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(angle * 3 + 180));
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(angle * 3 + 180));
|
||||
matrices.translate(0.0f, 0.0f, -0.4f);
|
||||
matrices.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(90));
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(item2, ModelTransformation.Mode.GROUND, lightAtBlock, overlay, matrices, vertexConsumers);
|
||||
matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(90));
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(item1, ModelTransformation.Mode.GROUND, lightAtBlock, overlay, matrices, vertexConsumers, 0);
|
||||
|
||||
|
||||
matrices.pop();
|
||||
}
|
||||
if (item2.getItem().isIn(ItemTags.LOGS_THAT_BURN) || item2.getItem().isIn(ItemTags.PLANKS)) {
|
||||
if (!item2.isEmpty() && !ItemTags.LOGS_THAT_BURN.contains(item2.getItem()) && !ItemTags.PLANKS.contains(item2.getItem())) {
|
||||
matrices.push();
|
||||
|
||||
matrices.translate(0.5f, 0.08f, 0.5f);
|
||||
if (blockEntity.getCachedState().getBlock().equals(Blocks.SMOKER)) matrices.translate(0f, 0.06f, 0f);
|
||||
if (blockEntity.getCachedState().getBlock().equals(Blocks.BLAST_FURNACE)) matrices.translate(0f, 0.24f, 0f);
|
||||
matrices.scale(1f, 1f, 1f);
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(angle * 3 + 180));
|
||||
matrices.translate(0.0f, 0.0f, -0.4f);
|
||||
matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(90));
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(item2, ModelTransformation.Mode.GROUND, lightAtBlock, overlay, matrices, vertexConsumers,0);
|
||||
|
||||
matrices.pop();
|
||||
}
|
||||
else if (!item2.isEmpty()) {
|
||||
matrices.push();
|
||||
BlockState state = Block.getBlockFromItem(item2.getItem()).getDefaultState();
|
||||
Sprite texture = MinecraftClient.getInstance().getBlockRenderManager().getModel(state).getSprite();
|
||||
Sprite texture = MinecraftClient.getInstance().getBlockRenderManager().getModel(state).getParticleSprite();
|
||||
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getEntityCutoutNoCull(spriteToTexture(texture)));
|
||||
|
||||
matrices.translate(0.5f, -1.3f, 0.5f);
|
||||
if (blockEntity.getCachedState().getBlock().equals(Blocks.SMOKER)) matrices.translate(0f, 0.06f, 0f);
|
||||
if (blockEntity.getCachedState().getBlock().equals(Blocks.BLAST_FURNACE)) matrices.translate(0f, 0.2f, 0f);
|
||||
matrices.scale(1f, 1f, 1f);
|
||||
|
||||
|
||||
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(angle * 3 + 180));
|
||||
bb_main.render(matrices, vertexConsumer, lightAtBlock, overlay);
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(angle * 3 + 180));
|
||||
planks.getPart().render(matrices, vertexConsumer, lightAtBlock, overlay);
|
||||
matrices.pop();
|
||||
}
|
||||
}
|
||||
|
||||
68
src/main/java/eu/midnightdust/visualoverhaul/block/renderer/JukeboxBlockEntityRenderer.java
Normal file → Executable file
68
src/main/java/eu/midnightdust/visualoverhaul/block/renderer/JukeboxBlockEntityRenderer.java
Normal file → Executable file
@@ -2,47 +2,81 @@ package eu.midnightdust.visualoverhaul.block.renderer;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.VisualOverhaulClient;
|
||||
import eu.midnightdust.visualoverhaul.config.VOConfig;
|
||||
import eu.midnightdust.visualoverhaul.util.SoundTest;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.block.SideShapeType;
|
||||
import net.minecraft.block.entity.JukeboxBlockEntity;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
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.block.entity.BlockEntityRendererFactory;
|
||||
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.state.property.Properties;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.*;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class JukeboxBlockEntityRenderer extends BlockEntityRenderer<JukeboxBlockEntity> {
|
||||
public class JukeboxBlockEntityRenderer implements BlockEntityRenderer<JukeboxBlockEntity> {
|
||||
private ItemStack record;
|
||||
private Identifier discItem;
|
||||
|
||||
public JukeboxBlockEntityRenderer(BlockEntityRenderDispatcher blockEntityRenderDispatcher) {
|
||||
super(blockEntityRenderDispatcher);
|
||||
public JukeboxBlockEntityRenderer(BlockEntityRendererFactory.Context ctx) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(JukeboxBlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
|
||||
|
||||
if (VOConfig.jukebox) {
|
||||
int lightAbove = WorldRenderer.getLightmapCoordinates(blockEntity.getWorld(), blockEntity.getPos().up());
|
||||
ItemStack record = blockEntity.getRecord();
|
||||
record.setCount(2);
|
||||
int lightAbove = WorldRenderer.getLightmapCoordinates(Objects.requireNonNull(blockEntity.getWorld()), blockEntity.getPos().up());
|
||||
|
||||
matrices.push();
|
||||
// Tries to get the disc using the serverside method
|
||||
if (blockEntity.getRecord() != ItemStack.EMPTY) {
|
||||
record = blockEntity.getRecord().copy();
|
||||
}
|
||||
// Else gets the record sound played at the position of the jukebox //
|
||||
else if (SoundTest.getSound(blockEntity.getPos()) != null) {
|
||||
// Converts the Sound Id to the item id of the approprieate disc (minecraft:music_disc.cat -> minecraft:music_disc_cat) //
|
||||
discItem = new Identifier(String.valueOf(SoundTest.getSound(blockEntity.getPos())).replace(".", "_"));
|
||||
|
||||
matrices.translate(0.5f, 1.03f, 0.5f);
|
||||
matrices.scale(0.75f, 0.75f, 0.75f);
|
||||
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion((blockEntity.getWorld().getTime() + tickDelta) * 4));
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(record, ModelTransformation.Mode.GROUND, lightAbove, overlay, matrices, vertexConsumers);
|
||||
// Tries to get the disc item from the registry //
|
||||
if (Registry.ITEM.getOrEmpty(discItem).isPresent()) {
|
||||
|
||||
matrices.pop();
|
||||
if (VOConfig.jukebox_fake_block) {
|
||||
record = new ItemStack(Registry.ITEM.get(discItem));
|
||||
}
|
||||
else {
|
||||
LogManager.getLogger("VisualOverhaul").warn("Error getting music disc item for" + SoundTest.getSound(blockEntity.getPos()));
|
||||
discItem = null;
|
||||
record = ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
// If the sound is stopped or no sound is playing, the stack is set to an empty stack //
|
||||
else {
|
||||
discItem = null;
|
||||
record = ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (!record.isEmpty()) {
|
||||
record.setCount(2);
|
||||
matrices.push();
|
||||
|
||||
matrices.translate(0.5f, 1.03f, 0.5f);
|
||||
matrices.scale(0.75f, 0.75f, 0.75f);
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(Util.getMeasuringTimeMs() / 9.0f));
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(record, ModelTransformation.Mode.GROUND, lightAbove, overlay, matrices, vertexConsumers, 0);
|
||||
|
||||
matrices.pop();
|
||||
}
|
||||
if (VOConfig.jukebox_fake_block && !blockEntity.getWorld().getBlockState(blockEntity.getPos().up()).isSideSolid(blockEntity.getWorld(),blockEntity.getPos().up(), Direction.DOWN, SideShapeType.FULL)) {
|
||||
matrices.push();
|
||||
matrices.translate(0f, 1f, 0f);
|
||||
if (record == ItemStack.EMPTY) {
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package eu.midnightdust.visualoverhaul.compat.phonos.block;
|
||||
|
||||
//import io.github.foundationgames.phonos.block.PhonosBlocks;
|
||||
//import io.github.foundationgames.phonos.block.RadioJukeboxBlock;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.property.IntProperty;
|
||||
|
||||
//public class RadioJukeboxTop extends Block {
|
||||
// public static final BooleanProperty PLAYING = RadioJukeboxBlock.PLAYING;
|
||||
// public static final IntProperty CHANNEL = RadioJukeboxBlock.CHANNEL;
|
||||
//
|
||||
// public RadioJukeboxTop() {
|
||||
// super(FabricBlockSettings.copy(PhonosBlocks.RADIO_JUKEBOX));
|
||||
// this.setDefaultState(this.stateManager.getDefaultState());
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
|
||||
// builder.add(PLAYING, CHANNEL);
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,74 @@
|
||||
package eu.midnightdust.visualoverhaul.compat.phonos.block.renderer;
|
||||
//
|
||||
//import eu.midnightdust.visualoverhaul.compat.phonos.block.RadioJukeboxTop;
|
||||
//import eu.midnightdust.visualoverhaul.compat.phonos.init.PhonosCompatInit;
|
||||
//import eu.midnightdust.visualoverhaul.config.VOConfig;
|
||||
//import io.github.foundationgames.phonos.block.RadioJukeboxBlock;
|
||||
//import io.github.foundationgames.phonos.block.entity.RadioJukeboxBlockEntity;
|
||||
//import net.fabricmc.api.EnvType;
|
||||
//import net.fabricmc.api.Environment;
|
||||
//import net.minecraft.block.BlockState;
|
||||
//import net.minecraft.block.Blocks;
|
||||
//import net.minecraft.client.MinecraftClient;
|
||||
//import net.minecraft.client.render.RenderLayer;
|
||||
//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.item.ItemStack;
|
||||
//
|
||||
//import java.util.Random;
|
||||
//
|
||||
//@Environment(EnvType.CLIENT)
|
||||
//public class RadioJukeboxBlockEntityRenderer implements BlockEntityRenderer<RadioJukeboxBlockEntity> {
|
||||
// private ItemStack record;
|
||||
// private float rotation = 0;
|
||||
// private BlockState blockState;
|
||||
//
|
||||
// public RadioJukeboxBlockEntityRenderer(BlockEntityRenderDispatcher blockEntityRenderDispatcher) {
|
||||
// super();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void render(RadioJukeboxBlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
|
||||
// if (VOConfig.jukebox) {
|
||||
// int lightAbove = WorldRenderer.getLightmapCoordinates(blockEntity.getWorld(), blockEntity.getPos().up());
|
||||
//
|
||||
// // Tries to get the disc using the serverside method
|
||||
// if (blockEntity.getStack(blockEntity.getPlayingSong()) != ItemStack.EMPTY) {
|
||||
// record = blockEntity.getStack(blockEntity.getPlayingSong()).copy();
|
||||
// record.setCount(2);
|
||||
// }
|
||||
// // If the sound is stopped or no sound is playing, the stack is set to an empty stack //
|
||||
// else {
|
||||
// record = ItemStack.EMPTY;
|
||||
// }
|
||||
//
|
||||
// matrices.push();
|
||||
//
|
||||
// matrices.translate(0.5f, 1.03f, 0.5f);
|
||||
// matrices.scale(0.75f, 0.75f, 0.75f);
|
||||
//
|
||||
// if (blockEntity.isPlaying()) {
|
||||
// rotation = (blockEntity.getWorld().getTime() + tickDelta) * 4;
|
||||
// }
|
||||
// matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(rotation));
|
||||
// MinecraftClient.getInstance().getItemRenderer().renderItem(record, ModelTransformation.Mode.GROUND, lightAbove, overlay, matrices, vertexConsumers);
|
||||
//
|
||||
// matrices.pop();
|
||||
// if (VOConfig.jukebox_fake_block && blockEntity.getWorld().getBlockState(blockEntity.getPos().up()).getBlock() == Blocks.AIR) {
|
||||
// blockState = blockEntity.getWorld().getBlockState(blockEntity.getPos());
|
||||
// matrices.push();
|
||||
// matrices.translate(0f, 1f, 0f);
|
||||
// if (record == ItemStack.EMPTY) {
|
||||
// MinecraftClient.getInstance().getBlockRenderManager().renderBlock(PhonosCompatInit.RadioJukeboxTop.getDefaultState().with(RadioJukeboxTop.PLAYING, false).with(RadioJukeboxTop.CHANNEL, blockState.get(RadioJukeboxBlock.CHANNEL)), blockEntity.getPos().up(), blockEntity.getWorld(), matrices, vertexConsumers.getBuffer(RenderLayer.getCutout()), false, new Random());
|
||||
// } else {
|
||||
// MinecraftClient.getInstance().getBlockRenderManager().renderBlock(PhonosCompatInit.RadioJukeboxTop.getDefaultState().with(RadioJukeboxTop.PLAYING, true).with(RadioJukeboxTop.CHANNEL, blockState.get(RadioJukeboxBlock.CHANNEL)), blockEntity.getPos().up(), blockEntity.getWorld(), matrices, vertexConsumers.getBuffer(RenderLayer.getCutout()), false, new Random());
|
||||
// }
|
||||
// matrices.pop();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,20 @@
|
||||
package eu.midnightdust.visualoverhaul.compat.phonos.init;
|
||||
|
||||
//import eu.midnightdust.visualoverhaul.compat.phonos.block.RadioJukeboxTop;
|
||||
//import io.github.foundationgames.phonos.block.PhonosBlocks;
|
||||
import net.fabricmc.fabric.impl.blockrenderlayer.BlockRenderLayerMapImpl;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public class PhonosCompatInit {
|
||||
//public static Block RadioJukeboxTop = new RadioJukeboxTop();
|
||||
|
||||
public static void init() {
|
||||
//Registry.register(Registry.BLOCK, new Identifier("visualoverhaul","radio_jukebox_top"), RadioJukeboxTop);
|
||||
|
||||
//BlockRenderLayerMapImpl.INSTANCE.putBlock(PhonosBlocks.RADIO_JUKEBOX, RenderLayer.getCutout());
|
||||
//BlockRenderLayerMapImpl.INSTANCE.putBlock(RadioJukeboxTop, RenderLayer.getCutout());
|
||||
}
|
||||
}
|
||||
@@ -1,288 +0,0 @@
|
||||
package eu.midnightdust.visualoverhaul.config;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.ScreenTexts;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.*;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.*;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
// MidnightConfig v0.1.0 //
|
||||
|
||||
/* Based on https://github.com/Minenash/TinyConfig
|
||||
Credits to Minenash - CC0-1.0
|
||||
You can copy this class to get a standalone version of MidnightConfig */
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class MidnightConfig {
|
||||
|
||||
private static final Pattern INTEGER_ONLY = Pattern.compile("(-?[0-9]*)");
|
||||
private static final Pattern DECIMAL_ONLY = Pattern.compile("-?([\\d]+\\.?[\\d]*|[\\d]*\\.?[\\d]+|\\.)");
|
||||
|
||||
private static final List<EntryInfo> entries = new ArrayList<>();
|
||||
|
||||
protected static class EntryInfo {
|
||||
Field field;
|
||||
Object widget;
|
||||
int width;
|
||||
Method dynamicTooltip;
|
||||
Map.Entry<TextFieldWidget,Text> error;
|
||||
Object defaultValue;
|
||||
Object value;
|
||||
String tempValue;
|
||||
boolean inLimits = true;
|
||||
}
|
||||
|
||||
private static Class configClass;
|
||||
private static String translationPrefix;
|
||||
private static Path path;
|
||||
|
||||
private static final Gson gson = new GsonBuilder()
|
||||
.excludeFieldsWithModifiers(Modifier.TRANSIENT)
|
||||
.excludeFieldsWithModifiers(Modifier.PRIVATE)
|
||||
.setPrettyPrinting()
|
||||
.create();
|
||||
|
||||
public static void init(String modid, Class<?> config) {
|
||||
translationPrefix = modid + ".midnightconfig.";
|
||||
path = FabricLoader.getInstance().getConfigDir().resolve(modid + ".json");
|
||||
configClass = config;
|
||||
|
||||
for (Field field : config.getFields()) {
|
||||
Class<?> type = field.getType();
|
||||
EntryInfo info = new EntryInfo();
|
||||
|
||||
Entry e;
|
||||
try { e = field.getAnnotation(Entry.class); }
|
||||
catch (Exception ignored) { continue; }
|
||||
|
||||
info.width = e.width();
|
||||
info.field = field;
|
||||
|
||||
if (type == int.class) textField(info, Integer::parseInt, INTEGER_ONLY, e.min(), e.max(), true);
|
||||
else if (type == double.class) textField(info, Double::parseDouble, DECIMAL_ONLY, e.min(), e.max(),false);
|
||||
else if (type == String.class) textField(info, String::length, null, Math.min(e.min(),0), Math.max(e.max(),1),true);
|
||||
else if (type == boolean.class) {
|
||||
Function<Object,Text> func = value -> new LiteralText((Boolean) value ? "True" : "False").formatted((Boolean) value ? Formatting.GREEN : Formatting.RED);
|
||||
info.widget = new AbstractMap.SimpleEntry<ButtonWidget.PressAction, Function<Object, Text>>(button -> {
|
||||
info.value = !(Boolean) info.value;
|
||||
button.setMessage(func.apply(info.value));
|
||||
}, func);
|
||||
}
|
||||
else if (type.isEnum()) {
|
||||
List<?> values = Arrays.asList(field.getType().getEnumConstants());
|
||||
Function<Object,Text> func = value -> new TranslatableText(translationPrefix + "enum." + type.getSimpleName() + "." + info.value.toString());
|
||||
info.widget = new AbstractMap.SimpleEntry<ButtonWidget.PressAction, Function<Object,Text>>( button -> {
|
||||
int index = values.indexOf(info.value) + 1;
|
||||
info.value = values.get(index >= values.size()? 0 : index);
|
||||
button.setMessage(func.apply(info.value));
|
||||
}, func);
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
||||
entries.add(info);
|
||||
|
||||
try { info.defaultValue = field.get(null); }
|
||||
catch (IllegalAccessException ignored) {}
|
||||
|
||||
try {
|
||||
info.dynamicTooltip = config.getMethod(e.dynamicTooltip());
|
||||
info.dynamicTooltip.setAccessible(true);
|
||||
} catch (Exception ignored) {}
|
||||
|
||||
}
|
||||
|
||||
try { gson.fromJson(Files.newBufferedReader(path), config); }
|
||||
catch (Exception e) { write(); }
|
||||
|
||||
for (EntryInfo info : entries) {
|
||||
try {
|
||||
info.value = info.field.get(null);
|
||||
info.tempValue = info.value.toString();
|
||||
}
|
||||
catch (IllegalAccessException ignored) {}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void textField(EntryInfo info, Function<String,Number> f, Pattern pattern, double min, double max, boolean cast) {
|
||||
boolean isNumber = pattern != null;
|
||||
info.widget = (BiFunction<TextFieldWidget, ButtonWidget, Predicate<String>>) (t, b) -> s -> {
|
||||
s = s.trim();
|
||||
if (!(s.isEmpty() || !isNumber || pattern.matcher(s).matches()))
|
||||
return false;
|
||||
|
||||
Number value = 0;
|
||||
boolean inLimits = false;
|
||||
System.out.println(((isNumber ^ s.isEmpty())));
|
||||
System.out.println(!s.equals("-") && !s.equals("."));
|
||||
info.error = null;
|
||||
if (!(isNumber && s.isEmpty()) && !s.equals("-") && !s.equals(".")) {
|
||||
value = f.apply(s);
|
||||
inLimits = value.doubleValue() >= min && value.doubleValue() <= max;
|
||||
info.error = inLimits? null : new AbstractMap.SimpleEntry<>(t, new LiteralText(value.doubleValue() < min ?
|
||||
"§cMinimum " + (isNumber? "value" : "length") + (cast? " is " + (int)min : " is " + min) :
|
||||
"§cMaximum " + (isNumber? "value" : "length") + (cast? " is " + (int)max : " is " + max)));
|
||||
}
|
||||
|
||||
info.tempValue = s;
|
||||
t.setEditableColor(inLimits? 0xFFFFFFFF : 0xFFFF7777);
|
||||
info.inLimits = inLimits;
|
||||
b.active = entries.stream().allMatch(e -> e.inLimits);
|
||||
|
||||
if (inLimits)
|
||||
info.value = isNumber? value : s;
|
||||
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
public static void write() {
|
||||
try {
|
||||
if (!Files.exists(path)) Files.createFile(path);
|
||||
Files.write(path, gson.toJson(configClass.newInstance()).getBytes());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Screen getScreen(Screen parent) {
|
||||
return new TinyConfigScreen(parent);
|
||||
}
|
||||
|
||||
private static class TinyConfigScreen extends Screen {
|
||||
protected TinyConfigScreen(Screen parent) {
|
||||
super(new TranslatableText(MidnightConfig.translationPrefix + "title"));
|
||||
this.parent = parent;
|
||||
}
|
||||
private final Screen parent;
|
||||
|
||||
// Real Time config update //
|
||||
@Override
|
||||
public void tick() {
|
||||
for (EntryInfo info : entries)
|
||||
try { info.field.set(null, info.value); }
|
||||
catch (IllegalAccessException ignore) {}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
this.addButton(new ButtonWidget(this.width / 2 - 154, this.height - 28, 150, 20, ScreenTexts.CANCEL, button -> {
|
||||
try { gson.fromJson(Files.newBufferedReader(path), configClass); }
|
||||
catch (Exception e) { write(); }
|
||||
|
||||
for (EntryInfo info : entries) {
|
||||
try {
|
||||
info.value = info.field.get(null);
|
||||
info.tempValue = info.value.toString();
|
||||
}
|
||||
catch (IllegalAccessException ignored) {}
|
||||
}
|
||||
Objects.requireNonNull(client).openScreen(parent);
|
||||
}));
|
||||
|
||||
ButtonWidget done = this.addButton(new ButtonWidget(this.width / 2 + 4, this.height - 28, 150, 20, ScreenTexts.DONE, (button) -> {
|
||||
for (EntryInfo info : entries)
|
||||
try { info.field.set(null, info.value); }
|
||||
catch (IllegalAccessException ignore) {}
|
||||
write();
|
||||
Objects.requireNonNull(client).openScreen(parent);
|
||||
}));
|
||||
|
||||
int y = 45;
|
||||
for (EntryInfo info : entries) {
|
||||
addButton(new ButtonWidget(width - 155, y, 40,20, new LiteralText("Reset").formatted(Formatting.RED), (button -> {
|
||||
info.value = info.defaultValue;
|
||||
info.tempValue = info.value.toString();
|
||||
Objects.requireNonNull(client).openScreen(this);
|
||||
})));
|
||||
|
||||
if (info.widget instanceof Map.Entry) {
|
||||
Map.Entry<ButtonWidget.PressAction,Function<Object,Text>> widget = (Map.Entry<ButtonWidget.PressAction, Function<Object, Text>>) info.widget;
|
||||
addButton(new ButtonWidget(width-110,y,info.width,20, widget.getValue().apply(info.value), widget.getKey()));
|
||||
}
|
||||
else {
|
||||
TextFieldWidget widget = addButton(new TextFieldWidget(textRenderer, width-110, y, info.width, 20, null));
|
||||
widget.setText(info.tempValue);
|
||||
|
||||
Predicate<String> processor = ((BiFunction<TextFieldWidget, ButtonWidget, Predicate<String>>) info.widget).apply(widget,done);
|
||||
widget.setTextPredicate(processor);
|
||||
|
||||
children.add(widget);
|
||||
}
|
||||
y += 25;
|
||||
}
|
||||
|
||||
}
|
||||
int aniX = this.width / 2;
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(matrices);
|
||||
|
||||
if (aniX < this.width / 2) {
|
||||
aniX = aniX +40;
|
||||
}
|
||||
|
||||
int stringWidth = (int) (title.getString().length() * 2.75f);
|
||||
this.fillGradient(matrices, this.width / 2 - stringWidth, 10, this.width /2 + stringWidth, 29, -1072689136, -804253680);
|
||||
this.fillGradient(matrices, this.width / 2 - aniX, 35, width/2 + aniX, this.height - 40, -1072689136, -804253680);
|
||||
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
drawCenteredText(matrices, textRenderer, title, width/2, 15, 0xFFFFFF);
|
||||
|
||||
int y = 40;
|
||||
for (EntryInfo info : entries) {
|
||||
drawTextWithShadow(matrices, textRenderer, new TranslatableText(translationPrefix + info.field.getName()), 12, y + 10, 0xFFFFFF);
|
||||
|
||||
if (info.error != null && info.error.getKey().isMouseOver(mouseX,mouseY))
|
||||
renderTooltip(matrices, info.error.getValue(), mouseX, mouseY);
|
||||
else if (mouseY >= y && mouseY < (y + 25)) {
|
||||
if (info.dynamicTooltip != null) {
|
||||
try {
|
||||
renderTooltip(matrices, (List<Text>) info.dynamicTooltip.invoke(null, entries), mouseX, mouseY);
|
||||
y += 25;
|
||||
continue;
|
||||
} catch (Exception e) { e.printStackTrace(); }
|
||||
}
|
||||
String key = translationPrefix + info.field.getName() + ".tooltip";
|
||||
if (I18n.hasTranslation(key)) {
|
||||
List<Text> list = new ArrayList<>();
|
||||
for (String str : I18n.translate(key).split("\n"))
|
||||
list.add(new LiteralText(str));
|
||||
renderTooltip(matrices, list, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
y += 25;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface Entry {
|
||||
String dynamicTooltip() default "";
|
||||
int width() default 100;
|
||||
double min() default Double.MIN_NORMAL;
|
||||
double max() default Double.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package eu.midnightdust.visualoverhaul.config;
|
||||
|
||||
import io.github.prospector.modmenu.api.ConfigScreenFactory;
|
||||
import io.github.prospector.modmenu.api.ModMenuApi;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class ModMenuIntegration implements ModMenuApi {
|
||||
|
||||
@Override
|
||||
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
||||
return parent -> new VOConfig().getScreen(parent);
|
||||
}
|
||||
}
|
||||
20
src/main/java/eu/midnightdust/visualoverhaul/config/VOConfig.java
Normal file → Executable file
20
src/main/java/eu/midnightdust/visualoverhaul/config/VOConfig.java
Normal file → Executable file
@@ -1,14 +1,14 @@
|
||||
package eu.midnightdust.visualoverhaul.config;
|
||||
|
||||
import eu.midnightdust.lib.config.MidnightConfig;
|
||||
|
||||
public class VOConfig extends MidnightConfig {
|
||||
@Entry
|
||||
public static boolean brewingstand = true;
|
||||
@Entry
|
||||
public static boolean jukebox = true;
|
||||
@Entry
|
||||
public static boolean jukebox_fake_block = true;
|
||||
@Entry
|
||||
public static boolean furnace = true;
|
||||
@Entry
|
||||
public static boolean coloredItems = true;
|
||||
@Entry public static boolean brewingstand = true;
|
||||
@Entry public static boolean jukebox = true;
|
||||
@Entry public static boolean jukebox_fake_block = true;
|
||||
@Entry public static boolean furnace = true;
|
||||
@Entry public static boolean smoker_particles = true;
|
||||
@Entry public static boolean blast_furnace_particles = true;
|
||||
@Entry public static boolean coloredItems = true;
|
||||
@Entry public static boolean potionEnchantmentGlint = true;
|
||||
}
|
||||
|
||||
39
src/main/java/eu/midnightdust/visualoverhaul/mixin/MixinAbstractFurnaceBlockEntity.java
Normal file → Executable file
39
src/main/java/eu/midnightdust/visualoverhaul/mixin/MixinAbstractFurnaceBlockEntity.java
Normal file → Executable file
@@ -2,16 +2,16 @@ package eu.midnightdust.visualoverhaul.mixin;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.VisualOverhaul;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.fabricmc.fabric.api.server.PlayerStream;
|
||||
import net.fabricmc.fabric.api.networking.v1.PlayerLookup;
|
||||
import net.fabricmc.fabric.impl.networking.ServerSidePacketRegistryImpl;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.*;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.util.collection.DefaultedList;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
@@ -22,26 +22,25 @@ import java.util.stream.Stream;
|
||||
@Mixin(AbstractFurnaceBlockEntity.class)
|
||||
public abstract class MixinAbstractFurnaceBlockEntity extends LockableContainerBlockEntity {
|
||||
|
||||
@Shadow protected DefaultedList<ItemStack> inventory;
|
||||
Boolean invUpdate = true;
|
||||
int playerUpdate = -1;
|
||||
private static boolean invUpdate = true;
|
||||
private static int playerUpdate = -1;
|
||||
|
||||
private MixinAbstractFurnaceBlockEntity(BlockEntityType<?> blockEntityType) {
|
||||
super(blockEntityType);
|
||||
|
||||
protected MixinAbstractFurnaceBlockEntity(BlockEntityType<?> blockEntityType, BlockPos blockPos, BlockState blockState) {
|
||||
super(blockEntityType, blockPos, blockState);
|
||||
}
|
||||
|
||||
@Inject(at = @At("TAIL"), method = "tick")
|
||||
public void tick(CallbackInfo ci) {
|
||||
if (this.world.getBlockState(this.pos).getBlock().is(Blocks.FURNACE)) {
|
||||
if (!this.world.isClient && (invUpdate || world.getPlayers().size() == playerUpdate)) {
|
||||
Stream<PlayerEntity> watchingPlayers = PlayerStream.watching(world, getPos());
|
||||
private static void tick(World world, BlockPos pos, BlockState state, AbstractFurnaceBlockEntity blockEntity, CallbackInfo ci) {
|
||||
if (world.getBlockState(pos).hasBlockEntity()) {
|
||||
if (!world.isClient && (invUpdate || world.getPlayers().size() == playerUpdate)) {
|
||||
Stream<ServerPlayerEntity> watchingPlayers = PlayerLookup.tracking(blockEntity).stream();
|
||||
PacketByteBuf passedData = new PacketByteBuf(Unpooled.buffer());
|
||||
passedData.writeBlockPos(pos);
|
||||
passedData.writeItemStack(inventory.get(0));
|
||||
passedData.writeItemStack(inventory.get(1));
|
||||
passedData.writeItemStack(inventory.get(2));
|
||||
passedData.writeItemStack(blockEntity.getStack(0));
|
||||
passedData.writeItemStack(blockEntity.getStack(1));
|
||||
passedData.writeItemStack(blockEntity.getStack(2));
|
||||
|
||||
passedData.writeString(String.valueOf(inventory));
|
||||
watchingPlayers.forEach(player -> ServerSidePacketRegistryImpl.INSTANCE.sendToPlayer(player, VisualOverhaul.UPDATE_FURNACE_ITEMS, passedData));
|
||||
invUpdate = false;
|
||||
}
|
||||
@@ -50,7 +49,7 @@ public abstract class MixinAbstractFurnaceBlockEntity extends LockableContainerB
|
||||
}
|
||||
|
||||
@Inject(at = @At("RETURN"), method = "getStack", cancellable = true)
|
||||
public void getStack(int slot, CallbackInfoReturnable cir) {
|
||||
this.invUpdate = true;
|
||||
public void getStack(int slot, CallbackInfoReturnable<ItemStack> cir) {
|
||||
invUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package eu.midnightdust.visualoverhaul.mixin;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.config.VOConfig;
|
||||
import net.minecraft.block.AbstractFurnaceBlock;
|
||||
import net.minecraft.block.BlastFurnaceBlock;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@Mixin(BlastFurnaceBlock.class)
|
||||
public abstract class MixinBlastFurnaceBlock extends AbstractFurnaceBlock {
|
||||
protected MixinBlastFurnaceBlock(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Inject(at = @At("TAIL"), method = "randomDisplayTick")
|
||||
public void vo$randomDisplayTick(BlockState state, World world, BlockPos pos, Random random, CallbackInfo ci) {
|
||||
if (state.get(LIT) && VOConfig.blast_furnace_particles) {
|
||||
double d = (double)pos.getX() + 0.5D;
|
||||
double e = pos.getY();
|
||||
double f = (double)pos.getZ() + 0.5D;
|
||||
|
||||
Direction direction = state.get(FACING);
|
||||
Direction.Axis axis = direction.getAxis();
|
||||
double h = random.nextDouble() * 0.6D - 0.3D;
|
||||
double i = axis == Direction.Axis.X ? (double)direction.getOffsetX() * 0.4D : h;
|
||||
double j = random.nextDouble() * 6.0D / 16.0D;
|
||||
double k = axis == Direction.Axis.Z ? (double)direction.getOffsetZ() * 0.4D : h;
|
||||
world.addParticle(ParticleTypes.FLAME, d + i, e + j, f + k, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
39
src/main/java/eu/midnightdust/visualoverhaul/mixin/MixinBrewingStandBlockEntity.java
Normal file → Executable file
39
src/main/java/eu/midnightdust/visualoverhaul/mixin/MixinBrewingStandBlockEntity.java
Normal file → Executable file
@@ -2,17 +2,18 @@ package eu.midnightdust.visualoverhaul.mixin;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.VisualOverhaul;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.fabricmc.fabric.api.server.PlayerStream;
|
||||
import net.fabricmc.fabric.api.networking.v1.PlayerLookup;
|
||||
import net.fabricmc.fabric.impl.networking.ServerSidePacketRegistryImpl;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.block.entity.BrewingStandBlockEntity;
|
||||
import net.minecraft.block.entity.LockableContainerBlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.util.collection.DefaultedList;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
@@ -23,27 +24,25 @@ import java.util.stream.Stream;
|
||||
@Mixin(BrewingStandBlockEntity.class)
|
||||
public abstract class MixinBrewingStandBlockEntity extends LockableContainerBlockEntity {
|
||||
|
||||
@Shadow private DefaultedList<ItemStack> inventory;
|
||||
Boolean invUpdate = true;
|
||||
int playerUpdate = -1;
|
||||
private static boolean invUpdate = true;
|
||||
private static int playerUpdate = -1;
|
||||
|
||||
private MixinBrewingStandBlockEntity(BlockEntityType<?> blockEntityType) {
|
||||
super(blockEntityType);
|
||||
protected MixinBrewingStandBlockEntity(BlockEntityType<?> blockEntityType, BlockPos blockPos, BlockState blockState) {
|
||||
super(blockEntityType, blockPos, blockState);
|
||||
}
|
||||
|
||||
@Inject(at = @At("TAIL"), method = "tick")
|
||||
public void tick(CallbackInfo ci) {
|
||||
if (!this.world.isClient && (invUpdate || world.getPlayers().size() == playerUpdate)) {
|
||||
Stream<PlayerEntity> watchingPlayers = PlayerStream.watching(world, getPos());
|
||||
private static void tick(World world, BlockPos pos, BlockState state, BrewingStandBlockEntity blockEntity, CallbackInfo ci) {
|
||||
if (!world.isClient && (invUpdate || world.getPlayers().size() == playerUpdate)) {
|
||||
Stream<ServerPlayerEntity> watchingPlayers = PlayerLookup.tracking(blockEntity).stream();
|
||||
PacketByteBuf passedData = new PacketByteBuf(Unpooled.buffer());
|
||||
passedData.writeBlockPos(pos);
|
||||
passedData.writeItemStack(inventory.get(0));
|
||||
passedData.writeItemStack(inventory.get(1));
|
||||
passedData.writeItemStack(inventory.get(2));
|
||||
passedData.writeItemStack(inventory.get(3));
|
||||
passedData.writeItemStack(inventory.get(4));
|
||||
passedData.writeItemStack(blockEntity.getStack(0));
|
||||
passedData.writeItemStack(blockEntity.getStack(1));
|
||||
passedData.writeItemStack(blockEntity.getStack(2));
|
||||
passedData.writeItemStack(blockEntity.getStack(3));
|
||||
passedData.writeItemStack(blockEntity.getStack(4));
|
||||
|
||||
passedData.writeString(String.valueOf(inventory));
|
||||
watchingPlayers.forEach(player -> ServerSidePacketRegistryImpl.INSTANCE.sendToPlayer(player, VisualOverhaul.UPDATE_POTION_BOTTLES, passedData));
|
||||
invUpdate = false;
|
||||
}
|
||||
@@ -51,7 +50,7 @@ public abstract class MixinBrewingStandBlockEntity extends LockableContainerBloc
|
||||
}
|
||||
|
||||
@Inject(at = @At("RETURN"), method = "getStack", cancellable = true)
|
||||
public void getStack(int slot, CallbackInfoReturnable cir) {
|
||||
this.invUpdate = true;
|
||||
public void getStack(int slot, CallbackInfoReturnable<ItemStack> cir) {
|
||||
invUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
56
src/main/java/eu/midnightdust/visualoverhaul/mixin/MixinJukeboxBlock.java
Executable file
56
src/main/java/eu/midnightdust/visualoverhaul/mixin/MixinJukeboxBlock.java
Executable file
@@ -0,0 +1,56 @@
|
||||
package eu.midnightdust.visualoverhaul.mixin;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.VisualOverhaul;
|
||||
import eu.midnightdust.visualoverhaul.util.JukeboxPacketUpdate;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.fabricmc.fabric.api.networking.v1.PlayerLookup;
|
||||
import net.fabricmc.fabric.impl.networking.ServerSidePacketRegistryImpl;
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.BlockWithEntity;
|
||||
import net.minecraft.block.JukeboxBlock;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.BlockEntityTicker;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.block.entity.JukeboxBlockEntity;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Mixin(JukeboxBlock.class)
|
||||
public abstract class MixinJukeboxBlock extends BlockWithEntity {
|
||||
|
||||
protected MixinJukeboxBlock(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderType getRenderType(BlockState state) {
|
||||
return BlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) {
|
||||
return world.isClient() ? null : checkType(type, BlockEntityType.JUKEBOX, MixinJukeboxBlock::tick);
|
||||
}
|
||||
@Unique
|
||||
private static void tick(World world, BlockPos pos, BlockState state, JukeboxBlockEntity blockEntity) {
|
||||
if (!world.isClient && (JukeboxPacketUpdate.invUpdate || world.getPlayers().size() == JukeboxPacketUpdate.playerUpdate)) {
|
||||
Stream<ServerPlayerEntity> watchingPlayers = PlayerLookup.tracking(blockEntity).stream();
|
||||
PacketByteBuf passedData = new PacketByteBuf(Unpooled.buffer());
|
||||
passedData.writeBlockPos(pos);
|
||||
passedData.writeItemStack(blockEntity.getRecord());
|
||||
|
||||
watchingPlayers.forEach(player -> ServerSidePacketRegistryImpl.INSTANCE.sendToPlayer(player, VisualOverhaul.UPDATE_RECORD, passedData));
|
||||
JukeboxPacketUpdate.invUpdate = false;
|
||||
}
|
||||
JukeboxPacketUpdate.playerUpdate = world.getPlayers().size();
|
||||
}
|
||||
}
|
||||
|
||||
36
src/main/java/eu/midnightdust/visualoverhaul/mixin/MixinJukeboxBlockEntity.java
Normal file → Executable file
36
src/main/java/eu/midnightdust/visualoverhaul/mixin/MixinJukeboxBlockEntity.java
Normal file → Executable file
@@ -1,16 +1,18 @@
|
||||
package eu.midnightdust.visualoverhaul.mixin;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.VisualOverhaul;
|
||||
import eu.midnightdust.visualoverhaul.util.JukeboxPacketUpdate;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.fabricmc.fabric.api.server.PlayerStream;
|
||||
import net.fabricmc.fabric.api.networking.v1.PlayerLookup;
|
||||
import net.fabricmc.fabric.impl.networking.ServerSidePacketRegistryImpl;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.*;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.util.Tickable;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
@@ -19,32 +21,28 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Mixin(JukeboxBlockEntity.class)
|
||||
public abstract class MixinJukeboxBlockEntity extends BlockEntity implements Tickable {
|
||||
public abstract class MixinJukeboxBlockEntity extends BlockEntity {
|
||||
|
||||
@Shadow private ItemStack record;
|
||||
Boolean invUpdate = true;
|
||||
int playerUpdate = -1;
|
||||
|
||||
private MixinJukeboxBlockEntity(BlockEntityType<?> blockEntityType) {
|
||||
super(blockEntityType);
|
||||
public MixinJukeboxBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
}
|
||||
|
||||
@Unique
|
||||
public void tick() {
|
||||
if (!this.world.isClient && (invUpdate || world.getPlayers().size() == playerUpdate)) {
|
||||
Stream<PlayerEntity> watchingPlayers = PlayerStream.watching(world, getPos());
|
||||
private static void tick(World world, BlockPos pos, BlockState state, JukeboxBlockEntity blockEntity) {
|
||||
if (!world.isClient && (JukeboxPacketUpdate.invUpdate || world.getPlayers().size() == JukeboxPacketUpdate.playerUpdate)) {
|
||||
Stream<ServerPlayerEntity> watchingPlayers = PlayerLookup.tracking(blockEntity).stream();
|
||||
PacketByteBuf passedData = new PacketByteBuf(Unpooled.buffer());
|
||||
passedData.writeBlockPos(pos);
|
||||
passedData.writeItemStack(record);
|
||||
passedData.writeItemStack(blockEntity.getRecord());
|
||||
|
||||
watchingPlayers.forEach(player -> ServerSidePacketRegistryImpl.INSTANCE.sendToPlayer(player, VisualOverhaul.UPDATE_RECORD, passedData));
|
||||
invUpdate = false;
|
||||
JukeboxPacketUpdate.invUpdate = false;
|
||||
}
|
||||
playerUpdate = world.getPlayers().size();
|
||||
JukeboxPacketUpdate.playerUpdate = world.getPlayers().size();
|
||||
}
|
||||
|
||||
@Inject(at = @At("RETURN"), method = "getRecord", cancellable = true)
|
||||
public void getRecord(CallbackInfoReturnable cir) {
|
||||
this.invUpdate = true;
|
||||
public void getRecord(CallbackInfoReturnable<ItemStack> cir) {
|
||||
JukeboxPacketUpdate.invUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package eu.midnightdust.visualoverhaul.mixin;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.config.VOConfig;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.PotionItem;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(PotionItem.class)
|
||||
public abstract class MixinPotionItem extends Item {
|
||||
public MixinPotionItem(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "hasGlint", cancellable = true)
|
||||
public void vo$hasGlint(ItemStack stack, CallbackInfoReturnable<Boolean> cir) {
|
||||
if (!VOConfig.potionEnchantmentGlint) cir.setReturnValue(super.hasGlint(stack));
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package eu.midnightdust.visualoverhaul.mixin;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.VisualOverhaul;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.profiler.Profiler;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.world.*;
|
||||
import net.minecraft.world.chunk.WorldChunk;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@Mixin(ServerWorld.class)
|
||||
public abstract class MixinServerWorld extends World {
|
||||
protected MixinServerWorld(MutableWorldProperties properties, RegistryKey<World> registryRef, DimensionType dimensionType, Supplier<Profiler> profiler, boolean isClient, boolean debugWorld, long seed) {
|
||||
super(properties, registryRef, dimensionType, profiler, isClient, debugWorld, seed);
|
||||
}
|
||||
|
||||
@Shadow protected abstract BlockPos getSurface(BlockPos pos);
|
||||
|
||||
@Inject(at = @At("TAIL"),method = "tickChunk")
|
||||
public void tickChunk(WorldChunk chunk, int randomTickSpeed, CallbackInfo ci) {
|
||||
ChunkPos chunkPos = chunk.getPos();
|
||||
boolean bl = this.isRaining();
|
||||
int x = chunkPos.getStartX();
|
||||
int z = chunkPos.getStartZ();
|
||||
Profiler profiler = this.getProfiler();
|
||||
BlockPos pos;
|
||||
|
||||
if (this.getGameRules().getInt(VisualOverhaul.PUDDLE_SPAWN_RATE) != 0) {
|
||||
profiler.push("puddles");
|
||||
if (bl && random.nextInt(10000 / this.getGameRules().getInt(VisualOverhaul.PUDDLE_SPAWN_RATE)) == 0) {
|
||||
pos = this.getSurface(getRandomPosInChunk(x, 0, z, 15));
|
||||
if (this.hasRain(pos) && getBlockState(pos.down()).isSideSolidFullSquare(this, pos, Direction.UP)) {
|
||||
setBlockState(pos, VisualOverhaul.Puddle.getDefaultState());
|
||||
}
|
||||
}
|
||||
profiler.pop();
|
||||
}
|
||||
|
||||
if (this.getGameRules().getInt(VisualOverhaul.SNOW_STACK_CHANCE) != 0) {
|
||||
profiler.push("extra_snow");
|
||||
if (bl && random.nextInt(10000 / this.getGameRules().getInt(VisualOverhaul.SNOW_STACK_CHANCE)) == 0) {
|
||||
pos = this.getSurface(getRandomPosInChunk(x, 0, z, 15));
|
||||
if (this.getBlockState(pos).getBlock() == Blocks.SNOW && getBlockState(pos.down()).isSideSolidFullSquare(this, pos, Direction.UP)) {
|
||||
int layer = getBlockState(pos).get(Properties.LAYERS);
|
||||
setBlockState(pos, Blocks.SNOW.getDefaultState().with(Properties.LAYERS, layer + 1));
|
||||
}
|
||||
}
|
||||
profiler.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package eu.midnightdust.visualoverhaul.mixin;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.config.VOConfig;
|
||||
import net.minecraft.block.AbstractFurnaceBlock;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.SmokerBlock;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@Mixin(SmokerBlock.class)
|
||||
public abstract class MixinSmokerBlock extends AbstractFurnaceBlock {
|
||||
protected MixinSmokerBlock(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Inject(at = @At("TAIL"), method = "randomDisplayTick")
|
||||
public void vo$randomDisplayTick(BlockState state, World world, BlockPos pos, Random random, CallbackInfo ci) {
|
||||
if (state.get(LIT) && VOConfig.smoker_particles) {
|
||||
double d = (double)pos.getX() + 0.5D;
|
||||
double e = pos.getY();
|
||||
double f = (double)pos.getZ() + 0.5D;
|
||||
|
||||
Direction direction = state.get(FACING);
|
||||
Direction.Axis axis = direction.getAxis();
|
||||
double h = random.nextDouble() * 0.6D - 0.3D;
|
||||
double i = axis == Direction.Axis.X ? (double)direction.getOffsetX() * 0.4D : h;
|
||||
double j = random.nextDouble() * 6.0D / 16.0D;
|
||||
double k = axis == Direction.Axis.Z ? (double)direction.getOffsetZ() * 0.4D : h;
|
||||
world.addParticle(ParticleTypes.FLAME, d + i, e + j, f + k, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
40
src/main/java/eu/midnightdust/visualoverhaul/mixin/MixinSoundSystem.java
Executable file
40
src/main/java/eu/midnightdust/visualoverhaul/mixin/MixinSoundSystem.java
Executable file
@@ -0,0 +1,40 @@
|
||||
package eu.midnightdust.visualoverhaul.mixin;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.util.SoundTest;
|
||||
import net.minecraft.client.sound.SoundInstance;
|
||||
import net.minecraft.client.sound.SoundSystem;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(SoundSystem.class)
|
||||
public abstract class MixinSoundSystem {
|
||||
|
||||
@Shadow private boolean started;
|
||||
|
||||
private BlockPos jukeboxPos;
|
||||
|
||||
@Inject(at = @At("TAIL"),method = "play(Lnet/minecraft/client/sound/SoundInstance;)V")
|
||||
public void vo$onPlayRecordSound(SoundInstance soundInstance, CallbackInfo ci) {
|
||||
if (soundInstance.getCategory().equals(SoundCategory.RECORDS) && this.started) {
|
||||
jukeboxPos = new BlockPos(soundInstance.getX(),soundInstance.getY(),soundInstance.getZ());
|
||||
SoundTest.soundPos.put(jukeboxPos, soundInstance.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(at = @At("HEAD"),method = "stop(Lnet/minecraft/client/sound/SoundInstance;)V")
|
||||
public void vo$onStopRecordSound(SoundInstance soundInstance, CallbackInfo ci) {
|
||||
if (soundInstance != null) {
|
||||
if (soundInstance.getCategory().equals(SoundCategory.RECORDS)) {
|
||||
jukeboxPos = new BlockPos(soundInstance.getX(), soundInstance.getY(), soundInstance.getZ());
|
||||
if (SoundTest.soundPos.containsKey(jukeboxPos)) {
|
||||
SoundTest.soundPos.remove(jukeboxPos, soundInstance.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package eu.midnightdust.visualoverhaul.util;
|
||||
|
||||
public class JukeboxPacketUpdate {
|
||||
public static boolean invUpdate = true;
|
||||
public static int playerUpdate = -1;
|
||||
}
|
||||
23
src/main/java/eu/midnightdust/visualoverhaul/util/SoundTest.java
Executable file
23
src/main/java/eu/midnightdust/visualoverhaul/util/SoundTest.java
Executable file
@@ -0,0 +1,23 @@
|
||||
package eu.midnightdust.visualoverhaul.util;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class SoundTest {
|
||||
|
||||
public static Map<BlockPos, Identifier> soundPos = Maps.newHashMap();
|
||||
|
||||
/**
|
||||
* Returns the Sound provided in MixinSoundSystem
|
||||
* {@link eu.midnightdust.visualoverhaul.mixin.MixinSoundSystem}
|
||||
*/
|
||||
public static Identifier getSound(BlockPos pos) {
|
||||
if (soundPos.containsKey(pos)) {
|
||||
return soundPos.get(pos);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package eu.midnightdust.visualoverhaul.util.sound;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class SoundTest {
|
||||
|
||||
public static Map<BlockPos, Identifier> soundPos = Maps.newHashMap();
|
||||
|
||||
/**
|
||||
* Returns the Sound provided in MixinSoundSystem
|
||||
* {@link eu.midnightdust.visualoverhaul.mixin.MixinSoundSystem}
|
||||
*/
|
||||
public static Identifier getSound(BlockPos pos) {
|
||||
if (soundPos.containsKey(pos)) {
|
||||
return soundPos.get(pos);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "biomemakeover:item/music_disk_button_mushrooms"
|
||||
},
|
||||
|
||||
"overrides": [
|
||||
{
|
||||
"predicate": {
|
||||
"round": 1
|
||||
},
|
||||
"model": "biomemakeover:item/button_mushrooms_music_disk_round"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "visualoverhaul:item/round_disc",
|
||||
"textures": {
|
||||
"0": "biomemakeover:item/music_disk_button_mushrooms"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "biomemakeover:item/music_disc_ghost_town"
|
||||
},
|
||||
|
||||
"overrides": [
|
||||
{
|
||||
"predicate": {
|
||||
"round": 1
|
||||
},
|
||||
"model": "biomemakeover:item/ghost_town_music_disk_round"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "visualoverhaul:item/round_disc",
|
||||
"textures": {
|
||||
"0": "biomemakeover:item/music_disc_ghost_town"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "biomemakeover:item/music_disc_swamp_jives"
|
||||
},
|
||||
|
||||
"overrides": [
|
||||
{
|
||||
"predicate": {
|
||||
"round": 1
|
||||
},
|
||||
"model": "biomemakeover:item/swamp_jives_music_disk_round"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "visualoverhaul:item/round_disc",
|
||||
"textures": {
|
||||
"0": "biomemakeover:item/music_disc_swamp_jives"
|
||||
}
|
||||
}
|
||||
15
src/main/resources/assets/desolation/models/item/music_disc_ashes.json
Executable file
15
src/main/resources/assets/desolation/models/item/music_disc_ashes.json
Executable file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "desolation:item/music_disc_ashes"
|
||||
},
|
||||
|
||||
"overrides": [
|
||||
{
|
||||
"predicate": {
|
||||
"round": 1
|
||||
},
|
||||
"model": "desolation:item/music_disc_ashes_round"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "visualoverhaul:item/round_disc",
|
||||
"textures": {
|
||||
"0": "desolation:item/music_disc_ashes"
|
||||
}
|
||||
}
|
||||
15
src/main/resources/assets/dynamic-discs/models/item/dynamic_disc.json
Executable file
15
src/main/resources/assets/dynamic-discs/models/item/dynamic_disc.json
Executable file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "minecraft:item/music_disc_13"
|
||||
},
|
||||
|
||||
"overrides": [
|
||||
{
|
||||
"predicate": {
|
||||
"round": 1
|
||||
},
|
||||
"model": "minecraft:item/music_disc_13_round"
|
||||
}
|
||||
]
|
||||
}
|
||||
15
src/main/resources/assets/extra_discs/models/item/music_disc_0x10c.json
Executable file
15
src/main/resources/assets/extra_discs/models/item/music_disc_0x10c.json
Executable file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "extra_discs:item/music_disc_0x10c"
|
||||
},
|
||||
|
||||
"overrides": [
|
||||
{
|
||||
"predicate": {
|
||||
"round": 1
|
||||
},
|
||||
"model": "extra_discs:item/music_disc_0x10c_round"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "visualoverhaul:item/round_disc",
|
||||
"textures": {
|
||||
"0": "extra_discs:item/music_disc_0x10c"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "extra_discs:item/music_disc_cliffside_hinson"
|
||||
},
|
||||
|
||||
"overrides": [
|
||||
{
|
||||
"predicate": {
|
||||
"round": 1
|
||||
},
|
||||
"model": "extra_discs:item/music_disc_cliffside_hinson_round"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "visualoverhaul:item/round_disc",
|
||||
"textures": {
|
||||
"0": "extra_discs:item/music_disc_cliffside_hinson"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "extra_discs:item/music_disc_i_jate_my_hob"
|
||||
},
|
||||
|
||||
"overrides": [
|
||||
{
|
||||
"predicate": {
|
||||
"round": 1
|
||||
},
|
||||
"model": "extra_discs:item/music_disc_i_jate_my_hob_round"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "visualoverhaul:item/round_disc",
|
||||
"textures": {
|
||||
"0": "extra_discs:item/music_disc_i_jate_my_hob"
|
||||
}
|
||||
}
|
||||
15
src/main/resources/assets/extra_discs/models/item/music_disc_peanuts.json
Executable file
15
src/main/resources/assets/extra_discs/models/item/music_disc_peanuts.json
Executable file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "extra_discs:item/music_disc_peanuts"
|
||||
},
|
||||
|
||||
"overrides": [
|
||||
{
|
||||
"predicate": {
|
||||
"round": 1
|
||||
},
|
||||
"model": "extra_discs:item/music_disc_peanuts_round"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "visualoverhaul:item/round_disc",
|
||||
"textures": {
|
||||
"0": "extra_discs:item/music_disc_peanuts"
|
||||
}
|
||||
}
|
||||
15
src/main/resources/assets/extra_discs/models/item/music_disc_repetition.json
Executable file
15
src/main/resources/assets/extra_discs/models/item/music_disc_repetition.json
Executable file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "extra_discs:item/music_disc_repetition"
|
||||
},
|
||||
|
||||
"overrides": [
|
||||
{
|
||||
"predicate": {
|
||||
"round": 1
|
||||
},
|
||||
"model": "extra_discs:item/music_disc_repetition_round"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "visualoverhaul:item/round_disc",
|
||||
"textures": {
|
||||
"0": "extra_discs:item/music_disc_repetition"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "extra_discs:item/music_disc_sometimes_i_make_video_game_music"
|
||||
},
|
||||
|
||||
"overrides": [
|
||||
{
|
||||
"predicate": {
|
||||
"round": 1
|
||||
},
|
||||
"model": "extra_discs:item/music_disc_sometimes_i_make_video_game_music_round"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "visualoverhaul:item/round_disc",
|
||||
"textures": {
|
||||
"0": "extra_discs:item/music_disc_sometimes_i_make_video_game_music"
|
||||
}
|
||||
}
|
||||
0
src/main/resources/assets/minecraft/models/item/music_disc_11.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_11.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_11_round.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_11_round.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_13.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_13.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_13_round.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_13_round.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_blocks.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_blocks.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_blocks_round.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_blocks_round.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_cat.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_cat.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_cat_round.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_cat_round.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_chirp.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_chirp.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_chirp_round.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_chirp_round.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_far.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_far.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_far_round.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_far_round.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_mall.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_mall.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_mall_round.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_mall_round.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_mellohi.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_mellohi.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_mellohi_round.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_mellohi_round.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_pigstep.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_pigstep.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_pigstep_round.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_pigstep_round.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_stal.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_stal.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_stal_round.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_stal_round.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_strad.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_strad.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_strad_round.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_strad_round.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_wait.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_wait.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_wait_round.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_wait_round.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_ward.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_ward.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_ward_round.json
Normal file → Executable file
0
src/main/resources/assets/minecraft/models/item/music_disc_ward_round.json
Normal file → Executable file
16
src/main/resources/assets/phonos/models/item/custom_music_disc.json
Executable file
16
src/main/resources/assets/phonos/models/item/custom_music_disc.json
Executable file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer1": "phonos:item/music_disc_outer",
|
||||
"layer0": "phonos:item/music_disc_inner"
|
||||
},
|
||||
|
||||
"overrides": [
|
||||
{
|
||||
"predicate": {
|
||||
"round": 1
|
||||
},
|
||||
"model": "phonos:item/custom_music_disc_round"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"parent": "visualoverhaul:item/round_disc_colored_layers",
|
||||
"textures": {
|
||||
"0": "phonos:item/music_disc_inner",
|
||||
"1": "phonos:item/music_disc_outer"
|
||||
}
|
||||
}
|
||||
0
src/main/resources/assets/visualoverhaul/blockstates/jukebox_top.json
Normal file → Executable file
0
src/main/resources/assets/visualoverhaul/blockstates/jukebox_top.json
Normal file → Executable file
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "visualoverhaul:block/puddle"
|
||||
}
|
||||
}
|
||||
}
|
||||
44
src/main/resources/assets/visualoverhaul/blockstates/radio_jukebox_top.json
Executable file
44
src/main/resources/assets/visualoverhaul/blockstates/radio_jukebox_top.json
Executable file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"variants": {
|
||||
"playing=true,channel=0": {"model": "visualoverhaul:block/phonos/jukebox_top_playing_0"},
|
||||
"playing=false,channel=0": {"model": "visualoverhaul:block/phonos/jukebox_top_stopped_0"},
|
||||
"playing=true,channel=1": {"model": "visualoverhaul:block/phonos/jukebox_top_playing_1"},
|
||||
"playing=false,channel=1": {"model": "visualoverhaul:block/phonos/jukebox_top_stopped_1"},
|
||||
"playing=true,channel=2": {"model": "visualoverhaul:block/phonos/jukebox_top_playing_2"},
|
||||
"playing=false,channel=2": {"model": "visualoverhaul:block/phonos/jukebox_top_stopped_2"},
|
||||
"playing=true,channel=3": {"model": "visualoverhaul:block/phonos/jukebox_top_playing_3"},
|
||||
"playing=false,channel=3": {"model": "visualoverhaul:block/phonos/jukebox_top_stopped_3"},
|
||||
"playing=true,channel=4": {"model": "visualoverhaul:block/phonos/jukebox_top_playing_4"},
|
||||
"playing=false,channel=4": {"model": "visualoverhaul:block/phonos/jukebox_top_stopped_4"},
|
||||
"playing=true,channel=5": {"model": "visualoverhaul:block/phonos/jukebox_top_playing_5"},
|
||||
"playing=false,channel=5": {"model": "visualoverhaul:block/phonos/jukebox_top_stopped_5"},
|
||||
"playing=true,channel=6": {"model": "visualoverhaul:block/phonos/jukebox_top_playing_6"},
|
||||
"playing=false,channel=6": {"model": "visualoverhaul:block/phonos/jukebox_top_stopped_6"},
|
||||
"playing=true,channel=7": {"model": "visualoverhaul:block/phonos/jukebox_top_playing_7"},
|
||||
"playing=false,channel=7": {"model": "visualoverhaul:block/phonos/jukebox_top_stopped_7"},
|
||||
"playing=true,channel=8": {"model": "visualoverhaul:block/phonos/jukebox_top_playing_8"},
|
||||
"playing=false,channel=8": {"model": "visualoverhaul:block/phonos/jukebox_top_stopped_8"},
|
||||
"playing=true,channel=9": {"model": "visualoverhaul:block/phonos/jukebox_top_playing_9"},
|
||||
"playing=false,channel=9": {"model": "visualoverhaul:block/phonos/jukebox_top_stopped_9"},
|
||||
"playing=true,channel=10": {"model": "visualoverhaul:block/phonos/jukebox_top_playing_10"},
|
||||
"playing=false,channel=10": {"model": "visualoverhaul:block/phonos/jukebox_top_stopped_10"},
|
||||
"playing=true,channel=11": {"model": "visualoverhaul:block/phonos/jukebox_top_playing_11"},
|
||||
"playing=false,channel=11": {"model": "visualoverhaul:block/phonos/jukebox_top_stopped_11"},
|
||||
"playing=true,channel=12": {"model": "visualoverhaul:block/phonos/jukebox_top_playing_12"},
|
||||
"playing=false,channel=12": {"model": "visualoverhaul:block/phonos/jukebox_top_stopped_12"},
|
||||
"playing=true,channel=13": {"model": "visualoverhaul:block/phonos/jukebox_top_playing_13"},
|
||||
"playing=false,channel=13": {"model": "visualoverhaul:block/phonos/jukebox_top_stopped_13"},
|
||||
"playing=true,channel=14": {"model": "visualoverhaul:block/phonos/jukebox_top_playing_14"},
|
||||
"playing=false,channel=14": {"model": "visualoverhaul:block/phonos/jukebox_top_stopped_14"},
|
||||
"playing=true,channel=15": {"model": "visualoverhaul:block/phonos/jukebox_top_playing_15"},
|
||||
"playing=false,channel=15": {"model": "visualoverhaul:block/phonos/jukebox_top_stopped_15"},
|
||||
"playing=true,channel=16": {"model": "visualoverhaul:block/phonos/jukebox_top_playing_16"},
|
||||
"playing=false,channel=16": {"model": "visualoverhaul:block/phonos/jukebox_top_stopped_16"},
|
||||
"playing=true,channel=17": {"model": "visualoverhaul:block/phonos/jukebox_top_playing_17"},
|
||||
"playing=false,channel=17": {"model": "visualoverhaul:block/phonos/jukebox_top_stopped_17"},
|
||||
"playing=true,channel=18": {"model": "visualoverhaul:block/phonos/jukebox_top_playing_18"},
|
||||
"playing=false,channel=18": {"model": "visualoverhaul:block/phonos/jukebox_top_stopped_18"},
|
||||
"playing=true,channel=19": {"model": "visualoverhaul:block/phonos/jukebox_top_playing_19"},
|
||||
"playing=false,channel=19": {"model": "visualoverhaul:block/phonos/jukebox_top_stopped_19"}
|
||||
}
|
||||
}
|
||||
BIN
src/main/resources/assets/visualoverhaul/icon.png
Normal file → Executable file
BIN
src/main/resources/assets/visualoverhaul/icon.png
Normal file → Executable file
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 11 KiB |
20
src/main/resources/assets/visualoverhaul/lang/en_us.json
Normal file → Executable file
20
src/main/resources/assets/visualoverhaul/lang/en_us.json
Normal file → Executable file
@@ -1,10 +1,12 @@
|
||||
{
|
||||
"visualoverhaul.midnightconfig.title":"Visual Overhaul Config",
|
||||
"visualoverhaul.midnightconfig.brewingstand":"Enable Brewing Stand Enhancements",
|
||||
"visualoverhaul.midnightconfig.jukebox":"Enable Jukebox Enhancements",
|
||||
"visualoverhaul.midnightconfig.jukebox_fake_block":"Enable fake block on jukebox top",
|
||||
"visualoverhaul.midnightconfig.furnace":"Enable Furnace Enhancements",
|
||||
"visualoverhaul.midnightconfig.coloredItems":"Enable biome-based item colors",
|
||||
"visualoverhaul.midnightconfig.coloredItems.tooltip":"Needs restart!",
|
||||
"block.visualoverhaul.puddle":"Puddle"
|
||||
{
|
||||
"visualoverhaul.midnightconfig.title":"Visual Overhaul Config",
|
||||
"visualoverhaul.midnightconfig.brewingstand":"Brewing Stand Enhancements",
|
||||
"visualoverhaul.midnightconfig.jukebox":"Jukebox Enhancements",
|
||||
"visualoverhaul.midnightconfig.jukebox_fake_block":"Fake block on jukebox top",
|
||||
"visualoverhaul.midnightconfig.furnace":"Furnace Enhancements",
|
||||
"visualoverhaul.midnightconfig.smoker_particles":"Smoker Particles",
|
||||
"visualoverhaul.midnightconfig.blast_furnace_particles":"Blast Furnace Particles",
|
||||
"visualoverhaul.midnightconfig.coloredItems":"Biome-based item colors",
|
||||
"visualoverhaul.midnightconfig.coloredItems.tooltip":"§cNeeds restart!",
|
||||
"visualoverhaul.midnightconfig.potionEnchantmentGlint":"Potion enchantment glint"
|
||||
}
|
||||
0
src/main/resources/assets/visualoverhaul/models/block/jukebox_top_playing.json
Normal file → Executable file
0
src/main/resources/assets/visualoverhaul/models/block/jukebox_top_playing.json
Normal file → Executable file
0
src/main/resources/assets/visualoverhaul/models/block/jukebox_top_stopped.json
Normal file → Executable file
0
src/main/resources/assets/visualoverhaul/models/block/jukebox_top_stopped.json
Normal file → Executable file
@@ -0,0 +1,85 @@
|
||||
{
|
||||
"credit": "made by Motschen",
|
||||
"textures": {
|
||||
"0": "block/glass",
|
||||
"1": "block/black_concrete",
|
||||
"2": "block/anvil",
|
||||
"3": "visualoverhaul:block/vo_jukebox_top",
|
||||
"4": "phonos:block/speaker_top_0",
|
||||
"particle": "block/glass"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 0.01, 16],
|
||||
"faces": {
|
||||
"up": {"uv": [0, 0, 16, 16], "texture": "#3"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 5, 16],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 16, 5], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 16, 5], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 16, 5], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 16, 5], "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 16, 16], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [7.875, 0, 7.875],
|
||||
"to": [8.125, 1.25, 8.125],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 0.25, 2], "texture": "#1"},
|
||||
"east": {"uv": [0, 0, 0.25, 2], "texture": "#1"},
|
||||
"south": {"uv": [0, 0, 0.25, 2], "texture": "#1"},
|
||||
"west": {"uv": [0, 0, 0.25, 2], "texture": "#1"},
|
||||
"up": {"uv": [0, 0, 0.25, 0.25], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [5.75, 1, 11.29],
|
||||
"to": [6, 1.5, 11.54],
|
||||
"rotation": {"angle": 45, "axis": "y", "origin": [5, 8, 12]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 0.25, 2], "texture": "#2"},
|
||||
"east": {"uv": [0, 0, 0.25, 2], "texture": "#2"},
|
||||
"south": {"uv": [0, 0, 0.25, 2], "texture": "#2"},
|
||||
"west": {"uv": [0, 0, 0.25, 2], "texture": "#2"},
|
||||
"up": {"uv": [0, 0, 0.25, 0.25], "texture": "#2"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [0.875, 0, 14.875],
|
||||
"to": [1.375, 1.5, 15.375],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [1, 8, 15]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 0.25, 2], "texture": "#1"},
|
||||
"east": {"uv": [0, 0, 0.25, 2], "texture": "#1"},
|
||||
"south": {"uv": [0, 0, 0.25, 2], "texture": "#1"},
|
||||
"west": {"uv": [0, 0, 0.25, 2], "texture": "#1"},
|
||||
"up": {"uv": [0, 0, 0.25, 0.25], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [0.65, 1.5, 14.875],
|
||||
"to": [7.15, 2, 15.375],
|
||||
"rotation": {"angle": 45, "axis": "y", "origin": [1, 10, 15]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 0.25, 2], "texture": "#1"},
|
||||
"east": {"uv": [0, 0, 0.25, 2], "texture": "#1"},
|
||||
"south": {"uv": [0, 0, 0.25, 2], "texture": "#1"},
|
||||
"west": {"uv": [0, 0, 0.25, 2], "texture": "#1"},
|
||||
"up": {"uv": [0, 0, 0.25, 0.25], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [10, 0.1, 12],
|
||||
"to": [15, 0.1, 15],
|
||||
"faces": {
|
||||
"up": {"uv": [4, 5, 12, 10], "rotation": 180, "texture": "#4"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "visualoverhaul:block/phonos/jukebox_top_playing_0",
|
||||
"textures": {
|
||||
"4": "phonos:block/speaker_top_1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "visualoverhaul:block/phonos/jukebox_top_playing_0",
|
||||
"textures": {
|
||||
"4": "phonos:block/speaker_top_10"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "visualoverhaul:block/phonos/jukebox_top_playing_0",
|
||||
"textures": {
|
||||
"4": "phonos:block/speaker_top_11"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "visualoverhaul:block/phonos/jukebox_top_playing_0",
|
||||
"textures": {
|
||||
"4": "phonos:block/speaker_top_12"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "visualoverhaul:block/phonos/jukebox_top_playing_0",
|
||||
"textures": {
|
||||
"4": "phonos:block/speaker_top_13"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "visualoverhaul:block/phonos/jukebox_top_playing_0",
|
||||
"textures": {
|
||||
"4": "phonos:block/speaker_top_14"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "visualoverhaul:block/phonos/jukebox_top_playing_0",
|
||||
"textures": {
|
||||
"4": "phonos:block/speaker_top_15"
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user