diff options
23 files changed, 364 insertions, 227 deletions
diff --git a/build.gradle b/build.gradle index 8b7a6e6d..3e80b24a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.0-SNAPSHOT' + id 'fabric-loom' version '1.1-SNAPSHOT' id 'maven-publish' id 'com.modrinth.minotaur' version '2.+' } @@ -36,9 +36,9 @@ repositories { } dependencies { - implementation 'com.google.code.gson:gson:2.10' - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2' + implementation 'com.google.code.gson:gson:2.10.1' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.2' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.2' // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" @@ -58,7 +58,7 @@ dependencies { modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" // https://mvnrepository.com/artifact/org.eclipse.jgit/org.eclipse.jgit used pull data from the NEU item repo - include(implementation("org.eclipse.jgit:org.eclipse.jgit:6.0.0.202111291000-r")) + include(implementation("org.eclipse.jgit:org.eclipse.jgit:6.4.0.202211300538-r")) include(modImplementation ("meteordevelopment:discord-ipc:1.1")) } diff --git a/gradle.properties b/gradle.properties index dd7af5a8..f1ea4278 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,22 +1,29 @@ org.gradle.jvmargs=-Xmx1G -Dfile.encoding=UTF-8 -Duser.language=en -Duser.country=US # Fabric Properties (https://fabricmc.net/versions.html) -minecraft_version=1.19.2 -yarn_mappings=1.19.2+build.1 -loader_version=0.14.8 +## 1.19.3 +minecraft_version=1.19.3 +yarn_mappings=1.19.3+build.5 +## 1.19.2 +#minecraft_version=1.19.2 +#yarn_mappings=1.19.2+build.28 +loader_version=0.14.12 #Fabric api -fabric_version=0.58.6+1.19.2 +## 1.19.3 +fabric_version=0.72.0+1.19.3 +## 1.19.2 +#fabric_version=0.72.0+1.19.2 # Dependencies ## Cloth Api (https://www.curseforge.com/minecraft/mc-mods/cloth-config/files) -clothconfig_version=7.0.65 +clothconfig_version=9.0.94 ## Mod Menu (https://www.curseforge.com/minecraft/mc-mods/modmenu/files) -mod_menu_version=4.0.6 +mod_menu_version=5.0.2 # Mod Properties -mod_version = 1.8.2 +mod_version = 1.8.3-beta maven_group = me.xmrvizzy archives_base_name = skyblocker modrinth_id=y6DuFGwJ -suported_version=1.19.2
\ No newline at end of file +suported_version=1.19.3
\ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar Binary files differindex 7454180f..943f0cbf 100644 --- a/gradle/wrapper/gradle-wrapper.jar +++ b/gradle/wrapper/gradle-wrapper.jar diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 856da69b..f398c33c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists
\ No newline at end of file +zipStorePath=wrapper/dists @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +# This is normally unused +# shellcheck disable=SC2034 +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" "-Dfile.encoding=UTF-8" "-Duser.language=en" "-Duser.country=US"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MSYS* | MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,105 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + 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 ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | 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" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# 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. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' -exec "$JAVACMD" "$@"
\ No newline at end of file +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index afa9efaa..93e3f59f 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -33,14 +34,14 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" "-Dfile.encoding=UTF-8" "-Duser.language=en" "-Duser.country=US" +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. 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 @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java b/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java index 97284bc1..e487c209 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java @@ -1,15 +1,14 @@ package me.xmrvizzy.skyblocker.config; +import java.util.ArrayList; +import java.util.List; + import me.shedaniel.autoconfig.AutoConfig; import me.shedaniel.autoconfig.ConfigData; import me.shedaniel.autoconfig.annotation.Config; import me.shedaniel.autoconfig.annotation.ConfigEntry; import me.shedaniel.autoconfig.serializer.GsonConfigSerializer; import me.xmrvizzy.skyblocker.chat.ChatFilterResult; -import net.minecraft.item.ItemStack; - -import java.util.ArrayList; -import java.util.List; @Config(name = "skyblocker") public class SkyblockerConfig implements ConfigData { @@ -67,7 +66,7 @@ public class SkyblockerConfig implements ConfigData { @ConfigEntry.Category("button8") @ConfigEntry.Gui.CollapsibleObject(startExpanded = false) - public QuickNavItem button8 = new QuickNavItem(true, new ItemData("player_head", 1, "tag:{SkullOwner:{Id:[I;1605800870,415127827,-1236127084,15358548],Properties:{textures:[{Value:\"e3RleHR1cmVzOntTS0lOOnt1cmw6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzg5MWQ1YjI3M2ZmMGJjNTBjOTYwYjJjZDg2ZWVmMWM0MGExYjk0MDMyYWU3MWU3NTQ3NWE1NjhhODI1NzQyMSJ9fX0=\"}]}}}"), "none", "/warp dungeon"); + public QuickNavItem button8 = new QuickNavItem(true, new ItemData("player_head", 1, "tag:{SkullOwner:{Id:[I;1605800870,415127827,-1236127084,15358548],Properties:{textures:[{Value:\"e3RleHR1cmVzOntTS0lOOnt1cmw6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzg5MWQ1YjI3M2ZmMGJjNTBjOTYwYjJjZDg2ZWVmMWM0MGExYjk0MDMyYWU3MWU3NTQ3NWE1NjhhODI1NzQyMSJ9fX0=\"}]}}}"), "none", "/warp dungeon_hub"); @ConfigEntry.Category("button9") @ConfigEntry.Gui.CollapsibleObject(startExpanded = false) @@ -175,7 +174,8 @@ public class SkyblockerConfig implements ConfigData { RIGHT, NONE; - public String toString() { + @Override + public String toString() { return switch (this) { case LAYER1 -> "Layer 1"; case LAYER2 -> "Layer 2"; @@ -217,7 +217,8 @@ public class SkyblockerConfig implements ConfigData { THREE_DAY, BOTH; - public String toString() { + @Override + public String toString() { return switch (this) { case ONE_DAY -> "1 day price"; case THREE_DAY -> "3 day price"; diff --git a/src/main/java/me/xmrvizzy/skyblocker/mixin/ClientPlayerEntityMixin.java b/src/main/java/me/xmrvizzy/skyblocker/mixin/ClientPlayerEntityMixin.java index 437e10f9..033272db 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/mixin/ClientPlayerEntityMixin.java +++ b/src/main/java/me/xmrvizzy/skyblocker/mixin/ClientPlayerEntityMixin.java @@ -6,7 +6,7 @@ import me.xmrvizzy.skyblocker.utils.Utils; import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.world.ClientWorld; -import net.minecraft.network.encryption.PlayerPublicKey; +// import net.minecraft.network.encryption.PlayerPublicKey; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -15,8 +15,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(ClientPlayerEntity.class) public abstract class ClientPlayerEntityMixin extends AbstractClientPlayerEntity { - public ClientPlayerEntityMixin(ClientWorld world, GameProfile profile, PlayerPublicKey publicKey) { - super(world, profile, publicKey); + // public ClientPlayerEntityMixin(ClientWorld world, GameProfile profile, PlayerPublicKey publicKey) { + public ClientPlayerEntityMixin(ClientWorld world, GameProfile profile) { + // super(world, profile, publicKey); + super(world, profile); } @Inject(method = "dropSelectedItem", at = @At("HEAD"), cancellable = true) diff --git a/src/main/java/me/xmrvizzy/skyblocker/mixin/InGameHudMixin.java b/src/main/java/me/xmrvizzy/skyblocker/mixin/InGameHudMixin.java index 9ceebf9f..7f25b339 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/mixin/InGameHudMixin.java +++ b/src/main/java/me/xmrvizzy/skyblocker/mixin/InGameHudMixin.java @@ -44,7 +44,7 @@ public abstract class InGameHudMixin extends DrawableHelper { private int scaledWidth; @Shadow - private void setOverlayMessage(Text message, boolean tinted) { + public void setOverlayMessage(Text message, boolean tinted) { } @Inject(method = "setOverlayMessage(Lnet/minecraft/text/Text;Z)V", at = @At("HEAD"), cancellable = true) diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/Reparty.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/Reparty.java index c06822de..19f13c32 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/Reparty.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/Reparty.java @@ -1,18 +1,18 @@ package me.xmrvizzy.skyblocker.skyblock.dungeon; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + import me.xmrvizzy.skyblocker.SkyblockerMod; import me.xmrvizzy.skyblocker.chat.ChatFilterResult; import me.xmrvizzy.skyblocker.chat.ChatPatternListener; import me.xmrvizzy.skyblocker.utils.Utils; -import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager; +import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.text.Text; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - public class Reparty extends ChatPatternListener { private static final MinecraftClient client = MinecraftClient.getInstance(); private static final SkyblockerMod skyblocker = SkyblockerMod.getInstance(); @@ -30,7 +30,7 @@ public class Reparty extends ChatPatternListener { dispatcher.register(ClientCommandManager.literal("rp").executes(context -> { if (!Utils.isOnSkyblock || this.repartying || client.player == null) return 0; this.repartying = true; - client.player.sendChatMessage("/p list", Text.of("/p list")); + client.player.networkHandler.sendCommand("p list"); return 0; })); }); @@ -68,15 +68,16 @@ public class Reparty extends ChatPatternListener { this.repartying = false; return; } - sendCommand(playerEntity, "/p disband", 1); + sendCommand(playerEntity, "p disband", 1); for (int i = 0; i < this.players.length; ++i) { - String command = "/p invite " + this.players[i]; + String command = "p invite " + this.players[i]; sendCommand(playerEntity, command, i + 2); } skyblocker.scheduler.schedule(() -> this.repartying = false, this.players.length + 2); } private void sendCommand(ClientPlayerEntity player, String command, int delay) { - skyblocker.scheduler.schedule(() -> player.sendChatMessage(command, Text.of(command)), delay * BASE_DELAY); + // skyblocker.scheduler.schedule(() -> player.sendChatMessage(command, Text.of(command)), delay * BASE_DELAY); + skyblocker.scheduler.schedule(() -> player.networkHandler.sendCommand(command), delay * BASE_DELAY); } } diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/Trivia.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/Trivia.java index b437ce10..81bee4ba 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/Trivia.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/Trivia.java @@ -1,5 +1,12 @@ package me.xmrvizzy.skyblocker.skyblock.dungeon; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; + import me.xmrvizzy.skyblocker.chat.ChatFilterResult; import me.xmrvizzy.skyblocker.chat.ChatPatternListener; import me.xmrvizzy.skyblocker.config.SkyblockerConfig; @@ -8,9 +15,6 @@ import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.text.Text; import net.minecraft.util.Formatting; -import java.util.*; -import java.util.regex.Matcher; - public class Trivia extends ChatPatternListener { private static final Map<String, String[]> answers; private List<String> solutions = Collections.emptyList(); @@ -65,7 +69,7 @@ public class Trivia extends ChatPatternListener { answers.put("What is the status of Storm?", new String[]{"The Wither Lords"}); answers.put("What is the status of Necron?", new String[]{"The Wither Lords"}); answers.put("What is the status of Maxor, Storm, Goldor and Necron?", new String[]{"The Wither Lords"}); - answers.put("How many total Fairy Souls are there?", new String[]{"238 Fairy Souls"}); + answers.put("How many total Fairy Souls are there?", new String[]{"239 Fairy Souls"}); answers.put("How many Fairy Souls are there in Spider's Den?", new String[]{"19 Fairy Souls"}); answers.put("How many Fairy Souls are there in The End?", new String[]{"12 Fairy Souls"}); answers.put("How many Fairy Souls are there in The Farming Islands?", new String[]{"20 Fairy Souls"}); diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/terminal/ColorTerminal.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/terminal/ColorTerminal.java index a589b759..f5c97738 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/terminal/ColorTerminal.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/terminal/ColorTerminal.java @@ -6,9 +6,10 @@ import me.xmrvizzy.skyblocker.container.ContainerSolver; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; +// import net.minecraft.registry.Registry; +import net.minecraft.registry.Registries; import net.minecraft.util.DyeColor; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -62,7 +63,8 @@ public class ColorTerminal extends ContainerSolver { itemColor = new HashMap<>(); for (DyeColor color : DyeColor.values()) for (String item : new String[]{"dye", "wool", "stained_glass", "terracotta"}) - itemColor.put(Registry.ITEM.get(new Identifier(color.getName() + '_' + item)), color); + // itemColor.put(Registry.ITEM.get(new Identifier(color.getName() + '_' + item)), color); + itemColor.put(Registries.ITEM.get(new Identifier(color.getName() + '_' + item)), color); itemColor.put(Items.BONE_MEAL, DyeColor.WHITE); itemColor.put(Items.LAPIS_LAZULI, DyeColor.BLUE); itemColor.put(Items.COCOA_BEANS, DyeColor.BROWN); diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/itemlist/ItemFixerUpper.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/itemlist/ItemFixerUpper.java index dc2d9947..249fba9f 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/itemlist/ItemFixerUpper.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/itemlist/ItemFixerUpper.java @@ -1,9 +1,10 @@ package me.xmrvizzy.skyblocker.skyblock.itemlist; import net.minecraft.item.Items; +// import net.minecraft.registry.Registry; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; - import java.util.Map; public class ItemFixerUpper { @@ -223,11 +224,14 @@ public class ItemFixerUpper { if (id.equals("minecraft:prismarine")) return PRISMARINE_VARIANTS[damage]; id = MAPPING.getOrDefault(id, id); - if (Registry.ITEM.get(new Identifier(id)).equals(Items.AIR)) { + // if (Registry.ITEM.get(new Identifier(id)).equals(Items.AIR)) { + if (Registries.ITEM.get(new Identifier(id)).equals(Items.AIR)) { String shortId = id.split(":")[1]; - if (damage < BLOCK_COLORS.length && !Registry.ITEM.get(new Identifier("minecraft:" + BLOCK_COLORS[damage] + shortId)).equals(Items.AIR)) + // if (damage < BLOCK_COLORS.length && !Registry.ITEM.get(new Identifier("minecraft:" + BLOCK_COLORS[damage] + shortId)).equals(Items.AIR)) + if (damage < BLOCK_COLORS.length && !Registries.ITEM.get(new Identifier("minecraft:" + BLOCK_COLORS[damage] + shortId)).equals(Items.AIR)) return "minecraft:" + BLOCK_COLORS[damage] + shortId; - if (damage < TREE_VARIANTS.length && !Registry.ITEM.get(new Identifier("minecraft:" + TREE_VARIANTS[damage] + shortId)).equals(Items.AIR)) + // if (damage < TREE_VARIANTS.length && !Registry.ITEM.get(new Identifier("minecraft:" + TREE_VARIANTS[damage] + shortId)).equals(Items.AIR)) + if (damage < TREE_VARIANTS.length && !Registries.ITEM.get(new Identifier("minecraft:" + TREE_VARIANTS[damage] + shortId)).equals(Items.AIR)) return "minecraft:" + TREE_VARIANTS[damage] + shortId; if (id.contains("wooden_")) return id.replaceFirst("wooden_", TREE_VARIANTS[damage]); diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/itemlist/ItemListWidget.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/itemlist/ItemListWidget.java index a635cea2..ce567b67 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/itemlist/ItemListWidget.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/itemlist/ItemListWidget.java @@ -1,6 +1,7 @@ package me.xmrvizzy.skyblocker.skyblock.itemlist; import com.mojang.blaze3d.systems.RenderSystem; + import me.xmrvizzy.skyblocker.mixin.RecipeBookWidgetAccessor; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -13,7 +14,6 @@ import net.minecraft.client.render.GameRenderer; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.screen.AbstractRecipeScreenHandler; import net.minecraft.text.Text; -import net.minecraft.text.TranslatableTextContent; import net.minecraft.util.Formatting; @Environment(value= EnvType.CLIENT) @@ -48,7 +48,7 @@ public class ItemListWidget extends RecipeBookWidget implements Drawable, Select if (this.isOpen()) { matrices.push(); matrices.translate(0.0D, 0.0D, 100.0D); - RenderSystem.setShader(GameRenderer::getPositionTexShader); + RenderSystem.setShader(GameRenderer::getPositionTexProgram); RenderSystem.setShaderTexture(0, TEXTURE); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); this.searchField = ((RecipeBookWidgetAccessor)this).getSearchField(); @@ -76,14 +76,16 @@ public class ItemListWidget extends RecipeBookWidget implements Drawable, Select } @Override - public boolean mouseClicked(double mouseX, double mouseY, int button) { - if (this.isOpen() && !this.client.player.isSpectator()) { - if (this.searchField.mouseClicked(mouseX, mouseY, button)) { - this.results.closeRecipeView(); - return true; - } - if (this.results.mouseClicked(mouseX, mouseY, button)) return true; - } - return false; - } -} + public boolean mouseClicked(double mouseX, double mouseY, int button) { + if (!this.isOpen() || this.client.player.isSpectator()) { + return false; + } + if (this.searchField != null && this.searchField.mouseClicked(mouseX, mouseY, button)) { + this.results.closeRecipeView(); + return true; + } + if (this.results.mouseClicked(mouseX, mouseY, button)) + return true; + return false; + } +}
\ No newline at end of file diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/itemlist/ResultButtonWidget.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/itemlist/ResultButtonWidget.java index 57fcbcd2..6d0d89e1 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/itemlist/ResultButtonWidget.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/itemlist/ResultButtonWidget.java @@ -1,6 +1,9 @@ package me.xmrvizzy.skyblocker.skyblock.itemlist; +import java.util.List; + import com.mojang.blaze3d.systems.RenderSystem; + import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder; import net.minecraft.client.gui.widget.ClickableWidget; @@ -11,8 +14,6 @@ import net.minecraft.item.Items; import net.minecraft.text.Text; import net.minecraft.util.Identifier; -import java.util.List; - public class ResultButtonWidget extends ClickableWidget { private static final Identifier BACKGROUND_TEXTURE = new Identifier("textures/gui/recipe_book.png"); @@ -36,22 +37,26 @@ public class ResultButtonWidget extends ClickableWidget { @Override public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float delta) { MinecraftClient client = MinecraftClient.getInstance(); - RenderSystem.setShader(GameRenderer::getPositionTexShader); + RenderSystem.setShader(GameRenderer::getPositionTexProgram); RenderSystem.setShaderTexture(0, BACKGROUND_TEXTURE); - this.drawTexture(matrices, this.x, this.y, 29, 206, this.width, this.height); - client.getItemRenderer().renderInGui(this.itemStack, this.x + 4, this.y + 4); - client.getItemRenderer().renderGuiItemOverlay(client.textRenderer, itemStack, this.x + 4, this.y + 4); + // this.drawTexture(matrices, this.x, this.y, 29, 206, this.width, this.height); + this.drawTexture(matrices, this.getX(), this.getY(), 29, 206, this.getWidth(), this.getHeight()); + // client.getItemRenderer().renderInGui(this.itemStack, this.x + 4, this.y + 4); + client.getItemRenderer().renderInGui(this.itemStack, this.getX() + 4, this.getY() + 4); + // client.getItemRenderer().renderGuiItemOverlay(client.textRenderer, itemStack, this.x + 4, this.y + 4); + client.getItemRenderer().renderGuiItemOverlay(client.textRenderer, itemStack, this.getX() + 4, this.getY() + 4); } - @Override public void renderTooltip(MatrixStack matrices, int mouseX, int mouseY) { MinecraftClient client = MinecraftClient.getInstance(); List<Text> tooltip = client.currentScreen.getTooltipFromItem(this.itemStack); + // TODO : add null check with log error client.currentScreen.renderTooltip(matrices, tooltip, mouseX, mouseY); } - @Override - public void appendNarrations(NarrationMessageBuilder builder) { - - } + @Override + protected void appendClickableNarrations(NarrationMessageBuilder builder) { + // TODO Auto-generated method stub + + } } diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/quicknav/QuickNav.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/quicknav/QuickNav.java index 4ea7fb99..85ebd3a6 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/quicknav/QuickNav.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/quicknav/QuickNav.java @@ -1,7 +1,12 @@ package me.xmrvizzy.skyblocker.skyblock.quicknav; +import java.util.ArrayList; +import java.util.List; + import com.mojang.brigadier.exceptions.CommandSyntaxException; + import me.xmrvizzy.skyblocker.config.SkyblockerConfig; + import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.nbt.StringNbtReader; diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/quicknav/QuickNavButton.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/quicknav/QuickNavButton.java index ac381240..f35e60b2 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/quicknav/QuickNavButton.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/quicknav/QuickNavButton.java @@ -1,6 +1,7 @@ package me.xmrvizzy.skyblocker.skyblock.quicknav; import com.mojang.blaze3d.systems.RenderSystem; + import me.xmrvizzy.skyblocker.mixin.HandledScreenAccessor; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -11,7 +12,6 @@ import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder; import net.minecraft.client.gui.widget.ClickableWidget; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.ItemStack; -import net.minecraft.text.LiteralTextContent; import net.minecraft.text.Text; import net.minecraft.util.Identifier; @@ -20,11 +20,6 @@ public class QuickNavButton extends ClickableWidget { private static final MinecraftClient CLIENT = MinecraftClient.getInstance(); private static final Identifier BUTTON_TEXTURE = new Identifier("textures/gui/container/creative_inventory/tabs.png"); - @Override - public void appendNarrations(NarrationMessageBuilder builder) { - - } - private int index; private boolean toggled; private int u; @@ -33,7 +28,7 @@ public class QuickNavButton extends ClickableWidget { private final ItemStack icon; public QuickNavButton(int index, boolean toggled, String command, ItemStack icon) { - super(0, 0, 28, 32, Text.empty()); + super(0, 0, 26, 32, Text.empty()); this.index = index; this.toggled = toggled; this.command = command; @@ -49,9 +44,11 @@ public class QuickNavButton extends ClickableWidget { int w = ((HandledScreenAccessor)handledScreen).getBackgroundWidth(); int h = ((HandledScreenAccessor)handledScreen).getBackgroundHeight(); if (h > 166) --h; // why is this even a thing - this.x = x + this.index % 6 * 28 + 4; - this.y = this.index < 6 ? y - 28 : y + h - 4; - this.u = 28; + // this.x = x + this.index % 6 * 28 + 4; + this.setX(x + this.index % 6 * 26 + 4); + // this.y = this.index < 6 ? y - 28 : y + h - 4; + this.setY(this.index < 6 ? y - 26 : y + h - 4); + this.u = 26; this.v = (index < 6 ? 0 : 64) + (toggled ? 32 : 0); } } @@ -60,7 +57,8 @@ public class QuickNavButton extends ClickableWidget { public void onClick(double mouseX, double mouseY) { if (!this.toggled) { this.toggled = true; - CLIENT.player.sendChatMessage(command, Text.of(command)); + CLIENT.player.networkHandler.sendCommand(command.replace("/", "")); + // TODO : add null check with log error } } @@ -72,22 +70,41 @@ public class QuickNavButton extends ClickableWidget { // render button background if (!this.toggled) { if (this.index >= 6) - this.drawTexture(matrices, this.x, this.y + 4, this.u, this.v + 4, this.width, this.height - 4); + // this.drawTexture(matrices, this.x, this.y + 4, this.u, this.v + 4, this.width, this.height - 4); + this.drawTexture(matrices, this.getX(), this.getY() + 4, this.u, this.v + 4, this.width, this.height - 4); else - this.drawTexture(matrices, this.x, this.y, this.u, this.v, this.width, this.height - 4); - } else this.drawTexture(matrices, this.x, this.y, this.u, this.v, this.width, this.height); + // this.drawTexture(matrices, this.x, this.y, this.u, this.v, this.width, this.height - 4); + this.drawTexture(matrices, this.getX(), this.getY() - 2, this.u, this.v, this.width, this.height - 4); + // } else this.drawTexture(matrices, this.x, this.y, this.u, this.v, this.width, this.height); + } else { + matrices.push(); + //Move the top buttons 2 pixels up if they're selected + if (this.index < 6) matrices.translate(0f, -2f, 0f); + this.drawTexture(matrices, this.getX(), this.getY(), this.u, this.v, this.width, this.height); + matrices.pop(); + } // render button icon if (!this.toggled) { if (this.index >= 6) - CLIENT.getItemRenderer().renderInGui(this.icon,this.x + 6, this.y + 6); + // CLIENT.getItemRenderer().renderInGui(this.icon,this.x + 6, this.y + 6); + CLIENT.getItemRenderer().renderInGui(this.icon,this.getX() + 5, this.getY() + 6); else - CLIENT.getItemRenderer().renderInGui(this.icon,this.x + 6, this.y + 9); + // CLIENT.getItemRenderer().renderInGui(this.icon,this.x + 6, this.y + 9); + CLIENT.getItemRenderer().renderInGui(this.icon,this.getX() + 5, this.getY() + 7); } else { if (this.index >= 6) - CLIENT.getItemRenderer().renderInGui(this.icon,this.x + 6, this.y + 9); + // CLIENT.getItemRenderer().renderInGui(this.icon,this.x + 6, this.y + 9); + CLIENT.getItemRenderer().renderInGui(this.icon,this.getX() + 5, this.getY() + 9); else - CLIENT.getItemRenderer().renderInGui(this.icon,this.x + 6, this.y + 6); + // CLIENT.getItemRenderer().renderInGui(this.icon,this.x + 6, this.y + 6); + CLIENT.getItemRenderer().renderInGui(this.icon,this.getX() + 5, this.getY() + 6); } RenderSystem.enableDepthTest(); } + + @Override + protected void appendClickableNarrations(NarrationMessageBuilder builder) { + // TODO Auto-generated method stub + + } } diff --git a/src/main/java/me/xmrvizzy/skyblocker/utils/ItemUtils.java b/src/main/java/me/xmrvizzy/skyblocker/utils/ItemUtils.java index 00f400ec..a4d1ee7b 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/utils/ItemUtils.java +++ b/src/main/java/me/xmrvizzy/skyblocker/utils/ItemUtils.java @@ -15,7 +15,8 @@ public class ItemUtils { public static List<Text> getTooltip(ItemStack item) { MinecraftClient client = MinecraftClient.getInstance(); if (client.player != null && item != null) - return item.getTooltip(client.player, TooltipContext.Default.NORMAL); + // return item.getTooltip(client.player, TooltipContext.Default.NORMAL); + return item.getTooltip(client.player, TooltipContext.Default.BASIC); return Collections.emptyList(); } diff --git a/src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtils.java b/src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtils.java index 3c96e1f4..0f2f3aef 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtils.java +++ b/src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtils.java @@ -17,7 +17,8 @@ import net.minecraft.util.math.Box; import net.minecraft.util.math.Direction; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.Vec3f; +// import net.minecraft.util.math.Vec3f; +import net.minecraft.util.math.RotationAxis; public class RenderUtils { @@ -41,7 +42,7 @@ public class RenderUtils { // Outline RenderSystem.disableCull(); - RenderSystem.setShader(GameRenderer::getRenderTypeLinesShader); + RenderSystem.setShader(GameRenderer::getRenderTypeLinesProgram); RenderSystem.lineWidth(lineWidth); buffer.begin(VertexFormat.DrawMode.LINES, VertexFormats.LINES); @@ -59,8 +60,10 @@ public class RenderUtils { MatrixStack matrices = new MatrixStack(); Camera camera = MinecraftClient.getInstance().gameRenderer.getCamera(); - matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(camera.getPitch())); - matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(camera.getYaw() + 180.0F)); + // matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(camera.getPitch())); + matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(camera.getPitch())); + // matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(camera.getYaw() + 180.0F)); + matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(camera.getYaw() + 180.0F)); matrices.translate(x - camera.getPos().x, y - camera.getPos().y, z - camera.getPos().z); diff --git a/src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtilsLiving.java b/src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtilsLiving.java index c1111b36..651ef2bd 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtilsLiving.java +++ b/src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtilsLiving.java @@ -35,7 +35,9 @@ import net.minecraft.client.render.model.json.ModelTransformation; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.ItemStack; import net.minecraft.text.Text; -import net.minecraft.util.math.Vec3f; +//import net.minecraft.util.math.Vec3f; +import net.minecraft.util.math.RotationAxis; +import org.joml.Vector3f; public class RenderUtilsLiving { @@ -52,8 +54,10 @@ public class RenderUtilsLiving { MatrixStack matrices = matrixFrom(x, y, z); Camera camera = mc.gameRenderer.getCamera(); - matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-camera.getYaw())); - matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(camera.getPitch())); + // matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-camera.getYaw())); + matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-camera.getYaw())); + // matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(camera.getPitch())); + matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(camera.getPitch())); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); @@ -92,20 +96,24 @@ public class RenderUtilsLiving { MatrixStack matrices = matrixFrom(x, y, z); Camera camera = mc.gameRenderer.getCamera(); - matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-camera.getYaw())); - matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(camera.getPitch())); + // matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-camera.getYaw())); + matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-camera.getYaw())); + // matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(camera.getPitch())); + matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(camera.getPitch())); matrices.translate(offX, offY, 0); matrices.scale((float) scale, (float) scale, 0.001f); - matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(180f)); + // matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(180f)); + matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(180f)); //mc.getBufferBuilders().getEntityVertexConsumers().draw(); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); - Vec3f[] currentLight = getCurrentLight(); + // Vec3f[] currentLight = getCurrentLight(); + Vector3f[] currentLight = getCurrentLight(); DiffuseLighting.disableGuiDepthLighting(); mc.getBufferBuilders().getEntityVertexConsumers().draw(); @@ -123,21 +131,25 @@ public class RenderUtilsLiving { MatrixStack matrices = new MatrixStack(); Camera camera = mc.gameRenderer.getCamera(); - matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(camera.getPitch())); - matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(camera.getYaw() + 180.0F)); + // matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(camera.getPitch())); + matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(camera.getPitch())); + // matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(camera.getYaw() + 180.0F)); + matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(camera.getYaw() + 180.0F)); matrices.translate(x - camera.getPos().x, y - camera.getPos().y, z - camera.getPos().z); return matrices; } - public static Vec3f[] getCurrentLight() { + // public static Vec3f[] getCurrentLight() { + public static Vector3f[] getCurrentLight() { if (shaderLightField == null) { shaderLightField = FieldUtils.getField(RenderSystem.class, "shaderLightDirections", true); } try { - return (Vec3f[]) shaderLightField.get(null); + // return (Vec3f[]) shaderLightField.get(null); + return (Vector3f[]) shaderLightField.get(null); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/src/main/java/me/xmrvizzy/skyblocker/utils/ToastBuilder.java b/src/main/java/me/xmrvizzy/skyblocker/utils/ToastBuilder.java index 910c8a6c..ae490649 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/utils/ToastBuilder.java +++ b/src/main/java/me/xmrvizzy/skyblocker/utils/ToastBuilder.java @@ -22,7 +22,7 @@ public class ToastBuilder implements Toast { @Override public Toast.Visibility draw(MatrixStack matrices, ToastManager manager, long startTime) { - RenderSystem.setShader(GameRenderer::getPositionTexShader); + RenderSystem.setShader(GameRenderer::getPositionTexProgram); RenderSystem.setShaderTexture(0, TEXTURE); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); diff --git a/src/main/java/me/xmrvizzy/skyblocker/utils/Vertexer.java b/src/main/java/me/xmrvizzy/skyblocker/utils/Vertexer.java index 12f4b0fd..cf6d90b6 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/utils/Vertexer.java +++ b/src/main/java/me/xmrvizzy/skyblocker/utils/Vertexer.java @@ -7,9 +7,12 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.math.Box; import net.minecraft.util.math.Direction; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Matrix3f; -import net.minecraft.util.math.Matrix4f; -import net.minecraft.util.math.Vec3f; +// import net.minecraft.util.math.Matrix3f; +// import net.minecraft.util.math.Matrix4f; +// import net.minecraft.util.math.Vec3f; +import org.joml.Matrix3f; +import org.joml.Matrix4f; +import org.joml.Vector3f; import org.apache.commons.lang3.ArrayUtils; public class Vertexer { @@ -135,22 +138,27 @@ public class Vertexer { Matrix4f model = matrices.peek().getPositionMatrix(); Matrix3f normal = matrices.peek().getNormalMatrix(); - Vec3f normalVec = getNormal(normal, x1, y1, z1, x2, y2, z2); + // Vec3f normalVec = getNormal(normal, x1, y1, z1, x2, y2, z2); + Vector3f normalVec = getNormal(normal, x1, y1, z1, x2, y2, z2); int[] color1 = lineColor.getColor(x1, y1, z1, 0); int[] color2 = lineColor.getColor(x2, y2, z2, 1); - vertexConsumer.vertex(model, x1, y1, z1).color(color1[0], color1[1], color1[2], color1[3]).normal(normal, normalVec.getX(), normalVec.getY(), normalVec.getZ()).next(); - vertexConsumer.vertex(model, x2, y2, z2).color(color2[0], color2[1], color2[2], color2[3]).normal(normal, normalVec.getX(), normalVec.getY(), normalVec.getZ()).next(); + // vertexConsumer.vertex(model, x1, y1, z1).color(color1[0], color1[1], color1[2], color1[3]).normal(normal, normalVec.getX(), normalVec.getY(), normalVec.getZ()).next(); + vertexConsumer.vertex(model, x1, y1, z1).color(color1[0], color1[1], color1[2], color1[3]).normal(normal, normalVec.x(), normalVec.y(), normalVec.z()).next(); + // vertexConsumer.vertex(model, x2, y2, z2).color(color2[0], color2[1], color2[2], color2[3]).normal(normal, normalVec.getX(), normalVec.getY(), normalVec.getZ()).next(); + vertexConsumer.vertex(model, x2, y2, z2).color(color2[0], color2[1], color2[2], color2[3]).normal(normal, normalVec.x(), normalVec.y(), normalVec.z()).next(); } - public static Vec3f getNormal(Matrix3f normal, float x1, float y1, float z1, float x2, float y2, float z2) { + // public static Vec3f getNormal(Matrix3f normal, float x1, float y1, float z1, float x2, float y2, float z2) { + public static Vector3f getNormal(Matrix3f normal, float x1, float y1, float z1, float x2, float y2, float z2) { float xNormal = x2 - x1; float yNormal = y2 - y1; float zNormal = z2 - z1; float normalSqrt = MathHelper.sqrt(xNormal * xNormal + yNormal * yNormal + zNormal * zNormal); - return new Vec3f(xNormal / normalSqrt, yNormal / normalSqrt, zNormal / normalSqrt); + // return new Vec3f(xNormal / normalSqrt, yNormal / normalSqrt, zNormal / normalSqrt); + return new Vector3f(xNormal / normalSqrt, yNormal / normalSqrt, zNormal / normalSqrt); } }
\ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 6e9858b1..95426c72 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -29,7 +29,7 @@ "fabricloader": ">=0.14.6", "fabric": "*", "cloth-config2": "*", - "minecraft": [">=1.19.1"] + "minecraft": ["1.19.3"] }, "custom": { "modmenu": { |