Update to 1.20
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -127,3 +127,6 @@ src/test/
|
|||||||
### ForgeGradle ###
|
### ForgeGradle ###
|
||||||
run/
|
run/
|
||||||
bin/
|
bin/
|
||||||
|
|
||||||
|
### Changelog ###
|
||||||
|
changelog.txt
|
||||||
|
|||||||
96
build.gradle
96
build.gradle
@@ -1,12 +1,15 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'eclipse'
|
id 'eclipse'
|
||||||
id 'net.minecraftforge.gradle' version '5.1.+'
|
id 'net.minecraftforge.gradle' version '6.0.+'
|
||||||
|
id 'me.hypherionmc.cursegradle' version '2.+'
|
||||||
}
|
}
|
||||||
|
|
||||||
archivesBaseName = "${mod_name}-${minecraft_version}"
|
archivesBaseName = "${mod_name}-${minecraft_version}"
|
||||||
|
version = mod_version
|
||||||
|
|
||||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||||
|
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
|
||||||
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + ' (' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
|
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + ' (' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
@@ -16,25 +19,10 @@ minecraft {
|
|||||||
runs {
|
runs {
|
||||||
client {
|
client {
|
||||||
workingDirectory project.file('run')
|
workingDirectory project.file('run')
|
||||||
taskName project.name + 'Client'
|
taskName "${project.name}Client"
|
||||||
|
|
||||||
// Recommended logging data for a userdev environment
|
|
||||||
// The markers can be added/remove as needed separated by commas.
|
|
||||||
// "SCAN": For mods scan.
|
|
||||||
// "REGISTRIES": For firing of registry events.
|
|
||||||
// "REGISTRYDUMP": For getting the contents of all registries.
|
|
||||||
// property 'forge.logging.markers', 'REGISTRIES'
|
|
||||||
|
|
||||||
// Recommended logging level for the console
|
|
||||||
// You can set various levels here.
|
|
||||||
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
|
|
||||||
// property 'forge.logging.console.level', 'debug'
|
|
||||||
|
|
||||||
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
|
||||||
// property 'forge.enabledGameTestNamespaces', "${mod_id}"
|
|
||||||
|
|
||||||
mods {
|
mods {
|
||||||
modSource {
|
"${mod_id}" {
|
||||||
source sourceSets.main
|
source sourceSets.main
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -42,32 +30,21 @@ minecraft {
|
|||||||
|
|
||||||
server {
|
server {
|
||||||
workingDirectory project.file('run')
|
workingDirectory project.file('run')
|
||||||
taskName project.name + 'Server'
|
taskName "${project.name}Server"
|
||||||
|
|
||||||
// property 'forge.logging.markers', 'REGISTRIES'
|
|
||||||
// property 'forge.logging.console.level', 'debug'
|
|
||||||
// property 'forge.enabledGameTestNamespaces', 'examplemod'
|
|
||||||
|
|
||||||
mods {
|
mods {
|
||||||
modSource {
|
"${mod_id}" {
|
||||||
source sourceSets.main
|
source sourceSets.main
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This run config launches GameTestServer and runs all registered gametests, then exits.
|
|
||||||
// By default, the server will crash when no gametests are provided.
|
|
||||||
// The gametest system is also enabled by default for other run configs under the /test command.
|
|
||||||
gameTestServer {
|
gameTestServer {
|
||||||
workingDirectory project.file('run')
|
workingDirectory project.file('run')
|
||||||
taskName project.name + 'GameTest'
|
taskName "${project.name}GameTest"
|
||||||
|
|
||||||
// property 'forge.logging.markers', 'REGISTRIES'
|
|
||||||
// property 'forge.logging.console.level', 'debug'
|
|
||||||
// property 'forge.enabledGameTestNamespaces', 'examplemod'
|
|
||||||
|
|
||||||
mods {
|
mods {
|
||||||
modSource {
|
"${mod_id}" {
|
||||||
source sourceSets.main
|
source sourceSets.main
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -75,15 +52,12 @@ minecraft {
|
|||||||
|
|
||||||
data {
|
data {
|
||||||
workingDirectory project.file('run')
|
workingDirectory project.file('run')
|
||||||
taskName project.name + 'Data'
|
taskName "${project.name}Data"
|
||||||
|
|
||||||
// property 'forge.logging.markers', 'REGISTRIES'
|
|
||||||
// property 'forge.logging.console.level', 'debug'
|
|
||||||
|
|
||||||
args '--mod', "${mod_id}", '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
|
args '--mod', "${mod_id}", '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
|
||||||
|
|
||||||
mods {
|
mods {
|
||||||
modSource {
|
"${mod_id}" {
|
||||||
source sourceSets.main
|
source sourceSets.main
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -93,33 +67,8 @@ minecraft {
|
|||||||
|
|
||||||
sourceSets.main.resources.srcDir 'src/generated/resources'
|
sourceSets.main.resources.srcDir 'src/generated/resources'
|
||||||
|
|
||||||
repositories {
|
|
||||||
// Put repositories for dependencies here
|
|
||||||
// ForgeGradle automatically adds the Forge maven and Maven Central for you
|
|
||||||
|
|
||||||
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so:
|
|
||||||
// flatDir {
|
|
||||||
// dir 'libs'
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
|
|
||||||
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
|
|
||||||
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
|
|
||||||
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
||||||
|
|
||||||
// Real mod deobf dependency examples - these get remapped to your current mappings
|
|
||||||
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency
|
|
||||||
// runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency
|
|
||||||
// implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency
|
|
||||||
|
|
||||||
// Examples using mod jars from ./libs
|
|
||||||
// implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")
|
|
||||||
|
|
||||||
// For more info...
|
|
||||||
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
|
||||||
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
@@ -152,3 +101,24 @@ processResources {
|
|||||||
tasks.withType(JavaCompile).configureEach {
|
tasks.withType(JavaCompile).configureEach {
|
||||||
options.encoding = 'UTF-8'
|
options.encoding = 'UTF-8'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
curseforge {
|
||||||
|
apiKey = project.hasProperty("curse_api_key") ? curse_api_key : ''
|
||||||
|
project {
|
||||||
|
id = curse_project_id
|
||||||
|
changelog = file('changelog.txt').canRead() ? file('changelog.txt').text : ''
|
||||||
|
changelogType = 'text'
|
||||||
|
releaseType = 'release'
|
||||||
|
addGameVersion 'Forge'
|
||||||
|
forge_compatible_minecraft_versions.split(",").each {
|
||||||
|
addGameVersion(it)
|
||||||
|
}
|
||||||
|
mainArtifact(jar) {
|
||||||
|
displayName = "${minecraft_version}-${mod_version} Universal"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
options {
|
||||||
|
javaVersionAutoDetect = false
|
||||||
|
forgeGradleIntegration = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,14 +1,18 @@
|
|||||||
# WorldHandler
|
# WorldHandler
|
||||||
mod_id = worldhandler
|
mod_id = worldhandler
|
||||||
mod_name = WorldHandler
|
mod_name = WorldHandler
|
||||||
version = 3.4.3
|
mod_version = 3.4.3
|
||||||
minecraft_version = 1.19.4
|
minecraft_version = 1.20
|
||||||
group = exopandora.worldhandler
|
group = exopandora.worldhandler
|
||||||
main_class = exopandora.worldhandler.Main
|
main_class = exopandora.worldhandler.Main
|
||||||
author = Exopandora
|
author = Exopandora
|
||||||
|
|
||||||
# Forge
|
# Forge
|
||||||
forge_version = 45.0.1
|
forge_version = 46.0.12
|
||||||
|
forge_compatible_minecraft_versions = 1.20
|
||||||
|
|
||||||
|
# Publishing
|
||||||
|
curse_project_id = 228970
|
||||||
|
|
||||||
# Gradle
|
# Gradle
|
||||||
org.gradle.jvmargs = -Xmx3G
|
org.gradle.jvmargs = -Xmx3G
|
||||||
|
|||||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
25
gradlew
vendored
25
gradlew
vendored
@@ -55,7 +55,7 @@
|
|||||||
# Darwin, MinGW, and NonStop.
|
# Darwin, MinGW, and NonStop.
|
||||||
#
|
#
|
||||||
# (3) This script is generated from the Groovy template
|
# (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
|
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
# within the Gradle project.
|
# within the Gradle project.
|
||||||
#
|
#
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
@@ -80,13 +80,10 @@ do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
APP_NAME="Gradle"
|
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
|
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||||
# 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.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
@@ -143,12 +140,16 @@ fi
|
|||||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
max*)
|
max*)
|
||||||
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC3045
|
||||||
MAX_FD=$( ulimit -H -n ) ||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
warn "Could not query maximum file descriptor limit"
|
warn "Could not query maximum file descriptor limit"
|
||||||
esac
|
esac
|
||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
'' | soft) :;; #(
|
'' | soft) :;; #(
|
||||||
*)
|
*)
|
||||||
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC3045
|
||||||
ulimit -n "$MAX_FD" ||
|
ulimit -n "$MAX_FD" ||
|
||||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
esac
|
esac
|
||||||
@@ -193,6 +194,10 @@ if "$cygwin" || "$msys" ; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# 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"'
|
||||||
|
|
||||||
# Collect all arguments for the java command;
|
# Collect all arguments for the java command;
|
||||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||||
# shell script including quotes and variable substitutions, so put them in
|
# shell script including quotes and variable substitutions, so put them in
|
||||||
@@ -205,6 +210,12 @@ set -- \
|
|||||||
org.gradle.wrapper.GradleWrapperMain \
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
"$@"
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
# Use "xargs" to parse quoted args.
|
# Use "xargs" to parse quoted args.
|
||||||
#
|
#
|
||||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
|||||||
15
gradlew.bat
vendored
15
gradlew.bat
vendored
@@ -14,7 +14,7 @@
|
|||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
@@ -25,7 +25,8 @@
|
|||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
|||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto execute
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
exit /b 1
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|||||||
@@ -2,9 +2,14 @@ pluginManagement {
|
|||||||
repositories {
|
repositories {
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
maven {
|
maven {
|
||||||
|
name = 'MinecraftForge'
|
||||||
url = 'https://maven.minecraftforge.net/'
|
url = 'https://maven.minecraftforge.net/'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
|
||||||
|
}
|
||||||
|
|
||||||
rootProject.name = 'WorldHandler'
|
rootProject.name = 'WorldHandler'
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package exopandora.worldhandler;
|
package exopandora.worldhandler;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
@@ -51,7 +50,7 @@ public class WorldHandler
|
|||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
Config.setupDirectories(WorldHandler.USERCONTENT_PATH);
|
Config.setupDirectories(WorldHandler.USERCONTENT_PATH);
|
||||||
modLoadingContext.registerConfig(Type.CLIENT, Config.CLIENT_SPEC, Main.MODID + File.pathSeparator + Main.MODID + ".toml");
|
modLoadingContext.registerConfig(Type.CLIENT, Config.CLIENT_SPEC, Main.MODID + "/" + Main.MODID + ".toml");
|
||||||
UsercontentLoader.load(WorldHandler.USERCONTENT_PATH);
|
UsercontentLoader.load(WorldHandler.USERCONTENT_PATH);
|
||||||
modEventBus.addListener(WorldHandler.this::registerKeyMappingsEvent);
|
modEventBus.addListener(WorldHandler.this::registerKeyMappingsEvent);
|
||||||
modEventBus.addListener(WorldHandler.this::registerClientReloadListeners);
|
modEventBus.addListener(WorldHandler.this::registerClientReloadListeners);
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package exopandora.worldhandler.builder.argument.tag;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
import exopandora.worldhandler.util.UserStylableComponent;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.nbt.ListTag;
|
||||||
|
import net.minecraft.nbt.StringTag;
|
||||||
|
import net.minecraft.nbt.Tag;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
|
||||||
|
public class SidedSignTextTag implements ITagProvider
|
||||||
|
{
|
||||||
|
private boolean isFront;
|
||||||
|
private final UserStylableComponent[] lines = new UserStylableComponent[]
|
||||||
|
{
|
||||||
|
new UserStylableComponent(),
|
||||||
|
new UserStylableComponent(),
|
||||||
|
new UserStylableComponent(),
|
||||||
|
new UserStylableComponent()
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String key()
|
||||||
|
{
|
||||||
|
return this.isFront ? "front_text" : "back_text";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
@Override
|
||||||
|
public Tag value()
|
||||||
|
{
|
||||||
|
ListTag messages = new ListTag();
|
||||||
|
|
||||||
|
for(UserStylableComponent text : this.lines)
|
||||||
|
{
|
||||||
|
messages.add(StringTag.valueOf(Component.Serializer.toJson(text)));
|
||||||
|
}
|
||||||
|
|
||||||
|
CompoundTag tag = new CompoundTag();
|
||||||
|
tag.put("messages", messages);
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserStylableComponent getLine(int index)
|
||||||
|
{
|
||||||
|
return this.lines[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isStyled()
|
||||||
|
{
|
||||||
|
return Arrays.stream(this.lines).anyMatch(UserStylableComponent::isStyled);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsFront(boolean isFront)
|
||||||
|
{
|
||||||
|
this.isFront = isFront;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
package exopandora.worldhandler.builder.argument.tag;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
import exopandora.worldhandler.util.UserStylableComponent;
|
|
||||||
import net.minecraft.nbt.StringTag;
|
|
||||||
import net.minecraft.nbt.Tag;
|
|
||||||
import net.minecraft.network.chat.Component;
|
|
||||||
|
|
||||||
public class TextTag implements ITagProvider
|
|
||||||
{
|
|
||||||
private final int id;
|
|
||||||
private final UserStylableComponent component = new UserStylableComponent();
|
|
||||||
|
|
||||||
public TextTag(int id)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UserStylableComponent getComponent()
|
|
||||||
{
|
|
||||||
return this.component;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String key()
|
|
||||||
{
|
|
||||||
return "Text" + this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
@Override
|
|
||||||
public Tag value()
|
|
||||||
{
|
|
||||||
return StringTag.valueOf(Component.Serializer.toJson(this.component));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -28,14 +28,14 @@ public class CommandWorldHandler
|
|||||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.register(Commands.literal("worldhandler")
|
dispatcher.register(Commands.literal("worldhandler")
|
||||||
.then(Commands.literal("help")
|
.then(Commands.literal("help")
|
||||||
.executes(context -> help(context.getSource())))
|
.executes(context -> help(context.getSource())))
|
||||||
.then(Commands.literal("display")
|
.then(Commands.literal("display")
|
||||||
.executes(context -> display(context.getSource())))
|
.executes(context -> display(context.getSource())))
|
||||||
.then(Commands.literal("version")
|
.then(Commands.literal("version")
|
||||||
.executes(context -> version(context.getSource())))
|
.executes(context -> version(context.getSource())))
|
||||||
.then(Commands.literal("allow_commands")
|
.then(Commands.literal("allow_commands")
|
||||||
.executes(context -> allowCommands(context.getSource()))));
|
.executes(context -> allowCommands(context.getSource()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int help(CommandSourceStack source) throws CommandSyntaxException
|
private static int help(CommandSourceStack source) throws CommandSyntaxException
|
||||||
@@ -86,7 +86,7 @@ public class CommandWorldHandler
|
|||||||
server.getCommands().sendCommands(player);
|
server.getCommands().sendCommands(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
source.sendSuccess(Component.translatable("commands.worldhandler.allow_commands.success"), false);
|
source.sendSuccess(() -> Component.translatable("commands.worldhandler.allow_commands.success"), false);
|
||||||
return operatorPermissionLevel;
|
return operatorPermissionLevel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,17 +5,17 @@ import net.minecraft.network.chat.Component;
|
|||||||
|
|
||||||
public class DummyScreen extends Screen
|
public class DummyScreen extends Screen
|
||||||
{
|
{
|
||||||
private final Runnable runnable;
|
private final Runnable onInit;
|
||||||
|
|
||||||
public DummyScreen(Runnable runnable)
|
public DummyScreen(Runnable onInit)
|
||||||
{
|
{
|
||||||
super(Component.empty());
|
super(Component.empty());
|
||||||
this.runnable = runnable;
|
this.onInit = onInit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void init()
|
protected void init()
|
||||||
{
|
{
|
||||||
this.runnable.run();
|
this.onInit.run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,4 @@ public interface IContainer
|
|||||||
|
|
||||||
int getBackgroundWidth();
|
int getBackgroundWidth();
|
||||||
int getBackgroundHeight();
|
int getBackgroundHeight();
|
||||||
|
|
||||||
void bindBackground();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import exopandora.worldhandler.util.ResourceHelper;
|
|||||||
import exopandora.worldhandler.util.TextUtils;
|
import exopandora.worldhandler.util.TextUtils;
|
||||||
import net.minecraft.Util;
|
import net.minecraft.Util;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiComponent;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.gui.components.AbstractWidget;
|
import net.minecraft.client.gui.components.AbstractWidget;
|
||||||
import net.minecraft.client.gui.components.Renderable;
|
import net.minecraft.client.gui.components.Renderable;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
@@ -144,7 +144,7 @@ public class GuiWorldHandler extends Container
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(PoseStack stack, int mouseX, int mouseY, float partialTicks)
|
public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks)
|
||||||
{
|
{
|
||||||
ActionHelper.tryRun(() ->
|
ActionHelper.tryRun(() ->
|
||||||
{
|
{
|
||||||
@@ -153,19 +153,18 @@ public class GuiWorldHandler extends Container
|
|||||||
|
|
||||||
if(Config.getSkin().drawBackground())
|
if(Config.getSkin().drawBackground())
|
||||||
{
|
{
|
||||||
super.renderBackground(stack);
|
super.renderBackground(guiGraphics);
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
RenderUtils.colorDefaultBackground();
|
RenderUtils.colorDefaultBackground();
|
||||||
|
|
||||||
this.bindBackground();
|
guiGraphics.blit(ResourceHelper.backgroundTexture(), backgroundX, backgroundY, 0, 0, this.getBackgroundWidth(), this.getBackgroundHeight());
|
||||||
GuiComponent.blit(stack, backgroundX, backgroundY, 0, 0, this.getBackgroundWidth(), this.getBackgroundHeight());
|
|
||||||
|
|
||||||
final String label = Main.MC_VERSION + "-" + Main.MOD_VERSION;
|
final String label = Main.MC_VERSION + "-" + Main.MOD_VERSION;
|
||||||
final int versionWidth = this.width - this.font.width(label) - 2;
|
final int versionWidth = this.width - this.font.width(label) - 2;
|
||||||
final int versionHeight = this.height - 10;
|
final int versionHeight = this.height - 10;
|
||||||
this.font.draw(stack, label, versionWidth, versionHeight, Config.getSkin().getLabelColor() + 0x33000000);
|
guiGraphics.drawString(this.font, label, versionWidth, versionHeight, Config.getSkin().getLabelColor() + 0x33000000, false);
|
||||||
|
|
||||||
int x = this.getContentX();
|
int x = this.getContentX();
|
||||||
int y = this.getContentY();
|
int y = this.getContentY();
|
||||||
@@ -174,30 +173,30 @@ public class GuiWorldHandler extends Container
|
|||||||
{
|
{
|
||||||
if(widget.isEnabled() && EnumLayer.BACKGROUND == widget.getLayer())
|
if(widget.isEnabled() && EnumLayer.BACKGROUND == widget.getLayer())
|
||||||
{
|
{
|
||||||
widget.drawScreen(stack, this, x, y, mouseX, mouseY, partialTicks);
|
widget.drawScreen(guiGraphics, this, x, y, mouseX, mouseY, partialTicks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final int maxWidth = this.getBackgroundWidth() - 18 - this.font.width(this.getPlayer()) - (Config.getSettings().watch() ? 9 : 0);
|
final int maxWidth = this.getBackgroundWidth() - 18 - this.font.width(this.getPlayer()) - (Config.getSettings().watch() ? 9 : 0);
|
||||||
this.font.draw(stack, TextUtils.stripText(this.content.getTitle(), maxWidth, this.font), backgroundX + 7, backgroundY + 7, Config.getSkin().getLabelColor());
|
guiGraphics.drawString(this.font, TextUtils.stripText(this.content.getTitle(), maxWidth, this.font), backgroundX + 7, backgroundY + 7, Config.getSkin().getLabelColor(), false);
|
||||||
|
|
||||||
for(Renderable renderable : this.renderables)
|
for(Renderable renderable : this.renderables)
|
||||||
{
|
{
|
||||||
renderable.render(stack, mouseX, mouseY, partialTicks);
|
renderable.render(guiGraphics, mouseX, mouseY, partialTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.content.drawScreen(stack, this, x, y, mouseX, mouseY, partialTicks);
|
this.content.drawScreen(guiGraphics, this, x, y, mouseX, mouseY, partialTicks);
|
||||||
|
|
||||||
for(IMenu menu : this.menus)
|
for(IMenu menu : this.menus)
|
||||||
{
|
{
|
||||||
menu.draw(stack, mouseX, mouseY, partialTicks);
|
menu.draw(guiGraphics, mouseX, mouseY, partialTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(IContainerWidget widget : WIDGETS)
|
for(IContainerWidget widget : WIDGETS)
|
||||||
{
|
{
|
||||||
if(widget.isEnabled() && EnumLayer.FOREGROUND == widget.getLayer())
|
if(widget.isEnabled() && EnumLayer.FOREGROUND == widget.getLayer())
|
||||||
{
|
{
|
||||||
widget.drawScreen(stack, this, x, y, mouseX, mouseY, partialTicks);
|
widget.drawScreen(guiGraphics, this, x, y, mouseX, mouseY, partialTicks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,19 +206,20 @@ public class GuiWorldHandler extends Container
|
|||||||
{
|
{
|
||||||
if(renderable instanceof GuiButtonTooltip)
|
if(renderable instanceof GuiButtonTooltip)
|
||||||
{
|
{
|
||||||
((GuiButtonTooltip) renderable).renderTooltip(this, stack, mouseX, mouseY);
|
((GuiButtonTooltip) renderable).renderTooltip(guiGraphics, this.font, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mouseX >= versionWidth && mouseY >= versionHeight)
|
if(mouseX >= versionWidth && mouseY >= versionHeight)
|
||||||
{
|
{
|
||||||
stack.pushPose();
|
PoseStack poseStack = guiGraphics.pose();
|
||||||
stack.translate(versionWidth - 12, versionHeight + 12, 0);
|
poseStack.pushPose();
|
||||||
|
poseStack.translate(versionWidth - 12, versionHeight + 12, 0);
|
||||||
|
|
||||||
this.renderTooltip(stack, Component.literal(label), 0, 0);
|
guiGraphics.renderTooltip(this.font, Component.literal(label), 0, 0);
|
||||||
|
|
||||||
stack.popPose();
|
poseStack.popPose();
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderSystem.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
@@ -456,10 +456,4 @@ public class GuiWorldHandler extends Container
|
|||||||
{
|
{
|
||||||
return 166;
|
return 166;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void bindBackground()
|
|
||||||
{
|
|
||||||
RenderSystem.setShaderTexture(0, ResourceHelper.backgroundTexture());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,7 @@ import exopandora.worldhandler.gui.container.Container;
|
|||||||
import exopandora.worldhandler.gui.content.Content;
|
import exopandora.worldhandler.gui.content.Content;
|
||||||
import exopandora.worldhandler.gui.content.Contents;
|
import exopandora.worldhandler.gui.content.Contents;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
import exopandora.worldhandler.gui.widget.button.GuiHintTextField;
|
||||||
import exopandora.worldhandler.util.ActionHelper;
|
import exopandora.worldhandler.util.ActionHelper;
|
||||||
import exopandora.worldhandler.util.CommandHelper;
|
import exopandora.worldhandler.util.CommandHelper;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
@@ -30,7 +30,7 @@ import net.minecraftforge.registries.ForgeRegistries;
|
|||||||
|
|
||||||
public class ContentButcher extends Content
|
public class ContentButcher extends Content
|
||||||
{
|
{
|
||||||
private GuiTextFieldTooltip radiusField;
|
private GuiHintTextField radiusField;
|
||||||
private String radius;
|
private String radius;
|
||||||
private final KillCommandBuilder builderKill = new KillCommandBuilder();
|
private final KillCommandBuilder builderKill = new KillCommandBuilder();
|
||||||
private final CommandPreview preview = new CommandPreview(this.builderKill, KillCommandBuilder.Label.KILL_TARGETS);
|
private final CommandPreview preview = new CommandPreview(this.builderKill, KillCommandBuilder.Label.KILL_TARGETS);
|
||||||
@@ -44,7 +44,7 @@ public class ContentButcher extends Content
|
|||||||
@Override
|
@Override
|
||||||
public void initGui(Container container, int x, int y)
|
public void initGui(Container container, int x, int y)
|
||||||
{
|
{
|
||||||
this.radiusField = new GuiTextFieldTooltip(x + 58, y, 114, 20, Component.translatable("gui.worldhandler.butcher.radius"));
|
this.radiusField = new GuiHintTextField(x + 58, y, 114, 20, Component.translatable("gui.worldhandler.butcher.radius"));
|
||||||
this.radiusField.setFilter(string ->
|
this.radiusField.setFilter(string ->
|
||||||
{
|
{
|
||||||
if(string == null)
|
if(string == null)
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public class ContentChangeWorld extends ContentChild
|
|||||||
else if(connection instanceof DedicatedConnection dedicated)
|
else if(connection instanceof DedicatedConnection dedicated)
|
||||||
{
|
{
|
||||||
ServerData data = dedicated.getData();
|
ServerData data = dedicated.getData();
|
||||||
ConnectScreen.startConnecting(new TitleScreen(), Minecraft.getInstance(), ServerAddress.parseString(data.ip), data);
|
ConnectScreen.startConnecting(new TitleScreen(), Minecraft.getInstance(), ServerAddress.parseString(data.ip), data, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import exopandora.worldhandler.gui.widget.button.EnumIcon;
|
|||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonIcon;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonIcon;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonTooltip;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonTooltip;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
import exopandora.worldhandler.gui.widget.button.GuiHintTextField;
|
||||||
import exopandora.worldhandler.util.ActionHelper;
|
import exopandora.worldhandler.util.ActionHelper;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
@@ -39,7 +39,7 @@ public class ContentCommandStack extends ContentChild
|
|||||||
private static final Component PLUS = Component.literal("+");
|
private static final Component PLUS = Component.literal("+");
|
||||||
private static final Component MINUS = Component.literal("-");
|
private static final Component MINUS = Component.literal("-");
|
||||||
|
|
||||||
private final List<GuiTextFieldTooltip> textfields = new ArrayList<GuiTextFieldTooltip>();
|
private final List<GuiHintTextField> textfields = new ArrayList<GuiHintTextField>();
|
||||||
private int scroll;
|
private int scroll;
|
||||||
private GuiButtonBase buttonCopy;
|
private GuiButtonBase buttonCopy;
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ public class ContentCommandStack extends ContentChild
|
|||||||
{
|
{
|
||||||
int command = index + this.scroll;
|
int command = index + this.scroll;
|
||||||
|
|
||||||
GuiTextFieldTooltip textfield = new GuiTextFieldTooltip(x, y + 24 * index, 232 - 48, 20, Component.translatable("gui.worldhandler.command_stack.command_n", command + 1));
|
GuiHintTextField textfield = new GuiHintTextField(x, y + 24 * index, 232 - 48, 20, Component.translatable("gui.worldhandler.command_stack.command_n", command + 1));
|
||||||
textfield.setFilter(Predicates.notNull());
|
textfield.setFilter(Predicates.notNull());
|
||||||
textfield.setValue(command < this.getCommandCount() ? this.getCommand(command) : null);
|
textfield.setValue(command < this.getCommandCount() ? this.getCommand(command) : null);
|
||||||
textfield.setResponder(text ->
|
textfield.setResponder(text ->
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package exopandora.worldhandler.gui.content.impl;
|
|||||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||||
import exopandora.worldhandler.gui.container.Container;
|
import exopandora.worldhandler.gui.container.Container;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
import exopandora.worldhandler.gui.widget.button.GuiHintTextField;
|
||||||
import exopandora.worldhandler.util.ActionHelper;
|
import exopandora.worldhandler.util.ActionHelper;
|
||||||
import exopandora.worldhandler.util.CommandHelper;
|
import exopandora.worldhandler.util.CommandHelper;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
@@ -12,7 +12,7 @@ import net.minecraft.network.chat.Component;
|
|||||||
public class ContentContinue extends ContentChild
|
public class ContentContinue extends ContentChild
|
||||||
{
|
{
|
||||||
private ICommandBuilder builder;
|
private ICommandBuilder builder;
|
||||||
private GuiTextFieldTooltip commandField;
|
private GuiHintTextField commandField;
|
||||||
private Object label;
|
private Object label;
|
||||||
private boolean special;
|
private boolean special;
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ public class ContentContinue extends ContentChild
|
|||||||
@Override
|
@Override
|
||||||
public void initGui(Container container, int x, int y)
|
public void initGui(Container container, int x, int y)
|
||||||
{
|
{
|
||||||
this.commandField = new GuiTextFieldTooltip(x + 116 / 2, y + 12, 116, 20);
|
this.commandField = new GuiHintTextField(x + 116 / 2, y + 12, 116, 20);
|
||||||
this.commandField.setFocused(false);
|
this.commandField.setFocused(false);
|
||||||
this.commandField.setValue(this.builder.toCommand(this.label, false));
|
this.commandField.setValue(this.builder.toCommand(this.label, false));
|
||||||
this.commandField.moveCursorToStart();
|
this.commandField.moveCursorToStart();
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import exopandora.worldhandler.gui.content.Content;
|
|||||||
import exopandora.worldhandler.gui.content.Contents;
|
import exopandora.worldhandler.gui.content.Contents;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiSlider;
|
import exopandora.worldhandler.gui.widget.button.GuiSlider;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
import exopandora.worldhandler.gui.widget.button.GuiHintTextField;
|
||||||
import exopandora.worldhandler.gui.widget.button.LogicSliderAttribute;
|
import exopandora.worldhandler.gui.widget.button.LogicSliderAttribute;
|
||||||
import exopandora.worldhandler.gui.widget.button.LogicSliderSimple;
|
import exopandora.worldhandler.gui.widget.button.LogicSliderSimple;
|
||||||
import exopandora.worldhandler.gui.widget.menu.impl.ILogicPageList;
|
import exopandora.worldhandler.gui.widget.menu.impl.ILogicPageList;
|
||||||
@@ -35,9 +35,9 @@ import net.minecraftforge.registries.ForgeRegistries;
|
|||||||
|
|
||||||
public class ContentCustomItem extends Content
|
public class ContentCustomItem extends Content
|
||||||
{
|
{
|
||||||
private GuiTextFieldTooltip itemField;
|
private GuiHintTextField itemField;
|
||||||
private GuiTextFieldTooltip itemLore1Field;
|
private GuiHintTextField itemLore1Field;
|
||||||
private GuiTextFieldTooltip itemLore2Field;
|
private GuiHintTextField itemLore2Field;
|
||||||
|
|
||||||
private final GiveCommandBuilder builderCutomItem = new GiveCommandBuilder();
|
private final GiveCommandBuilder builderCutomItem = new GiveCommandBuilder();
|
||||||
private final AttributeModifiersTag attributes = new AttributeModifiersTag();
|
private final AttributeModifiersTag attributes = new AttributeModifiersTag();
|
||||||
@@ -94,7 +94,7 @@ public class ContentCustomItem extends Content
|
|||||||
@Override
|
@Override
|
||||||
public void initGui(Container container, int x, int y)
|
public void initGui(Container container, int x, int y)
|
||||||
{
|
{
|
||||||
this.itemField = new GuiTextFieldTooltip(x + 118, y, 114, 20, Component.translatable("gui.worldhandler.items.custom_item.start.item_id"));
|
this.itemField = new GuiHintTextField(x + 118, y, 114, 20, Component.translatable("gui.worldhandler.items.custom_item.start.item_id"));
|
||||||
this.itemField.setFilter(Predicates.<String>notNull());
|
this.itemField.setFilter(Predicates.<String>notNull());
|
||||||
this.itemField.setValue(this.item);
|
this.itemField.setValue(this.item);
|
||||||
this.itemField.setResponder(text ->
|
this.itemField.setResponder(text ->
|
||||||
@@ -104,7 +104,7 @@ public class ContentCustomItem extends Content
|
|||||||
container.initButtons();
|
container.initButtons();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.itemLore1Field = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.items.custom_item.start.lore_1"));
|
this.itemLore1Field = new GuiHintTextField(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.items.custom_item.start.lore_1"));
|
||||||
this.itemLore1Field.setFilter(Predicates.<String>notNull());
|
this.itemLore1Field.setFilter(Predicates.<String>notNull());
|
||||||
this.itemLore1Field.setText(this.display.getLore1());
|
this.itemLore1Field.setText(this.display.getLore1());
|
||||||
this.itemLore1Field.setResponder(text ->
|
this.itemLore1Field.setResponder(text ->
|
||||||
@@ -113,7 +113,7 @@ public class ContentCustomItem extends Content
|
|||||||
container.initButtons();
|
container.initButtons();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.itemLore2Field = new GuiTextFieldTooltip(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.items.custom_item.start.lore_2"));
|
this.itemLore2Field = new GuiHintTextField(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.items.custom_item.start.lore_2"));
|
||||||
this.itemLore2Field.setFilter(Predicates.<String>notNull());
|
this.itemLore2Field.setFilter(Predicates.<String>notNull());
|
||||||
this.itemLore2Field.setText(this.display.getLore2());
|
this.itemLore2Field.setText(this.display.getLore2());
|
||||||
this.itemLore2Field.setResponder(text ->
|
this.itemLore2Field.setResponder(text ->
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import exopandora.worldhandler.gui.content.Content;
|
|||||||
import exopandora.worldhandler.gui.content.Contents;
|
import exopandora.worldhandler.gui.content.Contents;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonList;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonList;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
import exopandora.worldhandler.gui.widget.button.GuiHintTextField;
|
||||||
import exopandora.worldhandler.gui.widget.menu.impl.ILogicMapped;
|
import exopandora.worldhandler.gui.widget.menu.impl.ILogicMapped;
|
||||||
import exopandora.worldhandler.util.ActionHelper;
|
import exopandora.worldhandler.util.ActionHelper;
|
||||||
import exopandora.worldhandler.util.BlockHelper;
|
import exopandora.worldhandler.util.BlockHelper;
|
||||||
@@ -27,15 +27,15 @@ import net.minecraft.network.chat.MutableComponent;
|
|||||||
|
|
||||||
public class ContentEditBlocks extends Content
|
public class ContentEditBlocks extends Content
|
||||||
{
|
{
|
||||||
private GuiTextFieldTooltip x1Field;
|
private GuiHintTextField x1Field;
|
||||||
private GuiTextFieldTooltip y1Field;
|
private GuiHintTextField y1Field;
|
||||||
private GuiTextFieldTooltip z1Field;
|
private GuiHintTextField z1Field;
|
||||||
private GuiTextFieldTooltip x2Field;
|
private GuiHintTextField x2Field;
|
||||||
private GuiTextFieldTooltip y2Field;
|
private GuiHintTextField y2Field;
|
||||||
private GuiTextFieldTooltip z2Field;
|
private GuiHintTextField z2Field;
|
||||||
private GuiTextFieldTooltip block1Field;
|
private GuiHintTextField block1Field;
|
||||||
private GuiTextFieldTooltip block2Field;
|
private GuiHintTextField block2Field;
|
||||||
private GuiTextFieldTooltip filterField;
|
private GuiHintTextField filterField;
|
||||||
|
|
||||||
private final FillCommandBuilder builderFill = new FillCommandBuilder();
|
private final FillCommandBuilder builderFill = new FillCommandBuilder();
|
||||||
private final CloneCommandBuilder builderClone = new CloneCommandBuilder();
|
private final CloneCommandBuilder builderClone = new CloneCommandBuilder();
|
||||||
@@ -71,37 +71,37 @@ public class ContentEditBlocks extends Content
|
|||||||
{
|
{
|
||||||
this.updatePositions();
|
this.updatePositions();
|
||||||
|
|
||||||
this.x1Field = new GuiTextFieldTooltip(x + 118, y, 55, 20);
|
this.x1Field = new GuiHintTextField(x + 118, y, 55, 20);
|
||||||
this.x1Field.setFilter(this.coordinatePredicate("X1"));
|
this.x1Field.setFilter(this.coordinatePredicate("X1"));
|
||||||
this.x1Field.setValue("X1: " + BlockHelper.pos1().getX());
|
this.x1Field.setValue("X1: " + BlockHelper.pos1().getX());
|
||||||
this.x1Field.setResponder(text -> BlockHelper.pos1().setX(this.parseCoordinate(text)));
|
this.x1Field.setResponder(text -> BlockHelper.pos1().setX(this.parseCoordinate(text)));
|
||||||
|
|
||||||
this.y1Field = new GuiTextFieldTooltip(x + 118, y + 24, 55, 20);
|
this.y1Field = new GuiHintTextField(x + 118, y + 24, 55, 20);
|
||||||
this.y1Field.setFilter(this.coordinatePredicate("Y1"));
|
this.y1Field.setFilter(this.coordinatePredicate("Y1"));
|
||||||
this.y1Field.setValue("Y1: " + BlockHelper.pos1().getY());
|
this.y1Field.setValue("Y1: " + BlockHelper.pos1().getY());
|
||||||
this.y1Field.setResponder(text -> BlockHelper.pos1().setY(this.parseCoordinate(text)));
|
this.y1Field.setResponder(text -> BlockHelper.pos1().setY(this.parseCoordinate(text)));
|
||||||
|
|
||||||
this.z1Field = new GuiTextFieldTooltip(x + 118, y + 48, 55, 20);
|
this.z1Field = new GuiHintTextField(x + 118, y + 48, 55, 20);
|
||||||
this.z1Field.setFilter(this.coordinatePredicate("Z1"));
|
this.z1Field.setFilter(this.coordinatePredicate("Z1"));
|
||||||
this.z1Field.setValue("Z1: " + BlockHelper.pos1().getZ());
|
this.z1Field.setValue("Z1: " + BlockHelper.pos1().getZ());
|
||||||
this.z1Field.setResponder(text -> BlockHelper.pos1().setZ(this.parseCoordinate(text)));
|
this.z1Field.setResponder(text -> BlockHelper.pos1().setZ(this.parseCoordinate(text)));
|
||||||
|
|
||||||
this.x2Field = new GuiTextFieldTooltip(x + 118 + 59, y, 55, 20);
|
this.x2Field = new GuiHintTextField(x + 118 + 59, y, 55, 20);
|
||||||
this.x2Field.setFilter(this.coordinatePredicate("X2"));
|
this.x2Field.setFilter(this.coordinatePredicate("X2"));
|
||||||
this.x2Field.setValue("X2: " + BlockHelper.pos2().getX());
|
this.x2Field.setValue("X2: " + BlockHelper.pos2().getX());
|
||||||
this.x2Field.setResponder(text -> BlockHelper.pos2().setX(this.parseCoordinate(text)));
|
this.x2Field.setResponder(text -> BlockHelper.pos2().setX(this.parseCoordinate(text)));
|
||||||
|
|
||||||
this.y2Field = new GuiTextFieldTooltip(x + 118 + 59, y + 24, 55, 20);
|
this.y2Field = new GuiHintTextField(x + 118 + 59, y + 24, 55, 20);
|
||||||
this.y2Field.setFilter(this.coordinatePredicate("Y2"));
|
this.y2Field.setFilter(this.coordinatePredicate("Y2"));
|
||||||
this.y2Field.setValue("Y2: " + BlockHelper.pos2().getY());
|
this.y2Field.setValue("Y2: " + BlockHelper.pos2().getY());
|
||||||
this.y2Field.setResponder(text -> BlockHelper.pos2().setY(this.parseCoordinate(text)));
|
this.y2Field.setResponder(text -> BlockHelper.pos2().setY(this.parseCoordinate(text)));
|
||||||
|
|
||||||
this.z2Field = new GuiTextFieldTooltip(x + 118 + 59, y + 48, 55, 20);
|
this.z2Field = new GuiHintTextField(x + 118 + 59, y + 48, 55, 20);
|
||||||
this.z2Field.setFilter(this.coordinatePredicate("Z2"));
|
this.z2Field.setFilter(this.coordinatePredicate("Z2"));
|
||||||
this.z2Field.setValue("Z2: " + BlockHelper.pos2().getZ());
|
this.z2Field.setValue("Z2: " + BlockHelper.pos2().getZ());
|
||||||
this.z2Field.setResponder(text -> BlockHelper.pos2().setZ(this.parseCoordinate(text)));
|
this.z2Field.setResponder(text -> BlockHelper.pos2().setZ(this.parseCoordinate(text)));
|
||||||
|
|
||||||
this.block1Field = new GuiTextFieldTooltip(x + 118, y, 114, 20, Page.FILL.equals(this.page) ? Component.translatable("gui.worldhandler.edit_blocks.fill.block_id_to_fill") : Component.translatable("gui.worldhandler.edit_blocks.replace.block_id_replace"));
|
this.block1Field = new GuiHintTextField(x + 118, y, 114, 20, Page.FILL.equals(this.page) ? Component.translatable("gui.worldhandler.edit_blocks.fill.block_id_to_fill") : Component.translatable("gui.worldhandler.edit_blocks.replace.block_id_replace"));
|
||||||
this.block1Field.setFilter(Predicates.notNull());
|
this.block1Field.setFilter(Predicates.notNull());
|
||||||
this.block1Field.setValue(this.block1);
|
this.block1Field.setValue(this.block1);
|
||||||
this.block1Field.setResponder(text ->
|
this.block1Field.setResponder(text ->
|
||||||
@@ -111,7 +111,7 @@ public class ContentEditBlocks extends Content
|
|||||||
container.initButtons();
|
container.initButtons();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.block2Field = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.edit_blocks.replace.block_id_place"));
|
this.block2Field = new GuiHintTextField(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.edit_blocks.replace.block_id_place"));
|
||||||
this.block2Field.setFilter(Predicates.notNull());
|
this.block2Field.setFilter(Predicates.notNull());
|
||||||
this.block2Field.setValue(this.block2);
|
this.block2Field.setValue(this.block2);
|
||||||
this.block2Field.setResponder(text ->
|
this.block2Field.setResponder(text ->
|
||||||
@@ -121,7 +121,7 @@ public class ContentEditBlocks extends Content
|
|||||||
container.initButtons();
|
container.initButtons();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.filterField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.edit_blocks.clone.filter"));
|
this.filterField = new GuiHintTextField(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.edit_blocks.clone.filter"));
|
||||||
this.filterField.setFilter(Predicates.notNull());
|
this.filterField.setFilter(Predicates.notNull());
|
||||||
this.filterField.setValue(this.filter);
|
this.filterField.setValue(this.filter);
|
||||||
this.filterField.setResponder(text ->
|
this.filterField.setResponder(text ->
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import exopandora.worldhandler.gui.content.Content;
|
|||||||
import exopandora.worldhandler.gui.content.Contents;
|
import exopandora.worldhandler.gui.content.Contents;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonTooltip;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonTooltip;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
import exopandora.worldhandler.gui.widget.button.GuiHintTextField;
|
||||||
import exopandora.worldhandler.gui.widget.menu.impl.ILogicPageList;
|
import exopandora.worldhandler.gui.widget.menu.impl.ILogicPageList;
|
||||||
import exopandora.worldhandler.gui.widget.menu.impl.MenuPageList;
|
import exopandora.worldhandler.gui.widget.menu.impl.MenuPageList;
|
||||||
import exopandora.worldhandler.util.ActionHandler;
|
import exopandora.worldhandler.util.ActionHandler;
|
||||||
@@ -29,7 +29,7 @@ import net.minecraft.world.level.GameRules.GameRuleTypeVisitor;
|
|||||||
|
|
||||||
public class ContentGamerules extends Content
|
public class ContentGamerules extends Content
|
||||||
{
|
{
|
||||||
private GuiTextFieldTooltip valueField;
|
private GuiHintTextField valueField;
|
||||||
|
|
||||||
private boolean booleanValue;
|
private boolean booleanValue;
|
||||||
private String value;
|
private String value;
|
||||||
@@ -46,7 +46,7 @@ public class ContentGamerules extends Content
|
|||||||
@Override
|
@Override
|
||||||
public void initGui(Container container, int x, int y)
|
public void initGui(Container container, int x, int y)
|
||||||
{
|
{
|
||||||
this.valueField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.generic.value"));
|
this.valueField = new GuiHintTextField(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.generic.value"));
|
||||||
this.valueField.setFilter(Predicates.notNull());
|
this.valueField.setFilter(Predicates.notNull());
|
||||||
this.valueField.setValue(this.value);
|
this.valueField.setValue(this.value);
|
||||||
this.valueField.moveCursorToEnd();
|
this.valueField.moveCursorToEnd();
|
||||||
|
|||||||
@@ -58,7 +58,13 @@ public class ContentLocate extends Content
|
|||||||
{
|
{
|
||||||
if(Page.BIOME.equals(this.page))
|
if(Page.BIOME.equals(this.page))
|
||||||
{
|
{
|
||||||
List<ResourceLocation> biomes = RegistryHelper.getLookupProvider().lookup(Registries.BIOME).get().listElementIds().map(ResourceKey::location).collect(Collectors.toList());
|
List<ResourceLocation> biomes = RegistryHelper.getLookupProvider()
|
||||||
|
.lookup(Registries.BIOME)
|
||||||
|
.get()
|
||||||
|
.listElementIds()
|
||||||
|
.map(ResourceKey::location)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
MenuPageList<ResourceLocation> list = new MenuPageList<ResourceLocation>(x + 118, y, biomes, 114, 20, 3, container, new ILogicPageList<ResourceLocation>()
|
MenuPageList<ResourceLocation> list = new MenuPageList<ResourceLocation>(x + 118, y, biomes, 114, 20, 3, container, new ILogicPageList<ResourceLocation>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@@ -96,7 +102,12 @@ public class ContentLocate extends Content
|
|||||||
}
|
}
|
||||||
else if(Page.STRUCTURE.equals(this.page))
|
else if(Page.STRUCTURE.equals(this.page))
|
||||||
{
|
{
|
||||||
List<ResourceLocation> structures = RegistryHelper.getLookupProvider().lookup(Registries.STRUCTURE).get().listElementIds().map(ResourceKey::location).collect(Collectors.toList());
|
List<ResourceLocation> structures = RegistryHelper.getLookupProvider()
|
||||||
|
.lookup(Registries.STRUCTURE)
|
||||||
|
.get()
|
||||||
|
.listElementIds()
|
||||||
|
.map(ResourceKey::location)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
MenuPageList<ResourceLocation> list = new MenuPageList<ResourceLocation>(x + 118, y, structures, 114, 20, 3, container, new ILogicPageList<ResourceLocation>()
|
MenuPageList<ResourceLocation> list = new MenuPageList<ResourceLocation>(x + 118, y, structures, 114, 20, 3, container, new ILogicPageList<ResourceLocation>()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import exopandora.worldhandler.gui.widget.button.EnumIcon;
|
|||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonIcon;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonIcon;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonTooltip;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonTooltip;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
import exopandora.worldhandler.gui.widget.button.GuiHintTextField;
|
||||||
import exopandora.worldhandler.util.ActionHelper;
|
import exopandora.worldhandler.util.ActionHelper;
|
||||||
import exopandora.worldhandler.util.CommandHelper;
|
import exopandora.worldhandler.util.CommandHelper;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
@@ -31,8 +31,8 @@ import net.minecraft.network.chat.MutableComponent;
|
|||||||
|
|
||||||
public class ContentMultiplayer extends Content
|
public class ContentMultiplayer extends Content
|
||||||
{
|
{
|
||||||
private GuiTextFieldTooltip playerField;
|
private GuiHintTextField playerField;
|
||||||
private GuiTextFieldTooltip reasonField;
|
private GuiHintTextField reasonField;
|
||||||
|
|
||||||
private Page page = Page.KICK_AND_BAN;
|
private Page page = Page.KICK_AND_BAN;
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ public class ContentMultiplayer extends Content
|
|||||||
@Override
|
@Override
|
||||||
public void initGui(Container container, int x, int y)
|
public void initGui(Container container, int x, int y)
|
||||||
{
|
{
|
||||||
this.playerField = new GuiTextFieldTooltip(x + 118, y + this.page.getShift(), 114, 20, Component.translatable("gui.worldhandler.multiplayer.username"));
|
this.playerField = new GuiHintTextField(x + 118, y + this.page.getShift(), 114, 20, Component.translatable("gui.worldhandler.multiplayer.username"));
|
||||||
this.playerField.setFilter(Predicates.notNull());
|
this.playerField.setFilter(Predicates.notNull());
|
||||||
this.playerField.setFocused(false);
|
this.playerField.setFocused(false);
|
||||||
this.playerField.setValue(this.builderKick.targets().getTarget());
|
this.playerField.setValue(this.builderKick.targets().getTarget());
|
||||||
@@ -102,7 +102,7 @@ public class ContentMultiplayer extends Content
|
|||||||
container.initButtons();
|
container.initButtons();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.reasonField = new GuiTextFieldTooltip(x + 118, y + 24 + this.page.getShift(), 114, 20, Component.translatable("gui.worldhandler.multiplayer.kick_ban.reason"));
|
this.reasonField = new GuiHintTextField(x + 118, y + 24 + this.page.getShift(), 114, 20, Component.translatable("gui.worldhandler.multiplayer.kick_ban.reason"));
|
||||||
this.reasonField.setFilter(Predicates.notNull());
|
this.reasonField.setFilter(Predicates.notNull());
|
||||||
this.reasonField.setFocused(false);
|
this.reasonField.setFocused(false);
|
||||||
this.reasonField.setValue(this.builderKick.reason().get());
|
this.reasonField.setValue(this.builderKick.reason().get());
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import exopandora.worldhandler.util.BlockHelper;
|
|||||||
import exopandora.worldhandler.util.CommandHelper;
|
import exopandora.worldhandler.util.CommandHelper;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.Font;
|
import net.minecraft.client.gui.Font;
|
||||||
import net.minecraft.client.gui.GuiComponent;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.MutableComponent;
|
import net.minecraft.network.chat.MutableComponent;
|
||||||
@@ -66,7 +66,7 @@ public class ContentNoteEditor extends Content
|
|||||||
if(this.isActive)
|
if(this.isActive)
|
||||||
{
|
{
|
||||||
BlockPos pos = this.builderNoteEditor.pos().getBlockPos();
|
BlockPos pos = this.builderNoteEditor.pos().getBlockPos();
|
||||||
SoundEvent sound = getSoundEvent(pos.below()).getSoundEvent().get();
|
SoundEvent sound = getSoundEvent(pos).getSoundEvent().get();
|
||||||
|
|
||||||
container.addRenderableWidget(new GuiButtonPiano(x - 3 + 15, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.g"), sound, 0.53F, Type.NORMAL, () -> this.setNote(container.getPlayer(), 1)));
|
container.addRenderableWidget(new GuiButtonPiano(x - 3 + 15, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.g"), sound, 0.53F, Type.NORMAL, () -> this.setNote(container.getPlayer(), 1)));
|
||||||
container.addRenderableWidget(new GuiButtonPiano(x - 3 + 15 * 2, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.a"), sound, 0.6F, Type.NORMAL, () -> this.setNote(container.getPlayer(), 3)));
|
container.addRenderableWidget(new GuiButtonPiano(x - 3 + 15 * 2, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.a"), sound, 0.6F, Type.NORMAL, () -> this.setNote(container.getPlayer(), 3)));
|
||||||
@@ -109,46 +109,44 @@ public class ContentNoteEditor extends Content
|
|||||||
builder.pos().set(pos);
|
builder.pos().set(pos);
|
||||||
NoteBlockInstrument instrument = getSoundEvent(pos);
|
NoteBlockInstrument instrument = getSoundEvent(pos);
|
||||||
BlockState state = Blocks.NOTE_BLOCK.defaultBlockState()
|
BlockState state = Blocks.NOTE_BLOCK.defaultBlockState()
|
||||||
.setValue(BlockStateProperties.NOTEBLOCK_INSTRUMENT, instrument)
|
.setValue(BlockStateProperties.NOTEBLOCK_INSTRUMENT, instrument)
|
||||||
.setValue(BlockStateProperties.NOTE, note);
|
.setValue(BlockStateProperties.NOTE, note);
|
||||||
builder.block().set(state);
|
builder.block().set(state);
|
||||||
CommandHelper.sendCommand(player, builder, SetBlockCommandBuilder.Label.REPLACE);
|
CommandHelper.sendCommand(player, builder, SetBlockCommandBuilder.Label.REPLACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
public void drawScreen(GuiGraphics guiGraphics, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||||
{
|
{
|
||||||
if(this.isActive)
|
if(this.isActive)
|
||||||
{
|
{
|
||||||
RenderSystem.setShaderTexture(0, NOTE);
|
|
||||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
GuiComponent.blit(matrix, x - 1, y - 1, 0, 0, 8, 59);
|
guiGraphics.blit(NOTE, x - 1, y - 1, 0, 0, 8, 59);
|
||||||
GuiComponent.blit(matrix, x - 1, y - 1 + 59, 0, 59, 13, 35);
|
guiGraphics.blit(NOTE, x - 1, y - 1 + 59, 0, 59, 13, 35);
|
||||||
|
|
||||||
GuiComponent.blit(matrix, x - 1 + 232 - 5, y - 1, 18, 0, 7, 59);
|
guiGraphics.blit(NOTE, x - 1 + 232 - 5, y - 1, 18, 0, 7, 59);
|
||||||
GuiComponent.blit(matrix, x - 1 + 232 - 10, y - 1 + 59, 13, 59, 12, 35);
|
guiGraphics.blit(NOTE, x - 1 + 232 - 10, y - 1 + 59, 13, 59, 12, 35);
|
||||||
|
|
||||||
GuiComponent.blit(matrix, x - 1 + 8, y - 1, 0, 94, 219, 1);
|
guiGraphics.blit(NOTE, x - 1 + 8, y - 1, 0, 94, 219, 1);
|
||||||
GuiComponent.blit(matrix, x - 1 + 13, y - 1 + 93, 0, 94, 209, 1);
|
guiGraphics.blit(NOTE, x - 1 + 13, y - 1 + 93, 0, 94, 209, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float scale = 4;
|
float scale = 4;
|
||||||
|
|
||||||
PoseStack posestack = RenderSystem.getModelViewStack();
|
PoseStack posestack = guiGraphics.pose();
|
||||||
posestack.pushPose();
|
posestack.pushPose();
|
||||||
posestack.translate(container.width / 2 - 8.5F * scale, container.height / 2 - 15 - 8.5F * scale, 0);
|
posestack.translate(container.width / 2 - 8.5F * scale, container.height / 2 - 15 - 8.5F * scale, 0);
|
||||||
posestack.scale(scale, scale, scale);
|
posestack.scale(scale, scale, scale);
|
||||||
|
|
||||||
Minecraft.getInstance().getItemRenderer().renderGuiItem(matrix, new ItemStack(Items.NOTE_BLOCK), 0, 0);
|
guiGraphics.renderItem(new ItemStack(Items.NOTE_BLOCK), 0, 0);
|
||||||
|
|
||||||
posestack.popPose();
|
posestack.popPose();
|
||||||
RenderSystem.applyModelViewMatrix();
|
|
||||||
|
|
||||||
MutableComponent text = Component.translatable("gui.worldhandler.blocks.note_block_editor.look_at_note_block", KeyHandler.KEY_WORLD_HANDLER.getTranslatedKeyMessage());
|
MutableComponent text = Component.translatable("gui.worldhandler.blocks.note_block_editor.look_at_note_block", KeyHandler.KEY_WORLD_HANDLER.getTranslatedKeyMessage());
|
||||||
Font font = Minecraft.getInstance().font;
|
Font font = Minecraft.getInstance().font;
|
||||||
font.draw(matrix, text, x + 116 - font.width(text) / 2, y + 70, Config.getSkin().getLabelColor());
|
guiGraphics.drawString(font, text, x + 116 - font.width(text) / 2, y + 70, Config.getSkin().getLabelColor(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,10 +156,18 @@ public class ContentNoteEditor extends Content
|
|||||||
|
|
||||||
if(level != null)
|
if(level != null)
|
||||||
{
|
{
|
||||||
return NoteBlockInstrument.byStateAbove(level.getBlockState(blockPos.above())).orElseGet(() ->
|
NoteBlockInstrument noteblockinstrument = level.getBlockState(blockPos.above()).instrument();
|
||||||
|
|
||||||
|
if(noteblockinstrument.worksAboveNoteBlock())
|
||||||
{
|
{
|
||||||
return NoteBlockInstrument.byStateBelow(level.getBlockState(blockPos.below()));
|
return noteblockinstrument;
|
||||||
});
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NoteBlockInstrument noteblockinstrument1 = level.getBlockState(blockPos.below()).instrument();
|
||||||
|
NoteBlockInstrument noteblockinstrument2 = noteblockinstrument1.worksAboveNoteBlock() ? NoteBlockInstrument.HARP : noteblockinstrument1;
|
||||||
|
return noteblockinstrument2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package exopandora.worldhandler.gui.content.impl;
|
package exopandora.worldhandler.gui.content.impl;
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
|
||||||
|
|
||||||
import exopandora.worldhandler.builder.impl.ClearInventoryCommandBuilder;
|
import exopandora.worldhandler.builder.impl.ClearInventoryCommandBuilder;
|
||||||
import exopandora.worldhandler.builder.impl.KillCommandBuilder;
|
import exopandora.worldhandler.builder.impl.KillCommandBuilder;
|
||||||
@@ -13,11 +12,11 @@ import exopandora.worldhandler.gui.container.Container;
|
|||||||
import exopandora.worldhandler.gui.content.Content;
|
import exopandora.worldhandler.gui.content.Content;
|
||||||
import exopandora.worldhandler.gui.content.Contents;
|
import exopandora.worldhandler.gui.content.Contents;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
import exopandora.worldhandler.gui.widget.button.GuiHintTextField;
|
||||||
import exopandora.worldhandler.util.ActionHelper;
|
import exopandora.worldhandler.util.ActionHelper;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiComponent;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.gui.screens.inventory.InventoryScreen;
|
import net.minecraft.client.gui.screens.inventory.InventoryScreen;
|
||||||
import net.minecraft.client.resources.language.I18n;
|
import net.minecraft.client.resources.language.I18n;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
@@ -29,13 +28,13 @@ public class ContentPlayer extends Content
|
|||||||
{
|
{
|
||||||
private Page page = Page.START;
|
private Page page = Page.START;
|
||||||
|
|
||||||
private GuiTextFieldTooltip posXField;
|
private GuiHintTextField posXField;
|
||||||
private GuiTextFieldTooltip posYField;
|
private GuiHintTextField posYField;
|
||||||
private GuiTextFieldTooltip posZField;
|
private GuiHintTextField posZField;
|
||||||
|
|
||||||
private GuiTextFieldTooltip scoreField;
|
private GuiHintTextField scoreField;
|
||||||
private GuiTextFieldTooltip coinsField;
|
private GuiHintTextField coinsField;
|
||||||
private GuiTextFieldTooltip xpField;
|
private GuiHintTextField xpField;
|
||||||
|
|
||||||
private final SetWorldSpawnCommandBuilder builderSetWorldSpawn = new SetWorldSpawnCommandBuilder();
|
private final SetWorldSpawnCommandBuilder builderSetWorldSpawn = new SetWorldSpawnCommandBuilder();
|
||||||
private final SetSpawnCommandBuilder builderSpawnpoint = new SetSpawnCommandBuilder();
|
private final SetSpawnCommandBuilder builderSpawnpoint = new SetSpawnCommandBuilder();
|
||||||
@@ -61,12 +60,12 @@ public class ContentPlayer extends Content
|
|||||||
@Override
|
@Override
|
||||||
public void initGui(Container container, int x, int y)
|
public void initGui(Container container, int x, int y)
|
||||||
{
|
{
|
||||||
this.posXField = new GuiTextFieldTooltip(x + 118, y, 114, 20);
|
this.posXField = new GuiHintTextField(x + 118, y, 114, 20);
|
||||||
this.posYField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20);
|
this.posYField = new GuiHintTextField(x + 118, y + 24, 114, 20);
|
||||||
this.posZField = new GuiTextFieldTooltip(x + 118, y + 48, 114, 20);
|
this.posZField = new GuiHintTextField(x + 118, y + 48, 114, 20);
|
||||||
this.scoreField = new GuiTextFieldTooltip(x + 118, y + 12, 114, 20);
|
this.scoreField = new GuiHintTextField(x + 118, y + 12, 114, 20);
|
||||||
this.coinsField = new GuiTextFieldTooltip(x + 118, y + 36, 114, 20);
|
this.coinsField = new GuiHintTextField(x + 118, y + 36, 114, 20);
|
||||||
this.xpField = new GuiTextFieldTooltip(x + 118, y + 60, 114, 20);
|
this.xpField = new GuiHintTextField(x + 118, y + 60, 114, 20);
|
||||||
|
|
||||||
this.tick(container);
|
this.tick(container);
|
||||||
}
|
}
|
||||||
@@ -176,19 +175,20 @@ public class ContentPlayer extends Content
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
public void drawScreen(GuiGraphics guiGraphics, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||||
{
|
{
|
||||||
if(Page.START.equals(this.page) && Minecraft.getInstance().player != null)
|
if(Page.START.equals(this.page) && Minecraft.getInstance().player != null)
|
||||||
{
|
{
|
||||||
|
Minecraft minecraft = Minecraft.getInstance();
|
||||||
int xPos = x + 175;
|
int xPos = x + 175;
|
||||||
int yPos = y + 82;
|
int yPos = y + 82;
|
||||||
int playerNameWidth = Minecraft.getInstance().font.width(Minecraft.getInstance().player.getName()) / 2;
|
int playerNameWidth = minecraft.font.width(minecraft.player.getName()) / 2;
|
||||||
|
|
||||||
GuiComponent.fill(matrix, container.width / 2 - playerNameWidth - 1 + 59, yPos - 74, container.width / 2 + playerNameWidth + 1 + 59, yPos - 65, 0x3F000000);
|
guiGraphics.fill(container.width / 2 - playerNameWidth - 1 + 59, yPos - 74, container.width / 2 + playerNameWidth + 1 + 59, yPos - 65, 0x3F000000);
|
||||||
Minecraft.getInstance().font.draw(matrix, Minecraft.getInstance().player.getName(), container.width / 2 - playerNameWidth + 59, yPos - 73, 0xE0E0E0);
|
guiGraphics.drawString(minecraft.font, minecraft.player.getName(), container.width / 2 - playerNameWidth + 59, yPos - 73, 0xE0E0E0);
|
||||||
|
|
||||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
InventoryScreen.renderEntityInInventoryFollowsMouse(matrix, xPos, yPos, 30, xPos - mouseX, yPos - mouseY - 44, Minecraft.getInstance().player);
|
InventoryScreen.renderEntityInInventoryFollowsMouse(guiGraphics, xPos, yPos, 30, xPos - mouseX, yPos - mouseY - 44, minecraft.player);
|
||||||
RenderSystem.defaultBlendFunc();
|
RenderSystem.defaultBlendFunc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import exopandora.worldhandler.gui.container.Container;
|
|||||||
import exopandora.worldhandler.gui.content.Content;
|
import exopandora.worldhandler.gui.content.Content;
|
||||||
import exopandora.worldhandler.gui.content.Contents;
|
import exopandora.worldhandler.gui.content.Contents;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
import exopandora.worldhandler.gui.widget.button.GuiHintTextField;
|
||||||
import exopandora.worldhandler.gui.widget.menu.impl.ILogicButtonList;
|
import exopandora.worldhandler.gui.widget.menu.impl.ILogicButtonList;
|
||||||
import exopandora.worldhandler.gui.widget.menu.impl.MenuButtonList;
|
import exopandora.worldhandler.gui.widget.menu.impl.MenuButtonList;
|
||||||
import exopandora.worldhandler.util.ActionHelper;
|
import exopandora.worldhandler.util.ActionHelper;
|
||||||
@@ -30,7 +30,7 @@ import net.minecraftforge.registries.IForgeRegistry;
|
|||||||
|
|
||||||
public class ContentScoreboardObjectives extends ContentScoreboard
|
public class ContentScoreboardObjectives extends ContentScoreboard
|
||||||
{
|
{
|
||||||
private GuiTextFieldTooltip objectField;
|
private GuiHintTextField objectField;
|
||||||
private Page page = Page.CREATE;
|
private Page page = Page.CREATE;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -42,7 +42,7 @@ public class ContentScoreboardObjectives extends ContentScoreboard
|
|||||||
@Override
|
@Override
|
||||||
public void initGui(Container container, int x, int y)
|
public void initGui(Container container, int x, int y)
|
||||||
{
|
{
|
||||||
this.objectField = new GuiTextFieldTooltip(x + 118, y + this.page.getShift(), 114, 20, Component.translatable("gui.worldhandler.scoreboard.objectives.objective"));
|
this.objectField = new GuiHintTextField(x + 118, y + this.page.getShift(), 114, 20, Component.translatable("gui.worldhandler.scoreboard.objectives.objective"));
|
||||||
this.objectField.setFilter(Predicates.notNull());
|
this.objectField.setFilter(Predicates.notNull());
|
||||||
this.objectField.setResponder(text ->
|
this.objectField.setResponder(text ->
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import exopandora.worldhandler.gui.content.Contents;
|
|||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonTooltip;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonTooltip;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiSlider;
|
import exopandora.worldhandler.gui.widget.button.GuiSlider;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
import exopandora.worldhandler.gui.widget.button.GuiHintTextField;
|
||||||
import exopandora.worldhandler.gui.widget.button.LogicSliderSimple;
|
import exopandora.worldhandler.gui.widget.button.LogicSliderSimple;
|
||||||
import exopandora.worldhandler.util.ActionHelper;
|
import exopandora.worldhandler.util.ActionHelper;
|
||||||
import exopandora.worldhandler.util.CommandHelper;
|
import exopandora.worldhandler.util.CommandHelper;
|
||||||
@@ -33,8 +33,8 @@ public class ContentScoreboardPlayers extends ContentScoreboard
|
|||||||
|
|
||||||
private GuiButtonBase addButton;
|
private GuiButtonBase addButton;
|
||||||
private GuiButtonBase removeButton;
|
private GuiButtonBase removeButton;
|
||||||
private GuiTextFieldTooltip objectField;
|
private GuiHintTextField objectField;
|
||||||
private GuiTextFieldTooltip tagField;
|
private GuiHintTextField tagField;
|
||||||
|
|
||||||
public ContentScoreboardPlayers()
|
public ContentScoreboardPlayers()
|
||||||
{
|
{
|
||||||
@@ -74,7 +74,7 @@ public class ContentScoreboardPlayers extends ContentScoreboard
|
|||||||
@Override
|
@Override
|
||||||
public void initGui(Container container, int x, int y)
|
public void initGui(Container container, int x, int y)
|
||||||
{
|
{
|
||||||
this.objectField = new GuiTextFieldTooltip(x + 118, y, 114, 20, Component.translatable("gui.worldhandler.scoreboard.objectives.objective"));
|
this.objectField = new GuiHintTextField(x + 118, y, 114, 20, Component.translatable("gui.worldhandler.scoreboard.objectives.objective"));
|
||||||
this.objectField.setFilter(Predicates.notNull());
|
this.objectField.setFilter(Predicates.notNull());
|
||||||
this.objectField.setResponder(text ->
|
this.objectField.setResponder(text ->
|
||||||
{
|
{
|
||||||
@@ -85,7 +85,7 @@ public class ContentScoreboardPlayers extends ContentScoreboard
|
|||||||
});
|
});
|
||||||
this.objectField.setValue(BUILDER.objective().get());
|
this.objectField.setValue(BUILDER.objective().get());
|
||||||
|
|
||||||
this.tagField = new GuiTextFieldTooltip(x + 118, y + 12, 114, 20, Component.translatable("gui.worldhandler.scoreboard.players.tag"));
|
this.tagField = new GuiHintTextField(x + 118, y + 12, 114, 20, Component.translatable("gui.worldhandler.scoreboard.players.tag"));
|
||||||
this.tagField.setFilter(string -> string != null && !string.contains(" "));
|
this.tagField.setFilter(string -> string != null && !string.contains(" "));
|
||||||
this.tagField.setValue(this.builderTag.name().get());
|
this.tagField.setValue(this.builderTag.name().get());
|
||||||
this.tagField.setResponder(text ->
|
this.tagField.setResponder(text ->
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import exopandora.worldhandler.gui.container.Container;
|
|||||||
import exopandora.worldhandler.gui.content.Content;
|
import exopandora.worldhandler.gui.content.Content;
|
||||||
import exopandora.worldhandler.gui.content.Contents;
|
import exopandora.worldhandler.gui.content.Contents;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
import exopandora.worldhandler.gui.widget.button.GuiHintTextField;
|
||||||
import exopandora.worldhandler.gui.widget.menu.impl.ILogicButtonList;
|
import exopandora.worldhandler.gui.widget.menu.impl.ILogicButtonList;
|
||||||
import exopandora.worldhandler.gui.widget.menu.impl.MenuButtonList;
|
import exopandora.worldhandler.gui.widget.menu.impl.MenuButtonList;
|
||||||
import exopandora.worldhandler.util.ActionHelper;
|
import exopandora.worldhandler.util.ActionHelper;
|
||||||
@@ -32,7 +32,7 @@ public class ContentScoreboardTeams extends ContentScoreboard
|
|||||||
.add(this.builderTeams, TeamCommandBuilder.Label.EMPTY);
|
.add(this.builderTeams, TeamCommandBuilder.Label.EMPTY);
|
||||||
private final CommandPreview previewModify = new CommandPreview(this.builderTeams, TeamCommandBuilder.Label.MODIFY);
|
private final CommandPreview previewModify = new CommandPreview(this.builderTeams, TeamCommandBuilder.Label.MODIFY);
|
||||||
|
|
||||||
private GuiTextFieldTooltip teamField;
|
private GuiHintTextField teamField;
|
||||||
private Page page = Page.ADD;
|
private Page page = Page.ADD;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -56,7 +56,7 @@ public class ContentScoreboardTeams extends ContentScoreboard
|
|||||||
@Override
|
@Override
|
||||||
public void initGui(Container container, int x, int y)
|
public void initGui(Container container, int x, int y)
|
||||||
{
|
{
|
||||||
this.teamField = new GuiTextFieldTooltip(x + 118, y + this.page.getShift(), 114, 20, Component.translatable("gui.worldhandler.scoreboard.team.team"));
|
this.teamField = new GuiHintTextField(x + 118, y + this.page.getShift(), 114, 20, Component.translatable("gui.worldhandler.scoreboard.team.team"));
|
||||||
this.teamField.setFilter(Predicates.notNull());
|
this.teamField.setFilter(Predicates.notNull());
|
||||||
this.teamField.setValue(this.builderTeams.team().get());
|
this.teamField.setValue(this.builderTeams.team().get());
|
||||||
this.teamField.setResponder(text ->
|
this.teamField.setResponder(text ->
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import exopandora.worldhandler.gui.content.impl.ContentSettings.Setting.BooleanS
|
|||||||
import exopandora.worldhandler.gui.content.impl.ContentSettings.Setting.IntegerSetting;
|
import exopandora.worldhandler.gui.content.impl.ContentSettings.Setting.IntegerSetting;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonTooltip;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonTooltip;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
import exopandora.worldhandler.gui.widget.button.GuiHintTextField;
|
||||||
import exopandora.worldhandler.gui.widget.menu.impl.ILogicPageList;
|
import exopandora.worldhandler.gui.widget.menu.impl.ILogicPageList;
|
||||||
import exopandora.worldhandler.gui.widget.menu.impl.MenuPageList;
|
import exopandora.worldhandler.gui.widget.menu.impl.MenuPageList;
|
||||||
import exopandora.worldhandler.util.ActionHandler;
|
import exopandora.worldhandler.util.ActionHandler;
|
||||||
@@ -41,7 +41,7 @@ public class ContentSettings extends ContentChild
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Setting<?> setting;
|
private Setting<?> setting;
|
||||||
private GuiTextFieldTooltip valueField;
|
private GuiHintTextField valueField;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui(Container container, int x, int y)
|
public void initGui(Container container, int x, int y)
|
||||||
@@ -82,7 +82,7 @@ public class ContentSettings extends ContentChild
|
|||||||
|
|
||||||
container.addMenu(settings);
|
container.addMenu(settings);
|
||||||
|
|
||||||
this.valueField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.generic.value"));
|
this.valueField = new GuiHintTextField(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.generic.value"));
|
||||||
this.valueField.setFilter(string ->
|
this.valueField.setFilter(string ->
|
||||||
{
|
{
|
||||||
if(string == null)
|
if(string == null)
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
package exopandora.worldhandler.gui.content.impl;
|
package exopandora.worldhandler.gui.content.impl;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import com.google.common.base.Predicates;
|
import com.google.common.base.Predicates;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
|
||||||
import exopandora.worldhandler.builder.argument.PrimitiveArgument.Linkage;
|
import exopandora.worldhandler.builder.argument.PrimitiveArgument.Linkage;
|
||||||
import exopandora.worldhandler.builder.argument.tag.TextTag;
|
import exopandora.worldhandler.builder.argument.tag.SidedSignTextTag;
|
||||||
import exopandora.worldhandler.builder.impl.DataCommandBuilder;
|
import exopandora.worldhandler.builder.impl.DataCommandBuilder;
|
||||||
import exopandora.worldhandler.config.Config;
|
import exopandora.worldhandler.config.Config;
|
||||||
import exopandora.worldhandler.event.KeyHandler;
|
import exopandora.worldhandler.event.KeyHandler;
|
||||||
@@ -17,7 +14,7 @@ import exopandora.worldhandler.gui.container.Container;
|
|||||||
import exopandora.worldhandler.gui.content.Content;
|
import exopandora.worldhandler.gui.content.Content;
|
||||||
import exopandora.worldhandler.gui.content.Contents;
|
import exopandora.worldhandler.gui.content.Contents;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
import exopandora.worldhandler.gui.widget.button.GuiHintTextField;
|
||||||
import exopandora.worldhandler.gui.widget.menu.impl.ILogicColorMenu;
|
import exopandora.worldhandler.gui.widget.menu.impl.ILogicColorMenu;
|
||||||
import exopandora.worldhandler.gui.widget.menu.impl.MenuColorField;
|
import exopandora.worldhandler.gui.widget.menu.impl.MenuColorField;
|
||||||
import exopandora.worldhandler.util.ActionHelper;
|
import exopandora.worldhandler.util.ActionHelper;
|
||||||
@@ -25,19 +22,23 @@ import exopandora.worldhandler.util.BlockHelper;
|
|||||||
import exopandora.worldhandler.util.CommandHelper;
|
import exopandora.worldhandler.util.CommandHelper;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.Font;
|
import net.minecraft.client.gui.Font;
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.MutableComponent;
|
import net.minecraft.network.chat.MutableComponent;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.level.block.SignBlock;
|
import net.minecraft.world.level.block.SignBlock;
|
||||||
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
|
import net.minecraft.world.level.block.entity.SignBlockEntity;
|
||||||
|
|
||||||
public class ContentSignEditor extends Content
|
public class ContentSignEditor extends Content
|
||||||
{
|
{
|
||||||
private final DataCommandBuilder builderSignEditor = new DataCommandBuilder();
|
private final DataCommandBuilder builderSignEditor = new DataCommandBuilder();
|
||||||
private final TextTag[] texts = new TextTag[4];
|
private final SidedSignTextTag texts = new SidedSignTextTag();
|
||||||
private final CommandPreview preview = new CommandPreview(this.builderSignEditor, DataCommandBuilder.Label.MERGE_BLOCK);
|
private final CommandPreview preview = new CommandPreview(this.builderSignEditor, DataCommandBuilder.Label.MERGE_BLOCK);
|
||||||
|
|
||||||
private GuiTextFieldTooltip commandField;
|
private GuiHintTextField commandField;
|
||||||
|
|
||||||
private int selectedLine;
|
private int selectedLine;
|
||||||
private boolean editColor;
|
private boolean editColor;
|
||||||
@@ -46,13 +47,7 @@ public class ContentSignEditor extends Content
|
|||||||
public ContentSignEditor()
|
public ContentSignEditor()
|
||||||
{
|
{
|
||||||
this.builderSignEditor.linkage().set(Linkage.MERGE);
|
this.builderSignEditor.linkage().set(Linkage.MERGE);
|
||||||
|
this.builderSignEditor.nbt().addTagProvider(this.texts);
|
||||||
for(int x = 0; x < this.texts.length; x++)
|
|
||||||
{
|
|
||||||
TextTag text = new TextTag(x + 1);
|
|
||||||
this.texts[x] = text;
|
|
||||||
this.builderSignEditor.nbt().addTagProvider(text);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -64,8 +59,20 @@ public class ContentSignEditor extends Content
|
|||||||
@Override
|
@Override
|
||||||
public void init(Container container)
|
public void init(Container container)
|
||||||
{
|
{
|
||||||
|
Minecraft minecraft = Minecraft.getInstance();
|
||||||
|
BlockPos pos = BlockHelper.getFocusedBlockPos();
|
||||||
this.isActive = BlockHelper.getFocusedBlock() instanceof SignBlock;
|
this.isActive = BlockHelper.getFocusedBlock() instanceof SignBlock;
|
||||||
this.builderSignEditor.targetPos().set(BlockHelper.getFocusedBlockPos());
|
this.builderSignEditor.targetPos().set(pos);
|
||||||
|
|
||||||
|
if(this.isActive && minecraft.level != null)
|
||||||
|
{
|
||||||
|
BlockEntity entity = minecraft.level.getBlockEntity(pos);
|
||||||
|
|
||||||
|
if(entity instanceof SignBlockEntity sign)
|
||||||
|
{
|
||||||
|
this.texts.setIsFront(sign.isFacingFrontText(minecraft.player));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -73,17 +80,17 @@ public class ContentSignEditor extends Content
|
|||||||
{
|
{
|
||||||
if(this.isActive)
|
if(this.isActive)
|
||||||
{
|
{
|
||||||
this.commandField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.blocks.sign_editor.commmand"));
|
this.commandField = new GuiHintTextField(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.blocks.sign_editor.commmand"));
|
||||||
this.commandField.setFilter(Predicates.notNull());
|
this.commandField.setFilter(Predicates.notNull());
|
||||||
this.commandField.setValue(this.texts[this.selectedLine].getComponent().getCommand());
|
this.commandField.setValue(this.texts.getLine(this.selectedLine).getCommand());
|
||||||
this.commandField.moveCursorToEnd();
|
this.commandField.moveCursorToEnd();
|
||||||
this.commandField.setResponder(text ->
|
this.commandField.setResponder(text ->
|
||||||
{
|
{
|
||||||
this.texts[this.selectedLine].getComponent().setCommand(text);
|
this.texts.getLine(this.selectedLine).setCommand(text);
|
||||||
container.initButtons();
|
container.initButtons();
|
||||||
});
|
});
|
||||||
|
|
||||||
MenuColorField colors = new MenuColorField(x, y, "gui.worldhandler.blocks.sign_editor.text_line_" + (this.selectedLine + 1), this.texts[this.selectedLine].getComponent(), new ILogicColorMenu()
|
MenuColorField colors = new MenuColorField(x, y, "gui.worldhandler.blocks.sign_editor.text_line_" + (this.selectedLine + 1), this.texts.getLine(this.selectedLine), new ILogicColorMenu()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean validate(String text)
|
public boolean validate(String text)
|
||||||
@@ -152,7 +159,7 @@ public class ContentSignEditor extends Content
|
|||||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.blocks.sign_editor.format_text_line"), () -> this.toggleEditColor(container)));
|
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.blocks.sign_editor.format_text_line"), () -> this.toggleEditColor(container)));
|
||||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.actions.place_command_block"), () ->
|
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.actions.place_command_block"), () ->
|
||||||
{
|
{
|
||||||
CommandHelper.sendCommand(container.getPlayer(), this.builderSignEditor, DataCommandBuilder.Label.MERGE_BLOCK, Arrays.stream(this.texts).anyMatch(text -> text.getComponent().isStyled()));
|
CommandHelper.sendCommand(container.getPlayer(), this.builderSignEditor, DataCommandBuilder.Label.MERGE_BLOCK, this.texts.isStyled());
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,32 +186,31 @@ public class ContentSignEditor extends Content
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
public void drawScreen(GuiGraphics guiGraphics, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||||
{
|
{
|
||||||
if(this.isActive)
|
if(this.isActive)
|
||||||
{
|
{
|
||||||
if(!this.editColor)
|
if(!this.editColor)
|
||||||
{
|
{
|
||||||
this.commandField.render(matrix, mouseX, mouseY, partialTicks);
|
this.commandField.render(guiGraphics, mouseX, mouseY, partialTicks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float scale = 4;
|
float scale = 4;
|
||||||
|
|
||||||
PoseStack posestack = RenderSystem.getModelViewStack();
|
PoseStack posestack = guiGraphics.pose();
|
||||||
posestack.pushPose();
|
posestack.pushPose();
|
||||||
posestack.translate(container.width / 2 - 8.5F * scale, container.height / 2 - 15 - 8.5F * scale, 0);
|
posestack.translate(container.width / 2 - 8.5F * scale, container.height / 2 - 15 - 8.5F * scale, 0);
|
||||||
posestack.scale(scale, scale, scale);
|
posestack.scale(scale, scale, scale);
|
||||||
|
|
||||||
Minecraft.getInstance().getItemRenderer().renderGuiItem(posestack, new ItemStack(Items.OAK_SIGN), 0, 0);
|
guiGraphics.renderItem(new ItemStack(Items.OAK_SIGN), 0, 0);
|
||||||
|
|
||||||
posestack.popPose();
|
posestack.popPose();
|
||||||
RenderSystem.applyModelViewMatrix();
|
|
||||||
|
|
||||||
MutableComponent text = Component.translatable("gui.worldhandler.blocks.sign_editor.look_at_sign", KeyHandler.KEY_WORLD_HANDLER.getTranslatedKeyMessage());
|
MutableComponent text = Component.translatable("gui.worldhandler.blocks.sign_editor.look_at_sign", KeyHandler.KEY_WORLD_HANDLER.getTranslatedKeyMessage());
|
||||||
Font font = Minecraft.getInstance().font;
|
Font font = Minecraft.getInstance().font;
|
||||||
font.draw(matrix, text, x + 116 - font.width(text) / 2, y + 70, Config.getSkin().getLabelColor());
|
guiGraphics.drawString(font, text, x + 116 - font.width(text) / 2, y + 70, Config.getSkin().getLabelColor(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
|
|
||||||
import com.google.common.base.Predicates;
|
import com.google.common.base.Predicates;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
|
||||||
|
|
||||||
import exopandora.worldhandler.builder.argument.Coordinate;
|
import exopandora.worldhandler.builder.argument.Coordinate;
|
||||||
import exopandora.worldhandler.builder.argument.tag.AbstractAttributeTag;
|
import exopandora.worldhandler.builder.argument.tag.AbstractAttributeTag;
|
||||||
@@ -30,7 +29,7 @@ import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
|||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonIcon;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonIcon;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonItem;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonItem;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiSlider;
|
import exopandora.worldhandler.gui.widget.button.GuiSlider;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
import exopandora.worldhandler.gui.widget.button.GuiHintTextField;
|
||||||
import exopandora.worldhandler.gui.widget.button.LogicSliderAttribute;
|
import exopandora.worldhandler.gui.widget.button.LogicSliderAttribute;
|
||||||
import exopandora.worldhandler.gui.widget.button.LogicSliderSimple;
|
import exopandora.worldhandler.gui.widget.button.LogicSliderSimple;
|
||||||
import exopandora.worldhandler.gui.widget.menu.impl.ILogicColorMenu;
|
import exopandora.worldhandler.gui.widget.menu.impl.ILogicColorMenu;
|
||||||
@@ -42,7 +41,7 @@ import exopandora.worldhandler.util.ActionHelper;
|
|||||||
import exopandora.worldhandler.util.CommandHelper;
|
import exopandora.worldhandler.util.CommandHelper;
|
||||||
import exopandora.worldhandler.util.TextUtils;
|
import exopandora.worldhandler.util.TextUtils;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiComponent;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.resources.language.I18n;
|
import net.minecraft.client.resources.language.I18n;
|
||||||
import net.minecraft.nbt.ByteTag;
|
import net.minecraft.nbt.ByteTag;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
@@ -117,8 +116,8 @@ public class ContentSummon extends Content
|
|||||||
private static final Item[][] HANDS = {SWORDS, SWORDS};
|
private static final Item[][] HANDS = {SWORDS, SWORDS};
|
||||||
private static final Random RANDOM = new Random();
|
private static final Random RANDOM = new Random();
|
||||||
|
|
||||||
private GuiTextFieldTooltip mobField;
|
private GuiHintTextField mobField;
|
||||||
private GuiTextFieldTooltip nbtField;
|
private GuiHintTextField nbtField;
|
||||||
|
|
||||||
private int potionPage = 0;
|
private int potionPage = 0;
|
||||||
private boolean editColor;
|
private boolean editColor;
|
||||||
@@ -188,7 +187,7 @@ public class ContentSummon extends Content
|
|||||||
@Override
|
@Override
|
||||||
public void initGui(Container container, int x, int y)
|
public void initGui(Container container, int x, int y)
|
||||||
{
|
{
|
||||||
this.mobField = new GuiTextFieldTooltip(x + 118, y, 114, 20, Component.translatable("gui.worldhandler.entities.summon.start.mob_id"));
|
this.mobField = new GuiHintTextField(x + 118, y, 114, 20, Component.translatable("gui.worldhandler.entities.summon.start.mob_id"));
|
||||||
this.mobField.setFilter(Predicates.notNull());
|
this.mobField.setFilter(Predicates.notNull());
|
||||||
this.mobField.setValue(this.mob);
|
this.mobField.setValue(this.mob);
|
||||||
this.mobField.setResponder(text ->
|
this.mobField.setResponder(text ->
|
||||||
@@ -199,7 +198,7 @@ public class ContentSummon extends Content
|
|||||||
container.initButtons();
|
container.initButtons();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.nbtField = new GuiTextFieldTooltip(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.entities.summon.start.custom_nbt"));
|
this.nbtField = new GuiHintTextField(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.entities.summon.start.custom_nbt"));
|
||||||
this.nbtField.setFilter(Predicates.notNull());
|
this.nbtField.setFilter(Predicates.notNull());
|
||||||
this.nbtField.setValue(this.nbt);
|
this.nbtField.setValue(this.nbt);
|
||||||
this.nbtField.setResponder(text ->
|
this.nbtField.setResponder(text ->
|
||||||
@@ -513,22 +512,21 @@ public class ContentSummon extends Content
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
public void drawScreen(GuiGraphics guiGraphics, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||||
{
|
{
|
||||||
if(Page.POTIONS.equals(this.page))
|
if(Page.POTIONS.equals(this.page))
|
||||||
{
|
{
|
||||||
Minecraft.getInstance().font.draw(matrix, (this.potionPage + 1) + "/" + (ForgeRegistries.MOB_EFFECTS.getKeys().size() - 2), x + 118, y - 11, Config.getSkin().getHeadlineColor());
|
guiGraphics.drawString(Minecraft.getInstance().font, (this.potionPage + 1) + "/" + (ForgeRegistries.MOB_EFFECTS.getKeys().size() - 2), x + 118, y - 11, Config.getSkin().getHeadlineColor(), false);
|
||||||
}
|
}
|
||||||
else if(Page.EQUIPMENT.equals(this.page))
|
else if(Page.EQUIPMENT.equals(this.page))
|
||||||
{
|
{
|
||||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
RenderSystem.setShaderTexture(0, BEACON_LOCATION);
|
|
||||||
|
|
||||||
for(int i = 0; i < 4; i++)
|
for(int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
if(Items.AIR.equals(this.entity.getArmorItem(3 - i)))
|
if(Items.AIR.equals(this.entity.getArmorItem(3 - i)))
|
||||||
{
|
{
|
||||||
GuiComponent.blit(matrix, x + 118 + 24 + 2, y + 2 + 24 * i, 112, 221, 16, 16);
|
guiGraphics.blit(BEACON_LOCATION, x + 118 + 24 + 2, y + 2 + 24 * i, 112, 221, 16, 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -536,7 +534,7 @@ public class ContentSummon extends Content
|
|||||||
{
|
{
|
||||||
if(Items.AIR.equals(this.entity.getHandItem(i)))
|
if(Items.AIR.equals(this.entity.getHandItem(i)))
|
||||||
{
|
{
|
||||||
GuiComponent.blit(matrix, x + 118 + 70 + 2 + 24 * i, y + 2 + 36, 112, 221, 16, 16);
|
guiGraphics.blit(BEACON_LOCATION, x + 118 + 70 + 2 + 24 * i, y + 2 + 36, 112, 221, 16, 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ import java.util.TreeMap;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
|
||||||
|
|
||||||
import exopandora.worldhandler.Main;
|
import exopandora.worldhandler.Main;
|
||||||
import exopandora.worldhandler.builder.impl.UsercontentCommandBuilder;
|
import exopandora.worldhandler.builder.impl.UsercontentCommandBuilder;
|
||||||
import exopandora.worldhandler.gui.category.Categories;
|
import exopandora.worldhandler.gui.category.Categories;
|
||||||
@@ -35,6 +33,7 @@ import exopandora.worldhandler.usercontent.model.JsonWidget;
|
|||||||
import exopandora.worldhandler.util.TextUtils;
|
import exopandora.worldhandler.util.TextUtils;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.gui.components.AbstractWidget;
|
import net.minecraft.client.gui.components.AbstractWidget;
|
||||||
import net.minecraft.client.gui.components.EditBox;
|
import net.minecraft.client.gui.components.EditBox;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
@@ -137,7 +136,7 @@ public class ContentUsercontent extends Content
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
public void drawScreen(GuiGraphics guiGraphics, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||||
{
|
{
|
||||||
if(this.content.getGui() != null && this.content.getGui().getLabels() != null)
|
if(this.content.getGui() != null && this.content.getGui().getLabels() != null)
|
||||||
{
|
{
|
||||||
@@ -145,7 +144,7 @@ public class ContentUsercontent extends Content
|
|||||||
{
|
{
|
||||||
if(label.getVisible() == null || label.getVisible().eval(this.engineAdapter))
|
if(label.getVisible() == null || label.getVisible().eval(this.engineAdapter))
|
||||||
{
|
{
|
||||||
container.getMinecraft().font.draw(matrix, TextUtils.formatNonnull(label.getText()), label.getX() + x, label.getY() + y, label.getColor());
|
guiGraphics.drawString(Minecraft.getInstance().font, TextUtils.formatNonnull(label.getText()), label.getX() + x, label.getY() + y, label.getColor(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import exopandora.worldhandler.gui.container.Container;
|
|||||||
import exopandora.worldhandler.gui.content.Content;
|
import exopandora.worldhandler.gui.content.Content;
|
||||||
import exopandora.worldhandler.gui.content.Contents;
|
import exopandora.worldhandler.gui.content.Contents;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
import exopandora.worldhandler.gui.widget.button.GuiHintTextField;
|
||||||
import exopandora.worldhandler.util.ActionHelper;
|
import exopandora.worldhandler.util.ActionHelper;
|
||||||
import exopandora.worldhandler.util.TextUtils;
|
import exopandora.worldhandler.util.TextUtils;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
@@ -22,15 +22,15 @@ public class ContentWorldInfo extends Content
|
|||||||
{
|
{
|
||||||
private Page page = Page.START;
|
private Page page = Page.START;
|
||||||
|
|
||||||
private GuiTextFieldTooltip posXField;
|
private GuiHintTextField posXField;
|
||||||
private GuiTextFieldTooltip posYField;
|
private GuiHintTextField posYField;
|
||||||
private GuiTextFieldTooltip posZField;
|
private GuiHintTextField posZField;
|
||||||
|
|
||||||
private GuiTextFieldTooltip worldField;
|
private GuiHintTextField worldField;
|
||||||
private GuiTextFieldTooltip seedField;
|
private GuiHintTextField seedField;
|
||||||
|
|
||||||
private GuiTextFieldTooltip totalTimeField;
|
private GuiHintTextField totalTimeField;
|
||||||
private GuiTextFieldTooltip currentTimeField;
|
private GuiHintTextField currentTimeField;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui(Container container, int x, int y)
|
public void initGui(Container container, int x, int y)
|
||||||
@@ -38,27 +38,27 @@ public class ContentWorldInfo extends Content
|
|||||||
Level level = ContentWorldInfo.getSidedWorld();
|
Level level = ContentWorldInfo.getSidedWorld();
|
||||||
IntegratedServer server = Minecraft.getInstance().getSingleplayerServer();
|
IntegratedServer server = Minecraft.getInstance().getSingleplayerServer();
|
||||||
|
|
||||||
this.posXField = new GuiTextFieldTooltip(x + 118, y + 12, 114, 20);
|
this.posXField = new GuiHintTextField(x + 118, y + 12, 114, 20);
|
||||||
this.posXField.setValue(I18n.get("gui.worldhandler.world_info.start.spawn") + " X: " + ContentWorldInfo.format(level, object -> object.getLevelData().getXSpawn()));
|
this.posXField.setValue(I18n.get("gui.worldhandler.world_info.start.spawn") + " X: " + ContentWorldInfo.format(level, object -> object.getLevelData().getXSpawn()));
|
||||||
|
|
||||||
this.posYField = new GuiTextFieldTooltip(x + 118, y + 36, 114, 20);
|
this.posYField = new GuiHintTextField(x + 118, y + 36, 114, 20);
|
||||||
this.posYField.setValue(I18n.get("gui.worldhandler.world_info.start.spawn") + " Y: " + ContentWorldInfo.format(level, object -> object.getLevelData().getYSpawn()));
|
this.posYField.setValue(I18n.get("gui.worldhandler.world_info.start.spawn") + " Y: " + ContentWorldInfo.format(level, object -> object.getLevelData().getYSpawn()));
|
||||||
|
|
||||||
this.posZField = new GuiTextFieldTooltip(x + 118, y + 60, 114, 20);
|
this.posZField = new GuiHintTextField(x + 118, y + 60, 114, 20);
|
||||||
this.posZField.setValue(I18n.get("gui.worldhandler.world_info.start.spawn") + " Z: " + ContentWorldInfo.format(level, object -> object.getLevelData().getZSpawn()));
|
this.posZField.setValue(I18n.get("gui.worldhandler.world_info.start.spawn") + " Z: " + ContentWorldInfo.format(level, object -> object.getLevelData().getZSpawn()));
|
||||||
|
|
||||||
this.worldField = new GuiTextFieldTooltip(x + 118, y + 12, 114, 20);
|
this.worldField = new GuiHintTextField(x + 118, y + 12, 114, 20);
|
||||||
this.worldField.setValue(I18n.get("gui.worldhandler.world_info.world.name") + ": " + ContentWorldInfo.format(server, object -> object.getWorldData().getLevelName()));
|
this.worldField.setValue(I18n.get("gui.worldhandler.world_info.world.name") + ": " + ContentWorldInfo.format(server, object -> object.getWorldData().getLevelName()));
|
||||||
|
|
||||||
this.seedField = new GuiTextFieldTooltip(x + 118, y + 36, 114, 20);
|
this.seedField = new GuiHintTextField(x + 118, y + 36, 114, 20);
|
||||||
this.seedField.setValue(I18n.get("gui.worldhandler.world_info.world.seed") + ": " + ContentWorldInfo.format(server, object -> object.overworld().getSeed()));
|
this.seedField.setValue(I18n.get("gui.worldhandler.world_info.world.seed") + ": " + ContentWorldInfo.format(server, object -> object.overworld().getSeed()));
|
||||||
this.seedField.setFilter(string -> string.equals(this.seedField.getValue()));
|
this.seedField.setFilter(string -> string.equals(this.seedField.getValue()));
|
||||||
this.seedField.moveCursorToStart();
|
this.seedField.moveCursorToStart();
|
||||||
|
|
||||||
this.currentTimeField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20);
|
this.currentTimeField = new GuiHintTextField(x + 118, y + 24, 114, 20);
|
||||||
this.updateCurrentTime();
|
this.updateCurrentTime();
|
||||||
|
|
||||||
this.totalTimeField = new GuiTextFieldTooltip(x + 118, y + 48, 114, 20);
|
this.totalTimeField = new GuiHintTextField(x + 118, y + 48, 114, 20);
|
||||||
this.updateTotalTime();
|
this.updateTotalTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
package exopandora.worldhandler.gui.widget;
|
package exopandora.worldhandler.gui.widget;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
|
||||||
|
|
||||||
import exopandora.worldhandler.gui.container.Container;
|
import exopandora.worldhandler.gui.container.Container;
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||||
|
|
||||||
public interface IWidget extends GuiEventListener
|
public interface IWidget extends GuiEventListener
|
||||||
@@ -27,7 +26,7 @@ public interface IWidget extends GuiEventListener
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
default void drawScreen(PoseStack stack, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
default void drawScreen(GuiGraphics guiGraphics, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,18 +5,18 @@ import com.google.common.base.Predicates;
|
|||||||
import exopandora.worldhandler.builder.impl.WorldHandlerCommandBuilder;
|
import exopandora.worldhandler.builder.impl.WorldHandlerCommandBuilder;
|
||||||
import exopandora.worldhandler.config.Config;
|
import exopandora.worldhandler.config.Config;
|
||||||
import exopandora.worldhandler.gui.container.Container;
|
import exopandora.worldhandler.gui.container.Container;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
import exopandora.worldhandler.gui.widget.button.GuiHintTextField;
|
||||||
|
|
||||||
public class WidgetCommandSyntax implements IContainerWidget
|
public class WidgetCommandSyntax implements IContainerWidget
|
||||||
{
|
{
|
||||||
private static final WorldHandlerCommandBuilder BUILDER_WORLD_HANDLER = new WorldHandlerCommandBuilder();
|
private static final WorldHandlerCommandBuilder BUILDER_WORLD_HANDLER = new WorldHandlerCommandBuilder();
|
||||||
|
|
||||||
private GuiTextFieldTooltip syntaxField;
|
private GuiHintTextField syntaxField;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui(Container container, int x, int y)
|
public void initGui(Container container, int x, int y)
|
||||||
{
|
{
|
||||||
this.syntaxField = new GuiTextFieldTooltip(container.width / 2 - 156, container.height - 22, 312, 20);
|
this.syntaxField = new GuiHintTextField(container.width / 2 - 156, container.height - 22, 312, 20);
|
||||||
this.updateSyntax(container);
|
this.updateSyntax(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,17 @@
|
|||||||
package exopandora.worldhandler.gui.widget;
|
package exopandora.worldhandler.gui.widget;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
|
||||||
|
|
||||||
import exopandora.worldhandler.config.Config;
|
import exopandora.worldhandler.config.Config;
|
||||||
import exopandora.worldhandler.gui.container.Container;
|
import exopandora.worldhandler.gui.container.Container;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
import exopandora.worldhandler.gui.widget.button.GuiHintTextField;
|
||||||
import net.minecraft.Util;
|
import net.minecraft.Util;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.Font;
|
import net.minecraft.client.gui.Font;
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.resources.language.I18n;
|
import net.minecraft.client.resources.language.I18n;
|
||||||
|
|
||||||
public class WidgetNameField implements IContainerWidget
|
public class WidgetNameField implements IContainerWidget
|
||||||
{
|
{
|
||||||
private final GuiTextFieldTooltip nameField = Util.make(new GuiTextFieldTooltip(0, 0, 0, 11), textfield -> textfield.setMaxLength(16));
|
private final GuiHintTextField nameField = Util.make(new GuiHintTextField(0, 0, 0, 11), textfield -> textfield.setMaxLength(16));
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui(Container container, int x, int y)
|
public void initGui(Container container, int x, int y)
|
||||||
@@ -33,14 +32,15 @@ public class WidgetNameField implements IContainerWidget
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
public void drawScreen(GuiGraphics guiGraphics, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||||
{
|
{
|
||||||
String username = container.getPlayer().isEmpty() && !this.nameField.isFocused() ? I18n.get("gui.worldhandler.generic.edit_username") : container.getPlayer();
|
String username = container.getPlayer().isEmpty() && !this.nameField.isFocused() ? I18n.get("gui.worldhandler.generic.edit_username") : container.getPlayer();
|
||||||
|
Font font = Minecraft.getInstance().font;
|
||||||
|
|
||||||
int xPos = container.getBackgroundX() + container.getBackgroundWidth() - this.watchOffset() - 7 - Minecraft.getInstance().font.width(username);
|
int xPos = container.getBackgroundX() + container.getBackgroundWidth() - this.watchOffset() - 7 - font.width(username);
|
||||||
int yPos = container.getBackgroundY() + 7;
|
int yPos = container.getBackgroundY() + 7;
|
||||||
|
|
||||||
Minecraft.getInstance().font.draw(matrix, username, xPos, yPos, Config.getSkin().getLabelColor());
|
guiGraphics.drawString(font, username, xPos, yPos, Config.getSkin().getLabelColor(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package exopandora.worldhandler.gui.widget;
|
package exopandora.worldhandler.gui.widget;
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
|
||||||
|
|
||||||
import exopandora.worldhandler.config.Config;
|
import exopandora.worldhandler.config.Config;
|
||||||
import exopandora.worldhandler.gui.category.Category;
|
import exopandora.worldhandler.gui.category.Category;
|
||||||
@@ -10,12 +9,14 @@ import exopandora.worldhandler.gui.content.Content;
|
|||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||||
import exopandora.worldhandler.util.ActionHelper;
|
import exopandora.worldhandler.util.ActionHelper;
|
||||||
import exopandora.worldhandler.util.RenderUtils;
|
import exopandora.worldhandler.util.RenderUtils;
|
||||||
|
import exopandora.worldhandler.util.ResourceHelper;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.Font;
|
import net.minecraft.client.gui.Font;
|
||||||
import net.minecraft.client.gui.GuiComponent;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.gui.components.AbstractWidget;
|
import net.minecraft.client.gui.components.AbstractWidget;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
|
|
||||||
public class WidgetTabRenderer implements IContainerWidget
|
public class WidgetTabRenderer implements IContainerWidget
|
||||||
@@ -49,10 +50,11 @@ public class WidgetTabRenderer implements IContainerWidget
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
public void drawScreen(GuiGraphics guiGraphics, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||||
{
|
{
|
||||||
Content content = container.getContent();
|
Content content = container.getContent();
|
||||||
Category category = content.getCategory();
|
Category category = content.getCategory();
|
||||||
|
ResourceLocation texture = ResourceHelper.backgroundTexture();
|
||||||
|
|
||||||
int xPos = container.getBackgroundX();
|
int xPos = container.getBackgroundX();
|
||||||
int yPos = container.getBackgroundY();
|
int yPos = container.getBackgroundY();
|
||||||
@@ -70,21 +72,21 @@ public class WidgetTabRenderer implements IContainerWidget
|
|||||||
if(content.getActiveContent().equals(tab))
|
if(content.getActiveContent().equals(tab))
|
||||||
{
|
{
|
||||||
int height = Config.getSkin().getBackgroundAlphaInt() == 255 ? 25 : 22;
|
int height = Config.getSkin().getBackgroundAlphaInt() == 255 ? 25 : 22;
|
||||||
this.drawActiveTab(matrix, container, index, size, xPos + offset, yPos - 22, width, height, title);
|
this.drawActiveTab(guiGraphics, container, texture, index, size, xPos + offset, yPos - 22, width, height, title);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.drawInactiveTab(matrix, container, index, size, xPos + offset, yPos - 20, width, 20, title);
|
this.drawInactiveTab(guiGraphics, container, texture, index, size, xPos + offset, yPos - 20, width, 20, title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderUtils.colorDefaultBackground();
|
RenderUtils.colorDefaultBackground();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawActiveTab(PoseStack matrix, Container container, int index, int size, int x, int y, int width, int height, Component title)
|
private void drawActiveTab(GuiGraphics guiGraphics, Container container, ResourceLocation texture, int index, int size, int x, int y, int width, int height, Component title)
|
||||||
{
|
{
|
||||||
RenderUtils.colorDefaultBackground();
|
RenderUtils.colorDefaultBackground();
|
||||||
this.drawTabBackground(matrix, container, x, y, width, height);
|
this.drawTabBackground(guiGraphics, container, texture, x, y, width, height);
|
||||||
|
|
||||||
if(!Config.getSkin().sharpEdges())
|
if(!Config.getSkin().sharpEdges())
|
||||||
{
|
{
|
||||||
@@ -94,83 +96,81 @@ public class WidgetTabRenderer implements IContainerWidget
|
|||||||
{
|
{
|
||||||
if(index > 0)
|
if(index > 0)
|
||||||
{
|
{
|
||||||
RenderUtils.drawTexturedTriangleBL(matrix, container, x, y + height - 2, x - container.getBackgroundX(), 1, 2);
|
RenderUtils.drawTexturedTriangleBL(guiGraphics, texture, x, y + height - 2, x - container.getBackgroundX(), 1, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(index < size - 1 || size == 1)
|
if(index < size - 1 || size == 1)
|
||||||
{
|
{
|
||||||
RenderUtils.drawTexturedTriangleBR(matrix, container, x + width - 2, y + height - 2, x - container.getBackgroundX() + width, 1, 2);
|
RenderUtils.drawTexturedTriangleBR(guiGraphics, texture, x + width - 2, y + height - 2, x - container.getBackgroundX() + width, 1, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(index == 0)
|
if(index == 0)
|
||||||
{
|
{
|
||||||
RenderUtils.drawTexturedWedgeGradientTL(matrix, container, x, y + height, 0, height, width, WidgetTabRenderer.WEDGE_HEIGHT);
|
RenderUtils.drawTexturedWedgeGradientTL(guiGraphics, texture, x, y + height, 0, height, width, WidgetTabRenderer.WEDGE_HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(index == size - 1 && size > 1)
|
if(index == size - 1 && size > 1)
|
||||||
{
|
{
|
||||||
RenderUtils.drawTexturedWedgeGradientTR(matrix, container, x, y + height, x - container.getBackgroundX(), height, width, WidgetTabRenderer.WEDGE_HEIGHT);
|
RenderUtils.drawTexturedWedgeGradientTR(guiGraphics, texture, x, y + height, x - container.getBackgroundX(), height, width, WidgetTabRenderer.WEDGE_HEIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.drawTabBackgroundMerge(matrix, container, index, size, x, y, width, height);
|
this.drawTabBackgroundMerge(guiGraphics, container, texture, index, size, x, y, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderSystem.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.drawTabTitle(matrix, container, title, true, x, y, width, y + height, 0xFFFFFF);
|
this.drawTabTitle(guiGraphics, title, true, x, y, width, y + height, 0xFFFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawInactiveTab(PoseStack matrix, Container container, int index, int size, int x, int y, int width, int height, Component title)
|
private void drawInactiveTab(GuiGraphics guiGraphics, Container container, ResourceLocation texture, int index, int size, int x, int y, int width, int height, Component title)
|
||||||
{
|
{
|
||||||
RenderUtils.colorDarkBackground();
|
RenderUtils.colorDarkBackground();
|
||||||
this.drawTabBackground(matrix, container, x, y, width, 20);
|
this.drawTabBackground(guiGraphics, container, texture, x, y, width, 20);
|
||||||
|
|
||||||
if(!Config.getSkin().sharpEdges())
|
if(!Config.getSkin().sharpEdges())
|
||||||
{
|
{
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
this.drawTabBackgroundMerge(matrix, container, index, size, x, y, width, height);
|
this.drawTabBackgroundMerge(guiGraphics, container, texture, index, size, x, y, width, height);
|
||||||
RenderSystem.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.drawTabTitle(matrix, container, title, false, x, y + 2, width, y + height, 0xE0E0E0);
|
this.drawTabTitle(guiGraphics, title, false, x, y + 2, width, y + height, 0xE0E0E0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawTabBackgroundMerge(PoseStack matrix, Container container, int index, int size, int x, int y, int width, int height)
|
private void drawTabBackgroundMerge(GuiGraphics guiGraphics, Container container, ResourceLocation texture, int index, int size, int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
if(index == 0)
|
if(index == 0)
|
||||||
{
|
{
|
||||||
RenderUtils.drawTexturedTriangleTL(matrix, container, x, y + height, 0, height, 2);
|
RenderUtils.drawTexturedTriangleTL(guiGraphics, texture, x, y + height, 0, height, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(index == size - 1)
|
if(index == size - 1)
|
||||||
{
|
{
|
||||||
RenderUtils.drawTexturedTriangleTR(matrix, container, x + width - 3, y + height, container.getBackgroundWidth() - 3, height, 3);
|
RenderUtils.drawTexturedTriangleTR(guiGraphics, texture, x + width - 3, y + height, container.getBackgroundWidth() - 3, height, 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawTabBackground(PoseStack matrix, Container container, int x, int y, int width, int height)
|
private void drawTabBackground(GuiGraphics guiGraphics, Container container, ResourceLocation texture, int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
container.bindBackground();
|
|
||||||
|
|
||||||
int left = Mth.ceil(width / 2D);
|
int left = Mth.ceil(width / 2D);
|
||||||
int right = Mth.floor(width / 2D);
|
int right = Mth.floor(width / 2D);
|
||||||
|
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
|
|
||||||
GuiComponent.blit(matrix, x, y, 0, 0, left, height);
|
guiGraphics.blit(texture, x, y, 0, 0, left, height);
|
||||||
GuiComponent.blit(matrix, x + left, y, container.getBackgroundWidth() - right, 0, right, height);
|
guiGraphics.blit(texture, x + left, y, container.getBackgroundWidth() - right, 0, right, height);
|
||||||
|
|
||||||
RenderSystem.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawTabTitle(PoseStack matrix, GuiComponent gui, Component title, boolean isActive, int x, int y, int width, int height, int color)
|
private void drawTabTitle(GuiGraphics guiGraphics, Component title, boolean isActive, int x, int y, int width, int height, int color)
|
||||||
{
|
{
|
||||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
Font font = Minecraft.getInstance().font;
|
Font font = Minecraft.getInstance().font;
|
||||||
AbstractWidget.renderScrollingString(matrix, font, title, x + 5, y, x + width - 5, height, color);
|
AbstractWidget.renderScrollingString(guiGraphics, font, title, x + 5, y, x + width - 5, height, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
package exopandora.worldhandler.gui.widget;
|
package exopandora.worldhandler.gui.widget;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
|
||||||
|
|
||||||
import exopandora.worldhandler.config.Config;
|
import exopandora.worldhandler.config.Config;
|
||||||
import exopandora.worldhandler.gui.container.Container;
|
import exopandora.worldhandler.gui.container.Container;
|
||||||
import exopandora.worldhandler.util.RenderUtils;
|
import exopandora.worldhandler.util.RenderUtils;
|
||||||
import exopandora.worldhandler.util.TextUtils;
|
import exopandora.worldhandler.util.TextUtils;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
|
||||||
public class WidgetWatch implements IContainerWidget
|
public class WidgetWatch implements IContainerWidget
|
||||||
@@ -14,7 +13,7 @@ public class WidgetWatch implements IContainerWidget
|
|||||||
private boolean focused = false;
|
private boolean focused = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
public void drawScreen(GuiGraphics guiGraphics, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||||
{
|
{
|
||||||
final int watchX = container.getBackgroundX() + 233;
|
final int watchX = container.getBackgroundX() + 233;
|
||||||
final int watchY = container.getBackgroundY() + 5;
|
final int watchY = container.getBackgroundY() + 5;
|
||||||
@@ -26,11 +25,11 @@ public class WidgetWatch implements IContainerWidget
|
|||||||
time = Minecraft.getInstance().level.getLevelData().getDayTime();
|
time = Minecraft.getInstance().level.getLevelData().getDayTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderUtils.drawWatchIntoGui(matrix, container, watchX, watchY, time, Config.getSettings().smoothWatch());
|
RenderUtils.drawWatchIntoGui(guiGraphics, watchX, watchY, time, Config.getSettings().smoothWatch());
|
||||||
|
|
||||||
if(Config.getSettings().tooltips() && mouseX >= watchX && mouseX <= watchX + 9 && mouseY >= watchY && mouseY <= watchY + 9)
|
if(Config.getSettings().tooltips() && mouseX >= watchX && mouseX <= watchX + 9 && mouseY >= watchY && mouseY <= watchY + 9)
|
||||||
{
|
{
|
||||||
container.renderTooltip(matrix, Component.literal(TextUtils.formatWorldTime(time)), mouseX, mouseY + 9);
|
guiGraphics.renderTooltip(Minecraft.getInstance().font, Component.literal(TextUtils.formatWorldTime(time)), mouseX, mouseY + 9);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package exopandora.worldhandler.gui.widget.button;
|
package exopandora.worldhandler.gui.widget.button;
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
|
||||||
|
|
||||||
import exopandora.worldhandler.config.Config;
|
import exopandora.worldhandler.config.Config;
|
||||||
import exopandora.worldhandler.util.ActionHandler;
|
import exopandora.worldhandler.util.ActionHandler;
|
||||||
@@ -9,10 +8,11 @@ import exopandora.worldhandler.util.ActionHelper;
|
|||||||
import exopandora.worldhandler.util.RenderUtils;
|
import exopandora.worldhandler.util.RenderUtils;
|
||||||
import exopandora.worldhandler.util.ResourceHelper;
|
import exopandora.worldhandler.util.ResourceHelper;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiComponent;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.gui.components.AbstractButton;
|
import net.minecraft.client.gui.components.AbstractButton;
|
||||||
import net.minecraft.client.gui.narration.NarrationElementOutput;
|
import net.minecraft.client.gui.narration.NarrationElementOutput;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
|
|
||||||
public class GuiButtonBase extends AbstractButton
|
public class GuiButtonBase extends AbstractButton
|
||||||
@@ -31,19 +31,19 @@ public class GuiButtonBase extends AbstractButton
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderWidget(PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
|
public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks)
|
||||||
{
|
{
|
||||||
this.renderBackground(poseStack, mouseX, mouseY, partialTicks);
|
this.renderBackground(guiGraphics, mouseX, mouseY, partialTicks);
|
||||||
this.renderString(poseStack, Minecraft.getInstance().font, this.getFGColor() | Mth.ceil(this.alpha * 255.0F) << 24);
|
this.renderString(guiGraphics, Minecraft.getInstance().font, this.getFGColor() | Mth.ceil(this.alpha * 255.0F) << 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void renderBackground(PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
|
protected void renderBackground(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks)
|
||||||
{
|
{
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
RenderUtils.colorDefaultButton();
|
RenderUtils.colorDefaultButton();
|
||||||
|
|
||||||
int textureY = this.getTextureY();
|
int textureY = this.getTextureY();
|
||||||
RenderSystem.setShaderTexture(0, ResourceHelper.buttonTexture());
|
ResourceLocation texture = ResourceHelper.buttonTexture();
|
||||||
|
|
||||||
int hWidth = this.width / 2;
|
int hWidth = this.width / 2;
|
||||||
int hHeight = this.height / 2;
|
int hHeight = this.height / 2;
|
||||||
@@ -52,19 +52,19 @@ public class GuiButtonBase extends AbstractButton
|
|||||||
{
|
{
|
||||||
int textureOffset = 46 + textureY * 20;
|
int textureOffset = 46 + textureY * 20;
|
||||||
|
|
||||||
GuiComponent.blit(poseStack, this.getX(), this.getY(), 0, textureOffset, hWidth, hHeight);
|
guiGraphics.blit(texture, this.getX(), this.getY(), 0, textureOffset, hWidth, hHeight);
|
||||||
GuiComponent.blit(poseStack, this.getX(), this.getY() + hHeight, 0, textureOffset + 20 - hHeight, hWidth, hHeight);
|
guiGraphics.blit(texture, this.getX(), this.getY() + hHeight, 0, textureOffset + 20 - hHeight, hWidth, hHeight);
|
||||||
GuiComponent.blit(poseStack, this.getX() + hWidth, this.getY(), 200 - hWidth, textureOffset, hWidth, hHeight);
|
guiGraphics.blit(texture, this.getX() + hWidth, this.getY(), 200 - hWidth, textureOffset, hWidth, hHeight);
|
||||||
GuiComponent.blit(poseStack, this.getX() + hWidth, this.getY() + hHeight, 200 - hWidth, textureOffset + 20 - hHeight, hWidth, hHeight);
|
guiGraphics.blit(texture, this.getX() + hWidth, this.getY() + hHeight, 200 - hWidth, textureOffset + 20 - hHeight, hWidth, hHeight);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int textureOffset = textureY * 20;
|
int textureOffset = textureY * 20;
|
||||||
|
|
||||||
GuiComponent.blit(poseStack, this.getX(), this.getY(), 0, textureOffset, hWidth, hHeight);
|
guiGraphics.blit(texture, this.getX(), this.getY(), 0, textureOffset, hWidth, hHeight);
|
||||||
GuiComponent.blit(poseStack, this.getX(), this.getY() + hHeight, 0, textureOffset + 20 - hHeight, hWidth, hHeight);
|
guiGraphics.blit(texture, this.getX(), this.getY() + hHeight, 0, textureOffset + 20 - hHeight, hWidth, hHeight);
|
||||||
GuiComponent.blit(poseStack, this.getX() + hWidth, this.getY(), 200 - hWidth, textureOffset, this.width / 2, hHeight);
|
guiGraphics.blit(texture, this.getX() + hWidth, this.getY(), 200 - hWidth, textureOffset, this.width / 2, hHeight);
|
||||||
GuiComponent.blit(poseStack, this.getX() + hWidth, this.getY() + hHeight, 200 - hWidth, textureOffset + 20 - hHeight, hWidth, hHeight);
|
guiGraphics.blit(texture, this.getX() + hWidth, this.getY() + hHeight, 200 - hWidth, textureOffset + 20 - hHeight, hWidth, hHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderSystem.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
package exopandora.worldhandler.gui.widget.button;
|
package exopandora.worldhandler.gui.widget.button;
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
|
||||||
|
|
||||||
import exopandora.worldhandler.util.ActionHandler;
|
import exopandora.worldhandler.util.ActionHandler;
|
||||||
import exopandora.worldhandler.util.ResourceHelper;
|
import exopandora.worldhandler.util.ResourceHelper;
|
||||||
import net.minecraft.client.gui.GuiComponent;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
|
||||||
public class GuiButtonIcon extends GuiButtonTooltip
|
public class GuiButtonIcon extends GuiButtonTooltip
|
||||||
@@ -19,20 +18,18 @@ public class GuiButtonIcon extends GuiButtonTooltip
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderWidget(PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
|
public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks)
|
||||||
{
|
{
|
||||||
super.renderBackground(poseStack, mouseX, mouseY, partialTicks);
|
super.renderBackground(guiGraphics, mouseX, mouseY, partialTicks);
|
||||||
|
|
||||||
if(this.icon != null)
|
if(this.icon != null)
|
||||||
{
|
{
|
||||||
this.renderIcon(poseStack);
|
this.renderIcon(guiGraphics);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderIcon(PoseStack poseStack)
|
private void renderIcon(GuiGraphics guiGraphics)
|
||||||
{
|
{
|
||||||
RenderSystem.setShaderTexture(0, ResourceHelper.iconTexture());
|
|
||||||
|
|
||||||
if(this.active)
|
if(this.active)
|
||||||
{
|
{
|
||||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
@@ -42,6 +39,6 @@ public class GuiButtonIcon extends GuiButtonTooltip
|
|||||||
RenderSystem.setShaderColor(0.8F, 0.8F, 0.8F, 1.0F);
|
RenderSystem.setShaderColor(0.8F, 0.8F, 0.8F, 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
GuiComponent.blit(poseStack, this.getX() + this.width / 2 - 4, this.getY() + this.height / 2 - 4, this.icon.getX() * 8, this.icon.getY() * 8, 8, 8);
|
guiGraphics.blit(ResourceHelper.iconTexture(), this.getX() + this.width / 2 - 4, this.getY() + this.height / 2 - 4, this.icon.getX() * 8, this.icon.getY() * 8, 8, 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
package exopandora.worldhandler.gui.widget.button;
|
package exopandora.worldhandler.gui.widget.button;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
|
||||||
|
|
||||||
import exopandora.worldhandler.util.ActionHandler;
|
import exopandora.worldhandler.util.ActionHandler;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
|
||||||
@@ -23,9 +21,9 @@ public class GuiButtonItem extends GuiButtonBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderWidget(PoseStack matrix, int mouseX, int mouseY, float partialTicks)
|
public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks)
|
||||||
{
|
{
|
||||||
super.renderBackground(matrix, mouseX, mouseY, partialTicks);
|
super.renderBackground(guiGraphics, mouseX, mouseY, partialTicks);
|
||||||
Minecraft.getInstance().getItemRenderer().renderGuiItem(matrix, this.stack, this.getX() + this.width / 2 - 8, this.getY() + 2);
|
guiGraphics.renderItem(this.stack, this.getX() + this.width / 2 - 8, this.getY() + 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,14 +2,12 @@ package exopandora.worldhandler.gui.widget.button;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
|
||||||
|
|
||||||
import exopandora.worldhandler.gui.container.Container;
|
import exopandora.worldhandler.gui.container.Container;
|
||||||
import exopandora.worldhandler.gui.widget.menu.impl.ILogicMapped;
|
import exopandora.worldhandler.gui.widget.menu.impl.ILogicMapped;
|
||||||
import exopandora.worldhandler.util.TextUtils;
|
import exopandora.worldhandler.util.TextUtils;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.Font;
|
import net.minecraft.client.gui.Font;
|
||||||
import net.minecraft.client.gui.GuiComponent;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
@@ -36,9 +34,9 @@ public class GuiButtonList<T> extends GuiButtonTooltip
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderWidget(PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
|
public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks)
|
||||||
{
|
{
|
||||||
this.renderBackground(poseStack, mouseX, mouseY, partialTicks);
|
this.renderBackground(guiGraphics, mouseX, mouseY, partialTicks);
|
||||||
this.updateMessage();
|
this.updateMessage();
|
||||||
|
|
||||||
Font font = Minecraft.getInstance().font;
|
Font font = Minecraft.getInstance().font;
|
||||||
@@ -53,18 +51,18 @@ public class GuiButtonList<T> extends GuiButtonTooltip
|
|||||||
int spaceWidth = font.width(" ");
|
int spaceWidth = font.width(" ");
|
||||||
int yPos = this.getY() + (this.height - 8) / 2;
|
int yPos = this.getY() + (this.height - 8) / 2;
|
||||||
|
|
||||||
this.renderScrollingString(poseStack, font, combinedArrowWidth / 2 + 2, this.getFGColor() | Mth.ceil(this.alpha * 255.0F) << 24);
|
this.renderScrollingString(guiGraphics, font, combinedArrowWidth / 2 + 2, this.getFGColor() | Mth.ceil(this.alpha * 255.0F) << 24);
|
||||||
|
|
||||||
GuiComponent.drawCenteredString(poseStack, font, leftArrow, this.getX() + this.width / 2 - maxWidth / 2 - spaceWidth, yPos, this.getFGColor());
|
guiGraphics.drawCenteredString(font, leftArrow, this.getX() + this.width / 2 - maxWidth / 2 - spaceWidth, yPos, this.getFGColor());
|
||||||
GuiComponent.drawCenteredString(poseStack, font, rightArrow, this.getX() + this.width / 2 + maxWidth / 2 + spaceWidth, yPos, this.getFGColor());
|
guiGraphics.drawCenteredString(font, rightArrow, this.getX() + this.width / 2 + maxWidth / 2 + spaceWidth, yPos, this.getFGColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderTooltip(Screen screen, PoseStack matrix, int mouseX, int mouseY)
|
public void renderTooltip(GuiGraphics guiGraphics, Font font, int mouseX, int mouseY)
|
||||||
{
|
{
|
||||||
this.tooltip = this.logic.formatTooltip(this.items.get(this.persistence.getIndex()), this.persistence.getIndex() + 1, this.items.size());
|
this.tooltip = this.logic.formatTooltip(this.items.get(this.persistence.getIndex()), this.persistence.getIndex() + 1, this.items.size());
|
||||||
super.renderTooltip(screen, matrix, mouseX, mouseY);
|
super.renderTooltip(guiGraphics, font, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
package exopandora.worldhandler.gui.widget.button;
|
package exopandora.worldhandler.gui.widget.button;
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
|
||||||
|
|
||||||
import exopandora.worldhandler.Main;
|
import exopandora.worldhandler.Main;
|
||||||
import exopandora.worldhandler.config.Config;
|
import exopandora.worldhandler.config.Config;
|
||||||
import exopandora.worldhandler.util.ActionHandler;
|
import exopandora.worldhandler.util.ActionHandler;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.Font;
|
import net.minecraft.client.gui.Font;
|
||||||
import net.minecraft.client.gui.GuiComponent;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.resources.sounds.SimpleSoundInstance;
|
import net.minecraft.client.resources.sounds.SimpleSoundInstance;
|
||||||
import net.minecraft.client.sounds.SoundManager;
|
import net.minecraft.client.sounds.SoundManager;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
@@ -31,7 +30,7 @@ public class GuiButtonPiano extends GuiButtonBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderWidget(PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
|
public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks)
|
||||||
{
|
{
|
||||||
switch(this.type)
|
switch(this.type)
|
||||||
{
|
{
|
||||||
@@ -54,35 +53,34 @@ public class GuiButtonPiano extends GuiButtonBase
|
|||||||
int hovered = this.getTextureY();
|
int hovered = this.getTextureY();
|
||||||
|
|
||||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, Config.getSkin().getButtonAlpha());
|
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, Config.getSkin().getButtonAlpha());
|
||||||
RenderSystem.setShaderTexture(0, NOTE);
|
|
||||||
|
|
||||||
switch(this.type)
|
switch(this.type)
|
||||||
{
|
{
|
||||||
case LEFT:
|
case LEFT:
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case RIGHT:
|
case RIGHT:
|
||||||
this.drawWhiteKey(poseStack, hovered);
|
this.drawWhiteKey(guiGraphics, hovered);
|
||||||
break;
|
break;
|
||||||
case BLACK:
|
case BLACK:
|
||||||
this.drawBlackKey(poseStack, hovered);
|
this.drawBlackKey(guiGraphics, hovered);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void drawWhiteKey(PoseStack poseStack, int hoverstate)
|
protected void drawWhiteKey(GuiGraphics guiGraphics, int hoverstate)
|
||||||
{
|
{
|
||||||
int textColor = this.getFGColor();
|
int textColor = this.getFGColor();
|
||||||
Font font = Minecraft.getInstance().font;
|
Font font = Minecraft.getInstance().font;
|
||||||
|
|
||||||
GuiComponent.blit(poseStack, this.getX(), this.getY(), 25 + hoverstate * 15 - 15, 0, 15, 92);
|
guiGraphics.blit(NOTE, this.getX(), this.getY(), 25 + hoverstate * 15 - 15, 0, 15, 92);
|
||||||
font.draw(poseStack, this.getMessage(), (float) (this.getX() + this.width / 2 - font.width(this.getMessage()) / 2), (float) (this.getY() + (this.height - 8) / 2 + 36), textColor);
|
guiGraphics.drawString(font, this.getMessage(), this.getX() + this.width / 2 - font.width(this.getMessage()) / 2, this.getY() + (this.height - 8) / 2 + 36, textColor, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void drawBlackKey(PoseStack poseStack, int hoverstate)
|
protected void drawBlackKey(GuiGraphics guiGraphics, int hoverstate)
|
||||||
{
|
{
|
||||||
GuiComponent.blit(poseStack, this.getX(), this.getY(), 55 - hoverstate * 9 + 18, 0, 9, 58);
|
guiGraphics.blit(NOTE, this.getX(), this.getY(), 55 - hoverstate * 9 + 18, 0, 9, 58);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
package exopandora.worldhandler.gui.widget.button;
|
package exopandora.worldhandler.gui.widget.button;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
|
||||||
|
|
||||||
import exopandora.worldhandler.util.ActionHandler;
|
import exopandora.worldhandler.util.ActionHandler;
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.Font;
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
|
||||||
public class GuiButtonTooltip extends GuiButtonBase
|
public class GuiButtonTooltip extends GuiButtonBase
|
||||||
@@ -16,11 +15,11 @@ public class GuiButtonTooltip extends GuiButtonBase
|
|||||||
this.tooltip = tooltip;
|
this.tooltip = tooltip;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderTooltip(Screen screen, PoseStack poseStack, int mouseX, int mouseY)
|
public void renderTooltip(GuiGraphics guiGraphics, Font font, int mouseX, int mouseY)
|
||||||
{
|
{
|
||||||
if(this.isHovered() && this.tooltip != null && !this.tooltip.getString().isEmpty())
|
if(this.isHovered() && this.tooltip != null && !this.tooltip.getString().isEmpty())
|
||||||
{
|
{
|
||||||
screen.renderTooltip(poseStack, this.tooltip, mouseX, mouseY);
|
guiGraphics.renderTooltip(font, this.tooltip, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package exopandora.worldhandler.gui.widget.button;
|
||||||
|
|
||||||
|
import net.minecraft.ChatFormatting;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
|
import net.minecraft.client.gui.components.EditBox;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
|
||||||
|
public class GuiHintTextField extends EditBox
|
||||||
|
{
|
||||||
|
private Component hint;
|
||||||
|
|
||||||
|
public GuiHintTextField(int x, int y, int width, int height)
|
||||||
|
{
|
||||||
|
this(x, y, width, height, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GuiHintTextField(int x, int y, int width, int height, Component hint)
|
||||||
|
{
|
||||||
|
super(Minecraft.getInstance().font, x, y, width, height, null);
|
||||||
|
this.setMaxLength(Integer.MAX_VALUE);
|
||||||
|
this.hint = hint;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks)
|
||||||
|
{
|
||||||
|
super.render(guiGraphics, mouseX, mouseY, partialTicks);
|
||||||
|
|
||||||
|
if(this.isVisible() && !this.isFocused() && this.hint != null && ChatFormatting.stripFormatting(this.getValue()).isEmpty())
|
||||||
|
{
|
||||||
|
int x = this.getX();
|
||||||
|
int y = this.getY();
|
||||||
|
|
||||||
|
if(this.getInnerWidth() != this.width)
|
||||||
|
{
|
||||||
|
x += 4;
|
||||||
|
y += (this.height - 8) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
guiGraphics.drawString(Minecraft.getInstance().font, this.hint, x, y, 0x7F7F7F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHint(Component hint)
|
||||||
|
{
|
||||||
|
this.hint = hint;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Component getHint()
|
||||||
|
{
|
||||||
|
return this.hint;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setText(Component text)
|
||||||
|
{
|
||||||
|
if(text != null)
|
||||||
|
{
|
||||||
|
this.setValue(text.getString());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.setValue((String) null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,18 +3,19 @@ package exopandora.worldhandler.gui.widget.button;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
|
||||||
|
|
||||||
import exopandora.worldhandler.config.Config;
|
import exopandora.worldhandler.config.Config;
|
||||||
import exopandora.worldhandler.gui.container.Container;
|
import exopandora.worldhandler.gui.container.Container;
|
||||||
import exopandora.worldhandler.util.ILogic;
|
import exopandora.worldhandler.util.ILogic;
|
||||||
import exopandora.worldhandler.util.RenderUtils;
|
import exopandora.worldhandler.util.RenderUtils;
|
||||||
|
import exopandora.worldhandler.util.ResourceHelper;
|
||||||
import exopandora.worldhandler.util.TextUtils;
|
import exopandora.worldhandler.util.TextUtils;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.Font;
|
import net.minecraft.client.gui.Font;
|
||||||
import net.minecraft.client.gui.GuiComponent;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.MutableComponent;
|
import net.minecraft.network.chat.MutableComponent;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
||||||
public class GuiSlider extends GuiButtonBase
|
public class GuiSlider extends GuiButtonBase
|
||||||
{
|
{
|
||||||
@@ -34,9 +35,9 @@ public class GuiSlider extends GuiButtonBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderBackground(PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
|
public void renderBackground(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks)
|
||||||
{
|
{
|
||||||
super.renderBackground(poseStack, mouseX, mouseY, partialTicks);
|
super.renderBackground(guiGraphics, mouseX, mouseY, partialTicks);
|
||||||
|
|
||||||
int textureOffset = (Config.getSkin().getTextureType().equals("resourcepack") ? 66 : 20);
|
int textureOffset = (Config.getSkin().getTextureType().equals("resourcepack") ? 66 : 20);
|
||||||
|
|
||||||
@@ -47,9 +48,10 @@ public class GuiSlider extends GuiButtonBase
|
|||||||
|
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
RenderUtils.colorDefaultButton();
|
RenderUtils.colorDefaultButton();
|
||||||
|
ResourceLocation texture = ResourceHelper.buttonTexture();
|
||||||
|
|
||||||
GuiComponent.blit(poseStack, this.getX() + (int) (this.persistence.getValue() * (float) (this.width - 8)), this.getY(), 0, textureOffset, 4, 20);
|
guiGraphics.blit(texture, this.getX() + (int) (this.persistence.getValue() * (float) (this.width - 8)), this.getY(), 0, textureOffset, 4, 20);
|
||||||
GuiComponent.blit(poseStack, this.getX() + (int) (this.persistence.getValue() * (float) (this.width - 8)) + 4, this.getY(), 196, textureOffset, 4, 20);
|
guiGraphics.blit(texture, this.getX() + (int) (this.persistence.getValue() * (float) (this.width - 8)) + 4, this.getY(), 196, textureOffset, 4, 20);
|
||||||
|
|
||||||
RenderSystem.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,67 +0,0 @@
|
|||||||
package exopandora.worldhandler.gui.widget.button;
|
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
|
||||||
|
|
||||||
import net.minecraft.ChatFormatting;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.gui.components.EditBox;
|
|
||||||
import net.minecraft.network.chat.Component;
|
|
||||||
|
|
||||||
public class GuiTextFieldTooltip extends EditBox
|
|
||||||
{
|
|
||||||
private Component tooltip;
|
|
||||||
|
|
||||||
public GuiTextFieldTooltip(int x, int y, int width, int height)
|
|
||||||
{
|
|
||||||
this(x, y, width, height, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public GuiTextFieldTooltip(int x, int y, int width, int height, Component tooltip)
|
|
||||||
{
|
|
||||||
super(Minecraft.getInstance().font, x, y, width, height, null);
|
|
||||||
this.setMaxLength(Integer.MAX_VALUE);
|
|
||||||
this.tooltip = tooltip;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
|
|
||||||
{
|
|
||||||
super.render(poseStack, mouseX, mouseY, partialTicks);
|
|
||||||
|
|
||||||
if(this.isVisible() && !this.isFocused() && this.tooltip != null && ChatFormatting.stripFormatting(this.getValue()).isEmpty())
|
|
||||||
{
|
|
||||||
int x = this.getX();
|
|
||||||
int y = this.getY();
|
|
||||||
|
|
||||||
if(this.getInnerWidth() != this.width)
|
|
||||||
{
|
|
||||||
x += 4;
|
|
||||||
y += (this.height - 8) / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
Minecraft.getInstance().font.drawShadow(poseStack, this.tooltip, (float) x, (float) y, 0x7F7F7F);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTooltip(Component tooltip)
|
|
||||||
{
|
|
||||||
this.tooltip = tooltip;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Component getTooltip()
|
|
||||||
{
|
|
||||||
return this.tooltip;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setText(Component text)
|
|
||||||
{
|
|
||||||
if(text != null)
|
|
||||||
{
|
|
||||||
this.setValue(text.getString());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.setValue((String) null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
package exopandora.worldhandler.gui.widget.menu;
|
package exopandora.worldhandler.gui.widget.menu;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
|
||||||
|
|
||||||
import exopandora.worldhandler.gui.container.Container;
|
import exopandora.worldhandler.gui.container.Container;
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
|
|
||||||
public interface IMenu
|
public interface IMenu
|
||||||
{
|
{
|
||||||
void initGui(Container container);
|
void initGui(Container container);
|
||||||
void initButtons(Container container);
|
void initButtons(Container container);
|
||||||
void tick();
|
void tick();
|
||||||
void draw(PoseStack matrix, int mouseX, int mouseY, float partialTicks);
|
void draw(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,14 +7,13 @@ import java.util.function.BiFunction;
|
|||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
|
||||||
|
|
||||||
import exopandora.worldhandler.gui.container.Container;
|
import exopandora.worldhandler.gui.container.Container;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonList;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonList;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonList.Persistence;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonList.Persistence;
|
||||||
import exopandora.worldhandler.gui.widget.menu.Menu;
|
import exopandora.worldhandler.gui.widget.menu.Menu;
|
||||||
import exopandora.worldhandler.util.Node;
|
import exopandora.worldhandler.util.Node;
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.MutableComponent;
|
import net.minecraft.network.chat.MutableComponent;
|
||||||
|
|
||||||
@@ -110,7 +109,7 @@ public class MenuButtonList extends Menu
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(PoseStack matrix, int mouseX, int mouseY, float partialTicks)
|
public void draw(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,15 +3,14 @@ package exopandora.worldhandler.gui.widget.menu.impl;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
|
||||||
|
|
||||||
import exopandora.worldhandler.gui.container.Container;
|
import exopandora.worldhandler.gui.container.Container;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonList;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonList;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
import exopandora.worldhandler.gui.widget.button.GuiHintTextField;
|
||||||
import exopandora.worldhandler.gui.widget.menu.Menu;
|
import exopandora.worldhandler.gui.widget.menu.Menu;
|
||||||
import exopandora.worldhandler.util.UserStylableComponent;
|
import exopandora.worldhandler.util.UserStylableComponent;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.MutableComponent;
|
import net.minecraft.network.chat.MutableComponent;
|
||||||
import net.minecraft.network.chat.Style;
|
import net.minecraft.network.chat.Style;
|
||||||
@@ -42,7 +41,7 @@ public class MenuColorField extends Menu
|
|||||||
COLORS.add(ChatFormatting.WHITE);
|
COLORS.add(ChatFormatting.WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private GuiTextFieldTooltip textField;
|
private GuiHintTextField textField;
|
||||||
private final UserStylableComponent component;
|
private final UserStylableComponent component;
|
||||||
private final ILogicColorMenu logic;
|
private final ILogicColorMenu logic;
|
||||||
private final String translationKey;
|
private final String translationKey;
|
||||||
@@ -63,7 +62,7 @@ public class MenuColorField extends Menu
|
|||||||
@Override
|
@Override
|
||||||
public void initGui(Container container)
|
public void initGui(Container container)
|
||||||
{
|
{
|
||||||
this.textField = new GuiTextFieldTooltip(this.x + 118, this.y, 114, 20, Component.translatable(this.translationKey));
|
this.textField = new GuiHintTextField(this.x + 118, this.y, 114, 20, Component.translatable(this.translationKey));
|
||||||
this.textField.setFilter(this.logic::validate);
|
this.textField.setFilter(this.logic::validate);
|
||||||
this.textField.setFormatter((string, index) -> FormattedCharSequence.forward(string, this.component.getStyle()));
|
this.textField.setFormatter((string, index) -> FormattedCharSequence.forward(string, this.component.getStyle()));
|
||||||
this.textField.setValue(this.component.getText());
|
this.textField.setValue(this.component.getText());
|
||||||
@@ -151,7 +150,7 @@ public class MenuColorField extends Menu
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(PoseStack matrix, int mouseX, int mouseY, float partialTicks)
|
public void draw(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,13 @@ package exopandora.worldhandler.gui.widget.menu.impl;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
|
||||||
|
|
||||||
import exopandora.worldhandler.config.Config;
|
import exopandora.worldhandler.config.Config;
|
||||||
import exopandora.worldhandler.gui.container.Container;
|
import exopandora.worldhandler.gui.container.Container;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||||
import exopandora.worldhandler.gui.widget.menu.Menu;
|
import exopandora.worldhandler.gui.widget.menu.Menu;
|
||||||
import exopandora.worldhandler.util.TextUtils;
|
import exopandora.worldhandler.util.TextUtils;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.MutableComponent;
|
import net.minecraft.network.chat.MutableComponent;
|
||||||
@@ -104,9 +103,9 @@ public class MenuPageList<T> extends Menu
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(PoseStack matrix, int mouseX, int mouseY, float partialTicks)
|
public void draw(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks)
|
||||||
{
|
{
|
||||||
Minecraft.getInstance().font.draw(matrix, String.format("%d/%d", this.persistence.getPage() + 1, this.getTotalPages()), this.x, this.y - 11, Config.getSkin().getHeadlineColor());
|
guiGraphics.drawString(Minecraft.getInstance().font, String.format("%d/%d", this.persistence.getPage() + 1, this.getTotalPages()), this.x, this.y - 11, Config.getSkin().getHeadlineColor(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void goLeft(Container container)
|
private void goLeft(Container container)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import exopandora.worldhandler.gui.widget.button.GuiButtonItem;
|
|||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonList;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonList;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiButtonTooltip;
|
import exopandora.worldhandler.gui.widget.button.GuiButtonTooltip;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiSlider;
|
import exopandora.worldhandler.gui.widget.button.GuiSlider;
|
||||||
import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
import exopandora.worldhandler.gui.widget.button.GuiHintTextField;
|
||||||
import exopandora.worldhandler.gui.widget.button.LogicSliderSimple;
|
import exopandora.worldhandler.gui.widget.button.LogicSliderSimple;
|
||||||
import exopandora.worldhandler.usercontent.UsercontentAPI;
|
import exopandora.worldhandler.usercontent.UsercontentAPI;
|
||||||
import exopandora.worldhandler.usercontent.model.JsonItem;
|
import exopandora.worldhandler.usercontent.model.JsonItem;
|
||||||
@@ -102,7 +102,7 @@ public class WidgetFactory extends AbstractWidgetFactory
|
|||||||
}
|
}
|
||||||
else if(JsonWidget.Type.TEXTFIELD.equals(widget.getType()))
|
else if(JsonWidget.Type.TEXTFIELD.equals(widget.getType()))
|
||||||
{
|
{
|
||||||
GuiTextFieldTooltip textfield = new GuiTextFieldTooltip
|
GuiHintTextField textfield = new GuiHintTextField
|
||||||
(
|
(
|
||||||
widget.getLayout().getX() + x,
|
widget.getLayout().getX() + x,
|
||||||
widget.getLayout().getY() + y,
|
widget.getLayout().getY() + y,
|
||||||
|
|||||||
@@ -17,13 +17,13 @@ import net.minecraft.server.packs.resources.ReloadableResourceManager;
|
|||||||
import net.minecraft.server.packs.resources.ResourceManager;
|
import net.minecraft.server.packs.resources.ResourceManager;
|
||||||
import net.minecraft.util.Unit;
|
import net.minecraft.util.Unit;
|
||||||
import net.minecraft.util.profiling.ProfilerFiller;
|
import net.minecraft.util.profiling.ProfilerFiller;
|
||||||
import net.minecraft.world.level.storage.loot.PredicateManager;
|
import net.minecraft.world.level.storage.loot.LootDataManager;
|
||||||
import net.minecraftforge.common.crafting.conditions.ICondition.IContext;
|
import net.minecraftforge.common.crafting.conditions.ICondition.IContext;
|
||||||
|
|
||||||
public class AdvancementHelper implements PreparableReloadListener
|
public class AdvancementHelper implements PreparableReloadListener
|
||||||
{
|
{
|
||||||
private static final AdvancementHelper INSTANCE = new AdvancementHelper();
|
private static final AdvancementHelper INSTANCE = new AdvancementHelper();
|
||||||
private final ServerAdvancementManager manager = new ServerAdvancementManager(new PredicateManager(), IContext.EMPTY);
|
private final ServerAdvancementManager manager = new ServerAdvancementManager(new LootDataManager(), IContext.EMPTY);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Void> reload(PreparationBarrier stage, ResourceManager resourceManager, ProfilerFiller preparationsProfiler, ProfilerFiller reloadProfiler, Executor backgroundExecutor, Executor gameExecutor)
|
public CompletableFuture<Void> reload(PreparationBarrier stage, ResourceManager resourceManager, ProfilerFiller preparationsProfiler, ProfilerFiller reloadProfiler, Executor backgroundExecutor, Executor gameExecutor)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class CommandHelper
|
|||||||
|
|
||||||
public static void sendFeedback(CommandSourceStack source, String message)
|
public static void sendFeedback(CommandSourceStack source, String message)
|
||||||
{
|
{
|
||||||
source.sendSuccess(Component.literal(message), false);
|
source.sendSuccess(() -> Component.literal(message), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean canPlayerIssueCommand()
|
public static boolean canPlayerIssueCommand()
|
||||||
|
|||||||
@@ -5,13 +5,14 @@ import com.mojang.blaze3d.vertex.PoseStack;
|
|||||||
import com.mojang.math.Axis;
|
import com.mojang.math.Axis;
|
||||||
|
|
||||||
import exopandora.worldhandler.config.Config;
|
import exopandora.worldhandler.config.Config;
|
||||||
import net.minecraft.client.gui.GuiComponent;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
||||||
public class RenderUtils
|
public class RenderUtils
|
||||||
{
|
{
|
||||||
public static final double EPS = 0.0020000000949949026D;
|
public static final double EPS = 0.0020000000949949026D;
|
||||||
|
|
||||||
public static void drawWatchIntoGui(PoseStack matrix, GuiComponent gui, int width, int height, long worldTicks, boolean smooth)
|
public static void drawWatchIntoGui(GuiGraphics guiGraphics, int width, int height, long worldTicks, boolean smooth)
|
||||||
{
|
{
|
||||||
float hour = TextUtils.toHour(worldTicks);
|
float hour = TextUtils.toHour(worldTicks);
|
||||||
float minute = TextUtils.toMinute(worldTicks);
|
float minute = TextUtils.toMinute(worldTicks);
|
||||||
@@ -25,29 +26,29 @@ public class RenderUtils
|
|||||||
float rotationHour = (360 / 12) * (hour >= 12 ? (hour - 12) : hour) - 180F;
|
float rotationHour = (360 / 12) * (hour >= 12 ? (hour - 12) : hour) - 180F;
|
||||||
float rotationMinute = (360 / 60) * minute - 180F;
|
float rotationMinute = (360 / 60) * minute - 180F;
|
||||||
|
|
||||||
matrix.pushPose();
|
PoseStack poseStack = guiGraphics.pose();
|
||||||
matrix.translate(width + 5, height + 5, 0F);
|
poseStack.pushPose();
|
||||||
matrix.scale(0.25F, 0.25F, 0.25F);
|
poseStack.translate(width + 5, height + 5, 0F);
|
||||||
|
poseStack.scale(0.25F, 0.25F, 0.25F);
|
||||||
|
|
||||||
matrix.mulPose(Axis.ZP.rotationDegrees(rotationHour));
|
poseStack.mulPose(Axis.ZP.rotationDegrees(rotationHour));
|
||||||
GuiComponent.fill(matrix, -1, -1, 1, 11, 0xFF383838);
|
guiGraphics.fill(-1, -1, 1, 11, 0xFF383838);
|
||||||
matrix.mulPose(Axis.ZN.rotationDegrees(rotationHour));
|
poseStack.mulPose(Axis.ZN.rotationDegrees(rotationHour));
|
||||||
|
|
||||||
matrix.mulPose(Axis.ZP.rotationDegrees(rotationMinute));
|
poseStack.mulPose(Axis.ZP.rotationDegrees(rotationMinute));
|
||||||
GuiComponent.fill(matrix, -1, -1, 1, 15, 0xFF6F6F6F);
|
guiGraphics.fill(-1, -1, 1, 15, 0xFF6F6F6F);
|
||||||
matrix.mulPose(Axis.ZN.rotationDegrees(rotationMinute));
|
poseStack.mulPose(Axis.ZN.rotationDegrees(rotationMinute));
|
||||||
|
|
||||||
matrix.popPose();
|
poseStack.popPose();
|
||||||
|
|
||||||
RenderUtils.colorDefaultButton();
|
RenderUtils.colorDefaultButton();
|
||||||
RenderSystem.setShaderTexture(0, ResourceHelper.iconTexture());
|
|
||||||
|
|
||||||
GuiComponent.blit(matrix, width + 0, height, 48, 0, 10, 10);
|
guiGraphics.blit(ResourceHelper.iconTexture(), width + 0, height, 48, 0, 10, 10);
|
||||||
|
|
||||||
matrix.pushPose();
|
poseStack.pushPose();
|
||||||
matrix.scale(0.5F, 0.5F, 0.5F);
|
poseStack.scale(0.5F, 0.5F, 0.5F);
|
||||||
GuiComponent.fill(matrix, (width + 5) * 2 - 1, (height + 4) * 2 + 1, (width + 6) * 2 - 1, (height + 5) * 2 + 1, 0xFF000000);
|
guiGraphics.fill((width + 5) * 2 - 1, (height + 4) * 2 + 1, (width + 6) * 2 - 1, (height + 5) * 2 + 1, 0xFF000000);
|
||||||
matrix.popPose();
|
poseStack.popPose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void colorDefaultButton()
|
public static void colorDefaultButton()
|
||||||
@@ -85,39 +86,39 @@ public class RenderUtils
|
|||||||
RenderSystem.setShaderColor(Math.max(0, r - 0.3F), Math.max(0, g - 0.3F), Math.max(0, b - 0.3F), a);
|
RenderSystem.setShaderColor(Math.max(0, r - 0.3F), Math.max(0, g - 0.3F), Math.max(0, b - 0.3F), a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawTexturedTriangleBL(PoseStack matrix, GuiComponent gui, int x, int y, int textureX, int textureY, int size)
|
public static void drawTexturedTriangleBL(GuiGraphics guiGraphics, ResourceLocation texture, int x, int y, int textureX, int textureY, int size)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < size; i++)
|
for(int i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
GuiComponent.blit(matrix, x, y + i, textureX, textureY + i, i + 1, 1);
|
guiGraphics.blit(texture, x, y + i, textureX, textureY + i, i + 1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawTexturedTriangleBR(PoseStack matrix, GuiComponent gui, int x, int y, int textureX, int textureY, int size)
|
public static void drawTexturedTriangleBR(GuiGraphics guiGraphics, ResourceLocation texture, int x, int y, int textureX, int textureY, int size)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < size; i++)
|
for(int i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
GuiComponent.blit(matrix, x + size - i - 1, y + i, textureX + size - i - 1, textureY + i, i + 1, 1);
|
guiGraphics.blit(texture, x + size - i - 1, y + i, textureX + size - i - 1, textureY + i, i + 1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawTexturedTriangleTL(PoseStack matrix, GuiComponent gui, int x, int y, int textureX, int textureY, int size)
|
public static void drawTexturedTriangleTL(GuiGraphics guiGraphics, ResourceLocation texture, int x, int y, int textureX, int textureY, int size)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < size; i++)
|
for(int i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
GuiComponent.blit(matrix, x, y + i, textureX, textureY, size - i, 1);
|
guiGraphics.blit(texture, x, y + i, textureX, textureY, size - i, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawTexturedTriangleTR(PoseStack matrix, GuiComponent gui, int x, int y, int textureX, int textureY, int size)
|
public static void drawTexturedTriangleTR(GuiGraphics guiGraphics, ResourceLocation texture, int x, int y, int textureX, int textureY, int size)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < size; i++)
|
for(int i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
GuiComponent.blit(matrix, x + i, y + i, textureX + i, textureY, size - i, 1);
|
guiGraphics.blit(texture, x + i, y + i, textureX + i, textureY, size - i, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawTexturedWedgeGradientTR(PoseStack matrix, GuiComponent gui, int x, int y, int textureX, int textureY, int width, int height)
|
public static void drawTexturedWedgeGradientTR(GuiGraphics guiGraphics, ResourceLocation texture, int x, int y, int textureX, int textureY, int width, int height)
|
||||||
{
|
{
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
|
|
||||||
@@ -127,13 +128,13 @@ public class RenderUtils
|
|||||||
int z = width - (int) (w * width);
|
int z = width - (int) (w * width);
|
||||||
|
|
||||||
RenderUtils.colorDefaultBackground(w);
|
RenderUtils.colorDefaultBackground(w);
|
||||||
GuiComponent.blit(matrix, x + z, y + i, textureX + z, textureY + i, width - z, 1);
|
guiGraphics.blit(texture, x + z, y + i, textureX + z, textureY + i, width - z, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderSystem.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawTexturedWedgeGradientTL(PoseStack matrix, GuiComponent gui, int x, int y, int textureX, int textureY, int width, int height)
|
public static void drawTexturedWedgeGradientTL(GuiGraphics guiGraphics, ResourceLocation texture, int x, int y, int textureX, int textureY, int width, int height)
|
||||||
{
|
{
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
|
|
||||||
@@ -143,7 +144,7 @@ public class RenderUtils
|
|||||||
int z = (int) (w * width);
|
int z = (int) (w * width);
|
||||||
|
|
||||||
RenderUtils.colorDefaultBackground(w);
|
RenderUtils.colorDefaultBackground(w);
|
||||||
GuiComponent.blit(matrix, x, y + i, textureX, textureY + i, z, 1);
|
guiGraphics.blit(texture, x, y + i, textureX, textureY + i, z, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderSystem.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
|
|||||||
@@ -6,5 +6,5 @@ public net.minecraft.commands.arguments.coordinates.LocalCoordinates m_119908_(L
|
|||||||
public net.minecraft.advancements.critereon.MinMaxBounds$Doubles <init>(Ljava/lang/Double;Ljava/lang/Double;)V # constructor
|
public net.minecraft.advancements.critereon.MinMaxBounds$Doubles <init>(Ljava/lang/Double;Ljava/lang/Double;)V # constructor
|
||||||
public net.minecraft.network.chat.MutableComponent <init>(Lnet/minecraft/network/chat/ComponentContents;Ljava/util/List;Lnet/minecraft/network/chat/Style;)V # constructor
|
public net.minecraft.network.chat.MutableComponent <init>(Lnet/minecraft/network/chat/ComponentContents;Ljava/util/List;Lnet/minecraft/network/chat/Style;)V # constructor
|
||||||
public net.minecraft.commands.arguments.item.ItemParser f_120991_ # ERROR_NO_TAGS_ALLOWED
|
public net.minecraft.commands.arguments.item.ItemParser f_120991_ # ERROR_NO_TAGS_ALLOWED
|
||||||
public net.minecraft.world.level.storage.PrimaryLevelData f_78443_ # settings
|
public net.minecraft.world.level.storage.PrimaryLevelData f_78443_ # settings
|
||||||
public net.minecraft.client.gui.components.AbstractWidget m_274366_(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/gui/Font;Lnet/minecraft/network/chat/Component;IIIII)V # renderScrollingString
|
public net.minecraft.client.gui.components.AbstractWidget m_280138_(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/gui/Font;Lnet/minecraft/network/chat/Component;IIIII)V # renderScrollingString
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
modLoader="javafml"
|
modLoader="javafml"
|
||||||
loaderVersion="[45,)"
|
loaderVersion="[46,)"
|
||||||
updateJSONURL="https://raw.githubusercontent.com/Exopandora/worldhandler/master/version.json"
|
updateJSONURL="https://raw.githubusercontent.com/Exopandora/worldhandler/master/version.json"
|
||||||
issueTrackerURL="https://github.com/Exopandora/WorldHandler/issues"
|
issueTrackerURL="https://github.com/Exopandora/WorldHandler/issues"
|
||||||
displayURL="https://minecraft.curseforge.com/projects/world-handler-command-gui"
|
displayURL="https://minecraft.curseforge.com/projects/world-handler-command-gui"
|
||||||
@@ -11,13 +11,13 @@ license="GPL v3.0"
|
|||||||
|
|
||||||
[[mods]]
|
[[mods]]
|
||||||
modId="worldhandler"
|
modId="worldhandler"
|
||||||
version="1.19.4-${version}"
|
version="1.20-${version}"
|
||||||
displayName="World Handler"
|
displayName="World Handler"
|
||||||
description="The World Handler provides a simple and easy to use graphical user interface for commands. It lets you create powerful and complex sub-commands alongside NBT-structures within seconds."
|
description="The World Handler provides a simple and easy to use graphical user interface for commands. It lets you create powerful and complex sub-commands alongside NBT-structures within seconds."
|
||||||
|
|
||||||
[[dependencies.worldhandler]]
|
[[dependencies.worldhandler]]
|
||||||
modId="minecraft"
|
modId="minecraft"
|
||||||
mandatory=true
|
mandatory=true
|
||||||
versionRange="[1.19.4,)"
|
versionRange="[1.20,)"
|
||||||
ordering="NONE"
|
ordering="NONE"
|
||||||
side="BOTH"
|
side="BOTH"
|
||||||
|
|||||||
@@ -193,7 +193,7 @@
|
|||||||
"gui.worldhandler.items.enchantment.level": "Level",
|
"gui.worldhandler.items.enchantment.level": "Level",
|
||||||
"gui.worldhandler.items.enchantment.enchant": "Enchant",
|
"gui.worldhandler.items.enchantment.enchant": "Enchant",
|
||||||
|
|
||||||
"gui.worldhandler.blocks.sign_editor.look_at_sign": "Look at a Sign and press '%s'",
|
"gui.worldhandler.blocks.sign_editor.look_at_sign": "Look at a sign and press '%s'",
|
||||||
"gui.worldhandler.blocks.sign_editor.text_line_1": "Text Line I",
|
"gui.worldhandler.blocks.sign_editor.text_line_1": "Text Line I",
|
||||||
"gui.worldhandler.blocks.sign_editor.text_line_2": "Text Line II",
|
"gui.worldhandler.blocks.sign_editor.text_line_2": "Text Line II",
|
||||||
"gui.worldhandler.blocks.sign_editor.text_line_3": "Text Line III",
|
"gui.worldhandler.blocks.sign_editor.text_line_3": "Text Line III",
|
||||||
@@ -201,7 +201,7 @@
|
|||||||
"gui.worldhandler.blocks.sign_editor.commmand": "Command",
|
"gui.worldhandler.blocks.sign_editor.commmand": "Command",
|
||||||
"gui.worldhandler.blocks.sign_editor.format_text_line": "Format Text Line",
|
"gui.worldhandler.blocks.sign_editor.format_text_line": "Format Text Line",
|
||||||
|
|
||||||
"gui.worldhandler.blocks.note_block_editor.look_at_note_block": "Look at a Note Block and press '%s'",
|
"gui.worldhandler.blocks.note_block_editor.look_at_note_block": "Look at a note block and press '%s'",
|
||||||
"gui.worldhandler.blocks.note_block_editor.c": "C",
|
"gui.worldhandler.blocks.note_block_editor.c": "C",
|
||||||
"gui.worldhandler.blocks.note_block_editor.d": "D",
|
"gui.worldhandler.blocks.note_block_editor.d": "D",
|
||||||
"gui.worldhandler.blocks.note_block_editor.e": "E",
|
"gui.worldhandler.blocks.note_block_editor.e": "E",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"pack": {
|
"pack": {
|
||||||
"description": "World Handler",
|
"description": "World Handler",
|
||||||
"pack_format": 13
|
"pack_format": 15
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user